@LabelIndex 70677
@StringIndex 11357
class 0 event_ai_glommy_cow : default_npc {
parameter:
	int	event_coin = 9142;
	int	timer_count = 10;
	int	event_animal = 2;
	int	b_oneshot_kill = 1;

handler:
	EventHandler CREATED() {
		myself.c_ai0 = gg::GetNullCreature();
		myself.c_ai1 = gg::GetNullCreature();
		myself.c_ai2 = gg::GetNullCreature();
		myself.c_ai3 = gg::GetNullCreature();
		myself.c_ai4 = gg::GetNullCreature();
		myself.i_ai0 = 0;
		myself.i_ai1 = 0;
		myself.i_ai2 = 0;
		myself.i_ai3 = 0;
		myself.i_ai4 = 0;
		myself.i_quest0 = 0;
		myself.i_quest1 = 0;
		myself.i_quest2 = 0;
		myself.i_quest3 = 0;
		myself.i_quest4 = 0;
		myself.c_quest4 = gg::GetNullCreature();
		myself.c_quest0 = gg::GetNullCreature();
		myself::AddTimerEx(20000,360000);
	}

	EventHandler ATTACKED(attacker,damage,skill_name_id,i0,i1,i2,i3,i4) {
		if( gg::Rand(100) < 33 ) {
			if( myself::Skill_GetConsumeMP(368246785) < myself.sm.mp && myself::Skill_GetConsumeHP(368246785) < myself.sm.hp && myself::Skill_InReuseDelay(368246785) == 0 ) {
				myself::AddUseSkillDesire(attacker,368246785,0,1,1000000);
			}
		}
		if( skill_name_id == 187891713 || skill_name_id == 187957249 ) {
			if( myself.i_ai3 == 0 ) {
				if( myself::IsNullCreature(attacker) == 0 ) {
					myself.i_ai1 = attacker.id;
					myself.i_ai3 = 1;
					myself::Shout(myself.sm.name + "  :" + gg::IntToStr(myself.m_WorldTrapState));
					i0 = gg::Rand(100);
					if( i0 < 50 ) {
						myself::EffectMusic(myself.sm,10000,"EV_04");
						gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0," : 10     2!");
						if( myself::IsNullCreature(myself.sm) == 0 ) {
							myself::AddTimerEx(20001,3000);
						} else {
							myself.i_ai4 = 1;
						}
					}
				}
			} else {
				myself::Say("~  ˆ ");
			}
		} else {
			myself::Say("~    !     !");
		}
	}

	EventHandler NO_DESIRE() {
		myself::AddMoveAroundDesire(40,20);
	}

	EventHandler TIMER_FIRED_EX(timer_id,i0,i1,i2,c0) {
		if( timer_id == 20000 ) {
			myself::Despawn();
		}
		if( timer_id == 20001 ) {
			if( myself::IsNullCreature(myself.sm) == 0 ) {
				gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0,"10 .");
				myself::AddTimerEx(20002,1000);
			} else {
				myself.i_ai4 = 1;
			}
		}
		if( timer_id == 20002 ) {
			if( myself::IsNullCreature(myself.sm) == 0 ) {
				gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0,"9 .");
				myself::AddTimerEx(20003,1000);
			} else {
				myself.i_ai4 = 1;
			}
		}
		if( timer_id == 20003 ) {
			if( myself::IsNullCreature(myself.sm) == 0 ) {
				gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0,"8 .");
				myself::AddTimerEx(20004,1000);
			} else {
				myself.i_ai4 = 1;
			}
		}
		if( timer_id == 20004 ) {
			if( myself::IsNullCreature(myself.sm) == 0 ) {
				gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0,"7 .");
				myself::AddTimerEx(20005,1000);
			} else {
				myself.i_ai4 = 1;
			}
		}
		if( timer_id == 20005 ) {
			if( myself::IsNullCreature(myself.sm) == 0 ) {
				gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0,"6 .");
				myself::AddTimerEx(20006,1000);
			} else {
				myself.i_ai4 = 1;
			}
		}
		if( timer_id == 20006 ) {
			if( myself::IsNullCreature(myself.sm) == 0 ) {
				gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0,"5 .");
				myself::AddTimerEx(20007,1000);
			} else {
				myself.i_ai4 = 1;
			}
		}
		if( timer_id == 20007 ) {
			if( myself::IsNullCreature(myself.sm) == 0 ) {
				gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0,"4 .");
				myself::AddTimerEx(20008,1000);
			} else {
				myself.i_ai4 = 1;
			}
		}
		if( timer_id == 20008 ) {
			if( myself::IsNullCreature(myself.sm) == 0 ) {
				gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0,"3 .");
				myself::AddTimerEx(20009,1000);
			} else {
				myself.i_ai4 = 1;
			}
		}
		if( timer_id == 20009 ) {
			if( myself::IsNullCreature(myself.sm) == 0 ) {
				gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0,"2 .");
				myself::AddTimerEx(20010,1000);
			} else {
				myself.i_ai4 = 1;
			}
		}
		if( timer_id == 20010 ) {
			if( myself::IsNullCreature(myself.sm) == 0 ) {
				gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0,"1 .");
				myself::AddTimerEx(20011,1000);
			} else {
				myself.i_ai4 = 1;
			}
		}
		if( timer_id == 20011 ) {
			if( myself::IsNullCreature(myself.sm) == 0 ) {
				gg::BroadcastOnScreenMsgStr(myself.sm,6000,2,0,0,0,0,1,1000,0,"Mission Failed");
				myself.i_ai4 = 0;
			}
		}
		if( timer_id == 20012 ) {
			myself::Despawn();
		}
		if( timer_id == 20013 ) {
			myself::Despawn();
		}
	}

	EventHandler MY_DYING(last_attacker,i0,i1,i2,c0) {
		c0 = gg::GetCreatureFromID(myself.i_ai1);
		i2 = gg::Rand(100);
		if( myself::IsNullCreature(c0) == 0 ) {
			if( i2 <= 60 ) {
				if( myself.i_ai4 == 1 ) {
					if( myself::GetInventoryInfo(c0,0) >= ( myself::GetInventoryInfo(c0,1) * 0.800000 ) || myself::GetInventoryInfo(c0,2) >= ( myself::GetInventoryInfo(c0,3) * 0.800000 ) ) {
						myself::ShowSystemMessage(c0,1118);
						return;
					}
					myself::GiveItem1(c0,14720,2);
				} else if( myself.i_ai4 == 0 ) {
					if( myself::GetInventoryInfo(c0,0) >= ( myself::GetInventoryInfo(c0,1) * 0.800000 ) || myself::GetInventoryInfo(c0,2) >= ( myself::GetInventoryInfo(c0,3) * 0.800000 ) ) {
						myself::ShowSystemMessage(c0,1118);
						return;
					}
					myself::GiveItem1(c0,14720,1);
				}
			} else {
				myself::CreateOnePrivateEx(1013189,"event_ai_yellow_cow",0,0,gg::FloatToInt(myself.sm.x),gg::FloatToInt(myself.sm.y),gg::FloatToInt(myself.sm.z),( myself::GetDirectionToTarget(c0) * 182 ),0,0,myself.i_ai0);
				myself::Say("ˆ   .   !");
				myself::AddTimerEx(20012,1000);
			}
		} else {
			myself::Say("   .,      ˆ .");
			myself::AddTimerEx(20013,5000);
		}
	}

}
