class 1 ai_agit02_dietrich : (null)
{
handler:
	EventHandler NO_DESIRE()
	{
		myself::AddDoNothingDesire(5,5);
	}

	EventHandler CREATED()
	{
		myself::Shout(myself::MakeFString(1000277,"","","","",""));
		myself::AddTimerEx(1001,1000);
		myself.c_ai0 = myself.sm;
		myself.i_ai0 = 0;
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		if( timer_id == 1001 )
		{
			if( myself::InMyTerritory(myself.sm) == 0 && gg::Rand(3) < 1 )
			{
				myself::InstantTeleport(myself.sm,myself::FloatToInt(myself.boss.x),myself::FloatToInt(myself.boss.y),myself::FloatToInt(myself.boss.z));
				myself::RemoveAllAttackDesire();
			}
			if( gg::Rand(5) < 1 )
			{
				myself::RandomizeAttackDesire();
			}
			myself::AddTimerEx(1001,( 60 * 1000 ));
		}
		if( timer_id == 1002 )
		{
		}
		super;
	}

	EventHandler PARTY_ATTACKED(attacker,private,damage)
	{
		if( gg::Rand(3) < 1 && myself.c_ai0 != myself.sm && myself::InMyTerritory(myself.c_ai0) && myself::Skill_InReuseDelay(1084929) == 0 )
		{
			myself::AddMoveToDesire(myself::FloatToInt(myself.c_ai0.x),myself::FloatToInt(myself.c_ai0.y),myself::FloatToInt(myself.c_ai0.z),100000000);
		}
		if( attacker.is_pc != 0 || myself::IsInCategory(11,attacker.npc_class_id) )
		{
			myself::AddAttackDesire(attacker,1,( ( ( ( ( damage / myself.sm.max_hp ) / 0.050000 ) * damage ) * private.weight_point ) / 1000000 ));
		}
		if( myself.boss.hp < ( myself.boss.max_hp / 20 ) && myself.i_ai0 == 0 )
		{
			myself.i_ai0 = 1;
			myself::AddUseSkillDesire(myself.sm,1084161,1,1,( myself::GetTopDesireValue() + 2147483647 ));
			myself::Say(myself::MakeFString(1000280,"","","","",""));
		}
	}

	EventHandler USE_SKILL_FINISHED(target,skill_name_id)
	{
		if( ( skill_name_id / 256 ) == ( 1084160 / 256 ) )
		{
			myself::InstantTeleport(myself.sm,177134,-18807,-2263);
			myself::RemoveAllAttackDesire();
			myself::AddTimerEx(1002,3000);
		}
	}

	EventHandler SEE_SPELL(speller,skill_name_id,target)
	{
		if( speller.occupation == 16 || speller.occupation == 17 || speller.occupation == 30 || speller.occupation == 43 || speller.occupation == 51 || speller.occupation == 52 )
		{
			myself.c_ai0 = speller;
		}
		if( myself::Skill_GetEffectPoint(skill_name_id) > 0 )
		{
			if( myself.p_state == 3 && myself.top_desire_target == target )
			{
				myself::AddAttackDesire(speller,1,( ( ( myself::Skill_GetEffectPoint(skill_name_id) / myself.sm.max_hp ) / 0.050000 ) * 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 MOVE_TO_FINISHED(x,y,z)
	{
		if( myself::Skill_GetConsumeMP(1084929) < myself.sm.mp && myself::Skill_GetConsumeHP(1084929) < myself.sm.hp && myself::Skill_InReuseDelay(1084929) == 0 )
		{
			myself::AddUseSkillDesire(myself.sm,1084929,0,1,1000000);
		}
	}

}
