class 1 box_of_athrea1 : citizen
{
handler:
	EventHandler MY_DYING(always_list,c1,c2,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(501);
				target = code_info::RandomSelectOne();
				if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
				{
					c1 = myself::GetLastAttacker();
					if( c1.master )
					{
						c1 = c1.master;
					}
					c2 = myself::Pledge_GetLeader(c1);
					if( myself::HaveMemo(c2,501) && myself::GetMemoState(c2,501) == 4 )
					{
						if( c2.flag == 3 && myself.boss.flag == 15 )
						{
							c2.flag = ( c2.flag + 1 );
							myself::Say(myself::MakeFString(50110,"","","","",""));
						}
						else if( c2.flag == 2 && myself.boss.flag == 14 )
						{
							c2.flag = ( c2.flag + 1 );
							myself::Say(myself::MakeFString(50110,"","","","",""));
						}
						else if( c2.flag == 1 && myself.boss.flag == 13 )
						{
							c2.flag = ( c2.flag + 1 );
							myself::Say(myself::MakeFString(50110,"","","","",""));
						}
						else if( c2.flag == 0 && myself.boss.flag == 12 )
						{
							c2.flag = ( c2.flag + 1 );
							myself::Say(myself::MakeFString(50110,"","","","",""));
						}
						else if( c2.flag < 4 )
						{
							if( gg::Rand(4) == 0 )
							{
								c2.flag = ( c2.flag + 1 );
								myself::Say(myself::MakeFString(50110,"","","","",""));
							}
						}
						myself.boss.flag = ( myself.boss.flag + 1 );
					}
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		myself::SetCurrentQuestID(501);
		if( timer_id == 2501001 )
		{
			myself::Despawn();
		}
		super;
	}

	EventHandler CREATED(i0)
	{
		myself::SetCurrentQuestID(501);
		myself::AddTimerEx(2501001,( 300 * 1000 ));
		super;
	}

}
