class 1 enchanted_gargoyle : warrior_passive_physicalspecial
{
handler:
	EventHandler MY_DYING(always_list,c1,code_info,i9,last_attacker,lparty,member,random1_list,target)
	{
		always_list = gg::AllocCodeInfoList();
		random1_list = gg::AllocCodeInfoList();
		target = last_attacker;
		always_list::SetInfo(0,target);
		target = last_attacker;
		always_list::SetInfo(1,target);
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			switch(code_info.code)
			{
				case 0:
				{
					myself::SetCurrentQuestID(214);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						c1 = myself::GetLastAttacker();
						if( c1.master )
						{
							c1 = c1.master;
						}
						if( myself::HaveMemo(c1,214) && myself::OwnItemCount(c1,2705) == 1 && myself::OwnItemCount(c1,2711) == 1 && myself::OwnItemCount(c1,2715) == 1 && myself::OwnItemCount(c1,2719) < 5 )
						{
							myself::GiveItem1(c1,2719,1);
							if( myself::OwnItemCount(c1,2719) >= 5 )
							{
								myself::SoundEffect(c1,"ItemSound.quest_middle");
							}
							else
							{
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(335);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						c1 = myself::GetLastAttacker();
						if( c1.master )
						{
							c1 = c1.master;
						}
						if( myself::HaveMemo(c1,335) && myself::OwnItemCount(c1,3740) && myself::OwnItemCount(c1,3782) < 50 )
						{
							if( gg::Rand(2) == 0 )
							{
								c1.quest_last_reward_time = myself::GetCurrentTick();
								myself::GiveItem1(c1,3782,1);
								if( myself::OwnItemCount(c1,3782) >= 50 )
								{
									myself::SoundEffect(c1,"ItemSound.quest_middle");
								}
								else
								{
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
								}
							}
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

}
