public static void OnAssessTarget(NPCProto npc, NPCProto target) { NPCAI ai = npc.getAI(); //Check if target is Enemy and call AssessEnemy: if (npc.getAttitudeToGuild(target.getGuild()) == Enumeration.GuildsAttitude.HOSTILE && target.HP != 0 && !target.isUnconscious && ai.AssessEnemyRoutine != null) { if (ai.AssessWarnRoutine != null) { } else { ai.AssessEnemyRoutine(npc, target); } } if (target.HP == 0 && ai.AssessBodyRoutine != null) { ai.AssessBodyRoutine(npc, target); } }
public static void OnDamage(NPCProto npc, NPCProto victim, NPCProto attacker, int damage, bool dropUnconscious, bool dropDead) { NPCAI ai = npc.getAI(); if (victim.HP != 0) { if (npc.getAttitudeToGuild(victim.getGuild()) == Enumeration.GuildsAttitude.FRIENDLY && npc.getAttitudeToGuild(attacker.getGuild()) != Enumeration.GuildsAttitude.FRIENDLY) { ai.addEnemy(attacker); } else if (npc.getAttitudeToGuild(attacker.getGuild()) == Enumeration.GuildsAttitude.FRIENDLY && npc.getAttitudeToGuild(victim.getGuild()) != Enumeration.GuildsAttitude.FRIENDLY) { ai.addEnemy(victim); } } else if (ai.AssessBodyRoutine != null) { ai.AssessBodyRoutine(npc, victim); } }