void MonsterAI::EscapeSpring() { CMonster *monster = static_cast<CMonster*>(GetOwner()); if (monster == NULL) { LogError(AI_MODULE, "MosterAI has no owner object..."); return; } if(monster->GetHP() * 100.0f / monster->GetMaxHP() <= monster->GetEscapePoint()) { // change to escape state ChangeState(ST_ESCAPE); } }
void MonsterAI::GBHSpring(long hurt) { CMonster *monster = static_cast<CMonster*>(GetOwner()); if (monster == NULL) { LogError(AI_MODULE, "MosterAI has no owner object..."); return; } int hurtProportionHp= (int) (monster->GetMaxHP() * monster->GetHurtProportion() / 100); int hp= monster->GetHP(); int lastHp= hp + hurt; if(hurtProportionHp < lastHp && hurtProportionHp >= hp) { //RunScript(monster->GetGBHScriptName().c_str()); } }