class 1 baraq_orc_fighter : 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);
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			if( code_info.code == 0 )
			{
				myself::SetCurrentQuestID(163);
				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,163) == 1 )
					{
						if( gg::Rand(10) == 0 && myself::OwnItemCount(c1,1038) == 0 )
						{
							myself::GiveItem1(c1,1038,1);
							if( ( ( ( myself::OwnItemCount(c1,1038) + myself::OwnItemCount(c1,1039) ) + myself::OwnItemCount(c1,1040) ) + myself::OwnItemCount(c1,1041) ) >= 3 )
							{
								myself::SoundEffect(c1,"ItemSound.quest_middle");
								myself::SetFlagJournal(c1,163,2);
							}
							else
							{
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
						}
						if( gg::Rand(10) > 7 && myself::OwnItemCount(c1,1039) == 0 )
						{
							myself::GiveItem1(c1,1039,1);
							if( ( ( ( myself::OwnItemCount(c1,1038) + myself::OwnItemCount(c1,1039) ) + myself::OwnItemCount(c1,1040) ) + myself::OwnItemCount(c1,1041) ) >= 3 )
							{
								myself::SoundEffect(c1,"ItemSound.quest_middle");
								myself::SetFlagJournal(c1,163,2);
							}
							else
							{
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
						}
						if( gg::Rand(10) > 7 && myself::OwnItemCount(c1,1040) == 0 )
						{
							myself::GiveItem1(c1,1040,1);
							if( ( ( ( myself::OwnItemCount(c1,1038) + myself::OwnItemCount(c1,1039) ) + myself::OwnItemCount(c1,1040) ) + myself::OwnItemCount(c1,1041) ) >= 3 )
							{
								myself::SoundEffect(c1,"ItemSound.quest_middle");
								myself::SetFlagJournal(c1,163,2);
							}
							else
							{
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
						}
						if( gg::Rand(10) > 5 && myself::OwnItemCount(c1,1041) == 0 )
						{
							myself::GiveItem1(c1,1041,1);
							if( ( ( ( myself::OwnItemCount(c1,1038) + myself::OwnItemCount(c1,1039) ) + myself::OwnItemCount(c1,1040) ) + myself::OwnItemCount(c1,1041) ) >= 3 )
							{
								myself::SoundEffect(c1,"ItemSound.quest_middle");
								myself::SetFlagJournal(c1,163,2);
							}
							else
							{
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
						}
					}
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

}
