class 1 eviloverlord_ramsebalius : warrior_passive
{
handler:
	EventHandler MY_DYING(always_list,c1,code_info,i1,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(334);
				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,334) && myself::GetMemoState(c1,334) == 2 && c1.flag == 3 )
					{
						myself::Say(myself::MakeFString(33412,"","","","",""));
						if( gg::Rand(2) == 0 )
						{
							c1.quest_last_reward_time = myself::GetCurrentTick();
							myself::CreateOnePrivate(1027138,"great_demon_king",0,1);
						}
						else
						{
							i1 = gg::Rand(4);
							if( i1 == 0 )
							{
								myself::GiveItem1(c1,1979,1);
							}
							else if( i1 == 1 )
							{
								myself::GiveItem1(c1,1980,1);
							}
							else if( i1 == 2 )
							{
								myself::GiveItem1(c1,2952,1);
							}
							else if( i1 == 3 )
							{
								myself::GiveItem1(c1,2953,1);
							}
						}
					}
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		myself::SetCurrentQuestID(334);
		if( timer_id == 2336006 )
		{
			myself::Despawn();
			myself::Say(myself::MakeFString(33411,"","","","",""));
		}
		super;
	}

	EventHandler CREATED(i0)
	{
		myself::SetCurrentQuestID(334);
		myself::AddTimerEx(2336006,( 1000 * 200 ));
		myself::Say(myself::MakeFString(33426,"","","","",""));
		super;
	}

}
