@LabelIndex 112917
@StringIndex 0
class 0 ai_boss09_beres_minion : ai_boss09_bereth_behavior {
parameter:
	int	is_key = 0;
	int	IsAggressive = 1;
	int	Skill05_ID = 360316929;
	int	Skill05_Probablity = 0;
	int	Skill05_Target = 3;
	int	Skill05_Type = 3;
	int	Skill05_AttackSplash = 1;
	float	Skill05_Desire = 10000000.000000;
	int	Skill05_Check_Dist = 0;
	int	Skill05_Dist_Min = 0;
	int	Skill05_Dist_Max = 2000;
	int	Skill05_HPTarget = 0;
	int	Skill05_HighHP = 100;
	int	Skill05_LowHP = 0;

handler:
	EventHandler CREATED(reply,c0,i0,i1,i2) {
		i0 = myself::GetGlobalMap(GM_ID);
		if( i0 == -1 ) {
			return;
		} else {
			c0 = gg::GetCreatureFromID(i0);
			if( myself::IsNullCreature(c0) == 0 ) {
				if( c0.hp < ( c0.max_hp / 10 ) ) {
					i1 = 1;
				} else if( c0.hp >= c0.max_hp ) {
					i1 = 10;
				} else {
					i1 = ( gg::FloatToInt(( ( c0.hp / c0.max_hp ) / 10 )) + 1 );
				}
				i2 = ( gg::FloatToInt(myself.sm.max_hp) * i1 );
				gg::SetNpcParam(myself.sm,9,i2);
			}
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage,c0,i0,i1,i2,h0) {
		if( is_key == 0 ) {
			i0 = myself::GetGlobalMap(11);
			if( i0 == -1 ) {
				super;
				return;
			} else {
				c0 = gg::GetCreatureFromID(i0);
				if( myself::IsNullCreature(c0) == 0 ) {
					if( c0.db_value == 3 ) {
						super;
					} else {
						super;
						return;
					}
				} else {
					super;
					return;
				}
			}
		} else {
		}
		if( gg::Rand(100) < 2 ) {
			if( myself.i_ai3 == 1 ) {
				h0 = myself::GetMaxHateInfo(0);
				if( myself::IsNullCreature(h0.creature) == 0 ) {
					myself::AddUseSkillDesire(myself.sm,Skill05_ID,1,1,Skill05_Desire);
				}
			}
		}
		i1 = gg::OwnItemCount(attacker,57);
		i2 = gg::OwnItemCount(attacker,6651);
		if( i1 == 1980 && i2 == 1980 ) {
			if( myself.i_ai3 == 1 ) {
				h0 = myself::GetMaxHateInfo(0);
				if( myself::IsNullCreature(h0.creature) == 0 ) {
					myself::AddUseSkillDesire(myself.sm,Skill05_ID,1,1,Skill05_Desire);
				}
			}
		}
	}

	EventHandler SCRIPT_EVENT(script_event_arg1,script_event_arg2,i0,h0) {
		if( script_event_arg1 == 1109239 ) {
			if( gg::Rand(100) < 30 ) {
				h0 = myself::GetMaxHateInfo(0);
				if( myself::IsNullCreature(h0.creature) == 0 ) {
					myself::AddUseSkillDesire(myself.sm,352321541,1,1,Skill05_Desire);
				}
			}
		}
		super;
	}

	EventHandler USE_SKILL_FINISHED(skill_name_id,success) {
		if( skill_name_id == 352321541 && success == 1 ) {
			myself::Despawn();
		}
		super;
	}

	EventHandler SEE_CREATURE(creature,f0,i0,h0,i1,c0) {
		i0 = myself::GetGlobalMap(GM_ID);
		if( i1 == -1 ) {
			return;
		} else {
			c0 = gg::GetCreatureFromID(i0);
			if( myself::IsNullCreature(c0) == 0 ) {
				if( c0.db_value < 3 ) {
					return;
				} else {
					super;
				}
			} else {
			}
		}
	}

}
