@LabelIndex 136836
@StringIndex 0
class 0 ai_castle_pailaka_invader_basic : default_npc {
parameter:
	int	String_Num1 = -1;
	int	String_Num2 = -1;
	int	String_Num3 = -1;
	int	SelfBuff = 458752001;
	int	DDSkill_01 = 458752001;
	int	DDSkill_02 = 458752001;
	int	DDSkill_01_Prob = 20;
	int	DDSkill_02_Prob = 20;
	int	Pos_X = 0;
	int	Pos_Y = 0;
	int	Pos_Z = 0;
	int	different_level_9_attacked = 295895041;
	int	different_level_9_see_spelled = 276234241;

handler:
	EventHandler NO_DESIRE() {
	}

	EventHandler ATTACKED(attacker,damage,i0) {
		if( myself.i_ai0 == 0 ) {
			myself.i_ai0 = 1;
		}
		if( attacker.level > ( myself.sm.level + 8 ) ) {
			if( gg::GetAbnormalLevel(attacker,myself::Skill_GetAbnormalType(different_level_9_attacked)) == -1 ) {
				if( different_level_9_attacked == 295895041 ) {
					myself::CastBuffForQuestReward(attacker,different_level_9_attacked);
					myself::RemoveAttackDesire(attacker.id);
					return;
				} else {
					myself::CastBuffForQuestReward(attacker,different_level_9_attacked);
				}
			}
		}
	}

	EventHandler SEE_SPELL(speller,skill_name_id,i0,c0,i1) {
		if( speller.level > ( myself.sm.level + 8 ) ) {
			if( gg::GetAbnormalLevel(speller,myself::Skill_GetAbnormalType(different_level_9_see_spelled)) == -1 ) {
				if( different_level_9_see_spelled == 295895041 ) {
					myself::CastBuffForQuestReward(speller,different_level_9_see_spelled);
					myself::RemoveAttackDesire(speller.id);
					return;
				} else {
					myself::CastBuffForQuestReward(speller,different_level_9_see_spelled);
				}
			}
		}
	}

	EventHandler DESIRE_MANIPULATION(speller,desire) {
		if( desire > 0 ) {
			myself::MakeAttackEvent(speller,( desire * 10 ),0);
		}
	}

	EventHandler CLAN_ATTACKED(attacker,damage) {
		myself::MakeAttackEvent(attacker,( damage / 10 ),0);
	}

	EventHandler MOVE_TO_FINISHED(x,y,z) {
		if( myself::IsNullCreature(myself.c_ai0) == 0 ) {
			myself::MakeAttackEvent(myself.c_ai0,100,0);
		}
	}

	EventHandler SEE_CREATURE(creature) {
		if( myself.i_ai0 == 0 ) {
			myself.i_ai0 = 1;
		}
		if( creature.is_pc == 1 || myself::IsInCategory(12,creature.class_id) == 1 ) {
			myself::MakeAttackEvent(creature,200,0);
		}
	}

	EventHandler SCRIPT_EVENT(script_event_arg1,script_event_arg2,c0,h0,i0,i1) {
		if( script_event_arg1 == 2117001 ) {
			c0 = gg::GetCreatureFromIndex(script_event_arg2);
			if( myself::IsNullCreature(c0) == 0 ) {
				myself::AddHateInfo(c0,10,0,1,1);
			}
			i0 = myself::GetHateInfoCount();
			if( i0 == 4 ) {
				i1 = gg::Rand(4);
				h0 = myself::GetHateInfoByIndex(i1);
				myself.c_ai0 = h0.creature;
				if( myself.i_ai0 == 1 ) {
					if( myself::DistFromMe(myself.c_ai0) <= 700 ) {
						myself::MakeAttackEvent(myself.c_ai0,1000,0);
					} else {
						myself::MakeAttackEvent(myself.c_ai0,500,0);
					}
				}
			}
		}
	}

}
