[10701] Correct check percent spell costs in AI::CanCast

Also use uint32 for spell cost fields/results

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
kid 10 2010-11-08 22:04:50 +03:00 committed by VladimirMangos
parent a72930acc9
commit b435aa350f
5 changed files with 41 additions and 39 deletions

View file

@ -19,6 +19,7 @@
#include "CreatureAI.h"
#include "Creature.h"
#include "DBCStores.h"
#include "Spell.h"
CreatureAI::~CreatureAI()
{
@ -46,7 +47,7 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry *pSpell,
return CAST_FAIL_STATE;
// Check for power (also done by Spell::CheckCast())
if (m_creature->GetPower((Powers)pSpell->powerType) < pSpell->manaCost)
if (m_creature->GetPower((Powers)pSpell->powerType) < Spell::CalculatePowerCost(pSpell, m_creature))
return CAST_FAIL_POWER;
}