class 1 raid_private_standard : default_npc
{
parameter:
	float	Attack_DecayRatio = 6.600000;
	float	UseSkill_DecayRatio = 66000.000000;
	float	Attack_BoostValue = 300.000000;
	float	UseSkill_BoostValue = 100000.000000;

handler:
	EventHandler NO_DESIRE()
	{
		if( myself.boss.alive )
		{
			myself::AddFollowDesire(myself.boss,5);
		}
		else
		{
			myself::AddMoveAroundDesire(10,5);
		}
	}

	EventHandler CREATED()
	{
		if( myself.boss.alive == 0 )
		{
			myself::Despawn();
			return;
		}
		myself::AddTimerEx(1001,2000);
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		if( timer_id == 1001 )
		{
			if( myself::DistFromMe(myself.boss) > 500 && myself.boss.alive != 0 && myself.p_state != 3 )
			{
				myself::InstantTeleport(myself.sm,myself::FloatToInt(myself.boss.x),myself::FloatToInt(myself.boss.y),myself::FloatToInt(myself.boss.z));
			}
			if( gg::Rand(3) < 1 )
			{
				myself::RandomizeAttackDesire();
			}
			if( myself.boss.alive == 0 )
			{
				myself::Despawn();
				return;
			}
			myself::AddTimerEx(1001,( 60 * 1000 ));
		}
	}

	EventHandler PARTY_ATTACKED(attacker,private,damage,i0,c0)
	{
		if( attacker.level <= ( myself.boss.level + 8 ) )
		{
			if( attacker.is_pc != 0 || myself::IsInCategory(11,attacker.npc_class_id) )
			{
				if( damage == 0 )
				{
					damage = 1;
				}
				myself::AddAttackDesire(attacker,1,( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) * 20000 ));
			}
		}
		if( private == myself.sm )
		{
			i0 = 10;
			if( attacker.level > ( myself.sm.level + 8 ) && myself::GetAbnormalLevel(attacker,myself::Skill_GetAbnormalType(1155841)) == -1 )
			{
				myself::AddUseSkillDesire(attacker,1155841,0,1,1000000);
				myself::RemoveAttackDesire(attacker.id);
			}
		}
		else
		{
			i0 = ( 8 + gg::Rand(13) );
		}
		if( myself::GetPathfindFailCount() > i0 )
		{
			if( myself::IsNullCreature(myself.top_desire_target) == 1 )
			{
			}
			else if( myself::DistFromMe(myself.top_desire_target) < 1000 )
			{
				myself::InstantTeleport(myself.sm,myself::FloatToInt(myself.top_desire_target.x),myself::FloatToInt(myself.top_desire_target.y),myself::FloatToInt(myself.top_desire_target.z));
			}
			else
			{
				myself::RemoveAllAttackDesire();
				if( attacker.is_pc != 0 || myself::IsInCategory(11,attacker.npc_class_id) )
				{
					if( damage == 0 )
					{
						damage = 1;
					}
					myself::AddAttackDesire(attacker,1,( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) * 20000 ));
				}
				myself::InstantTeleport(myself.sm,myself::FloatToInt(attacker.x),myself::FloatToInt(attacker.y),myself::FloatToInt(attacker.z));
			}
		}
		if( myself.sm.in_peacezone != 0 )
		{
			myself::InstantTeleport(myself.sm,myself.start_x,myself.start_y,myself.start_z);
			myself::RemoveAllAttackDesire();
		}
	}

	EventHandler SEE_SPELL(speller,skill_name_id)
	{
		if( speller.level > ( myself.sm.level + 8 ) && myself::GetAbnormalLevel(speller,myself::Skill_GetAbnormalType(1079041)) == -1 )
		{
			myself::AddUseSkillDesire(speller,1079041,0,1,1000000);
			return;
		}
		if( myself::Skill_GetEffectPoint(skill_name_id) > 0 )
		{
			if( myself::IsNullCreature(myself.top_desire_target) == 0 )
			{
				if( myself.p_state == 3 && myself.top_desire_target != speller )
				{
					myself::AddAttackDesire(speller,1,( ( ( myself::Skill_GetEffectPoint(skill_name_id) / myself.sm.max_hp ) * 2000 ) * 150 ));
				}
			}
		}
		if( myself::IsNullCreature(myself.top_desire_target) == 0 )
		{
			if( myself::GetPathfindFailCount() > 10 && speller == myself.top_desire_target && myself::FloatToInt(myself.sm.hp) != myself::FloatToInt(myself.sm.max_hp) )
			{
				myself::InstantTeleport(myself.sm,myself::FloatToInt(speller.x),myself::FloatToInt(speller.y),myself::FloatToInt(speller.z));
			}
		}
	}

	EventHandler PARTY_DIED(private)
	{
		if( private == myself.boss )
		{
			myself::Despawn();
		}
	}

}
