class 1 small_baby_gourd : default_npc
{
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(997);
				target = code_info::RandomSelectOne();
				if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
				{
					c1 = myself::GetLastAttacker();
					i0 = gg::Rand(5);
					i0 = ( 99740 + i0 );
					myself::Say(myself::MakeFString(i0,"","","","",""));
					myself::SoundEffect(c1,"ItemSound.quest_middle");
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage,i0,i_quest1,i_quest2,i_quest3,skill_name_id)
	{
		myself::SetCurrentQuestID(997);
		switch(myself.i_quest0)
		{
			case 0:
			{
				myself.i_quest1 = 0;
				myself.i_quest2 = 0;
				myself.i_quest3 = 0;
				if( ( skill_name_id / 256 ) == ( 513280 / 256 ) )
				{
					i0 = gg::Rand(10);
					i0 = ( 99720 + i0 );
					if( gg::Rand(1000) < 389 )
					{
						i0 = gg::Rand(10);
						i0 = ( 99720 + i0 );
						myself.i_quest1 = ( myself.i_quest1 + 1 );
						myself.i_quest2 = ( myself.i_quest2 + 1 );
						myself::Say(myself::MakeFString(i0,"","","","",""));
						if( myself::Skill_GetConsumeMP(1155329) < myself.sm.mp && myself::Skill_GetConsumeHP(1155329) < myself.sm.hp && myself::Skill_InReuseDelay(1155329) == 0 )
						{
							myself::AddUseSkillDesire(myself.sm,1155329,1,1,1000000);
						}
					}
					else
					{
						i0 = gg::Rand(10);
						i0 = ( 99720 + i0 );
						myself.i_quest1 = ( myself.i_quest1 + 1 );
						myself.i_quest3 = ( myself.i_quest3 + 1 );
						myself::Say(myself::MakeFString(i0,"","","","",""));
						if( myself::Skill_GetConsumeMP(1155585) < myself.sm.mp && myself::Skill_GetConsumeHP(1155585) < myself.sm.hp && myself::Skill_InReuseDelay(1155585) == 0 )
						{
							myself::AddUseSkillDesire(myself.sm,1155585,1,1,1000000);
						}
					}
				}
				myself.i_quest0 = 1;
				break;
			}
			case 1:
			{
				if( ( skill_name_id / 256 ) == ( 513280 / 256 ) && myself.i_quest1 >= 4 )
				{
					i0 = gg::Rand(10);
					i0 = ( 99710 + i0 );
					myself.i_quest1 = ( myself.i_quest1 + 1 );
					myself::Say(myself::MakeFString(i0,"","","","",""));
					myself::Despawn();
					if( gg::Rand(1000) < 389 )
					{
						myself.i_quest2 = ( myself.i_quest2 + 1 );
					}
					else
					{
						myself.i_quest3 = ( myself.i_quest3 + 1 );
					}
					if( myself.i_quest2 > myself.i_quest3 )
					{
						myself::CreateOnePrivateEx(1012775,"g_small_adult_gourd",0,0,myself::FloatToInt(myself.sm.x),myself::FloatToInt(myself.sm.y),myself::FloatToInt(myself.sm.z),0,myself.sm.summoner_id,0,0);
						myself.i_quest2 = 0;
						myself.i_quest3 = 0;
					}
					else
					{
						myself::CreateOnePrivateEx(1012776,"b_small_adult_gourd",0,0,myself::FloatToInt(myself.sm.x),myself::FloatToInt(myself.sm.y),myself::FloatToInt(myself.sm.z),0,myself.sm.summoner_id,0,0);
						myself.i_quest2 = 0;
						myself.i_quest3 = 0;
					}
					myself::SoundEffect(attacker,"ItemSound3.sys_sow_success");
				}
				else if( ( skill_name_id / 256 ) == ( 513280 / 256 ) )
				{
					if( gg::Rand(1000) < 389 )
					{
						i0 = gg::Rand(10);
						i0 = ( 99720 + i0 );
						myself.i_quest1 = ( myself.i_quest1 + 1 );
						myself.i_quest2 = ( myself.i_quest2 + 1 );
						myself::Say(myself::MakeFString(i0,"","","","",""));
						if( myself::Skill_GetConsumeMP(1155329) < myself.sm.mp && myself::Skill_GetConsumeHP(1155329) < myself.sm.hp && myself::Skill_InReuseDelay(1155329) == 0 )
						{
							myself::AddUseSkillDesire(myself.sm,1155329,1,1,1000000);
						}
					}
					else
					{
						i0 = gg::Rand(10);
						i0 = ( 99720 + i0 );
						myself.i_quest1 = ( myself.i_quest1 + 1 );
						myself.i_quest3 = ( myself.i_quest3 + 1 );
						myself::Say(myself::MakeFString(i0,"","","","",""));
						if( myself::Skill_GetConsumeMP(1155585) < myself.sm.mp && myself::Skill_GetConsumeHP(1155585) < myself.sm.hp && myself::Skill_InReuseDelay(1155585) == 0 )
						{
							myself::AddUseSkillDesire(myself.sm,1155585,1,1,1000000);
						}
					}
				}
				else if( gg::Rand(2) == 0 )
				{
					i0 = gg::Rand(10);
					i0 = ( 99730 + i0 );
					myself::Say(myself::MakeFString(i0,"","","","",""));
				}
				break;
			}
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(i0,talker,timer_id)
	{
		myself::SetCurrentQuestID(997);
		if( timer_id == 99702 )
		{
			i0 = gg::Rand(10);
			i0 = ( 99790 + i0 );
			myself::Say(myself::MakeFString(i0,"","","","",""));
		}
		if( timer_id == 99723 )
		{
			myself::Say(myself::MakeFString(99743,"","","","",""));
			myself::AddTimerEx(99724,( 1000 * 60 ));
		}
		if( timer_id == 99724 )
		{
			myself::Say(myself::MakeFString(99744,"","","","",""));
			myself::AddTimerEx(99709,( 1000 * 60 ));
		}
		if( timer_id == 99709 )
		{
			myself::Despawn();
		}
		super;
	}

	EventHandler CREATED(i0)
	{
		myself::SetCurrentQuestID(997);
		i0 = gg::Rand(10);
		i0 = ( 99700 + i0 );
		myself::Say(myself::MakeFString(i0,"","","","",""));
		myself::AddTimerEx(99702,( 1000 * 2 ));
		myself::AddTimerEx(99723,( 1000 * 60 ));
		super;
	}

}
