class 1 cave_howler : warrior_aggressive_casting_enchant_self
{
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);
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			if( code_info.code == 0 )
			{
				myself::SetCurrentQuestID(375);
				target = code_info::RandomSelectOne();
				if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
				{
					c0 = myself::GetLastAttacker();
					if( c0.master )
					{
						c0 = c0.master;
					}
					i1 = myself::Party_GetCount(c0);
					if( i1 != 0 )
					{
						for(i0 = 0; i0 < i1; i0 = ( i0 + 1 ))
						{
							c1 = myself::Party_GetCreature(c0,i0);
							i2 = gg::Rand(1000);
							if( i2 > i3 && myself::HaveMemo(c1,375) )
							{
								i3 = i2;
								c2 = c1;
							}
						}
					}
					else
					{
						c2 = c0;
					}
					if( 1 && myself::HaveMemo(c2,375) && myself::IsNullCreature(c2) == 0 && myself::DistFromMe(c2) <= 1500 )
					{
						c2.quest_last_reward_time = myself::GetCurrentTick();
						if( gg::Rand(10) < 9 && myself::OwnItemCount(c2,5889) < 100 )
						{
							if( myself::OwnItemCount(c2,5889) == 99 )
							{
								myself::GiveItem1(c2,5889,1);
								myself::SoundEffect(c2,"ItemSound.quest_middle");
							}
							else
							{
								myself::GiveItem1(c2,5889,1);
								myself::SoundEffect(c2,"ItemSound.quest_itemget");
							}
						}
					}
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

}
