void Creature::onAttacking(uint32_t interval) { if(!attackedCreature) return; onAttacked(); attackedCreature->onAttacked(); if(g_game.isSightClear(getPosition(), attackedCreature->getPosition(), true)) doAttacking(interval); }
void Creature::onAttacking(uint32_t interval) { if(attackedCreature){ onAttacked(); attackedCreature->onAttacked(); if(g_game.onCreatureAttack(this, attackedCreature)){ //handled by script return; } if(g_game.isSightClear(getPosition(), attackedCreature->getPosition(), true)){ doAttacking(interval); } } }
void Creature::onAttacking(uint32_t interval) { if(!attackedCreature || attackedCreature->getHealth() < 1 || interval < 100) return; bool deny = false; CreatureEventList attackEvents = getCreatureEvents(CREATURE_EVENT_ATTACK); for(CreatureEventList::iterator it = attackEvents.begin(); it != attackEvents.end(); ++it) { if(!(*it)->executeAction(this, attackedCreature) && !deny) deny = true; } if(deny) setAttackedCreature(NULL); if(!attackedCreature) return; onAttacked(); attackedCreature->onAttacked(); if(g_game.isSightClear(getPosition(), attackedCreature->getPosition(), true)) doAttacking(interval); }