@LabelIndex 55758
@StringIndex 0
class 0 party_private_heretic_zealot2 : party_private_physicalspecial {
parameter:
	int	PhysicalSpecial2 = 458752001;

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

	EventHandler ATTACKED(attacker,i0) {
		if( myself.p_state != 3 && myself.p_state != 10 ) {
			if( myself.i_ai4 == 0 ) {
				myself.i_ai4 = 1;
			}
		}
		if( myself.i_ai0 == 1 ) {
			if( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) {
				if( myself::IsNullCreature(myself.top_desire_target) == 0 ) {
					if( myself::Skill_GetConsumeMP(PhysicalSpecial2) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial2) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial2) == 0 ) {
						myself::AddUseSkillDesire(myself.top_desire_target,PhysicalSpecial2,0,1,1000000);
					}
				} else if( myself::IsNullCreature(attacker) == 0 ) {
					if( myself::Skill_GetConsumeMP(PhysicalSpecial2) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial2) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial2) == 0 ) {
						myself::AddUseSkillDesire(attacker,PhysicalSpecial2,0,1,1000000);
					}
				}
			}
		}
		super;
	}

	EventHandler PARTY_ATTACKED(attacker,private,i0) {
		if( myself.p_state != 3 && myself.p_state != 10 ) {
			if( myself.i_ai4 == 0 ) {
				myself.i_ai4 = 1;
			}
		}
		if( myself.i_ai0 == 1 ) {
			if( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) {
				if( myself::IsNullCreature(myself.top_desire_target) == 0 ) {
					if( gg::Rand(100) < 33 ) {
						if( myself::Skill_GetConsumeMP(PhysicalSpecial2) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial2) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial2) == 0 ) {
							myself::AddUseSkillDesire(myself.top_desire_target,PhysicalSpecial2,0,1,1000000);
						}
					}
				} else if( myself::IsNullCreature(attacker) == 0 ) {
					if( gg::Rand(100) < 33 ) {
						if( myself::Skill_GetConsumeMP(PhysicalSpecial2) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial2) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial2) == 0 ) {
							myself::AddUseSkillDesire(attacker,PhysicalSpecial2,0,1,1000000);
						}
					}
				}
			}
		}
		super;
	}

	EventHandler OUT_OF_TERRITORY() {
		if( myself.i_ai4 == 0 ) {
			myself::RemoveAllAttackDesire();
			myself::AddMoveToDesire(myself.start_x,myself.start_y,myself.start_z,100);
		}
	}

	EventHandler SCRIPT_EVENT(script_event_arg1,script_event_arg2,script_event_arg3,i0,c0) {
		if( script_event_arg3 == gg::GetIndexFromCreature(myself.boss) ) {
			if( script_event_arg1 == 10033 ) {
				c0 = gg::GetCreatureFromIndex(script_event_arg2);
				if( myself::IsNullCreature(c0) == 0 ) {
					myself.i_ai4 = 1;
					myself::RemoveAllAttackDesire();
					if( c0.is_pc != 0 || myself::IsInCategory(12,c0.class_id) ) {
						myself::AddAttackDesire(c0,1,( 1 * 200 ));
					}
				}
			} else if( script_event_arg1 == 10035 ) {
				myself.i_ai4 = 0;
				myself::RemoveAllAttackDesire();
				myself::AddMoveToDesire(myself.start_x,myself.start_y,myself.start_z,100);
			} else if( script_event_arg1 == 10002 ) {
				c0 = gg::GetCreatureFromIndex(script_event_arg2);
				if( myself::IsNullCreature(c0) == 0 ) {
					myself::RemoveAllAttackDesire();
					if( c0.is_pc != 0 || myself::IsInCategory(12,c0.class_id) ) {
						myself::AddAttackDesire(c0,1,( 1 * 200 ));
					}
				}
			}
		}
	}

	EventHandler PARTY_DIED(private,c0) {
		if( private == myself.boss ) {
			myself.i_ai0 = 1;
			if( myself::IsNullCreature(myself.top_desire_target) == 0 ) {
				c0 = myself.top_desire_target;
				if( myself::Skill_GetConsumeMP(PhysicalSpecial2) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial2) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial2) == 0 ) {
					myself::AddUseSkillDesire(c0,PhysicalSpecial2,0,1,1000000);
				}
			}
		}
		super;
	}

}
