ScriptedAI: Fix types in SelectSpell
--HG-- branch : trunk
This commit is contained in:
@@ -197,7 +197,7 @@ Unit* ScriptedAI::SelectUnit(SelectAggroTarget pTarget, uint32 uiPosition)
|
||||
}
|
||||
}
|
||||
|
||||
SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 uiMechanic, SelectTargetType selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects)
|
||||
SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, uint32 uiSchool, uint32 uiMechanic, SelectTargetType selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects)
|
||||
{
|
||||
//No target so we can't cast
|
||||
if (!pTarget)
|
||||
@@ -235,11 +235,11 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 u
|
||||
continue;
|
||||
|
||||
//Check for school if specified
|
||||
if (uiSchool >= 0 && pTempSpell->SchoolMask & uiSchool)
|
||||
if (uiSchool && (pTempSpell->SchoolMask & uiSchool) == 0)
|
||||
continue;
|
||||
|
||||
//Check for spell mechanic if specified
|
||||
if (uiMechanic >= 0 && pTempSpell->Mechanic != uiMechanic)
|
||||
if (uiMechanic && pTempSpell->Mechanic != uiMechanic)
|
||||
continue;
|
||||
|
||||
//Make sure that the spell uses the requested amount of power
|
||||
|
||||
@@ -156,7 +156,7 @@ struct ScriptedAI : public CreatureAI
|
||||
bool HealthBelowPct(uint32 pct) const { return me->GetHealth() * 100 < me->GetMaxHealth() * pct; }
|
||||
|
||||
//Returns spells that meet the specified criteria from the creatures spell list
|
||||
SpellEntry const* SelectSpell(Unit* Target, int32 School, int32 Mechanic, SelectTargetType Targets, uint32 PowerCostMin, uint32 PowerCostMax, float RangeMin, float RangeMax, SelectEffect Effect);
|
||||
SpellEntry const* SelectSpell(Unit* Target, uint32 School, uint32 Mechanic, SelectTargetType Targets, uint32 PowerCostMin, uint32 PowerCostMax, float RangeMin, float RangeMax, SelectEffect Effect);
|
||||
|
||||
//Checks if you can cast the specified spell
|
||||
bool CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggered = false);
|
||||
|
||||
@@ -71,7 +71,7 @@ void guardAI::UpdateAI(const uint32 diff)
|
||||
if (BuffTimer <= diff)
|
||||
{
|
||||
//Find a spell that targets friendly and applies an aura (these are generally buffs)
|
||||
SpellEntry const *info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA);
|
||||
SpellEntry const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA);
|
||||
|
||||
if (info && !GlobalCooldown)
|
||||
{
|
||||
@@ -102,11 +102,11 @@ void guardAI::UpdateAI(const uint32 diff)
|
||||
|
||||
//Select a healing spell if less than 30% hp
|
||||
if (me->GetHealth()*100 / me->GetMaxHealth() < 30)
|
||||
info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
|
||||
info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
|
||||
|
||||
//No healing spell available, select a hostile spell
|
||||
if (info) Healing = true;
|
||||
else info = SelectSpell(me->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE);
|
||||
else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE);
|
||||
|
||||
//20% chance to replace our white hit with a spell
|
||||
if (info && rand() % 5 == 0 && !GlobalCooldown)
|
||||
@@ -133,11 +133,11 @@ void guardAI::UpdateAI(const uint32 diff)
|
||||
|
||||
//Select a healing spell if less than 30% hp ONLY 33% of the time
|
||||
if (me->GetHealth()*100 / me->GetMaxHealth() < 30 && rand() % 3 == 0)
|
||||
info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
|
||||
info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
|
||||
|
||||
//No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE)
|
||||
if (info) Healing = true;
|
||||
else info = SelectSpell(me->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE);
|
||||
else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE);
|
||||
|
||||
//Found a spell, check if we arn't on cooldown
|
||||
if (info && !GlobalCooldown)
|
||||
|
||||
Reference in New Issue
Block a user