@LabelIndex 105234
@StringIndex 0
class 0 beres_private_private : party_private {
parameter:
	int	PhysicalSpecial = 458752001;
	int	selfbuff = 458752001;

handler:
	EventHandler CREATED(c0) {
		myself.i_ai0 = 30;
		myself.i_ai1 = myself::GetTick();
		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,0,10000000);
		}
		if( myself.sm.param1 == 1000 ) {
			c0 = gg::GetCreatureFromIndex(myself.sm.param2);
			if( myself::IsNullCreature(c0) == 0 ) {
				myself::AddHateInfo(c0,500,0,1,1);
				if( myself::Skill_GetConsumeMP(PhysicalSpecial) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial) == 0 && gg::GetAbnormalLevel(myself.sm,myself::Skill_GetAbnormalType(23134209)) <= 0 && gg::GetAbnormalLevel(myself.sm,myself::Skill_GetAbnormalType(87556097)) <= 0 ) {
					myself::AddUseSkillDesire(c0,PhysicalSpecial,0,1,1000000);
				}
				myself::AddUseSkillDesire(c0,305594369,0,1,100000);
			}
		}
		myself::AddTimerEx(1101,( 30 * 1000 ));
		super;
	}

	EventHandler ATTACKED(attacker,damage) {
		myself.i_ai1 = myself::GetTick();
		if( gg::Rand(100) < myself.i_ai0 ) {
			if( myself::Skill_GetConsumeMP(PhysicalSpecial) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial) == 0 && gg::GetAbnormalLevel(myself.sm,myself::Skill_GetAbnormalType(23134209)) <= 0 && gg::GetAbnormalLevel(myself.sm,myself::Skill_GetAbnormalType(87556097)) <= 0 ) {
				myself::AddUseSkillDesire(attacker,PhysicalSpecial,0,1,1000000);
			}
		}
		super;
	}

	EventHandler PARTY_ATTACKED(attacker,damage,private,f0) {
		myself.i_ai1 = myself::GetTick();
		if( gg::Rand(100) < myself.i_ai0 ) {
			if( myself::Skill_GetConsumeMP(PhysicalSpecial) < myself.sm.mp && myself::Skill_GetConsumeHP(PhysicalSpecial) < myself.sm.hp && myself::Skill_InReuseDelay(PhysicalSpecial) == 0 && gg::GetAbnormalLevel(myself.sm,myself::Skill_GetAbnormalType(23134209)) <= 0 && gg::GetAbnormalLevel(myself.sm,myself::Skill_GetAbnormalType(87556097)) <= 0 ) {
				myself::AddUseSkillDesire(attacker,PhysicalSpecial,0,1,1000000);
			}
		}
		if( private != myself.sm ) {
			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 SEE_CREATURE(creature) {
		myself.i_ai1 = myself::GetTick();
		if( creature.is_pc == 0 && myself::IsInCategory(12,creature.class_id) == 0 ) {
			return;
		}
		if( SeeCreatureAttackerTime == -1 ) {
			if( SetAggressiveTime == -1 ) {
				if( myself::GetLifeTime() >= ( gg::Rand(5) + 3 ) && myself::InMyTerritory(myself.sm) ) {
					myself::AddAttackDesire(creature,1,200);
				}
			} else if( SetAggressiveTime == 0 ) {
				if( myself::InMyTerritory(myself.sm) ) {
					myself::AddAttackDesire(creature,1,200);
				}
			} else if( myself::GetLifeTime() > ( SetAggressiveTime + gg::Rand(4) ) && myself::InMyTerritory(myself.sm) ) {
				myself::AddAttackDesire(creature,1,200);
			}
		} else if( myself::GetLifeTime() > SeeCreatureAttackerTime && myself::InMyTerritory(myself.sm) ) {
			myself::AddAttackDesire(creature,1,200);
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id,party0,i1,c0,c1) {
		if( timer_id == 1101 ) {
			if( myself::InMyTerritory(myself.sm) == 0 ) {
				myself::RemoveAllDesire();
				myself::AddTimerEx(80129,1000);
			}
			if( ( myself::GetTick() - myself.i_ai1 ) > ( ( 5 * 60 ) * 1000 ) ) {
				myself::BroadcastScriptEvent(11039,0,1000);
				myself::Despawn();
			}
			myself::AddTimerEx(1101,( 30 * 1000 ));
		}
		if( timer_id == 80129 ) {
			myself::InstantTeleport(myself.sm,myself.start_x,myself.start_y,myself.start_z);
		}
	}

	EventHandler SCRIPT_EVENT(script_event_arg1,script_event_arg2,script_event_arg3,c0,i0) {
		if( script_event_arg1 == 11039 ) {
			myself::Despawn();
		}
	}

	EventHandler PARTY_DIED(private,party0,i1,c0,c1) {
		if( private != myself.boss ) {
			myself.i_ai0 = ( myself.i_ai0 + 10 );
		}
	}

	EventHandler MY_DYING(c0,c1,party0,i1,i2) {
		if( myself.sm.class_id == 1022268 ) {
			if( gg::Rand(10000) <= 987 ) {
				myself::DropItem1(myself.sm,9595,1);
			}
		}
		if( myself.sm.class_id == 1022269 ) {
			if( gg::Rand(10000) <= 995 ) {
				myself::DropItem1(myself.sm,9595,1);
			}
		}
	}

}
