class 1 drevanul_prince_zeruel : warrior_passive
{
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);
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			if( code_info.code == 0 )
			{
				myself::SetCurrentQuestID(229);
				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,229) == 1 && myself::OwnItemCount(c1,3324) == 1 && myself::OwnItemCount(c1,3335) == 1 && myself::OwnItemCount(c1,3029) == 1 && myself::OwnItemCount(c1,3332) == 1 )
					{
						if( c1.equiped_weapon_class_id == 3029 )
						{
							myself::Say(myself::MakeFString(22936,"","","","",""));
							myself::GiveItem1(c1,3334,1);
							myself::GiveItem1(c1,3333,1);
							myself::SoundEffect(c1,"ItemSound.quest_itemget");
							myself::DeleteItem1(c1,3335,myself::OwnItemCount(c1,3335));
							myself::DeleteItem1(c1,3332,myself::OwnItemCount(c1,3332));
							myself::SetFlagJournal(c1,229,10);
						}
					}
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage)
	{
		myself::SetCurrentQuestID(229);
		if( attacker.master )
		{
			attacker = attacker.master;
		}
		if( myself::HaveMemo(attacker,229) == 1 && myself::OwnItemCount(attacker,3323) == 1 )
		{
			myself::Say(myself::MakeFString(22934,"","","","",""));
			myself::Despawn();
			myself::SetFlagJournal(attacker,229,5);
		}
		else if( myself::HaveMemo(attacker,229) == 1 && myself::OwnItemCount(attacker,3324) == 1 && myself::OwnItemCount(attacker,3335) == 1 && myself::OwnItemCount(attacker,3029) == 1 && myself::OwnItemCount(attacker,3332) == 1 )
		{
			if( myself.i_quest0 == 0 && attacker.equiped_weapon_class_id == 3029 )
			{
				myself::Say(myself::MakeFString(22935,"","","","",""));
				myself.i_quest0 = 1;
			}
		}
		super;
	}

}
