class 1 hunter_bear : warrior_passive
{
handler:
	EventHandler MY_DYING(always_list,c1,code_info,i0,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(417);
				target = code_info::RandomSelectOne();
				if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
				{
					c1 = myself::GetLastAttacker();
					if( myself::HaveMemo(myself.c_quest0,417) == 1 && myself::OwnItemCount(myself.c_quest0,1653) == 1 && myself::OwnItemCount(myself.c_quest0,1655) < 5 && myself.i_quest0 == 1 )
					{
						if( myself.c_quest0.flag > 20 )
						{
							i0 = ( ( myself.c_quest0.flag - 20 ) * 10 );
							if( gg::Rand(100) <= i0 )
							{
								myself::CreateOnePrivate(1027058,"honey_bear",0,1);
								myself.c_quest0.flag = 0;
							}
							else
							{
								myself.c_quest0.flag = ( myself.c_quest0.flag + 1 );
							}
						}
						else
						{
							myself.c_quest0.flag = ( myself.c_quest0.flag + 1 );
						}
					}
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage)
	{
		myself::SetCurrentQuestID(417);
		if( myself::HaveMemo(attacker,417) )
		{
			switch(myself.i_quest0)
			{
				case 0:
				{
					myself.i_quest0 = 1;
					if( attacker.master )
					{
						myself.c_quest0 = attacker.master;
					}
					else
					{
						myself.c_quest0 = attacker;
					}
					break;
				}
				case 1:
				{
					if( attacker.master )
					{
						if( myself.c_quest0 != attacker.master )
						{
							myself.i_quest0 = 2;
						}
					}
					else if( myself.c_quest0 != attacker )
					{
						myself.i_quest0 = 2;
					}
					break;
				}
				case 2:
				{
					break;
				}
			}
		}
		super;
	}

}
