class 1 vuku_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);
		target = last_attacker;
		always_list::SetInfo(1,target);
		target = last_attacker;
		if( myself::HaveMemo(target,426) == 1 )
		{
			random1_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,426) == 1 )
				{
					random1_list::SetInfo(2,target);
				}
			}
		}
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			switch(code_info.code)
			{
				case 0:
				{
					myself::SetCurrentQuestID(415);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						c1 = myself::GetLastAttacker();
						if( myself::HaveMemo(myself.c_quest0,415) == 1 && myself::OwnItemCount(myself.c_quest0,1607) == 1 && myself::OwnItemCount(myself.c_quest0,1609) < 3 && myself.i_quest0 == 1 )
						{
							if( ( ( ( myself::OwnItemCount(myself.c_quest0,1610) + myself::OwnItemCount(myself.c_quest0,1611) ) + myself::OwnItemCount(myself.c_quest0,1612) ) + myself::OwnItemCount(myself.c_quest0,1609) ) >= 11 )
							{
								myself::DeleteItem1(myself.c_quest0,1609,myself::OwnItemCount(myself.c_quest0,1609));
								myself::DeleteItem1(myself.c_quest0,1610,myself::OwnItemCount(myself.c_quest0,1610));
								myself::DeleteItem1(myself.c_quest0,1611,myself::OwnItemCount(myself.c_quest0,1611));
								myself::DeleteItem1(myself.c_quest0,1612,myself::OwnItemCount(myself.c_quest0,1612));
								myself::DeleteItem1(myself.c_quest0,1607,1);
								myself::GiveItem1(myself.c_quest0,1608,1);
								myself::SetFlagJournal(myself.c_quest0,415,12);
								myself::SoundEffect(myself.c_quest0,"ItemSound.quest_middle");
							}
							else
							{
								myself::GiveItem1(myself.c_quest0,1609,1);
								myself::SoundEffect(myself.c_quest0,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(418);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						c1 = myself::GetLastAttacker();
						if( myself::HaveMemo(myself.c_quest0,418) == 1 && myself::OwnItemCount(myself.c_quest0,1639) == 1 && myself::OwnItemCount(myself.c_quest0,1640) < 1 && myself.i_quest0 == 1 )
						{
							if( gg::Rand(10) < 2 )
							{
								myself::GiveItem1(myself.c_quest0,1640,1);
								myself::SetFlagJournal(myself.c_quest0,418,6);
								myself::SoundEffect(myself.c_quest0,"ItemSound.quest_middle");
							}
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
			if( code_info.code == 2 )
			{
				myself::SetCurrentQuestID(426);
				target = code_info::RandomSelectOne();
				if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
				{
					if( gg::Rand(1000) < 115 )
					{
						myself::GiveItem1(target,7586,1);
						myself::SoundEffect(target,"ItemSound.quest_itemget");
					}
				}
			}
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage)
	{
		myself::SetCurrentQuestID(415);
		if( myself::HaveMemo(attacker,415) )
		{
			switch(myself.i_quest0)
			{
				case 0:
				{
					if( attacker.attack_type != 5 && attacker.attack_type != 9 )
					{
						myself.i_quest0 = 2;
					}
					else
					{
						myself.i_quest0 = 1;
					}
					myself.c_quest0 = attacker;
					break;
				}
				case 1:
				{
					if( myself.c_quest0 != attacker || ( attacker.attack_type != 5 && attacker.attack_type != 9 ) )
					{
						myself.i_quest0 = 2;
					}
					break;
				}
				case 2:
				{
					break;
				}
			}
		}
		myself::SetCurrentQuestID(418);
		if( myself::HaveMemo(attacker,418) )
		{
			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;
	}

}
