Core/SmartAI: added SMART_ACTION_INVOKER_CAST, spellID, castFlags,

-if avaliable, last used invoker will cast spellId with castFlags on targets

--HG--
branch : trunk
This commit is contained in:
Rat
2010-11-06 23:18:04 +01:00
parent 3809892987
commit 9781bba535
3 changed files with 16 additions and 0 deletions
@@ -342,6 +342,20 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
}
break;
}
case SMART_ACTION_INVOKER_CAST:
{
if (!mLastInvoker) return;
ObjectList* targets = GetTargets(e, unit);
if (!targets) return;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); itr++)
if (IsUnit((*itr)))
{
if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS)
mLastInvoker->InterruptNonMeleeSpells(false);
mLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell,(e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
}
break;
}
case SMART_ACTION_ADD_AURA:
{
ObjectList* targets = GetTargets(e, unit);
@@ -546,6 +546,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
break;
case SMART_ACTION_ADD_AURA:
case SMART_ACTION_CAST:
case SMART_ACTION_INVOKER_CAST:
if (!IsSpellValid(e, e.action.cast.spell)) return false;
break;
case SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS:
@@ -431,6 +431,7 @@ enum SMART_ACTION
SMART_ACTION_ADD_NPC_FLAG = 82, // Flags
SMART_ACTION_REMOVE_NPC_FLAG = 83, // Flags
SMART_ACTION_SIMPLE_TALK = 84, // groupID, can be used to make players say groupID, Text_over event is not triggered, whisper can not be used (Target units will say the text)
SMART_ACTION_INVOKER_CAST = 85, // spellID, castFlags, if avaliable, last used invoker will cast spellId with castFlags on targets
SMART_ACTION_END = 85,
};