@LabelIndex 110317
@StringIndex 0
class 0 c_tower_wizard_explosion : wizard_basic {
parameter:
	string	MyMaker = "my_maker";
	int	SelfExplosion = 362283009;
	int	MyMakerNumber = 0;
	int	SD_skill = 458752001;

handler:
	EventHandler CREATED() {
		myself.i_ai0 = 0;
		myself.i_ai1 = 0;
	}

	EventHandler ATTACKED(maker0) {
		if( gg::FloatToInt(( ( myself.sm.hp / myself.sm.max_hp ) * 100 )) < 30 && myself.i_ai0 == 0 ) {
			if( gg::GetAbnormalLevel(myself.sm,myself::Skill_GetAbnormalType(69730305)) > 0 || gg::GetAbnormalLevel(myself.sm,myself::Skill_GetAbnormalType(87556097)) > 0 || gg::GetAbnormalLevel(myself.sm,myself::Skill_GetAbnormalType(29622273)) > 0 || gg::GetAbnormalLevel(myself.sm,myself::Skill_GetAbnormalType(45547521)) > 0 ) {
			} else {
				myself::RemoveAllDesire();
				myself.i_ai0 = 1;
				myself::AddUseSkillDesire(myself.sm,SelfExplosion,1,0,999999999999999999);
			}
		}
		super;
	}

	EventHandler SCRIPT_EVENT(script_event_arg1,script_event_arg2) {
		if( script_event_arg1 == 88012 ) {
			if( myself.i_ai1 == 0 ) {
				myself.c_ai0 = gg::GetCreatureFromIndex(script_event_arg2);
				myself::RemoveAllDesire();
				myself::AddUseSkillDesire(myself.sm,SelfExplosion,1,0,999999999999999999);
			} else {
				return;
			}
		}
		super;
	}

	EventHandler USE_SKILL_FINISHED(skill_name_id,success,maker0,h0) {
		if( success == 1 ) {
			if( skill_name_id == SelfExplosion && myself.i_ai0 == 1 ) {
				myself.i_ai1 = 1;
				myself::BroadcastScriptEvent(88012,gg::GetIndexFromCreature(myself.sm),100);
				maker0 = gg::GetNpcMaker(MyMaker);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,88004,0,0);
					myself::Suicide();
				}
			} else if( skill_name_id == SelfExplosion && myself.i_ai0 == 0 ) {
				myself.i_ai1 = 1;
				myself::BroadcastScriptEvent(88012,gg::GetIndexFromCreature(myself.sm),100);
				maker0 = gg::GetNpcMaker(MyMaker);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,88005,MyMakerNumber,0);
					myself::Despawn();
				}
			} else if( skill_name_id == Skill01_ID && gg::Rand(100) < 20 ) {
				h0 = myself::GetMaxHateInfo(0);
				if( myself::IsNullHateInfo(h0) == 0 ) {
					if( myself::IsNullCreature(h0.creature) == 0 ) {
						myself::AddUseSkillDesire(h0.creature,SD_skill,0,1,999999999999999999);
					}
				}
			}
		}
		super;
	}

}
