diff options
| author | megamage <none@none> | 2009-05-10 22:48:22 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-05-10 22:48:22 -0500 |
| commit | 82f886e3c1daa6ae9049bb0c0c0c00219e9735ba (patch) | |
| tree | 7b8a4bbebf4365c57af8a21694a50aabecf2423a /src/game/CreatureAI.cpp | |
| parent | 904300b4c2f0c708bc98812ec2a0be04249a81d4 (diff) | |
*Update AI scripts. Use better default AI.
--HG--
branch : trunk
Diffstat (limited to 'src/game/CreatureAI.cpp')
| -rw-r--r-- | src/game/CreatureAI.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index 011ffab22e5..123fa1182a1 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -21,9 +21,8 @@ #include "CreatureAI.h" #include "CreatureAIImpl.h" #include "Creature.h" -#include "Player.h" -#include "Pet.h" #include "World.h" +#include "SpellMgr.h" //Disable CreatureAI when charmed void CreatureAI::OnCharmed(bool apply) @@ -261,16 +260,47 @@ void CreatureAI::FillAISpellInfo() { AISpellInfo = new AISpellInfoType[GetSpellStore()->GetNumRows()]; + AISpellInfoType *AIInfo = AISpellInfo; const SpellEntry * spellInfo; - for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) + for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i, ++AIInfo) { spellInfo = GetSpellStore()->LookupEntry(i); - if (!spellInfo) + if(!spellInfo) continue; + if(spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD) + AIInfo->condition = AICOND_DIE; + else if(IsPassiveSpell(i) || GetSpellDuration(spellInfo) == -1) + AIInfo->condition = AICOND_AGGRO; + else + AIInfo->condition = AICOND_COMBAT; + + if(AIInfo->cooldown < spellInfo->RecoveryTime) + AIInfo->cooldown = spellInfo->RecoveryTime; + for(uint32 j = 0; j < 3; ++j) { + if(spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY + || spellInfo->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY) + { + if(AIInfo->target < AITARGET_VICTIM) + AIInfo->target = AITARGET_VICTIM; + } + + if(spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA) + { + if(spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY) + { + if(AIInfo->target < AITARGET_DEBUFF) + AIInfo->target = AITARGET_DEBUFF; + } + else if(IsPositiveSpell(i)) + { + if(AIInfo->target < AITARGET_BUFF) + AIInfo->target = AITARGET_BUFF; + } + } } } } |
