Core/ScriptedAI: remove ScriptedAI::CanCast function which is not functioning properly (compare that func with Spell::CheckCast to see how it should work) and is unused. Closes #2275.

This commit is contained in:
QAston
2011-09-12 00:19:10 +02:00
parent dad5b0bb3c
commit ec7da6f911
3 changed files with 1 additions and 26 deletions

View File

@@ -269,27 +269,6 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
return apSpell[urand(0, spellCount - 1)];
}
bool ScriptedAI::CanCast(Unit* target, SpellInfo const* spell, bool triggered /*= false*/)
{
//No target so we can't cast
if (!target || !spell)
return false;
//Silenced so we can't cast
if (!triggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
return false;
//Check for power
if (!triggered && me->GetPower(Powers(spell->PowerType)) < spell->ManaCost)
return false;
//Unit is out of range of this spell
if (me->IsInRange(target, float(me->GetSpellMinRangeForTarget(target, spell)), float(me->GetSpellMaxRangeForTarget(target, spell))))
return false;
return true;
}
void ScriptedAI::DoResetThreat()
{
if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty())

View File

@@ -160,9 +160,6 @@ struct ScriptedAI : public CreatureAI
//Returns spells that meet the specified criteria from the creatures spell list
SpellInfo 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* target, SpellInfo const* spell, bool triggered = false);
void SetEquipmentSlots(bool loadDefault, int32 mainHand = EQUIP_NO_CHANGE, int32 offHand = EQUIP_NO_CHANGE, int32 ranged = EQUIP_NO_CHANGE);
//Generally used to control if MoveChase() is to be used or not in AttackStart(). Some creatures does not chase victims

View File

@@ -1505,8 +1505,7 @@ class npc_captain_grondel : public CreatureScript
switch (eventId)
{
case EVENT_GRONDEL_CHARGE_CHECK:
if (CanCast(me->getVictim(), sSpellMgr->GetSpellInfo(SPELL_CHARGE)))
DoCastVictim(SPELL_CHARGE);
DoCastVictim(SPELL_CHARGE);
Events.ScheduleEvent(EVENT_GRONDEL_CHARGE_CHECK, 500);
break;
case EVENT_GRONDEL_MORTAL_STRIKE: