class 1 shield_skeleton : warrior_passive
{
handler:
	EventHandler MY_DYING(always_list,c1,code_info,i0,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(413);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						c1 = myself::GetLastAttacker();
						if( myself::HaveMemo(myself.c_quest0,413) == 1 && myself::OwnItemCount(myself.c_quest0,1267) == 1 && myself.i_quest0 == 1 && myself::OwnItemCount(myself.c_quest0,1268) < 10 )
						{
							myself::GiveItem1(myself.c_quest0,1268,1);
							if( myself::OwnItemCount(myself.c_quest0,1268) >= 9 )
							{
								myself::SoundEffect(myself.c_quest0,"ItemSound.quest_middle");
								myself::SetFlagJournal(myself.c_quest0,413,6);
							}
							else
							{
								myself::SoundEffect(myself.c_quest0,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(325);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						c1 = myself::GetLastAttacker();
						if( c1.master )
						{
							c1 = c1.master;
						}
						if( myself::OwnItemCount(c1,1349) && myself::HaveMemo(c1,325) )
						{
							i0 = gg::Rand(100);
							c1.quest_last_reward_time = myself::GetCurrentTick();
							if( i0 < 6 )
							{
								myself::GiveItem1(c1,1353,1);
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
							else if( i0 < 21 )
							{
								myself::GiveItem1(c1,1354,1);
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
							else if( i0 < 30 )
							{
								myself::GiveItem1(c1,1355,1);
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
							else if( i0 < 31 )
							{
								myself::GiveItem1(c1,1356,1);
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
							else if( i0 < 64 )
							{
								myself::GiveItem1(c1,1357,1);
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage)
	{
		myself::SetCurrentQuestID(413);
		if( myself::HaveMemo(attacker,413) )
		{
			switch(myself.i_quest0)
			{
				case 0:
				{
					myself.i_quest0 = 1;
					if( attacker.master )
					{
						myself.c_quest0 = attacker.master;
					}
					else
					{
						myself.c_quest0 = attacker;
					}
					break;
				}
				case 1:
				{
					if( attacker.master )
					{
						if( myself.c_quest0 != attacker.master )
						{
							myself.i_quest0 = 2;
						}
					}
					else if( myself.c_quest0 != attacker )
					{
						myself.i_quest0 = 2;
					}
					break;
				}
				case 2:
				{
					break;
				}
			}
		}
		super;
	}

}
