class 1 party_private_ex : warrior
{
parameter:
	int	DDMagic = 262209537;

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

	EventHandler PARTY_ATTACKED(attacker,private,damage,f0)
	{
		if( attacker.is_pc != 0 || myself::IsInCategory(11,attacker.npc_class_id) )
		{
			f0 = 0;
			if( SetHateGroup >= 0 )
			{
				if( myself::IsInCategory(SetHateGroup,attacker.occupation) )
				{
					f0 = ( f0 + SetHateGroupRatio );
				}
			}
			if( attacker.occupation == SetHateOccupation )
			{
				f0 = ( f0 + SetHateOccupationRatio );
			}
			if( SetHateRace == attacker.race )
			{
				f0 = ( f0 + SetHateRaceRatio );
			}
			f0 = ( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) ) );
			myself::AddAttackDesire(attacker,1,( ( ( f0 * damage ) * private.weight_point ) * 10 ));
		}
	}

	EventHandler ATTACKED(attacker,damage,f0)
	{
		if( myself.boss.alive == 0 )
		{
			if( attacker.is_pc != 0 || myself::IsInCategory(11,attacker.npc_class_id) )
			{
				f0 = 0;
				if( SetHateGroup >= 0 )
				{
					if( myself::IsInCategory(SetHateGroup,attacker.occupation) )
					{
						f0 = ( f0 + SetHateGroupRatio );
					}
				}
				if( attacker.occupation == SetHateOccupation )
				{
					f0 = ( f0 + SetHateOccupationRatio );
				}
				if( SetHateRace == attacker.race )
				{
					f0 = ( f0 + SetHateRaceRatio );
				}
				f0 = ( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) ) );
				myself::AddAttackDesire(attacker,1,( f0 * 100 ));
			}
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		if( 1004 == timer_id )
		{
			if( myself.p_state != 3 && myself.p_state != 10 )
			{
				myself::Despawn();
			}
			else
			{
				myself::AddTimerEx(1004,20000);
			}
		}
		super;
	}

	EventHandler CLAN_ATTACKED(attacker,damage,f0)
	{
		if( myself.boss.alive == 0 && myself::GetLifeTime() > 7 )
		{
			if( attacker.is_pc != 0 || myself::IsInCategory(11,attacker.npc_class_id) )
			{
				f0 = 0;
				if( SetHateGroup >= 0 )
				{
					if( myself::IsInCategory(SetHateGroup,attacker.occupation) )
					{
						f0 = ( f0 + SetHateGroupRatio );
					}
				}
				if( attacker.occupation == SetHateOccupation )
				{
					f0 = ( f0 + SetHateOccupationRatio );
				}
				if( SetHateRace == attacker.race )
				{
					f0 = ( f0 + SetHateRaceRatio );
				}
				f0 = ( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) ) );
				myself::AddAttackDesire(attacker,1,( f0 * 30 ));
			}
		}
	}

	EventHandler SEE_SPELL(speller,skill_name_id,target,f0,i0)
	{
		if( myself.boss.alive == 0 )
		{
			if( myself::Skill_GetEffectPoint(skill_name_id) > 0 )
			{
				if( myself.p_state == 3 && myself.top_desire_target == target )
				{
					i0 = myself::Skill_GetEffectPoint(skill_name_id);
					f0 = 0;
					if( SetHateGroup >= 0 )
					{
						if( myself::IsInCategory(SetHateGroup,speller.occupation) )
						{
							f0 = ( f0 + SetHateGroupRatio );
						}
					}
					if( speller.occupation == SetHateOccupation )
					{
						f0 = ( f0 + SetHateOccupationRatio );
					}
					if( SetHateRace == speller.race )
					{
						f0 = ( f0 + SetHateRaceRatio );
					}
					f0 = ( ( ( 1.000000 * i0 ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * i0 ) / ( myself.sm.level + 7 ) ) ) );
					myself::AddAttackDesire(speller,1,( f0 * 150 ));
				}
			}
			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 OUT_OF_TERRITORY()
	{
		myself::RemoveAllAttackDesire();
		myself::AddMoveToDesire(myself.start_x,myself.start_y,myself.start_z,100);
	}

	EventHandler PARTY_DIED(private)
	{
		if( private == myself.boss )
		{
			myself::AddTimerEx(1004,20000);
		}
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		if( 1004 == timer_id )
		{
			if( myself.p_state != 3 && myself.p_state != 10 )
			{
				myself::Despawn();
			}
			else
			{
				myself::AddTimerEx(1004,20000);
			}
		}
	}

}
