class 1 ai_boss03_raikel_leos : party_private
{
handler:
	EventHandler CREATED()
	{
		myself::AddTimerEx(2001,10000);
		myself.i_ai0 = myself.boss.flag;
		myself.i_ai1 = 1;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		if( timer_id == 2001 )
		{
			if( ( ( myself.boss.flag != myself.i_ai0 || myself::DistFromMe(myself.boss) > 3000 ) && myself.i_ai1 == 1 ) && myself.boss.alive != 0 )
			{
				myself.i_ai0 = myself.boss.flag;
				myself::InstantTeleport(myself.sm,myself::FloatToInt(myself.boss.x),myself::FloatToInt(myself.boss.y),myself::FloatToInt(myself.boss.z));
				myself::RemoveAllAttackDesire();
			}
			myself::AddTimerEx(2001,10000);
		}
		super;
	}

	EventHandler PARTY_ATTACKED(attacker,private,damage)
	{
		if( gg::Rand(100) < 5 )
		{
			if( myself::Skill_GetConsumeMP(1041156) < myself.sm.mp && myself::Skill_GetConsumeHP(1041156) < myself.sm.hp && myself::Skill_InReuseDelay(1041156) == 0 )
			{
				myself::AddUseSkillDesire(attacker,1041156,0,1,1000000);
			}
		}
		super;
	}

	EventHandler PARTY_DIED(private)
	{
		if( private == myself.boss )
		{
			myself.i_ai1 = 0;
		}
	}

}
