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/Unit.cpp | |
parent | 904300b4c2f0c708bc98812ec2a0be04249a81d4 (diff) |
*Update AI scripts. Use better default AI.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 3f09eec9351..28d2fbd619b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -11607,11 +11607,14 @@ void CharmInfo::InitPossessCreateSpells() { for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) { - uint32 spellid = ((Creature*)m_unit)->m_spells[i]; - if(IsPassiveSpell(spellid)) - m_unit->CastSpell(m_unit, spellid, true); + uint32 spellId = ((Creature*)m_unit)->m_spells[i]; + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); + if(spellInfo && spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD) + spellId = 0; + if(IsPassiveSpell(spellId)) + m_unit->CastSpell(m_unit, spellId, true); else - AddSpellToAB(0, spellid, ACT_DISABLED); + AddSpellToAB(0, spellId, ACT_DISABLED); } } } @@ -11629,6 +11632,10 @@ void CharmInfo::InitCharmCreateSpells() for(uint32 x = 0; x < MAX_SPELL_CHARM; ++x) { uint32 spellId = ((Creature*)m_unit)->m_spells[x]; + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); + if(spellInfo && spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD) + spellId = 0; + m_charmspells[x].spellId = spellId; if(!spellId) @@ -11643,7 +11650,6 @@ void CharmInfo::InitCharmCreateSpells() { ActiveStates newstate; bool onlyselfcast = true; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if(!spellInfo) onlyselfcast = false; for(uint32 i = 0;i<3 && onlyselfcast;++i) //non existent spell will not make any problems as onlyselfcast would be false -> break right away |