bool Monster::canUseSpell(const Position& pos, const Position& targetPos,
const spellBlock_t& sb, uint32_t interval, bool& inRange)
{
inRange = true;
if(!sb.isMelee || !extraMeleeAttack)
{
if(sb.speed > attackTicks)
{
resetTicks = false;
return false;
}
if(attackTicks % sb.speed >= interval) //already used this spell for this round
return false;
}
//felipe copy pasted code and send it to me for 7$????
if(sb.range != 0 && std::max(std::abs(pos.x - targetPos.x), std::abs(pos.y - targetPos.y)) > (int32_t)sb.range){
inRange = false;
return false;
}
return true;
}