@LabelIndex 114987
@StringIndex 0
class 0 ai_keym_firearea : warrior_basic {
parameter:
	int	Skill01_keymonster = 373686273;
	int	Skill01_display = 377094145;
	int	monster_id = 1018621;
	int	FireDeBuff = 378339329;
	string	monster_ai = "ai_adiantum_skilluse";

handler:
	EventHandler CREATED() {
		myself::AddTimerEx(1000,1000);
	}

	EventHandler SEE_CREATURE(creature) {
		if( creature.is_pc == 1 && myself.i_ai0 == 0 ) {
			myself.c_ai0 = creature;
			myself.i_ai0 = 1;
			myself::AddTimerEx(2000,1000);
			myself::AddTimerEx(6000,1000);
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id,c0,i0,i1) {
		if( timer_id == 1000 ) {
			myself::LookNeighbor(3000);
			myself::AddTimerEx(1000,( 10 * 1000 ));
		}
		if( timer_id == 2000 ) {
			i0 = gg::Rand(100);
			if( i0 < 50 ) {
				c0 = myself.c_ai0;
				if( myself::InMyTerritory(c0) ) {
					myself::AddUseSkillDesire(myself.c_ai0,Skill01_display,0,0,500000);
					myself::CreateOnePrivateEx(monster_id,monster_ai,0,0,gg::FloatToInt(c0.x),gg::FloatToInt(c0.y),gg::FloatToInt(c0.z),0,0,0,0);
				}
			}
			myself::AddTimerEx(2000,( 15 * 1000 ));
		}
		if( timer_id == 6000 ) {
			if( myself::Skill_GetConsumeMP(FireDeBuff) < myself.sm.mp && myself::Skill_GetConsumeHP(FireDeBuff) < myself.sm.hp && myself::Skill_InReuseDelay(FireDeBuff) == 0 ) {
				myself::AddUseSkillDesire(myself.sm,FireDeBuff,0,1,1000000);
			}
			myself::AddTimerEx(6000,60000);
		}
	}

	EventHandler SCRIPT_EVENT(script_event_arg1,script_event_arg2,c0) {
		if( script_event_arg1 == 2316002 ) {
			c0 = gg::GetCreatureFromIndex(script_event_arg2);
			if( myself::IsNullCreature(c0) == 0 ) {
				myself::AddUseSkillDesire(c0,Skill01_keymonster,0,1,50000000);
			}
		}
	}

}
