class 1 party_private_casting_enchant : party_private
{
parameter:
	int	Buff = 1031169;

handler:
	EventHandler CREATED()
	{
		myself.i_ai0 = 0;
		myself.i_ai1 = 0;
		super;
	}

	EventHandler ATTACKED(attacker,damage)
	{
		if( attacker.is_pc != 0 || myself::IsInCategory(11,attacker.npc_class_id) )
		{
			if( myself.i_ai1 == 0 && gg::Rand(100) < 33 && myself::FloatToInt(( ( myself.sm.hp / myself.sm.max_hp ) * 100 )) > 50 )
			{
				if( myself::Skill_GetConsumeMP(Buff) < myself.sm.mp && myself::Skill_GetConsumeHP(Buff) < myself.sm.hp && myself::Skill_InReuseDelay(Buff) == 0 )
				{
					myself::AddUseSkillDesire(myself.sm,Buff,1,1,1000000);
				}
				myself.i_ai1 = 1;
			}
		}
		super;
	}

}
