class 1 porta : warrior_pa_casting_summon_pc
{
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);
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			switch(code_info.code)
			{
				case 0:
				{
					myself::SetCurrentQuestID(217);
					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,217) && myself::GetMemoState(c1,217) == 16 && myself::OwnItemCount(c1,2761) < 10 )
						{
							if( myself::OwnItemCount(c1,2761) == 9 )
							{
								myself::GiveItem1(c1,2761,1);
								myself::SoundEffect(c1,"Itemsound.quest_middle");
								myself::SetFlagJournal(c1,217,20);
							}
							else
							{
								myself::GiveItem1(c1,2761,1);
								myself::SoundEffect(c1,"Itemsound.quest_itemget");
							}
						}
					}
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(233);
					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,233) && myself::OwnItemCount(c1,2883) == 1 && myself::OwnItemCount(c1,2884) < 10 )
						{
							myself::GiveItem1(c1,2884,1);
							if( myself::OwnItemCount(c1,2884) >= 10 )
							{
								myself::SoundEffect(c1,"ItemSound.quest_middle");
							}
							myself::SoundEffect(c1,"ItemSound.quest_itemget");
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

}
