class 1 valakas : ai_boss07_valakas
{
handler:
	EventHandler MY_DYING(always_list,c0,c1,code_info,i0,i1,i2,i9,last_attacker,lparty,member,random1_list,target)
	{
		always_list = gg::AllocCodeInfoList();
		always_list::SetInfo(0,last_attacker);
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			if( code_info.code == 0 )
			{
				myself::SetCurrentQuestID(350);
				target = code_info::RandomSelectOne();
				if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
				{
					c1 = myself::GetLastAttacker();
					if( c1.master )
					{
						c1 = c1.master;
					}
					i1 = myself::Party_GetCount(c1);
					if( i1 == 0 )
					{
						if( myself::HaveMemo(c1,350) )
						{
							if( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( myself::OwnItemCount(c1,4651) + myself::OwnItemCount(c1,4652) ) + myself::OwnItemCount(c1,4653) ) + myself::OwnItemCount(c1,4654) ) + myself::OwnItemCount(c1,4655) ) + myself::OwnItemCount(c1,4656) ) + myself::OwnItemCount(c1,4657) ) + myself::OwnItemCount(c1,4658) ) + myself::OwnItemCount(c1,4659) ) + myself::OwnItemCount(c1,4660) ) + myself::OwnItemCount(c1,4661) ) + myself::OwnItemCount(c1,5579) ) + myself::OwnItemCount(c1,5582) ) + myself::OwnItemCount(c1,5914) ) + myself::OwnItemCount(c1,4629) ) + myself::OwnItemCount(c1,4630) ) + myself::OwnItemCount(c1,4631) ) + myself::OwnItemCount(c1,4632) ) + myself::OwnItemCount(c1,4633) ) + myself::OwnItemCount(c1,4634) ) + myself::OwnItemCount(c1,4635) ) + myself::OwnItemCount(c1,4636) ) + myself::OwnItemCount(c1,4637) ) + myself::OwnItemCount(c1,4638) ) + myself::OwnItemCount(c1,4639) ) + myself::OwnItemCount(c1,5577) ) + myself::OwnItemCount(c1,5580) ) + myself::OwnItemCount(c1,5908) ) + myself::OwnItemCount(c1,4640) ) + myself::OwnItemCount(c1,4641) ) + myself::OwnItemCount(c1,4642) ) + myself::OwnItemCount(c1,4643) ) + myself::OwnItemCount(c1,4644) ) + myself::OwnItemCount(c1,4645) ) + myself::OwnItemCount(c1,4646) ) + myself::OwnItemCount(c1,4647) ) + myself::OwnItemCount(c1,4648) ) + myself::OwnItemCount(c1,4649) ) + myself::OwnItemCount(c1,4650) ) + myself::OwnItemCount(c1,5578) ) + myself::OwnItemCount(c1,5581) ) + myself::OwnItemCount(c1,5911) ) == 1 )
							{
								if( myself::OwnItemCount(c1,4661) == 1 )
								{
									myself::DeleteItem1(c1,4661,1);
									myself::GiveItem1(c1,5579,1);
									myself::AddLog(6,c1,5579);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
									myself::ShowSystemMessage(c1,974);
								}
								else if( myself::OwnItemCount(c1,5579) == 1 )
								{
									myself::DeleteItem1(c1,5579,1);
									myself::GiveItem1(c1,5582,1);
									myself::AddLog(6,c1,5582);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
									myself::ShowSystemMessage(c1,974);
								}
								else if( myself::OwnItemCount(c1,4639) == 1 )
								{
									myself::DeleteItem1(c1,4639,1);
									myself::GiveItem1(c1,5577,1);
									myself::AddLog(6,c1,5577);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
									myself::ShowSystemMessage(c1,974);
								}
								else if( myself::OwnItemCount(c1,5577) == 1 )
								{
									myself::DeleteItem1(c1,5577,1);
									myself::GiveItem1(c1,5580,1);
									myself::AddLog(6,c1,5580);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
									myself::ShowSystemMessage(c1,974);
								}
								else if( myself::OwnItemCount(c1,4650) == 1 )
								{
									myself::DeleteItem1(c1,4650,1);
									myself::GiveItem1(c1,5578,1);
									myself::AddLog(6,c1,5578);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
									myself::ShowSystemMessage(c1,974);
								}
								else if( myself::OwnItemCount(c1,5578) == 1 )
								{
									myself::DeleteItem1(c1,5578,1);
									myself::GiveItem1(c1,5581,1);
									myself::AddLog(6,c1,5581);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
									myself::ShowSystemMessage(c1,974);
								}
								else if( myself::OwnItemCount(c1,5580) == 1 )
								{
									myself::DeleteItem1(c1,5580,1);
									myself::GiveItem1(c1,5908,1);
									myself::AddLog(6,c1,5908);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
									myself::ShowSystemMessage(c1,974);
								}
								else if( myself::OwnItemCount(c1,5581) == 1 )
								{
									myself::DeleteItem1(c1,5581,1);
									myself::GiveItem1(c1,5911,1);
									myself::AddLog(6,c1,5911);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
									myself::ShowSystemMessage(c1,974);
								}
								else if( myself::OwnItemCount(c1,5582) == 1 )
								{
									myself::DeleteItem1(c1,5582,1);
									myself::GiveItem1(c1,5914,1);
									myself::AddLog(6,c1,5914);
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
									myself::ShowSystemMessage(c1,974);
								}
								else
								{
									myself::ShowSystemMessage(c1,1264);
								}
							}
							else if( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( myself::OwnItemCount(c1,4651) + myself::OwnItemCount(c1,4652) ) + myself::OwnItemCount(c1,4653) ) + myself::OwnItemCount(c1,4654) ) + myself::OwnItemCount(c1,4655) ) + myself::OwnItemCount(c1,4656) ) + myself::OwnItemCount(c1,4657) ) + myself::OwnItemCount(c1,4658) ) + myself::OwnItemCount(c1,4659) ) + myself::OwnItemCount(c1,4660) ) + myself::OwnItemCount(c1,4661) ) + myself::OwnItemCount(c1,5579) ) + myself::OwnItemCount(c1,5582) ) + myself::OwnItemCount(c1,5914) ) + myself::OwnItemCount(c1,4629) ) + myself::OwnItemCount(c1,4630) ) + myself::OwnItemCount(c1,4631) ) + myself::OwnItemCount(c1,4632) ) + myself::OwnItemCount(c1,4633) ) + myself::OwnItemCount(c1,4634) ) + myself::OwnItemCount(c1,4635) ) + myself::OwnItemCount(c1,4636) ) + myself::OwnItemCount(c1,4637) ) + myself::OwnItemCount(c1,4638) ) + myself::OwnItemCount(c1,4639) ) + myself::OwnItemCount(c1,5577) ) + myself::OwnItemCount(c1,5580) ) + myself::OwnItemCount(c1,5908) ) + myself::OwnItemCount(c1,4640) ) + myself::OwnItemCount(c1,4641) ) + myself::OwnItemCount(c1,4642) ) + myself::OwnItemCount(c1,4643) ) + myself::OwnItemCount(c1,4644) ) + myself::OwnItemCount(c1,4645) ) + myself::OwnItemCount(c1,4646) ) + myself::OwnItemCount(c1,4647) ) + myself::OwnItemCount(c1,4648) ) + myself::OwnItemCount(c1,4649) ) + myself::OwnItemCount(c1,4650) ) + myself::OwnItemCount(c1,5578) ) + myself::OwnItemCount(c1,5581) ) + myself::OwnItemCount(c1,5911) ) >= 2 )
							{
								myself::ShowSystemMessage(c1,977);
							}
							else
							{
								myself::ShowSystemMessage(c1,1265);
							}
						}
					}
					else
					{
						for(i0 = 0; i0 < i1; i0 = ( i0 + 1 ))
						{
							c0 = myself::Party_GetCreature(c1,i0);
							if( myself::HaveMemo(c0,350) && myself::DistFromMe(c0) <= 1500 )
							{
								if( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( myself::OwnItemCount(c0,4651) + myself::OwnItemCount(c0,4652) ) + myself::OwnItemCount(c0,4653) ) + myself::OwnItemCount(c0,4654) ) + myself::OwnItemCount(c0,4655) ) + myself::OwnItemCount(c0,4656) ) + myself::OwnItemCount(c0,4657) ) + myself::OwnItemCount(c0,4658) ) + myself::OwnItemCount(c0,4659) ) + myself::OwnItemCount(c0,4660) ) + myself::OwnItemCount(c0,4661) ) + myself::OwnItemCount(c0,5579) ) + myself::OwnItemCount(c0,5582) ) + myself::OwnItemCount(c0,5914) ) + myself::OwnItemCount(c0,4629) ) + myself::OwnItemCount(c0,4630) ) + myself::OwnItemCount(c0,4631) ) + myself::OwnItemCount(c0,4632) ) + myself::OwnItemCount(c0,4633) ) + myself::OwnItemCount(c0,4634) ) + myself::OwnItemCount(c0,4635) ) + myself::OwnItemCount(c0,4636) ) + myself::OwnItemCount(c0,4637) ) + myself::OwnItemCount(c0,4638) ) + myself::OwnItemCount(c0,4639) ) + myself::OwnItemCount(c0,5577) ) + myself::OwnItemCount(c0,5580) ) + myself::OwnItemCount(c0,5908) ) + myself::OwnItemCount(c0,4640) ) + myself::OwnItemCount(c0,4641) ) + myself::OwnItemCount(c0,4642) ) + myself::OwnItemCount(c0,4643) ) + myself::OwnItemCount(c0,4644) ) + myself::OwnItemCount(c0,4645) ) + myself::OwnItemCount(c0,4646) ) + myself::OwnItemCount(c0,4647) ) + myself::OwnItemCount(c0,4648) ) + myself::OwnItemCount(c0,4649) ) + myself::OwnItemCount(c0,4650) ) + myself::OwnItemCount(c0,5578) ) + myself::OwnItemCount(c0,5581) ) + myself::OwnItemCount(c0,5911) ) == 1 )
								{
									if( myself::OwnItemCount(c0,4661) == 1 )
									{
										myself::DeleteItem1(c0,4661,1);
										myself::GiveItem1(c0,5579,1);
										myself::AddLog(6,c0,5579);
										myself::SoundEffect(c0,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(c0,974);
									}
									else if( myself::OwnItemCount(c0,5579) == 1 )
									{
										myself::DeleteItem1(c0,5579,1);
										myself::GiveItem1(c0,5582,1);
										myself::AddLog(6,c0,5582);
										myself::SoundEffect(c0,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(c0,974);
									}
									else if( myself::OwnItemCount(c0,4639) == 1 )
									{
										myself::DeleteItem1(c0,4639,1);
										myself::GiveItem1(c0,5577,1);
										myself::AddLog(6,c0,5577);
										myself::SoundEffect(c0,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(c0,974);
									}
									else if( myself::OwnItemCount(c0,5577) == 1 )
									{
										myself::DeleteItem1(c0,5577,1);
										myself::GiveItem1(c0,5580,1);
										myself::AddLog(6,c0,5580);
										myself::SoundEffect(c0,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(c0,974);
									}
									else if( myself::OwnItemCount(c0,4650) == 1 )
									{
										myself::DeleteItem1(c0,4650,1);
										myself::GiveItem1(c0,5578,1);
										myself::AddLog(6,c0,5578);
										myself::SoundEffect(c0,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(c0,974);
									}
									else if( myself::OwnItemCount(c0,5578) == 1 )
									{
										myself::DeleteItem1(c0,5578,1);
										myself::GiveItem1(c0,5581,1);
										myself::AddLog(6,c0,5581);
										myself::SoundEffect(c0,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(c0,974);
									}
									else if( myself::OwnItemCount(c0,5580) == 1 )
									{
										myself::DeleteItem1(c0,5580,1);
										myself::GiveItem1(c0,5908,1);
										myself::AddLog(6,c0,5908);
										myself::SoundEffect(c0,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(c0,974);
									}
									else if( myself::OwnItemCount(c0,5581) == 1 )
									{
										myself::DeleteItem1(c0,5581,1);
										myself::GiveItem1(c0,5911,1);
										myself::AddLog(6,c0,5911);
										myself::SoundEffect(c0,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(c0,974);
									}
									else if( myself::OwnItemCount(c0,5582) == 1 )
									{
										myself::DeleteItem1(c0,5582,1);
										myself::GiveItem1(c0,5914,1);
										myself::AddLog(6,c0,5914);
										myself::SoundEffect(c0,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(c0,974);
									}
									else
									{
										myself::ShowSystemMessage(c0,1264);
									}
								}
								else if( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( myself::OwnItemCount(c0,4651) + myself::OwnItemCount(c0,4652) ) + myself::OwnItemCount(c0,4653) ) + myself::OwnItemCount(c0,4654) ) + myself::OwnItemCount(c0,4655) ) + myself::OwnItemCount(c0,4656) ) + myself::OwnItemCount(c0,4657) ) + myself::OwnItemCount(c0,4658) ) + myself::OwnItemCount(c0,4659) ) + myself::OwnItemCount(c0,4660) ) + myself::OwnItemCount(c0,4661) ) + myself::OwnItemCount(c0,5579) ) + myself::OwnItemCount(c0,5582) ) + myself::OwnItemCount(c0,5914) ) + myself::OwnItemCount(c0,4629) ) + myself::OwnItemCount(c0,4630) ) + myself::OwnItemCount(c0,4631) ) + myself::OwnItemCount(c0,4632) ) + myself::OwnItemCount(c0,4633) ) + myself::OwnItemCount(c0,4634) ) + myself::OwnItemCount(c0,4635) ) + myself::OwnItemCount(c0,4636) ) + myself::OwnItemCount(c0,4637) ) + myself::OwnItemCount(c0,4638) ) + myself::OwnItemCount(c0,4639) ) + myself::OwnItemCount(c0,5577) ) + myself::OwnItemCount(c0,5580) ) + myself::OwnItemCount(c0,5908) ) + myself::OwnItemCount(c0,4640) ) + myself::OwnItemCount(c0,4641) ) + myself::OwnItemCount(c0,4642) ) + myself::OwnItemCount(c0,4643) ) + myself::OwnItemCount(c0,4644) ) + myself::OwnItemCount(c0,4645) ) + myself::OwnItemCount(c0,4646) ) + myself::OwnItemCount(c0,4647) ) + myself::OwnItemCount(c0,4648) ) + myself::OwnItemCount(c0,4649) ) + myself::OwnItemCount(c0,4650) ) + myself::OwnItemCount(c0,5578) ) + myself::OwnItemCount(c0,5581) ) + myself::OwnItemCount(c0,5911) ) >= 2 )
								{
									myself::ShowSystemMessage(c0,977);
								}
								else
								{
									myself::ShowSystemMessage(c0,1265);
								}
							}
						}
					}
				}
			}
		}
		super;
	}

}
