class 1 skeleton_hunter : warrior_aggressive
{
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);
		target = last_attacker;
		always_list::SetInfo(2,target);
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			switch(code_info.code)
			{
				case 0:
				{
					myself::SetCurrentQuestID(103);
					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,970) == 1 && myself::OwnItemCount(c1,1107) < 10 )
						{
							if( gg::Rand(10) < 3 )
							{
								myself::GiveItem1(c1,1107,1);
								if( myself::OwnItemCount(c1,1107) >= 9 )
								{
									myself::SoundEffect(c1,"ItemSound.quest_middle");
									myself::SetFlagJournal(c1,103,4);
								}
								else
								{
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
								}
							}
						}
					}
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(320);
					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,320) == 1 && myself::OwnItemCount(c1,809) < 10 )
						{
							if( gg::Rand(100) < 18 )
							{
								myself::GiveItem1(c1,809,1);
								if( myself::OwnItemCount(c1,809) >= 9 )
								{
									myself::SoundEffect(c1,"ItemSound.quest_middle");
									myself::SetFlagJournal(c1,320,2);
								}
								else
								{
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
								}
							}
						}
					}
					break;
				}
				case 2:
				{
					myself::SetCurrentQuestID(412);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						c1 = myself::GetLastAttacker();
						if( myself::HaveMemo(myself.c_quest0,412) == 1 && myself::OwnItemCount(myself.c_quest0,1278) == 1 && myself.i_quest0 == 1 && myself::OwnItemCount(myself.c_quest0,1259) < 2 )
						{
							if( gg::Rand(2) == 0 )
							{
								myself::GiveItem1(myself.c_quest0,1259,1);
								if( myself::OwnItemCount(myself.c_quest0,1259) == 2 )
								{
									myself::SoundEffect(myself.c_quest0,"ItemSound.quest_middle");
								}
								else
								{
									myself::SoundEffect(myself.c_quest0,"ItemSound.quest_itemget");
								}
							}
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage)
	{
		myself::SetCurrentQuestID(412);
		if( myself::HaveMemo(attacker,412) )
		{
			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;
	}

}
