class 1 grave_warlord : warrior_aggressive_physicalspecial
{
handler:
	EventHandler MY_DYING(always_list,c0,c1,c2,code_info,i0,i1,i2,i3,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;
		if( myself::HaveMemo(target,634) == 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,634) == 1 )
				{
					always_list::SetInfo(1,target);
				}
			}
		}
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			switch(code_info.code)
			{
				case 0:
				{
					myself::SetCurrentQuestID(385);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						if( gg::Rand(100) < 30 )
						{
							c1 = myself::GetLastAttacker();
							if( c1.master )
							{
								c1 = c1.master;
							}
							i1 = myself::Party_GetCount(c1);
							i2 = 0;
							if( i1 == 0 && myself::HaveMemo(c1,385) )
							{
								c2 = c1;
							}
							for(i0 = 0; i0 < i1; i0 = ( i0 + 1 ))
							{
								c0 = myself::Party_GetCreature(c1,i0);
								if( myself::HaveMemo(c0,385) )
								{
									i3 = gg::Rand(1000);
									if( i2 < i3 )
									{
										i2 = i3;
										c2 = c0;
									}
								}
							}
							if( 1 && myself::IsNullCreature(c2) == 0 && myself::DistFromMe(c2) <= 1500 )
							{
								c2.quest_last_reward_time = myself::GetCurrentTick();
								myself::GiveItem1(c2,5902,1);
								myself::SoundEffect(c2,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(634);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						i0 = myself::FloatToInt(( ( 0.150000 * myself.sm.level ) + 1.600000 ));
						if( gg::Rand(100) >= 10 )
						{
							i0 = 0;
						}
						if( i0 > 0 )
						{
							myself::GiveItem1(target,7079,i0);
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

}
