From e2f25d1c92ca031a8d9248036bbb67bcc70179de Mon Sep 17 00:00:00 2001 From: badcaptain Date: Thu, 25 Apr 2013 00:42:52 -0400 Subject: [PATCH] Fixed a couple of merc stat issues and a few bot aggro issues, removed unneeded bot pet AI. --- changelog.txt | 6 ++++ zone/MobAI.cpp | 9 ++++++ zone/bot.cpp | 28 ++++++++++------- zone/botspellsai.cpp | 2 +- zone/merc.cpp | 72 ++------------------------------------------ zone/merc.h | 2 +- 6 files changed, 37 insertions(+), 82 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8b7df0a4d..d39146a1e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,11 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- + +== 04/24/2013 == +Bad_Captain: Fixed a couple of merc stat issues. +Bad_Captain: Removed unneeded bot pet AI. +Bad_Captain: Fixed a few bot aggro issues. (Uleat) + == 04/20/2013 == JJ: Fixed rare case where heals from buffs could go negative. diff --git a/zone/MobAI.cpp b/zone/MobAI.cpp index a2030aa7d..348704511 100644 --- a/zone/MobAI.cpp +++ b/zone/MobAI.cpp @@ -1083,6 +1083,15 @@ void Mob::AI_Process() { RemoveFromHateList(this); return; } + +#ifdef BOTS + if (IsPet() && GetOwner()->IsBot() && target == GetOwner()) + { + // this blocks all pet attacks against owner..bot pet test (copied above check) + RemoveFromHateList(this); + return; + } +#endif //BOTS if(DivineAura()) return; diff --git a/zone/bot.cpp b/zone/bot.cpp index 51b649bce..c80981883 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3122,10 +3122,6 @@ bool Bot::Process() // Bot AI AI_Process(); - // Bot Pet AI - if(HasPet()) - PetAIProcess(); - return true; } @@ -3581,8 +3577,8 @@ void Bot::AI_Process() { if(!IsEngaged()) { if(GetFollowID()) { - if(BotOwner && BotOwner->CastToClient()->AutoAttackEnabled() && BotOwner->GetTarget() && - BotOwner->GetTarget()->IsNPC() && BotOwner->GetTarget()->GetHateAmount(BotOwner)) { + if(BotOwner && BotOwner->GetTarget() && BotOwner->GetTarget()->IsNPC() && (BotOwner->GetTarget()->GetHateAmount(BotOwner) + || BotOwner->CastToClient()->AutoAttackEnabled()) && IsAttackAllowed(BotOwner->GetTarget())) { AddToHateList(BotOwner->GetTarget(), 1); if(HasPet()) @@ -3594,11 +3590,12 @@ void Bot::AI_Process() { if(g) { for(int counter = 0; counter < g->GroupCount(); counter++) { if(g->members[counter]) { - if(g->members[counter]->IsEngaged() && g->members[counter]->GetTarget()) { - AddToHateList(g->members[counter]->GetTarget(), 1); + Mob* tar = g->members[counter]->GetTarget(); + if(tar && tar->IsNPC() && tar->GetHateAmount(g->members[counter]) && IsAttackAllowed(g->members[counter]->GetTarget())) { + AddToHateList(tar, 1); if(HasPet()) - GetPet()->AddToHateList(g->members[counter]->GetTarget(), 1); + GetPet()->AddToHateList(tar, 1); break; } @@ -6364,6 +6361,10 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillType attack_skil SendHPUpdate(); + if(this == from) { + return; + } + // Aggro the bot's group members if(IsGrouped()) { @@ -6372,7 +6373,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillType attack_skil { for(int i=0; imembers[i] && g->members[i]->IsBot() && from && !g->members[i]->CheckAggro(from)) + if(g->members[i] && g->members[i]->IsBot() && from && !g->members[i]->CheckAggro(from) && g->members[i]->IsAttackAllowed(from)) { g->members[i]->AddToHateList(from, 1); } @@ -9034,7 +9035,12 @@ bool Bot::IsBotAttackAllowed(Mob* attacker, Mob* target, bool& hasRuleDefined) if(attacker && target) { - if(attacker->IsClient() && target->IsBot() && attacker->CastToClient()->GetPVP() && target->CastToBot()->GetBotOwner()->CastToClient()->GetPVP()) + if(attacker == target) + { + hasRuleDefined = true; + Result = false; + } + else if(attacker->IsClient() && target->IsBot() && attacker->CastToClient()->GetPVP() && target->CastToBot()->GetBotOwner()->CastToClient()->GetPVP()) { hasRuleDefined = true; Result = true; diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index 64937b92d..5bae0b60b 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -308,7 +308,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { continue; // no buffs with illusions.. use #bot command to cast illusions - if(IsEffectInSpell(selectedBotSpell.SpellId, SE_Illusion)) + if(IsEffectInSpell(selectedBotSpell.SpellId, SE_Illusion) && tar != this) continue; //no teleport spells use #bot command to cast teleports diff --git a/zone/merc.cpp b/zone/merc.cpp index cdb63beac..ba9e5d66f 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -61,6 +61,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading) skills[r] = database.GetSkillCap(GetClass(),(SkillType)r,GetLevel()); } + GetMercSize(); CalcBonuses(); SetHP(GetMaxHP()); @@ -80,7 +81,6 @@ Merc::~Merc() { void Merc::CalcBonuses() { //_ZP(Merc_CalcBonuses); - GenerateBaseStats(); memset(&itembonuses, 0, sizeof(StatBonuses)); memset(&aabonuses, 0, sizeof(StatBonuses)); CalcItemBonuses(&itembonuses); @@ -117,59 +117,7 @@ void Merc::CalcBonuses() rooted = FindType(SE_Root); } -void Merc::GenerateBaseStats() { - - // base stats - uint16 Strength = _baseSTR; - uint16 Stamina = _baseSTA; - uint16 Dexterity = _baseDEX; - uint16 Agility = _baseAGI; - uint16 Wisdom = _baseWIS; - uint16 Intelligence = _baseINT; - uint16 Charisma = _baseCHA; - uint16 Attack = _baseATK; - uint16 MagicResist = _baseMR; - uint16 FireResist = _baseFR; - uint16 DiseaseResist = _baseDR; - uint16 PoisonResist = _basePR; - uint16 ColdResist = _baseCR; - uint16 CorruptionResist = _baseCorrup; - - switch(this->GetClass()) { - case 1: // Warrior - Strength += 10; - Stamina += 20; - Agility += 10; - Dexterity += 10; - Attack += 12; - break; - case 2: // Cleric - Strength += 5; - Stamina += 5; - Agility += 10; - Wisdom += 30; - Attack += 8; - break; - case 4: // Ranger - Strength += 15; - Stamina += 10; - Agility += 10; - Wisdom += 15; - Attack += 17; - break; - case 9: // Rogue - Strength += 10; - Stamina += 20; - Agility += 10; - Dexterity += 10; - Attack += 12; - break; - case 12: // Wizard - Stamina += 20; - Intelligence += 30; - Attack += 5; - break; - } +void Merc::GetMercSize() { float MercSize = GetSize(); @@ -220,20 +168,6 @@ void Merc::GenerateBaseStats() { break; } - this->_baseSTR = Strength; - this->_baseSTA = Stamina; - this->_baseDEX = Dexterity; - this->_baseAGI = Agility; - this->_baseWIS = Wisdom; - this->_baseINT = Intelligence; - this->_baseCHA = Charisma; - this->_baseATK = Attack; - this->_baseMR = MagicResist; - this->_baseFR = FireResist; - this->_baseDR = DiseaseResist; - this->_basePR = PoisonResist; - this->_baseCR = ColdResist; - this->_baseCorrup = CorruptionResist; this->size = MercSize; } @@ -940,7 +874,7 @@ int16 Merc::CalcCorrup() } int16 Merc::CalcATK() { - ATK = _baseATK + itembonuses.ATK + spellbonuses.ATK + aabonuses.ATK + GroupLeadershipAAOffenseEnhancement() + ((GetSTR() + GetSkill(OFFENSE)) * 9 / 10); + ATK = _baseATK + itembonuses.ATK + spellbonuses.ATK + aabonuses.ATK + GroupLeadershipAAOffenseEnhancement(); return(ATK); } diff --git a/zone/merc.h b/zone/merc.h index dadba3fc1..4ed6e6332 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -328,7 +328,7 @@ private: int GroupLeadershipAAHealthRegeneration(); int GroupLeadershipAAOffenseEnhancement(); - void GenerateBaseStats(); + void GetMercSize(); void GenerateAppearance(); bool LoadMercSpells();