class 1 velociraptor : warrior_universal
{
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;
		if( myself::HaveMemo(target,641) == 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,641) == 1 )
				{
					always_list::SetInfo(0,target);
				}
			}
		}
		target = last_attacker;
		if( myself::HaveMemo(target,642) == 1 )
		{
			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,642) == 1 )
				{
					always_list::SetInfo(1,target);
				}
			}
		}
		target = last_attacker;
		if( myself::HaveMemo(target,111) == 1 )
		{
			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,111) == 1 )
				{
					always_list::SetInfo(2,target);
				}
			}
		}
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			switch(code_info.code)
			{
				case 0:
				{
					myself::SetCurrentQuestID(641);
					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,641) == 1 && myself::GetMemoState(c1,641) == 1 )
						{
							if( gg::Rand(100) < 50 )
							{
								if( myself::OwnItemCount(c1,8782) < 29 )
								{
									myself::GiveItem1(c1,8782,1);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
								}
								else
								{
									myself::GiveItem1(c1,8782,1);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
									myself::SetFlagJournal(c1,641,2);
									myself::SetMemoState(c1,641,2);
								}
							}
						}
					}
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(642);
					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,642) == 1 && myself::GetMemoState(c1,642) == 1 )
						{
							if( gg::Rand(100) < 40 )
							{
								myself::GiveItem1(c1,8774,1);
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
				case 2:
				{
					myself::SetCurrentQuestID(111);
					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,111) == 1 && myself::GetMemoState(c1,111) == 4 )
						{
							if( gg::Rand(100) < 40 )
							{
								if( myself::OwnItemCount(c1,8768) < 49 )
								{
									myself::GiveItem1(c1,8768,1);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
								}
								else
								{
									myself::GiveItem1(c1,8768,1);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
									myself::SetFlagJournal(c1,111,5);
									myself::SetMemoState(c1,111,5);
								}
							}
						}
					}
					break;
				}
			}
		}
		super;
	}

}
