@LabelIndex 136683
@StringIndex 0
class 0 ai_castle_pailaka_warrior_npc : ai_castle_pailaka_npc {
handler:
	EventHandler ATTACKED(attacker,damage) {
		super;
		if( myself::IsNullCreature(attacker) == 0 ) {
			if( attacker.is_pc == 0 && myself::IsInCategory(12,attacker.class_id) == 0 ) {
				myself::AddAttackDesire(attacker,0,damage);
				if( myself::DistFromMe(attacker) >= 300 ) {
					myself::BroadcastScriptEvent(2117004,gg::GetIndexFromCreature(attacker),1000);
				}
			}
		}
		if( myself::IsNullCreature(myself.top_desire_target) == 0 ) {
			if( myself::CanAttack(myself.top_desire_target) == 1 ) {
				if( Skill01_ID != 458752001 && gg::Rand(100) < Skill01_Prob ) {
					if( myself::Skill_GetConsumeMP(Skill01_ID) < myself.sm.mp && myself::Skill_GetConsumeHP(Skill01_ID) < myself.sm.hp && myself::Skill_InReuseDelay(Skill01_ID) == 0 ) {
						myself::AddUseSkillDesire(myself.top_desire_target,Skill01_ID,0,0,1000000);
					}
				}
				if( Skill02_ID != 458752001 && gg::Rand(100) < Skill02_Prob ) {
					if( myself::Skill_GetConsumeMP(Skill02_ID) < myself.sm.mp && myself::Skill_GetConsumeHP(Skill02_ID) < myself.sm.hp && myself::Skill_InReuseDelay(Skill02_ID) == 0 ) {
						myself::AddUseSkillDesire(myself.top_desire_target,Skill02_ID,0,0,1000000);
					}
				}
			} else {
				myself::RemoveAttackDesire(myself.top_desire_target.id);
			}
		}
	}

	EventHandler CLAN_ATTACKED(attacker,damage) {
		super;
		if( myself::IsNullCreature(attacker) == 0 ) {
			if( attacker.is_pc == 0 && myself::IsInCategory(12,attacker.class_id) == 0 ) {
				if( myself::CanAttack(attacker) == 1 ) {
					myself::MakeAttackEvent(attacker,( damage / 2 ),0);
				}
			}
		}
	}

	EventHandler SEE_CREATURE(creature,party0,c0) {
		if( creature.is_pc == 0 && myself::IsInCategory(12,creature.class_id) == 0 ) {
			myself::MakeAttackEvent(creature,100,0);
		}
		super;
	}

	EventHandler SCRIPT_EVENT(script_event_arg1,script_event_arg2,i0,c0) {
		if( script_event_arg1 == 2117006 ) {
			c0 = gg::GetCreatureFromIndex(script_event_arg2);
			if( myself::IsNullCreature(c0) == 0 ) {
				myself::AddAttackDesire(c0,0,10);
				myself::MakeAttackEvent(c0,10,0);
			}
		}
		super;
	}

}
