class 1 tyrant : 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);
		target = last_attacker;
		always_list::SetInfo(1,target);
		target = last_attacker;
		always_list::SetInfo(2,target);
		target = last_attacker;
		always_list::SetInfo(3,target);
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			switch(code_info.code)
			{
				case 0:
				{
					myself::SetCurrentQuestID(219);
					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,219) && myself::OwnItemCount(c1,3177) && myself::OwnItemCount(c1,3181) < 10 )
						{
							if( gg::Rand(2) == 1 )
							{
								if( myself::OwnItemCount(c1,3181) == 9 )
								{
									myself::GiveItem1(c1,3181,1);
									myself::SoundEffect(c1,"Itemsound.quest_middle");
									if( myself::OwnItemCount(c1,3178) >= 10 && myself::OwnItemCount(c1,3179) >= 10 && myself::OwnItemCount(c1,3180) >= 10 && myself::OwnItemCount(c1,3182) >= 10 )
									{
										myself::SetFlagJournal(c1,219,7);
									}
								}
								else
								{
									myself::GiveItem1(c1,3181,1);
									myself::SoundEffect(c1,"Itemsound.quest_itemget");
								}
							}
						}
					}
					break;
				}
				case 1:
				{
					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,3204) && myself::OwnItemCount(c1,3206) < 10 )
						{
							if( gg::Rand(20) < 10 )
							{
								if( myself::OwnItemCount(c1,3206) == 9 )
								{
									myself::GiveItem1(c1,3206,1);
									myself::SoundEffect(c1,"Itemsound.quest_middle");
									if( myself::OwnItemCount(c1,3205) >= 10 && myself::OwnItemCount(c1,3207) >= 10 )
									{
										myself::SetFlagJournal(c1,220,2);
									}
								}
								else
								{
									myself::GiveItem1(c1,3206,1);
									myself::SoundEffect(c1,"Itemsound.quest_itemget");
								}
							}
						}
					}
					break;
				}
				case 2:
				{
					myself::SetCurrentQuestID(230);
					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,230) && myself::OwnItemCount(c1,3352) == 0 && myself::OwnItemCount(c1,3350) && myself::OwnItemCount(c1,3343) < 30 )
						{
							if( gg::Rand(10) < 5 )
							{
								if( myself::OwnItemCount(c1,3343) == 29 )
								{
									myself::GiveItem1(c1,3343,1);
									myself::SoundEffect(c1,"Itemsound.quest_middle");
								}
								else
								{
									myself::GiveItem1(c1,3343,1);
									myself::SoundEffect(c1,"Itemsound.quest_itemget");
								}
							}
						}
					}
					break;
				}
				case 3:
				{
					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::OwnItemCount(c1,3680) && myself::OwnItemCount(c1,3681) && myself::OwnItemCount(c1,3690) == 0 )
						{
							if( gg::Rand(10) == 0 )
							{
								c1.quest_last_reward_time = myself::GetCurrentTick();
								myself::GiveItem1(c1,3690,1);
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

}
