@LabelIndex 18510
@StringIndex 0
class 0 party_leader_wizard_dd2 : party_leader_wizard {
parameter:
	int	W_ShortRangeDDMagic = 272629761;
	int	W_LongRangeDDMagic = 272039937;

handler:
	EventHandler ATTACKED(attacker,damage,h0,i0,i1,f0) {
		super;
		h0 = myself::GetMaxHateInfo(0);
		if( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) {
			if( myself.i_ai0 == 0 ) {
				i0 = 0;
				if( myself::IsNullHateInfo(h0) == 0 ) {
					if( myself::IsNullCreature(h0.creature) == 0 ) {
						i0 = 1;
					}
				}
				if( i0 == 1 ) {
					if( h0.creature == attacker ) {
						i0 = 1;
					}
				}
				if( myself::DistFromMe(attacker) > 100 && gg::Rand(100) < 80 ) {
					if( i0 == 1 ) {
						if( myself::Skill_GetConsumeMP(W_LongRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(W_LongRangeDDMagic) < myself.sm.hp ) {
							if( myself::Skill_InReuseDelay(W_LongRangeDDMagic) == 0 ) {
								myself::AddUseSkillDesire(attacker,W_LongRangeDDMagic,0,1,1000000);
							} else {
								myself::AddUseSkillDesire(attacker,W_LongRangeDDMagic,0,1,1000000);
							}
						} else {
							myself.i_ai0 = 1;
							myself::AddAttackDesire(attacker,1,1000);
						}
					} else if( gg::Rand(100) < 2 ) {
						if( myself::Skill_GetConsumeMP(W_LongRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(W_LongRangeDDMagic) < myself.sm.hp ) {
							if( myself::Skill_InReuseDelay(W_LongRangeDDMagic) == 0 ) {
								myself::AddUseSkillDesire(attacker,W_LongRangeDDMagic,0,1,1000000);
							} else {
								myself::AddUseSkillDesire(attacker,W_LongRangeDDMagic,0,1,1000000);
							}
						} else {
							myself.i_ai0 = 1;
							myself::AddAttackDesire(attacker,1,1000);
						}
					}
				} else if( i0 == 1 ) {
					if( myself::Skill_GetConsumeMP(W_ShortRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(W_ShortRangeDDMagic) < myself.sm.hp ) {
						if( myself::Skill_InReuseDelay(W_ShortRangeDDMagic) == 0 ) {
							myself::AddUseSkillDesire(attacker,W_ShortRangeDDMagic,0,1,1000000);
						} else {
							myself::AddUseSkillDesire(attacker,W_ShortRangeDDMagic,0,1,1000000);
						}
					} else {
						myself.i_ai0 = 1;
						myself::AddAttackDesire(attacker,1,1000);
					}
				} else if( gg::Rand(100) < 2 ) {
					if( myself::Skill_GetConsumeMP(W_ShortRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(W_ShortRangeDDMagic) < myself.sm.hp ) {
						if( myself::Skill_InReuseDelay(W_ShortRangeDDMagic) == 0 ) {
							myself::AddUseSkillDesire(attacker,W_ShortRangeDDMagic,0,1,1000000);
						} else {
							myself::AddUseSkillDesire(attacker,W_ShortRangeDDMagic,0,1,1000000);
						}
					} else {
						myself.i_ai0 = 1;
						myself::AddAttackDesire(attacker,1,1000);
					}
				}
			} else if( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) {
				f0 = 0;
				if( SetHateGroup >= 0 ) {
					if( myself::IsInCategory(SetHateGroup,attacker.occupation) ) {
						f0 = ( f0 + SetHateGroupRatio );
					}
				}
				if( attacker.occupation == SetHateOccupation ) {
					f0 = ( f0 + SetHateOccupationRatio );
				}
				if( SetHateRace == attacker.race ) {
					f0 = ( f0 + SetHateRaceRatio );
				}
				f0 = ( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) ) );
				myself::AddAttackDesire(attacker,1,( f0 * 100 ));
			}
		}
	}

	EventHandler CLAN_ATTACKED(attacker,damage,i6,h0) {
		myself::RemoveAllHateInfoIF(1,0);
		if( ( myself::GetLifeTime() > 7 && ( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) ) && myself::GetHateInfoCount() == 0 ) {
			if( myself::DistFromMe(attacker) > 100 ) {
				if( myself::Skill_GetConsumeMP(W_LongRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(W_LongRangeDDMagic) < myself.sm.hp ) {
					if( myself::Skill_InReuseDelay(W_LongRangeDDMagic) == 0 ) {
						myself::AddUseSkillDesire(attacker,W_LongRangeDDMagic,0,1,1000000);
					} else {
						myself::AddUseSkillDesire(attacker,W_LongRangeDDMagic,0,1,1000000);
					}
				} else {
					myself.i_ai0 = 1;
					myself::AddAttackDesire(attacker,1,1000);
				}
			} else if( myself::Skill_GetConsumeMP(W_ShortRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(W_ShortRangeDDMagic) < myself.sm.hp ) {
				if( myself::Skill_InReuseDelay(W_ShortRangeDDMagic) == 0 ) {
					myself::AddUseSkillDesire(attacker,W_ShortRangeDDMagic,0,1,1000000);
				} else {
					myself::AddUseSkillDesire(attacker,W_ShortRangeDDMagic,0,1,1000000);
				}
			} else {
				myself.i_ai0 = 1;
				myself::AddAttackDesire(attacker,1,1000);
			}
		}
		super;
	}

	EventHandler PARTY_ATTACKED(attacker,damage,i6,h0) {
		myself::RemoveAllHateInfoIF(1,0);
		if( ( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) && myself::GetHateInfoCount() == 0 ) {
			if( myself::DistFromMe(attacker) > 100 ) {
				if( myself::Skill_GetConsumeMP(W_LongRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(W_LongRangeDDMagic) < myself.sm.hp ) {
					if( myself::Skill_InReuseDelay(W_LongRangeDDMagic) == 0 ) {
						myself::AddUseSkillDesire(attacker,W_LongRangeDDMagic,0,1,1000000);
					} else {
						myself::AddUseSkillDesire(attacker,W_LongRangeDDMagic,0,1,1000000);
					}
				} else {
					myself.i_ai0 = 1;
					myself::AddAttackDesire(attacker,1,1000);
				}
			} else if( myself::Skill_GetConsumeMP(W_ShortRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(W_ShortRangeDDMagic) < myself.sm.hp ) {
				if( myself::Skill_InReuseDelay(W_ShortRangeDDMagic) == 0 ) {
					myself::AddUseSkillDesire(attacker,W_ShortRangeDDMagic,0,1,1000000);
				} else {
					myself::AddUseSkillDesire(attacker,W_ShortRangeDDMagic,0,1,1000000);
				}
			} else {
				myself.i_ai0 = 1;
				myself::AddAttackDesire(attacker,1,1000);
			}
		}
		super;
	}

	EventHandler USE_SKILL_FINISHED(h0,i0) {
		h0 = myself::GetMaxHateInfo(0);
		i0 = 0;
		if( myself::IsNullHateInfo(h0) == 0 ) {
			if( myself::IsNullCreature(h0.creature) == 0 ) {
				i0 = 1;
			}
		}
		if( i0 == 1 ) {
			if( myself.i_ai0 != 1 ) {
				if( myself::DistFromMe(h0.creature) > 100 ) {
					if( myself::Skill_GetConsumeMP(W_LongRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(W_LongRangeDDMagic) < myself.sm.hp ) {
						if( myself::Skill_InReuseDelay(W_LongRangeDDMagic) == 0 ) {
							myself::AddUseSkillDesire(h0.creature,W_LongRangeDDMagic,0,1,1000000);
						} else {
							myself::AddUseSkillDesire(h0.creature,W_LongRangeDDMagic,0,1,1000000);
						}
					} else {
						myself.i_ai0 = 1;
						myself::AddAttackDesire(h0.creature,1,1000);
					}
				} else if( myself::Skill_GetConsumeMP(W_ShortRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(W_ShortRangeDDMagic) < myself.sm.hp ) {
					if( myself::Skill_InReuseDelay(W_ShortRangeDDMagic) == 0 ) {
						myself::AddUseSkillDesire(h0.creature,W_ShortRangeDDMagic,0,1,1000000);
					} else {
						myself::AddUseSkillDesire(h0.creature,W_ShortRangeDDMagic,0,1,1000000);
					}
				} else {
					myself.i_ai0 = 1;
					myself::AddAttackDesire(h0.creature,1,1000);
				}
			}
		}
	}

}
