@LabelIndex 35590
@StringIndex 0
class 0 wizard_ag_saint_middle_ddmagic : wizard_saint_middle_ddmagic {
handler:
	EventHandler SEE_CREATURE(creature,i6,i0) {
		if( creature.is_pc == 0 && myself::IsInCategory(12,creature.class_id) == 0 ) {
			super;
			return;
		}
		if( myself::GetLifeTime() > 7 && myself::InMyTerritory(myself.sm) && myself::GetHateInfoCount() == 0 ) {
			if( myself::DistFromMe(creature) < 40 ) {
				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(creature,W_ShortRangeDDMagic,0,1,1000000);
					} else {
						myself::AddUseSkillDesire(creature,W_ShortRangeDDMagic,0,1,1000000);
					}
				} else {
					myself.i_ai0 = 1;
					myself::AddAttackDesire(creature,1,1000);
				}
			} else if( myself::Skill_GetConsumeMP(W_MiddleRangeDDMagic) < myself.sm.mp && myself::Skill_GetConsumeHP(W_MiddleRangeDDMagic) < myself.sm.hp ) {
				if( myself::Skill_InReuseDelay(W_MiddleRangeDDMagic) == 0 ) {
					myself::AddUseSkillDesire(creature,W_MiddleRangeDDMagic,0,1,1000000);
				} else {
					myself::AddUseSkillDesire(creature,W_MiddleRangeDDMagic,0,1,1000000);
				}
			} else {
				myself.i_ai0 = 1;
				myself::AddAttackDesire(creature,1,1000);
			}
			if( creature.is_pc == 0 && myself::IsInCategory(12,creature.class_id) == 0 ) {
				return;
			}
			i0 = 0;
			if( SeeCreatureAttackerTime == -1 ) {
				if( SetAggressiveTime == -1 ) {
					if( myself::GetLifeTime() >= ( gg::Rand(5) + 3 ) && myself::InMyTerritory(myself.sm) ) {
						i0 = 1;
					}
				} else if( SetAggressiveTime == 0 ) {
					if( myself::InMyTerritory(myself.sm) ) {
						i0 = 1;
					}
				} else if( myself::GetLifeTime() > ( SetAggressiveTime + gg::Rand(4) ) && myself::InMyTerritory(myself.sm) ) {
					i0 = 1;
				}
			} else if( myself::GetLifeTime() > SeeCreatureAttackerTime && myself::InMyTerritory(myself.sm) ) {
				i0 = 1;
			}
			if( myself::GetHateInfoCount() == 0 && i0 == 1 ) {
				myself::AddHateInfo(creature,300,0,1,1);
			} else {
				myself::AddHateInfo(creature,100,0,1,1);
			}
		}
		super;
	}

}
