class 1 deinonychus : warrior_universal
{
handler:
	EventHandler MY_DYING(always_list,code_info,i9,last_attacker,lparty,member,random1_list,target)
	{
		always_list = gg::AllocCodeInfoList();
		random1_list = gg::AllocCodeInfoList();
		target = last_attacker;
		if( myself::HaveMemo(target,642) == 1 && myself::GetMemoState(target,642) == 1 )
		{
			always_list::SetInfo(0,target);
		}
		if( gg::IsNull(lparty) == 0 )
		{
			for(i9 = 0; i9 < lparty.member_count; i9 = ( i9 + 1 ))
			{
				target = myself::GetMemberOfParty(lparty,i9);
				if( myself::HaveMemo(target,642) == 1 && myself::GetMemoState(target,642) == 1 )
				{
					always_list::SetInfo(0,target);
				}
			}
		}
		target = last_attacker;
		if( myself::HaveMemo(target,111) == 1 && myself::GetMemoState(target,111) == 10 )
		{
			always_list::SetInfo(1,target);
		}
		if( gg::IsNull(lparty) == 0 )
		{
			for(i9 = 0; i9 < lparty.member_count; i9 = ( i9 + 1 ))
			{
				target = myself::GetMemberOfParty(lparty,i9);
				if( myself::HaveMemo(target,111) == 1 && myself::GetMemoState(target,111) == 10 )
				{
					always_list::SetInfo(1,target);
				}
			}
		}
		target = last_attacker;
		if( myself::HaveMemo(target,125) == 1 && myself::GetMemoState(target,125) == 3 )
		{
			always_list::SetInfo(2,target);
		}
		if( gg::IsNull(lparty) == 0 )
		{
			for(i9 = 0; i9 < lparty.member_count; i9 = ( i9 + 1 ))
			{
				target = myself::GetMemberOfParty(lparty,i9);
				if( myself::HaveMemo(target,125) == 1 && myself::GetMemoState(target,125) == 3 )
				{
					always_list::SetInfo(2,target);
				}
			}
		}
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			switch(code_info.code)
			{
				case 0:
				{
					myself::SetCurrentQuestID(642);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						if( gg::Rand(100) < 40 )
						{
							myself::GiveItem1(target,8774,1);
							myself::SoundEffect(target,"ItemSound.quest_itemget");
						}
					}
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(111);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						if( gg::Rand(100) < 50 )
						{
							if( myself::OwnItemCount(target,8771) < 10 )
							{
								myself::GiveItem1(target,8771,1);
								myself::SoundEffect(target,"ItemSound.quest_itemget");
							}
							else if( myself::OwnItemCount(target,8770) == 10 && myself::OwnItemCount(target,8772) == 10 )
							{
								myself::SetFlagJournal(target,111,11);
								myself::AddLog(11,target,111);
								myself::SetMemoState(target,111,11);
							}
						}
					}
					break;
				}
				case 2:
				{
					myself::SetCurrentQuestID(125);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						if( gg::Rand(100) < 50 )
						{
							if( myself::OwnItemCount(target,8780) < 2 )
							{
								myself::GiveItem1(target,8780,1);
								myself::SoundEffect(target,"ItemSound.quest_itemget");
							}
							else if( myself::OwnItemCount(target,8779) == 2 )
							{
								myself::SetFlagJournal(target,125,4);
								myself::AddLog(11,target,125);
								myself::SetMemoState(target,125,4);
							}
						}
					}
					break;
				}
			}
		}
		super;
	}

}
