@LabelIndex 52407
@StringIndex 0
class 0 party_leader_casting_3skill_approach : party_leader {
parameter:
	int	SelfBuff = 263979009;
	int	SelfRangeDDMagic = 264306689;
	int	PhysicalSpecial = 264241153;

handler:
	EventHandler CREATED(c0) {
		myself::AddTimerEx(2001,10000);
		if( myself::Skill_GetConsumeMP(SelfBuff) < myself.sm.mp && myself::Skill_GetConsumeHP(SelfBuff) < myself.sm.hp && myself::Skill_InReuseDelay(SelfBuff) == 0 ) {
			myself::AddUseSkillDesire(myself.sm,SelfBuff,1,1,1000000);
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id) {
		if( timer_id == 2001 ) {
			if( gg::GetAbnormalLevel(myself.sm,myself::Skill_GetAbnormalType(SelfBuff)) <= 0 && myself.p_state != 3 ) {
				if( myself::Skill_GetConsumeMP(SelfBuff) < myself.sm.mp && myself::Skill_GetConsumeHP(SelfBuff) < myself.sm.hp && myself::Skill_InReuseDelay(SelfBuff) == 0 ) {
					myself::AddUseSkillDesire(myself.sm,SelfBuff,1,1,1000000);
				}
			}
			myself::AddTimerEx(2001,10000);
		}
		if( timer_id == 2002 ) {
			if( myself::Skill_GetConsumeMP(SelfBuff) < myself.sm.mp && myself::Skill_GetConsumeHP(SelfBuff) < myself.sm.hp && myself::Skill_InReuseDelay(SelfBuff) == 0 ) {
				myself::AddUseSkillDesire(myself.sm,SelfBuff,1,1,1000000);
			}
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage,i0) {
		if( myself::IsNullCreature(myself.top_desire_target) == 0 ) {
			if( ( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) && myself.top_desire_target == attacker ) {
				if( myself::DistFromMe(attacker) < 200 && gg::Rand(100) < 33 ) {
					if( myself::Skill_GetConsumeMP(SelfRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(SelfRangeDDMagic) < myself.sm.hp && myself::Skill_InReuseDelay(SelfRangeDDMagic) == 0 ) {
						myself::AddUseSkillDesire(myself.sm,SelfRangeDDMagic,0,1,1000000);
					}
				}
				if( gg::Rand(100) < 33 ) {
					if( myself::Skill_GetConsumeMP(PhysicalSpecial) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial) == 0 ) {
						myself::AddUseSkillDesire(attacker,PhysicalSpecial,0,1,1000000);
					}
				}
			}
		}
		super;
	}

	EventHandler CLAN_ATTACKED(attacker,damage) {
		if( myself::GetLifeTime() > 7 && ( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) ) {
			if( myself::IsNullCreature(myself.top_desire_target) == 0 ) {
				if( myself::DistFromMe(attacker) < 200 && gg::Rand(100) < 33 && myself.top_desire_target == attacker ) {
					if( myself::Skill_GetConsumeMP(SelfRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(SelfRangeDDMagic) < myself.sm.hp && myself::Skill_InReuseDelay(SelfRangeDDMagic) == 0 ) {
						myself::AddUseSkillDesire(myself.sm,SelfRangeDDMagic,0,1,1000000);
					}
				}
			}
			if( gg::Rand(100) < 33 ) {
				if( myself::Skill_GetConsumeMP(PhysicalSpecial) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial) == 0 ) {
					myself::AddUseSkillDesire(attacker,PhysicalSpecial,0,1,1000000);
				}
			}
		}
		super;
	}

	EventHandler PARTY_ATTACKED(attacker,private,damage,f0) {
		if( myself::GetLifeTime() > 7 && ( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) ) {
			if( myself::IsNullCreature(myself.top_desire_target) == 0 ) {
				if( myself::DistFromMe(attacker) < 200 && gg::Rand(100) < 33 && myself.top_desire_target == attacker ) {
					if( myself::Skill_GetConsumeMP(SelfRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(SelfRangeDDMagic) < myself.sm.hp && myself::Skill_InReuseDelay(SelfRangeDDMagic) == 0 ) {
						myself::AddUseSkillDesire(myself.sm,SelfRangeDDMagic,0,1,1000000);
					}
				}
			}
			if( gg::Rand(100) < 33 ) {
				if( myself::Skill_GetConsumeMP(PhysicalSpecial) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial) == 0 ) {
					myself::AddUseSkillDesire(attacker,PhysicalSpecial,0,1,1000000);
				}
			}
		}
		super;
	}

}
