class 1 agit_wizard_flee : agit_warrior_flee
{
parameter:

handler:
	EventHandler ATTACKED(attacker,damage,skill_name_id,i0,i1)
	{
		if( myself.i_ai1 == 1 )
		{
			myself::AddFleeDesire(attacker,10000);
			if( gg::Rand(100) < 10 )
			{
				if( myself::Skill_GetConsumeMP(1040646) < myself.sm.mp && myself::Skill_GetConsumeHP(1040646) < myself.sm.hp && myself::Skill_InReuseDelay(1040646) == 0 )
				{
					myself::AddUseSkillDesire(myself.sm,1040646,1,1,1000000);
				}
			}
		}
		else if( myself::IsInCategory(11,attacker.npc_class_id) != 0 && attacker.master.pledge_id == myself.sm.pledge_id )
		{
		}
		else if( attacker.pledge_id != myself.sm.pledge_id || attacker.pledge_id == 0 )
		{
			if( myself::FloatToInt(( ( myself.sm.hp / myself.sm.max_hp ) * 100 )) > 50 )
			{
				if( attacker.is_pc == 1 )
				{
					myself::AddAttackDesire(attacker,1,( ( ( damage / myself.sm.max_hp ) / 0.050000 ) * 100 ));
				}
				else
				{
					myself::AddAttackDesire(attacker,1,( ( ( damage / myself.sm.max_hp ) / 0.050000 ) * 10 ));
				}
			}
			else if( myself::FloatToInt(( ( myself.sm.hp / myself.sm.max_hp ) * 100 )) > 30 )
			{
				if( gg::Rand(100) < 90 )
				{
					if( attacker.is_pc == 1 )
					{
						myself::AddAttackDesire(attacker,1,( ( ( damage / myself.sm.max_hp ) / 0.050000 ) * 100 ));
					}
					else
					{
						myself::AddAttackDesire(attacker,1,( ( ( damage / myself.sm.max_hp ) / 0.050000 ) * 10 ));
					}
				}
				else
				{
					myself.i_ai1 = 1;
					myself::RemoveAllAttackDesire();
					myself::AddTimerEx(3001,5000);
				}
			}
			else
			{
				myself.i_ai1 = 1;
				myself::RemoveAllAttackDesire();
			}
		}
	}

}
