@LabelIndex 40140
@StringIndex 6683
class 0 warrior_growth_step4 : warrior_growh_basic {
parameter:
	int	SelfBuff = 263979009;
	int	PhysicalSpecial = 264241153;
	int	DDMagic = 264306689;

handler:
	EventHandler CREATED() {
		myself.i_ai1 = 0;
		myself.i_ai2 = 0;
		myself.i_ai4 = 1;
		myself.c_ai0 = gg::GetCreatureFromIndex(myself.sm.param1);
		myself.i_ai3 = myself.sm.param2;
		if( myself::IsNullCreature(myself.c_ai0) ) {
			myself::Say(".  ");
		} else {
			myself::AddAttackDesire(myself.c_ai0,1,100);
		}
		myself.i_ai2 = 0;
		myself::BroadcastScriptEvent(10018,gg::GetIndexFromCreature(myself.sm),700);
		if( gg::Rand(100) < 33 ) {
			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,skill_name_id,i0,f0) {
		if( myself.i_ai1 == 1 ) {
			if( myself.top_desire_target == attacker ) {
				myself.i_ai2 = 1;
			}
		} else {
			myself::AddTimerEx(2001,5000);
			myself.i_ai1 = 1;
		}
		if( ( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) && myself::IsNullCreature(myself.top_desire_target) == 0 ) {
			if( myself.top_desire_target == attacker && 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) ) ) && myself::IsNullCreature(myself.top_desire_target) == 0 ) {
			if( myself.top_desire_target == attacker && 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 TIMER_FIRED_EX(timer_id) {
		if( timer_id == 2001 ) {
			if( myself.p_state != 3 && myself.p_state != 10 ) {
				myself.i_ai1 = 0;
				myself.i_ai2 = 0;
			} else if( myself.i_ai2 == 0 ) {
				if( myself::IsNullCreature(myself.top_desire_target) == 0 && gg::Rand(100) < 50 ) {
					if( gg::GetAbnormalLevel(myself.top_desire_target,myself::Skill_GetAbnormalType(DDMagic)) <= 0 ) {
						if( myself::Skill_GetConsumeMP(DDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(DDMagic) < myself.sm.hp && myself::Skill_InReuseDelay(DDMagic) == 0 ) {
							myself::AddUseSkillDesire(myself.top_desire_target,DDMagic,0,1,1000000);
						}
					}
				}
			}
			myself::AddTimerEx(2001,5000);
			myself.i_ai2 = 0;
		}
		super;
	}

}
