class 1 abyssal_jewel_2 : citizen
{
handler:
	EventHandler ATTACKED(attacker,damage)
	{
		myself::SetCurrentQuestID(337);
		if( attacker.master )
		{
			attacker = attacker.master;
		}
		if( ( myself::GetMemoState(attacker,337) == 40000 || myself::GetMemoState(attacker,337) == 40010 ) && myself::HaveMemo(attacker,337) == 1 )
		{
			if( myself.sm.hp < ( myself.sm.max_hp * 0.800000 ) && myself.i_quest0 == 0 )
			{
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself::CreateOnePrivate(1027169,"jewel_guardian_musfel",0,1);
				myself.i_quest0 = 1;
				myself::AddTimerEx(233754,( ( 1000 * 60 ) * 15 ));
			}
			if( myself.sm.hp < ( myself.sm.max_hp * 0.400000 ) && myself::OwnItemCount(attacker,3860) == 0 )
			{
				myself::GiveItem1(attacker,3860,1);
				myself::SoundEffect(attacker,"ItemSound.quest_itemget");
				myself::AddTimerEx(233752,( ( 1000 * 60 ) * 4 ));
			}
		}
		if( myself.sm.hp < ( myself.sm.max_hp * 0.100000 ) )
		{
			myself::Despawn();
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		myself::SetCurrentQuestID(337);
		if( timer_id == 233752 || timer_id == 233754 )
		{
			myself::Despawn();
		}
		super;
	}

}
