class 1 revenant_of_tantos_chief : 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(220);
				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,220) && myself::OwnItemCount(c1,3235) && myself::OwnItemCount(c1,3236) == 0 )
					{
						myself::GiveItem1(c1,3236,1);
						myself::SetFlagJournal(c1,220,10);
						myself::SoundEffect(c1,"Itemsound.quest_middle");
						myself::Say(myself::MakeFString(22056,"","","","",""));
					}
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage)
	{
		myself::SetCurrentQuestID(220);
		switch(myself.i_quest0)
		{
			case 0:
			{
				myself.c_quest0 = attacker;
				if( myself::HaveMemo(myself.c_quest0,220) && myself::OwnItemCount(myself.c_quest0,3236) == 0 )
				{
					myself::Say(myself::MakeFString(22055,"","","","",""));
					myself.i_quest0 = 1;
				}
				break;
			}
			case 1:
			{
				if( myself::HaveMemo(myself.c_quest0,220) && myself::OwnItemCount(myself.c_quest0,3236) == 0 && myself.sm.hp < ( myself.sm.max_hp / 3.000000 ) )
				{
					myself::Say(myself::MakeFString(22057,"","","","",""));
					myself.i_quest0 = 2;
				}
				break;
			}
			case 2:
			{
				break;
			}
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		myself::SetCurrentQuestID(220);
		if( timer_id == 22005 )
		{
			myself::Despawn();
		}
		super;
	}

	EventHandler CREATED(i0)
	{
		myself::SetCurrentQuestID(220);
		myself::AddTimerEx(22005,( 1000 * 200 ));
		super;
	}

}
