04-04-2008, 01:00 PM
NeoABS & NeoSABS ()enemy processes script
posted by azrith001
Apr 4 2008
This new version of the ()Enemy Processes script allows you to have the database BGM and the Database Victory ME... You can even set a custom Victory ME of your own...
Whats New:
When the monsters see or Hear you the Battle music starts
When you battle aginst a single monster the victory ME plays after their Defeat...
You can set whether or not to have an ME
credit:
Mr.Mo
posted by azrith001
Apr 4 2008
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given.
No support is given.
This new version of the ()Enemy Processes script allows you to have the database BGM and the Database Victory ME... You can even set a custom Victory ME of your own...
Whats New:
When the monsters see or Hear you the Battle music starts
When you battle aginst a single monster the victory ME plays after their Defeat...
You can set whether or not to have an ME
Code:
#----------------------------------------------------------------
# * Azrith001 NeoABS options
# * battle music update
#----------------------------------------------------------------
# Whether or not to have victory music
$vic_se = true
# if vic_se == true what it the victory music
$vic_music = "002-Victory02"
# victory volume
$vic_vol = 100
# victory pitch
$vic_pitch = 150
# whether or not to play victory me in database(if false will play the one set above)
$vic_vase_me = true
# It automatically plays the music that you set in the data base
# Just incase you want to add anything go to lines 204-221
#----------------------------------------------------------------
# END
#----------------------------------------------------------------
#===============================================================================
# ** NeoABS - www.unknowncoders.com
#-------------------------------------------------------------------------------
# Author Mr.Mo "Muhammet Sivri"
# Version 1.0
# Date 11/25/07 (m/d/y)
#===============================================================================
module UCoders
class NeoABS
#-----------------------------------------------------------------------------
# * Enemy Update
#-----------------------------------------------------------------------------
def update_enemy(event_id)
enemy = @enemies[event_id]; return if enemy.nil? || $game_temp.message_window_showing
return update_respawn(enemy) if enemy.dead?
return @enemies.delete(event_id) if enemy.event.character_name == ""
# Update Enemy State
update_enemy_state(enemy)
# Check the enemy can find anyone
enemy.find_enemy if enemy.attacking_id <= -UCoders::Max_Actors
if enemy.attacking_id > -UCoders::Max_Actors
# Check if still in range
enemy.check_enemy_range
if enemy.attacking_id > -UCoders::Max_Actors
m = enemy.event.moving?
# Move Towards that enemy
enemy.event.move_towards(enemy.my_enemy.event) if !m && !enemy.behavior(1).include?(4) && !(enemy.behavior(1).include?(3) && enemy.dying?)
if !m && enemy.behavior(1).include?(2) && enemy.in_range?(enemy.my_enemy.event,2) && !(enemy.behavior(1).include?(3) && enemy.dying?)
enemy.event.move_backward if !enemy.behavior(1).include?(4)
elsif !m && enemy.behavior(1).include?(2) && !enemy.in_range?(enemy.my_enemy.event,3) && !(enemy.behavior(1).include?(3) && enemy.dying?)
enemy.event.move_towards(enemy.my_enemy.event) if !enemy.behavior(1).include?(4)
elsif !m && (enemy.behavior(1).include?(3) && enemy.dying?) && enemy.in_range?(enemy.my_enemy.event,3)
enemy.event.move_away(enemy.my_enemy.event) if !enemy.behavior(1).include?(4)
end
m = enemy.event.moving?
enemy.event.turn_to(enemy.my_enemy.event) if (!m || enemy.behavior(1).include?(2)) && !enemy.behavior(1).include?(5) #&& !(enemy.behavior(1).include?(3) && enemy.dying?)
# Attack Enemy
enemy_attack(enemy) if (Graphics.frame_count % (61-enemy.frequency*10) == 0 ) && enemy.behavior(1).include?(1)
end
end
enemy.attack_fail += 1
if enemy.attack_fail > 100
enemy.attack_fail = 0
enemy.restore_setup
end
end
#--------------------------------------------------------------------------
# * Update Enemy State(Enemy)
#--------------------------------------------------------------------------
def update_enemy_state(enemy)
enemy.states.each { |id|
next if !States.has_key?(id)
state = States[id]
next if state == 0
enemy.state_time += 1
if enemy.state_time >= state
enemy.remove_state(id); return enemy.state_time = 0
end
}
if enemy.hp > 0 and enemy.slip_damage? and Graphics.frame_count % (40) == 0
enemy.hp -= [enemy.maxhp / 100, 1].max
enemy_dead?(enemy,nil) if enemy.hp <= 0
end
end
#-----------------------------------------------------------------------------
# * Enemy Attack
#-----------------------------------------------------------------------------
def enemy_attack(attacker)
#Return if the enemy can't attack
return if attacker.event.moving? || attacker.event.erased || attacker.event.erase_it || attacker.actions.empty? || attacker.dead? || attacker.event.fade || attacker.actions.nil?
attacking = attacker.my_enemy
#Get all actions
attacker.actions.each { |action| next if attacker.enemy_pre_attack(action)
#Get the current action kind
ak = action.kind
if ak == 0 # Basic
#Get the action=
if action.basic == 0 #Attack
next if !attacker.in_range?(attacking.event, 1) || !attacker.in_direction?(attacking.event)
#Attack it's enemy
attacking.effect_attack(attacker)
#Animate the enemy
attacker.event.animation_id = attacker.animation1_id
animate(attacker.event, "_melee") if Enemy_Animation
#Show Animation
if attacking.behavior(1).include?(6)
hit_enemy(attacking,attacker) if attacking.damage != "Miss"
attacking.damage = nil
else
hit_enemy(attacking,attacker) if attacking.damage != "Miss"
end
#Check if enemy's enemy is dead
return if enemy_dead?(attacking,attacker)
#Set the new target for the enemy
return attacking.battle_setup(attacker.event.id)
end
elsif ak == 1 || ak == 2 # Skill
# Get the skill
skill = $data_skills[action.skill_id]; return if skill.nil?
# Activate Common Event
$game_temp.common_event_id = skill.common_event_id if skill.common_event_id > 0
# Get the skill scope
sc = skill.scope
if sc == 1 # One Enemy
next if !attacker.in_direction?(attacking.event) || !attacker.can_use_skill?(skill)
# Animate the enemy
if Range_Skills.has_key?(skill.id)
if !obstocle_check(attacker.event,attacking.event)
attacker.event.move_towards(attacking.event) if !attacker.behavior(1).include?(4)
return
end
@range.push(Game_Ranged_Skill.new(attacker.event, attacker, skill))
attacker.sp -= skill.sp_cost
attacker.event.animation_id = skill.animation1_id
animate(attacker.event,"_cast") if Enemy_Animation
return
end
animate(attacker.event,"_cast") if Enemy_Animation
attacker.event.animation_id = skill.animation1_id
# If the skill is not ranged
enemies = []
# Get all enemies
@enemies.each_value { |e|
next if e == attacker or !attacker.hate_group.include?(e.enemy_id)
enemies.push(enemy)
}
enemies.push($game_player) if attacker.hate_group.include?(0)
# Order them from closest to the farthest
enemies.sort! {|a,b|
get_range(attacker.event,a.event) - get_range(attacker.event,b.event)}
# Attack the closest one
enemies[0].actor.effect_skill(attacker, skill)
# Take off SP
attacker.sp -= skill.sp_cost
# Show Animation on enemy
if enemies[0].actor.behavior(1).include?(6)
hit_enemy(enemies[0], attacker, skill.animation2_id) if enemies[0].actor.damage != "Miss"
enemies[0].actor.damage = nil
else
hit_enemy(enemies[0], attacker, skill.animation2_id) if enemies[0].actor.damage != "Miss"
end
# Return if enemy is dead
return if enemy_dead?(enemies[0].actor,attacker)
# Setup movement
return enemies[0].actor.battle_setup(attacker.event.id)
elsif sc == 3 || sc == 4 || sc == 7 # User
next if attacker.hp > skill.power.abs
# Animate the enemy
attacker.event.animation_id = skill.animation1_id
animate(attacker.event,"_cast") if Enemy_Animation
attacker.effect_skill(attacker, skill)
attacker.sp -= skill.sp_cost
return attacker.event.animation_id = skill.animation2_id
end
end
}
attacker.attack_fail = 0
end
#--------------------------------------------------------------------------
# * Hit Enemy(Enemy) or (Player)
#--------------------------------------------------------------------------
def hit_enemy(e,a,animation=nil)
return if animation == 0
# Animate player
animate(e,"_hit") if e.is_a?(Game_Player) and Player_Animation
# Animate Enemy
animate(e.event,"_hit") if e.is_a?(ABS_Enemy) and Enemy_Animation
if animation.nil?
e.event.animation_id = a.animation2_id
else
e.event.animation_id = animation
end
end
#--------------------------------------------------------------------------
# * Enemy Dead?(Enemy) or (Player)
#--------------------------------------------------------------------------
def enemy_dead?(e,a)
#Return a new method if e is an actor
return player_dead?(e,a) if e.is_a?(Game_Actor)
#Return false if enemy dead
return false if !e.dead?
#EDIT SPOT
if $vic_se == true
if $vic_vase_me == true
#play victory me
$game_system.me_play($data_system.battle_end_me)
# Return to BGM used before battle started
$game_map.autoplay
else
#play victory me
Audio.me_play("Audio/ME/" + $vic_music, $vic_vol, $vic_pitch)
# Return to BGM used before battle started
$game_map.autoplay
end
else
# Return to BGM used before battle started
$game_map.autoplay
end
######################3
enemy = e
treasure(enemy) if !a.nil? and a.is_a?(Game_Actor)
a.restore_setup if !a.nil?
# Tell near by allies
@enemies.each_value { |en| en.ally_killed(e,a) if en != e}
# ID
id = enemy.event.id
# Remove from list
@enemies.delete(id) if @enemies[id].respawn == 0
event = enemy.event
event.enemy_not_able = true
event.fade = true
event.erase_page = event.page
event.social.dead(a) if UCoders.has?("Social System")
case enemy.trigger[0]
when 0
event.erase_it = true
when 1
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
$game_switches[enemy.trigger[1]] = true
$game_map.need_refresh = true
when 2
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
if enemy.trigger[2] == 0
$game_variables[enemy.trigger[1]] += 1
$game_map.need_refresh = true
else
$game_variables[enemy.trigger[1]] = enemy.trigger[2]
$game_map.need_refresh = true
end
when 3
value = "A" if enemy.trigger[1] == 1
value = "B" if enemy.trigger[1] == 2
value = "C" if enemy.trigger[1] == 3
value = "D" if enemy.trigger[1] == 4
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if value == 0
key = [$game_map.map_id, event.id, value]
$game_self_switches[key] = true
$game_map.need_refresh = true
end
return true
end
#--------------------------------------------------------------------------
# * Player Dead(Player,Enemy)
#--------------------------------------------------------------------------
def player_dead?(a,e)
#Check State Effect
$game_party.actors[0].states.each { |id|
$game_player.movable = true if SLEEP_EFFECT.include?(id)
$game_party.actors[0].states.delete(id) if SLEEP_EFFECT.include?(id) }
#return if the player is not dead
return false if !a.dead?
#If the player is dead;
e.restore_setup if !e.nil?
#Game Over?
if Next_Leader and !$game_party.all_dead?
move_forward
else
revive_actor
end
return true
end
#--------------------------------------------------------------------------
# * Move Forward
#--------------------------------------------------------------------------
def move_forward
# Return if party size is 1
return if $game_party.actors.size == 1
# Record current actor.
actor = $game_party.actors[0]
# Remove actor
$game_party.actors.delete(actor)
$game_party.actors.compact
# Check if everyone except leader is dead
return $game_party.actors.insert(0,actor) if $game_party.all_dead?
$game_player.end_animate
# Insert leader to last place
$game_party.actors.push(actor)
# Loop members until alive
for a in $game_party.actors
next if a.nil?
if a.dead?
$game_party.actors.delete(a)
$game_party.actors.push(a)
else
break
end
end
# Refreshe game player
$game_player.refresh
end
#--------------------------------------------------------------------------
# * Treasure(Enemy)
#--------------------------------------------------------------------------
def treasure(enemy)
exp = 0
gold = 0
treasures = []
unless enemy.hidden
exp += enemy.exp
gold += enemy.gold
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
treasures = treasures[0..5]
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
actor.hp = actor.maxhp
actor.sp = actor.maxsp
#Show LEvel Up if need to
actor.damage = "~Level Up~" if DisplayLevelUp
Audio.me_play("Audio/ME/" + LevelUpMusic.to_s, 100, 100) if LevelUpMusic != ""
end
end
end
# Add Treasures
if ITEM_DROP
@treasures.push(Treasure_Display.new(enemy.event,"#{GOLD_DISPLAY}",[],gold)) if gold > 0
for item in treasures
case item
when RPG::Item
g = DEFAULT_ITEM_DISPLAY
g = ITEMS_DISPLAY[item.id] if ITEMS_DISPLAY[item.id] != nil
@treasures.push(Treasure_Display.new(enemy.event,"#{g}",[item],0))
when RPG::Weapon
g = DEFAULT_WEAPON_DISPLAY
g = WEAPONS_DISPLAY[item.id] if WEAPONS_DISPLAY[item.id] != nil
@treasures.push(Treasure_Display.new(enemy.event,"#{g}",[item],0))
when RPG::Armor
g = DEFAULT_ARMOR_DISPLAY
g = ARMORS_DISPLAY[item.id] if ARMORS_DISPLAY[item.id] != nil
@treasures.push(Treasure_Display.new(enemy.event,"#{g}",[item],0))
end
end
else
$game_party.gain_gold(gold)
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
end
end
#--------------------------------------------------------------------------
# * Update Respawn(enemy)
#--------------------------------------------------------------------------
def update_respawn(enemy)
event = enemy.event
return if enemy.respawn == 0 or !event.erased
enemy.respawn -= 1
if enemy.respawn == 0
event.enemy_not_able = false
event.moveto(event.event.x,event.event.y)
event.erased = false
event.refresh
end
end
end
end
#============================================================================
# * ABS Enemy
#============================================================================
class ABS_Enemy < Game_Battler
#-----------------------------------------------------------------------------
# * Instance Variables
#-----------------------------------------------------------------------------
attr_reader :event_id, :enemy_id, :attacking_id, :orx, :ory, :ord, :temp_move_type
attr_writer :behavior
attr_accessor :range, :hate_group, :speed, :frequency, :respawn, :trigger,
:go_to, :in_battle, :stop, :x, :y, :direction, :attack_fail
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(enemy_id,e)
super()
@event_id = e.id
@enemy_id = enemy_id
@behavior = []
@range = []
@hate_group = []
@speed = 0
@frequency = 0
@respawn = 0
@trigger = []
@go_to = []
@attacking_id = -UCoders::Max_Actors
@temp_move_type = 0
@temp_speed = 0
@temp_frequency = 0
@hp = maxhp
@sp = maxsp
@stop = false
@attack_fail = 0
# Set Speed
@temp_speed = e.move_speed
# Set Frequency
@temp_frequency = e.move_frequency
# Set Move Type
@temp_move_type = 0
# Location
@x = e.x
@y = e.y
@orx = @x # Original position before battle
@ory = @y # Original position before battle
@ord = @direction # Original position before battle
@direction = e.direction
end
#--------------------------------------------------------------------------
# * Get Enemy ID
#--------------------------------------------------------------------------
def id; return @enemy_id; end
def actor; return self; end
#--------------------------------------------------------------------------
# * Check Enemy Range
#--------------------------------------------------------------------------
def check_enemy_range
restore_setup if my_enemy.nil? || my_enemy.dead? || !in_range?(my_enemy.event,see_range+hear_range+2)
end
#--------------------------------------------------------------------------
# * Find Enemy
#--------------------------------------------------------------------------
def find_enemy
behavior.each{|i|
see_anyone if i == 1 # When See
hear_anyone if i == 2 # When Hear
ally_in_battle if i == 3 # Friend Under Attack
}
end
#--------------------------------------------------------------------------
# * Ally Killed(ally)
#--------------------------------------------------------------------------
def ally_killed(ally,killer)
return if !behavior.include?(3) || @hate_group.include?(ally.enemy_id) ||
(!in_range?(ally.event,hear_range) && !in_range?(ally.event,see_range)) ||
!@hate_group.include?(killer.enemy_id)
# Setup
$game_player.social.wanted[event.id,event.emo_map_id] = UCoders::Wanted_Time if UCoders.has?("Social System")
battle_setup(killer.enemy_id)
if UCoders.has?("Social System")
event.social.setup_crime_rate(ally,self) if event.social.npc?
end
end
#--------------------------------------------------------------------------
# * See Anyone
#--------------------------------------------------------------------------
def see_anyone
#play battle bgm
$game_system.bgm_play($data_system.battle_bgm)
enemies = []
#Get player
if @hate_group.include?(0)
enemies.push($game_party.actors[0]) if in_direction?($game_player) && in_range?($game_player, see_range) && $game_map.no_wall(event, $game_player)
end
# If the list larger then 1
if @hate_group.size > 1 || (@hate_group.size == 1 && !@hate_group.include?(0))
$NeoABS.enemies.each_value { |e| enemies.push(e) if e != self && @hate_group.include?(e.enemy_id) && in_range?(e.event,see_range) && in_direction?(e.event) && $game_map.no_wall(event, e.event)
}
end
# If the list is larger
if !enemies.empty?
# Get closest enemy
enemies = enemies.sort! {|a,b| a.get_range(event) - b.get_range(event) }
# Setup for Battle
battle_setup(enemies[0].event.id)
end
end
#--------------------------------------------------------------------------
# * Hear Anyone
#--------------------------------------------------------------------------
def hear_anyone
#play battle bgm
$game_system.bgm_play($data_system.battle_bgm)
enemies = []
#Get player
if @hate_group.include?(0) && $game_player.moving?
s = $NeoABS.dash_speed/2+hear_range
d = ($game_player.dashing ? s : $game_player.sneaking ? 1 : hear_range)
enemies.push($game_party.actors[0]) if in_range?($game_player, d)
end
# If the list larger then 1
if @hate_group.size > 1 || (@hate_group.size == 1 && !@hate_group.include?(0))
$NeoABS.enemies.each_value { |e| enemies.push(e) if e != self && @hate_group.include?(e.enemy_id) && e.event.moving? && in_range?(e.event,hear_range) }
end
# If the list is larger
if enemies.size > 0
# Get closest enemy
enemies = enemies.sort! {|a,b| a.get_range(event) - b.get_range(event) }
# Setup for Battle
battle_setup(enemies[0].event.id)
end
end
#--------------------------------------------------------------------------
# * Ally In Battle
#--------------------------------------------------------------------------
def ally_in_battle
ally = []
ally.push($game_party.actors[0]) if !@hate_group.include?(0) && $game_party.actors[0].attacking_id > -UCoders::Max_Actors && (in_range?($game_player,hear_range) || in_range?($game_player,see_range))
# If the list larger then 1
$NeoABS.enemies.each_value { |e| ally.push(e) if e != self && !@hate_group.include?(e.enemy_id) && e.attacking_id > -UCoders::Max_Actors} if !UCoders.has?("Social System")
$NeoABS.enemies.each_value { |e| ally.push(e) if e != self && !@hate_group.include?(e.enemy_id) && (e.attacking_id > -UCoders::Max_Actors or e.event.social.attacked_by > -UCoders::Max_Actors) && (in_range?(e.event,hear_range) || in_range?(e.event,see_range))} if UCoders.has?("Social System")
# Pick closest enemy
if !ally.empty?
# Get closest enemy
ally.sort! {|a,b| a.get_range(event) - b.get_range(event) }
# Setup for Battle
for i in 0..ally.size
next if ally[i].nil?
if UCoders.has?("Social System")
ally_e = ally[i].event; next if ally[i].my_enemy.nil?
if ally_e.social.attacked_by > -UCoders::Max_Actors
$game_player.social.wanted[event.id,event.emo_map_id] = UCoders::Wanted_Time
battle_setup(ally[i].event.social.attacked_by)
event.social.setup_crime_rate(ally[i],self) if event.social.npc?; break
else
$game_player.social.wanted[event.id,event.emo_map_id] = UCoders::Wanted_Time
battle_setup(ally[i].attacking_id)
event.social.setup_crime_rate(ally[i],self) if event.social.npc?; break
end
else
next if ally[i].my_enemy.nil? || ally[i].my_enemy.event.nil?
battle_setup(ally[i].attacking_id); break
end
end
end
end
#--------------------------------------------------------------------------
# * Setup(e_id) - Sets up against new enemy
#--------------------------------------------------------------------------
def battle_setup(e_id)
return if e_id < 0
enemy_id = (e_id > 0 ? $NeoABS.enemies[e_id].enemy_id : 0)
if UCoders.has?("Social System") && !@hate_group.include?(enemy_id)
# Check
e = (e_id == 0 ? $game_player : $NeoABS.enemies[e_id].event)
return if !event.social.retaliate?(self,e)
# Stop follow if following
event.social.reset_following(false) if event.social.following?
elsif !UCoders.has?("Social System") && !@hate_group.include?(enemy_id)
return
end
# Restore setup if enemy in battle
restore_setup if @attacking_id > -UCoders::Max_Actors
# Set Speed
@temp_speed = event.move_speed; event.move_speed = @speed
# Set Frequency
@temp_frequency = event.move_frequency; event.move_frequency = @frequency
# Set Move Type
@temp_move_type = event.move_type; #event.move_type = 0
# Set Up Enemy
@attacking_id = e_id
# Original Position
@orx = event.x
@ory = event.y
@ord = event.direction
event.social.grudge_attack_id = e_id if UCoders.has?("Social System") && event.social.npc?
end
#--------------------------------------------------------------------------
# * Restore the Movement Type(Enemy)
#--------------------------------------------------------------------------
def restore_setup
return if @attacking_id <= -UCoders::Max_Actors
@attacking_id = -UCoders::Max_Actors
# Restore Speed, Frequency, Move Type
event.move_speed = @temp_speed; event.move_frequency = @temp_frequency
event.move_type = @temp_move_type
event.social.grudge_attack_id = -UCoders::Max_Actors if UCoders.has?("Social System")
end
#--------------------------------------------------------------------------
# * Get its current enemy
#--------------------------------------------------------------------------
def my_enemy
id = @attacking_id; return (id <= 0 ? $game_party.actors[id.abs] : $NeoABS.enemies[id])
end
#--------------------------------------------------------------------------
# * Get Range
#--------------------------------------------------------------------------
def get_range(object)
x = (event.x - object.x) * (event.x - object.x); y = (event.y - object.y) * (event.y - object.y)
return Math.sqrt(x + y).to_i
end
#--------------------------------------------------------------------------
# * In Range?(Element, Object, Range)
#--------------------------------------------------------------------------
def in_range?(object, range)
x = (event.x - object.x) * (event.x - object.x)
y = (event.y - object.y) * (event.y - object.y)
r = x + y
return r <= (range * range)
end
#--------------------------------------------------------------------------
# * In Direction?(Element, Object)
#--------------------------------------------------------------------------
def in_direction?(object)
return true if event.direction == 2 && object.y >= event.y && object.x == event.x
return true if event.direction == 4 && object.x <= event.x && object.y == event.y
return true if event.direction == 6 && object.x >= event.x && object.y == event.y
return true if event.direction == 8 && object.y <= event.y && object.x == event.x
return false
end
#--------------------------------------------------------------------------
# * dying?
#--------------------------------------------------------------------------
def dying?
return @hp < self.maxhp*0.25
end
#--------------------------------------------------------------------------
# * Kill
#--------------------------------------------------------------------------
def kill
@hp = 0
end
#--------------------------------------------------------------------------
# * Get Behavior(type)
#--------------------------------------------------------------------------
def behavior(r=0); return @behavior[r]; end
#--------------------------------------------------------------------------
# * Get See Range
#--------------------------------------------------------------------------
def see_range; return @range[0]; end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Get Hear Range
#--------------------------------------------------------------------------
def hear_range; return @range[1]; end
#--------------------------------------------------------------------------
# * Get Event
#--------------------------------------------------------------------------
def event; return $game_map.events[@event_id]; end
#--------------------------------------------------------------------------
# * Enemy Pre-Attack(Enemy,Actions) - Checks action conditions to see if the
# enemy can attack.
#--------------------------------------------------------------------------
def enemy_pre_attack(actions)
return true if self.hp * 100.0 / self.maxhp > actions.condition_hp
return true if $game_party.max_level < actions.condition_level
switch_id = actions.condition_switch_id
return true if actions.condition_switch_id > 0 and !$game_switches[switch_id]
return true if actions.kind == 0 and actions.basic == 0 and !self.behavior(1).include?(1)
return true if actions.rating < rand(11)
return false
end
#--------------------------------------------------------------------------
# * Get Index
#--------------------------------------------------------------------------
def index
return @member_index
end
#--------------------------------------------------------------------------
# * Get Name
#--------------------------------------------------------------------------
def name
return $data_enemies[@enemy_id].name
end
#--------------------------------------------------------------------------
# * Get Basic Maximum HP
#--------------------------------------------------------------------------
def base_maxhp
return $data_enemies[@enemy_id].maxhp
end
#--------------------------------------------------------------------------
# * Get Basic Maximum SP
#--------------------------------------------------------------------------
def base_maxsp
return $data_enemies[@enemy_id].maxsp
end
#--------------------------------------------------------------------------
# * Get Basic Strength
#--------------------------------------------------------------------------
def base_str
return $data_enemies[@enemy_id].str
end
#--------------------------------------------------------------------------
# * Get Basic Dexterity
#--------------------------------------------------------------------------
def base_dex
return $data_enemies[@enemy_id].dex
end
#--------------------------------------------------------------------------
# * Get Basic Agility
#--------------------------------------------------------------------------
def base_agi
return $data_enemies[@enemy_id].agi
end
#--------------------------------------------------------------------------
# * Get Basic Intelligence
#--------------------------------------------------------------------------
def base_int
return $data_enemies[@enemy_id].int
end
#--------------------------------------------------------------------------
# * Get Basic Attack Power
#--------------------------------------------------------------------------
def base_atk
return $data_enemies[@enemy_id].atk
end
#--------------------------------------------------------------------------
# * Get Basic Physical Defense
#--------------------------------------------------------------------------
def base_pdef
return $data_enemies[@enemy_id].pdef
end
#--------------------------------------------------------------------------
# * Get Basic Magic Defense
#--------------------------------------------------------------------------
def base_mdef
return $data_enemies[@enemy_id].mdef
end
#--------------------------------------------------------------------------
# * Get Basic Evasion
#--------------------------------------------------------------------------
def base_eva
return $data_enemies[@enemy_id].eva
end
#--------------------------------------------------------------------------
# * Get Offensive Animation ID for Normal Attack
#--------------------------------------------------------------------------
def animation1_id
return $data_enemies[@enemy_id].animation1_id
end
#--------------------------------------------------------------------------
# * Get Target Animation ID for Normal Attack
#--------------------------------------------------------------------------
def animation2_id
return $data_enemies[@enemy_id].animation2_id
end
#--------------------------------------------------------------------------
# * Get Element Revision Value
# element_id : Element ID
#--------------------------------------------------------------------------
def element_rate(element_id)
# Get a numerical value corresponding to element effectiveness
table = [0,200,150,100,50,0,-100]
result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
# If protected by state, this element is reduced by half
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# End Method
return result
end
#--------------------------------------------------------------------------
# * Get State Effectiveness
#--------------------------------------------------------------------------
def state_ranks
return $data_enemies[@enemy_id].state_ranks
end
#--------------------------------------------------------------------------
# * Determine State Guard
# state_id : state ID
#--------------------------------------------------------------------------
def state_guard?(state_id)
return false
end
#--------------------------------------------------------------------------
# * Get Normal Attack Element
#--------------------------------------------------------------------------
def element_set; return []; end
#--------------------------------------------------------------------------
# * Get Normal Attack State Change (+)
#--------------------------------------------------------------------------
def plus_state_set; return []; end
#--------------------------------------------------------------------------
# * Get Normal Attack State Change (-)
#--------------------------------------------------------------------------
def minus_state_set
return []
end
#--------------------------------------------------------------------------
# * Aquire Actions
#--------------------------------------------------------------------------
def actions
return $data_enemies[@enemy_id].actions
end
#--------------------------------------------------------------------------
# * Get EXP
#--------------------------------------------------------------------------
def exp
return $data_enemies[@enemy_id].exp
end
#--------------------------------------------------------------------------
# * Get Gold
#--------------------------------------------------------------------------
def gold
return $data_enemies[@enemy_id].gold
end
#--------------------------------------------------------------------------
# * Get Item ID
#--------------------------------------------------------------------------
def item_id
return $data_enemies[@enemy_id].item_id
end
#--------------------------------------------------------------------------
# * Get Weapon ID
#--------------------------------------------------------------------------
def weapon_id
return $data_enemies[@enemy_id].weapon_id
end
#--------------------------------------------------------------------------
# * Get Armor ID
#--------------------------------------------------------------------------
def armor_id
return $data_enemies[@enemy_id].armor_id
end
#--------------------------------------------------------------------------
# * Get Treasure Appearance Probability
#--------------------------------------------------------------------------
def treasure_prob
return $data_enemies[@enemy_id].treasure_prob
end
end
credit:
Mr.Mo