@LabelIndex 109264
@StringIndex 12916
class 0 raid_boss_fortress_wizard : wizard_fortress_officer {
parameter:
	int	final_skill_id = 267255809;
	int	final_skill_prob = 2;
	int	Buff = 264110083;
	int	send_zen_id = 0;
	int	zen_skill_interval = 15;
	int	spawn_interval = 0;
	int	max_spawn = 0;
	int	spawn_prob = 5;
	int	spawn_x = 50;
	int	spawn_y = 50;
	int	silhouette = 33;
	string	ai_type = "wolf";
	int	msg_final_skill = -1;

handler:
	EventHandler CREATED() {
		myself::BroadcastScriptEvent(1009,gg::GetIndexFromCreature(myself.sm),2000);
		myself::AddTimerEx(2001,( 30 * 1000 ));
		if( spawn_interval > 0 ) {
			myself::AddTimerEx(2099,( spawn_interval * 1000 ));
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage,i0) {
		super;
		if( gg::Rand(100) < final_skill_prob ) {
			if( myself::IsNullCreature(myself.top_desire_target) == 0 ) {
				myself::RemoveAllAttackDesire();
				if( msg_final_skill > -1 ) {
					myself::Shout(gg::MakeFString(msg_final_skill,"","","","",""));
				}
				if( myself::Skill_GetConsumeMP(final_skill_id) < myself.sm.mp && myself::Skill_GetConsumeHP(final_skill_id) < myself.sm.hp && myself::Skill_InReuseDelay(final_skill_id) == 0 ) {
					myself::AddUseSkillDesire(myself.top_desire_target,final_skill_id,0,1,1000000);
				}
			}
		}
	}

	EventHandler ABNORMAL_STATUS_CHANGED(speller,skill_id,skill_level,skill_name_id,s0,i0) {
		if( myself::IsInCombatMode(myself.sm) == 0 ) {
			return;
		}
		if( skill_id == 5397 ) {
			if( skill_level > 1 ) {
				myself::RemoveAllAttackDesire();
				if( msg_final_skill > -1 ) {
					myself::Shout(gg::MakeFString(msg_final_skill,"","","","",""));
				}
				if( myself::Skill_GetConsumeMP(final_skill_id) < myself.sm.mp && myself::Skill_GetConsumeHP(final_skill_id) < myself.sm.hp && myself::Skill_InReuseDelay(final_skill_id) == 0 ) {
					myself::AddUseSkillDesire(myself.top_desire_target,final_skill_id,0,1,1000000);
				}
			}
		}
	}

	EventHandler PARTY_DIED(private) {
		if( private != myself.sm ) {
			if( myself::IsInCombatMode(myself.sm) == 1 && myself.i_ai2 < max_spawn ) {
				myself.i_ai2 = ( myself.i_ai2 - 1 );
			}
		}
	}

	EventHandler TIMER_FIRED_EX(timer_id,i0,i1) {
		if( timer_id == 2001 ) {
			myself::BroadcastScriptEvent(1009,gg::GetIndexFromCreature(myself.sm),2000);
			myself::AddTimerEx(2001,( 10 * 1000 ));
		} else if( timer_id == 2099 ) {
			if( myself::IsInCombatMode(myself.sm) == 1 ) {
				if( myself.i_ai2 < max_spawn && gg::Rand(100) < spawn_prob ) {
					i0 = myself::GetDirection(myself.sm);
					i1 = gg::GetIndexFromCreature(myself.top_desire_target);
					myself::CreateOnePrivateEx(silhouette,ai_type,0,0,gg::FloatToInt(( myself.sm.x - gg::Rand(spawn_x) )),gg::FloatToInt(( myself.sm.y - gg::Rand(spawn_y) )),gg::FloatToInt(myself.sm.z),i0,1000,i1,0);
					myself.i_ai2 = ( myself.i_ai2 + 1 );
				}
			} else {
				myself.i_ai0 = 0;
				myself.i_ai1 = 0;
				myself.i_ai2 = 0;
			}
			myself::AddTimerEx(2099,( spawn_interval * 1000 ));
		}
		super;
	}

}
