class 1 royal_rush_strong_man_2 : warrior
{
parameter:
	int	PhysicalSpecial1 = 1032193;
	int	DDMagic1 = 1032193;
	int	SelfBuff = 1032193;

handler:
	EventHandler CREATED()
	{
		myself::LookNeighbor(300);
		if( myself::Skill_GetConsumeMP(SelfBuff) < myself.sm.mp && myself::Skill_GetConsumeHP(SelfBuff) < myself.sm.hp && myself::Skill_InReuseDelay(SelfBuff) == 0 )
		{
			myself::AddUseSkillDesire(myself.sm,SelfBuff,1,1,1000000);
		}
		myself::AddTimerEx(6001,( 60 * 1000 ));
		super;
	}

	EventHandler SEE_CREATURE(creature)
	{
		if( creature.is_pc == 0 && myself::IsInCategory(11,creature.npc_class_id) == 0 )
		{
			super;
			return;
		}
		if( myself::GetLifeTime() > 7 && myself::InMyTerritory(myself.sm) && myself.p_state == 3 )
		{
			if( myself::IsNullCreature(myself.top_desire_target) == 0 )
			{
				if( gg::Rand(100) < 33 && myself.top_desire_target == creature )
				{
					if( myself::Skill_GetConsumeMP(PhysicalSpecial1) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial1) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial1) == 0 )
					{
						myself::AddUseSkillDesire(creature,PhysicalSpecial1,0,1,1000000);
					}
				}
			}
		}
		if( creature.is_pc == 0 && myself::IsInCategory(11,creature.npc_class_id) == 0 )
		{
			return;
		}
		if( SetAggressiveTime == -1 )
		{
			if( myself::GetLifeTime() >= ( gg::Rand(5) + 3 ) && myself::InMyTerritory(myself.sm) )
			{
				myself::AddAttackDesire(creature,1,200);
			}
		}
		else if( SetAggressiveTime == 0 )
		{
			if( myself::InMyTerritory(myself.sm) )
			{
				myself::AddAttackDesire(creature,1,200);
			}
		}
		else if( myself::GetLifeTime() > ( SetAggressiveTime + gg::Rand(4) ) && myself::InMyTerritory(myself.sm) )
		{
			myself::AddAttackDesire(creature,1,200);
		}
		if( myself::GetLifeTime() > -1 && myself::InMyTerritory(myself.sm) )
		{
			myself::AddAttackDesire(creature,1,200);
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage)
	{
		if( attacker.is_pc != 0 || myself::IsInCategory(11,attacker.npc_class_id) )
		{
			if( myself::IsNullCreature(myself.top_desire_target) == 0 )
			{
				if( gg::Rand(100) < 33 && myself.top_desire_target == attacker )
				{
					if( myself::Skill_GetConsumeMP(PhysicalSpecial1) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial1) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial1) == 0 )
					{
						myself::AddUseSkillDesire(attacker,PhysicalSpecial1,0,1,1000000);
					}
				}
				if( gg::Rand(100) < 33 && myself.top_desire_target == attacker )
				{
					if( myself::Skill_GetConsumeMP(DDMagic1) < myself.sm.mp && myself::Skill_GetConsumeHP(DDMagic1) < myself.sm.hp && myself::Skill_InReuseDelay(DDMagic1) == 0 )
					{
						myself::AddUseSkillDesire(attacker,DDMagic1,0,1,1000000);
					}
				}
			}
		}
		super;
	}

	EventHandler CLAN_ATTACKED(attacker,damage)
	{
		if( ( myself::GetLifeTime() > 7 && ( attacker.is_pc != 0 || myself::IsInCategory(11,attacker.npc_class_id) ) ) && myself.p_state != 3 )
		{
			if( gg::Rand(100) < 33 )
			{
				if( myself::Skill_GetConsumeMP(PhysicalSpecial1) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial1) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial1) == 0 )
				{
					myself::AddUseSkillDesire(attacker,PhysicalSpecial1,0,1,1000000);
				}
			}
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		if( timer_id == 6001 )
		{
			if( gg::GetDateTime(0,4) >= 55 )
			{
				myself::Despawn();
			}
			myself::AddTimerEx(6001,( 60 * 1000 ));
		}
		super;
	}

	EventHandler MY_DYING()
	{
		myself::CreateOnePrivateEx(1031455,"royal_rush_keybox",0,0,myself::FloatToInt(myself.sm.x),myself::FloatToInt(myself.sm.y),myself::FloatToInt(myself.sm.z),0,0,0,0);
		super;
	}

}
