Introdução
Modo de batalha ABS leve e sem muitas lags e etc..
Características
* Herói tem animação de ataque hit e magic
* Animação para o inimigo (opcional)
* HUD personalizada baseada em Zelda 64
* Modo de dano modificado
* Boa customização
* ABS Leve sem muitos lag e etc.
* Singleplayer
Screenshots
Como usar
Cole o Script acima do Scrip Main, no editor de scripts.
Precisa do RMXP Standard Development Kit (SDK)
Demo
Não Necessário
Script:
Créditos e Agradecimentos
Prexus, Apidcloud, HugoLinux
Modo de batalha ABS leve e sem muitas lags e etc..
Características
* Herói tem animação de ataque hit e magic
* Animação para o inimigo (opcional)
* HUD personalizada baseada em Zelda 64
* Modo de dano modificado
* Boa customização
* ABS Leve sem muitos lag e etc.
* Singleplayer
Screenshots
Como usar
Cole o Script acima do Scrip Main, no editor de scripts.
Precisa do RMXP Standard Development Kit (SDK)
Demo
Não Necessário
Script:
- Código:
#-----------------------------------------------------------------------------#
# ► ABS Prexus 1.2 EX ◄
#
# Criado por Prexus
# Traduzido por Ogrim_Dooh
#-----------------------------------------------------------------------------#
# Dependências: #
# RMXP Standard Development Kit (SDK) #
#-----------------------------------------------------------------------------#
#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------
SDK.log('Prexus ABS', 'Prexus', 1, '18.12.05')
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.state('Prexus ABS') == true
#------------------------------------------------------------------------
# * Action Battle System (ABS) Class
#------------------------------------------------------------------------
# The core class and functional epicenter of the Action Battle System
#------------------------------------------------------------------------
class ABS
attr_accessor :p_animations
attr_accessor :e_animations
attr_accessor :player
attr_accessor :enemies
attr_accessor :events
attr_accessor :event_triggers
attr_reader :enabled
#----------------------------------------------------------------------
# * Initialization Handlers
#----------------------------------------------------------------------
# Makes sure that everything is set up to start the ABS
#----------------------------------------------------------------------
def initialize
@enabled = false
@player = $game_party.actors[0] # Sets to leader player
@enemies = {} # Enemy Hash
@events = {} # Hash of Dead Events
@event_triggers = {} # Hash of the Triggers of Dead Events
end
#----------------------------------------------------------------------
def setup_enemies(events)
@enemies = {} # Reset Enemy Hash
for event in events.values
parameters = SDK.event_comment_input(event, 3, 'ABS Setup')
next if !parameters
name = parameters[0].split
troop = parameters[1].split
trigger = parameters[2].split
for monster in $data_enemies
next if !monster
if name[1].upcase == monster.name.upcase
@enemies[event.id] = ABS::Enemy.new(monster.id)
@enemies[event.id].event_id = event.id
@enemies[event.id].troop = "ABS #{event.id}"
@enemies[event.id].troop = troop[1].upcase unless troop[1] == nil
@enemies[event.id].trigger_type = trigger[1].upcase
@enemies[event.id].trigger = trigger[2]
end
break if @enemies[event.id] != nil
end
end
end
#----------------------------------------------------------------------
def enable
@enabled = true
setup_enemies($game_map.events)
$scene.hud_window.visible = true if $scene.is_a?(Scene_Map)
update
end
#----------------------------------------------------------------------
def disable
@enabled = false
for enemy in @enemies.values
enemy.disengage
end
@enemies = {}
end
#----------------------------------------------------------------------
# * Update Handlers
#----------------------------------------------------------------------
# Updates and refreshes any information regarding characters, enemies,
# the ABS itself, or the graphic displays.
#----------------------------------------------------------------------
def update
update_player # Checks and updates player related stuff
for enemy in @enemies.values
update_enemy(enemy) # Checks and updates enemy related stuff
end
update_status # Checks and updates engine related stuff
update_hud # Checks and updates display related stuff
end
#----------------------------------------------------------------------
def update_player
@player = $game_party.actors[0] # Makes sure player is correct
# Decrease cooldown
@player.abs.chill if @player.abs.acted and @player.abs.cooldown != 0
# Reset acted if cooldown is over
@player.abs.acted = false if @player.abs.cooldown == 0
# Reset variables if player's cooldown has been reset
@player.abs.reset unless @player.abs.acted
end
#----------------------------------------------------------------------
def update_enemy(enemy)
enemy.find_player # Checks if player is close
if enemy.engaged
enemy.guarding = false # Resets guarding
enemy.chill if enemy.cooldown != 0 # Decrease cooldown
if enemy.cooldown == 0
enemy.reset if enemy.check_ai # Reset timers
enemy.cooldown /= 2 if enemy.guarding
end
enemy.path_find # Pathfind to the player
end
if enemy.dead?
collect_spoils(enemy) # Collect items and exp
remove(enemy) # Remove enemy based on its triggers
end
end
#----------------------------------------------------------------------
def update_status
$game_temp.gameover = true if $game_party.all_dead? # End game if dead.
end
#----------------------------------------------------------------------
def update_hud
#hud **Censurado** goes here
end
#----------------------------------------------------------------------
# * ABS Functions
#----------------------------------------------------------------------
# Handles anything regarding the ABS best done outside of other classes
#----------------------------------------------------------------------
def collect_spoils(enemy)
exp = enemy.exp # Set to the enemy's EXP amount
gold = enemy.gold # Set to the enemy's GOLD amount
if rand(100) < enemy.treasure_prob # Random Probability of SPOIL
if enemy.item_id > 0 # If its an ITEM
treasure = $data_items[enemy.item_id]
end
if enemy.weapon_id > 0 # If its a WEAPON
treasure = $data_weapons[enemy.weapon_id]
end
if enemy.armor_id > 0 # If its an ARMOR
treasure = $data_armors[enemy.armor_id]
end
end
@player.exp += exp unless @player.cant_get_exp? # Add Appropriate EXP
$game_party.gain_gold(gold) # Add Appropriate GOLD
case treasure
when RPG::Item
$game_party.gain_item(item.id, 1) # Add ITEM
when RPG::Weapon
$game_party.gain_weapon(item.id, 1) # Add WEAPON
when RPG::Armor
$game_party.gain_armor(item.id, 1) # Add ARMOR
end
end
#----------------------------------------------------------------------
def remove(enemy)
@enemies.delete(enemy.event_id) # Remove dead enemy from hash
case enemy.trigger_type
when 'LOCAL' # If trigger is a local switch
case enemy.trigger.upcase
when 'A','B','C','D' # If the trigger is a valid trigger
event = $game_map.events[enemy.event_id]
key = [event.map_id, event.id, enemy.trigger.upcase]
$game_self_switches[key] = true
@events[event.id] = event
@event_triggers[event.id] = enemy.trigger.upcase
return
end
when 'SWITCH' # If the trigger is a switch
if enemy.trigger.to_i > 0 # If the trigger is a valid switch
$game_switches[enemy.trigger.to_i] = true
return
end
when 'CHEST'
event = $game_map.events[enemy.event_id]
key = [event.map_id, event.id, 'A']
$game_self_switches[key] = true
@events[event.id] = event
@event_triggers[event.id] = enemy.trigger_type.upcase
return
end
# Else just remove the event lickity split.
$game_map.events[enemy.event_id].character_name = ''
$game_map.events[enemy.event_id].erase
end
#----------------------------------------------------------------------
# * Calculation Functions
#----------------------------------------------------------------------
# Handles range and direction checks
#----------------------------------------------------------------------
def check_range(element, object, range = 0)
element = $game_map.events[element.event_id] if element.is_a?(ABS::Enemy)
object = $game_map.events[object.event_id] if object.is_a?(ABS::Enemy)
x = (object.x - element.x) * (object.x - element.x)
y = (object.y - element.y) * (object.y - element.y)
r = x + y
if r <= (range * range)
return true
end
return false
end
#----------------------------------------------------------------------
def find_range(element, object)
element = $game_map.events[element.event_id] if element.is_a?(ABS::Enemy)
object = $game_map.events[object.event_id] if object.is_a?(ABS::Enemy)
x = (object.x - element.x) * (object.x - element.x)
y = (object.y - element.y) * (object.y - element.y)
return (x + y)
end
#----------------------------------------------------------------------
def check_facing(element, object)
element = $game_map.events[element.event_id] if element.is_a?(ABS::Enemy)
object = $game_map.events[object.event_id] if object.is_a?(ABS::Enemy)
if element.direction == 2
return true if object.y >= element.y
end
if element.direction == 4
return true if object.x <= element.x
end
if element.direction == 6
return true if object.x >= element.x
end
if element.direction == 8
return true if object.y <= element.y
end
return false
end
#----------------------------------------------------------------------
# * ABS Animation Engine Functions
#----------------------------------------------------------------------
# Handles animating map sprites for a wide variety of uses
#----------------------------------------------------------------------
def animate(object, animation_name, position, wait = 8, frames = 0, repeat = 0)
if object != nil
object.animate(animation_name, position, frames, wait, repeat)
end
end
#----------------------------------------------------------------------
# * ABS Enemy Object
#----------------------------------------------------------------------
# This object handles interaction between the event and the enemy and
# deals with all the attacks and such.
#----------------------------------------------------------------------
class Enemy < Game_Battler
attr_accessor :event_id
attr_accessor :engaged
attr_accessor :trigger_type
attr_accessor :trigger
attr_accessor :cooldown
attr_accessor :dis_cooldown
attr_accessor :guarding
attr_accessor :troop
#--------------------------------------------------------------------
# * Initialize Handlers
#--------------------------------------------------------------------
# Handles setting up all the stats and information needed by the ABS
#--------------------------------------------------------------------
def initialize(monster_id)
super()
@event_id = 0
@enemy_id = monster_id
@trigger_type = nil
@trigger = nil
@engaged = false
@guarding = false
@cooldown = 0
@dis_cooldown = 0
@move_type = 0
@move_frequency = 0
@move_speed = 0
@hp = maxhp
@sp = maxsp
@troop = nil
end
#--------------------------------------------------------------------
# * Enemy Artificial Intelligence
#--------------------------------------------------------------------
# Handles the enemy's decision making and priorities.
#--------------------------------------------------------------------
def check_ai
check_status
return true if check_self_status
return true if check_troop_status
return false unless @engaged
return true if check_range_spell if @hp < (maxhp/25)
return true if check_melee_attack
return true if check_range_spell unless @hp < (maxhp/25)
@guarding = (1 == rand(5))
return @guarding
end
#--------------------------------------------------------------------
def set_skills(kind = 1)
skills = []
for action in $data_enemies[@enemy_id].actions
skills.push($data_skills[action.skill_id]) if action.kind == kind
end
return skills
end
#--------------------------------------------------------------------
def check_self_status
if @hp < (maxhp/25)
skills = set_skills(1)
return false if skills.size == 0 or skills == []
for skill in skills
next if !skill_can_use?(skill.id)
next unless [3, 4, 7].include?(skill.scope) and skill.power < 0
case skill.scope
when 3,7
target_enemies = [self]
when 4
target_enemies = []
for enemy in $ABS.enemies.values
target_enemies.push(enemy) if enemy.troop == @troop and
$ABS.check_range($game_map.events[@event_id], $game_map.events[enemy.event_id], skill.range)
end
end
for target in target_enemies
target.skill_effect(self, skill)
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_map.events[target.event_id]
end
sprite.damage(target.damage, target.critical) if sprite
end
successful_hit(self, target_enemies, skill) unless target_enemies == nil
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-cast',
event.direction/2, 4, 3, 0) if $ABS.e_animations
return true
end
return false
end
end
#--------------------------------------------------------------------
def check_troop_status
skills = set_skills(1)
return false if skills.size == 0 or skills == []
troop = []
for enemy in $ABS.enemies.values
troop.push(enemy) if enemy.troop == @troop and (enemy.hp <
(enemy.maxhp*0.25)) and enemy != self
end
return false if troop.size == 0 or troop == []
for skill in skills
next if !skill_can_use?(skill.id)
next unless [3, 4].include?(skill.scope) and skill.power < 0
case skill.scope
when 3
top_target = self
for target in troop
top_target = target if target.hp < top_target.hp and
$ABS.check_range($game_map.events[@event_id], $game_map.events[target.event_id], skill.range)
end
target_enemies = [top_target]
when 4
target_enemies = []
for target in troop
target_enemies.push(target) if
$ABS.check_range($game_map.events[@event_id],
$game_map.events[target.event_id], skill.range)
end
end
for target in target_enemies
target.skill_effect(self, skill)
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_map.events[target.event_id]
end
sprite.damage(target.damage, target.critical) if sprite
end
successful_hit(self, target_enemies, skill) unless target_enemies == nil
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-cast',
event.direction/2, 4, 3, 0) if $ABS.e_animations
return true
end
return false
end
#------------------------------------------------------------------------
def check_melee_attack
if $ABS.check_range(self, $game_player, 1) and
$ABS.check_facing(self, $game_player) and @cooldown == 0
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-atk',
event.direction/2, 4, 3, 0) if $ABS.e_animations
$ABS.player.attack_effect(self)
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_player
end
sprite.damage($ABS.player.damage, $ABS.player.critical) if sprite
if $ABS.player.damage != 'Miss' and $ABS.player.damage != 0
successful_hit(self, [$ABS.player])
end
return true
end
return false
end
#------------------------------------------------------------------------
def check_range_spell
skills = set_skills(1)
return false if skills.size == 0 or skills == []
viable_skills = []
for skill in skills
next if !skill_can_use?(skill.id)
next unless $ABS.check_range($game_map.events[@event_id], $game_player, skill.range)
next unless [1, 2].include?(skill.scope) or skill.power >= 0
viable_skills.push(skill)
end
return false if viable_skills.size == 0 or viable_skills == []
skill = viable_skills[rand(viable_skills.size+1)]
return false if skill == nil
$ABS.player.skill_effect(self, skill)
event = $game_map.events[@event_id]
$ABS.animate(event, event.page.graphic.character_name + '-cast',
event.direction/2, 4, 3, 0) if $ABS.e_animations
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_player
end
sprite.damage($ABS.player.damage, $ABS.player.critical) if sprite
successful_hit(self, [$ABS.player], skill)
return true
end
#------------------------------------------------------------------------
def reset
@cooldown = ((Graphics.frame_rate * ((500 + (999 - agi)*1.2) / 1000)) * 1.5).floor
end
#------------------------------------------------------------------------
def chill
@cooldown -= 1 unless @cooldown == 0
end
#------------------------------------------------------------------------
def find_player
if $ABS.check_range(self, $game_player, 7) and
$ABS.check_facing(self, $game_player)
engage unless @engaged
return
end
check_disengage if @engaged
return
end
#------------------------------------------------------------------------
def guarding?
return @guarding
end
#------------------------------------------------------------------------
def successful_hit(object = self, target = [$game_party.actors[0]], skill = nil)
anim1 = 0; anim2 = 0
if skill == nil
anim1 = animation1_id if !$ABS.p_animations
anim2 = animation2_id
else
anim1 = skill.animation1_id if !$ABS.p_animations
anim2 = skill.animation2_id
end
if object.is_a?(Game_Actor)
$game_player.animation_id = anim1 if !$ABS.p_animations
else
event = $game_map.events[object.event_id]
event.animation_id = anim1 if !$ABS.e_animations
end
return if !target
for tar in target
next if !tar
if tar.is_a?(Game_Actor)
$game_player.animation_id = anim2
$ABS.animate($game_player, $game_player.character_name + '-hit',
$game_player.direction/2, 4, 3) if $ABS.p_animations
else
event = $game_map.events[tar.event_id]
event.animation_id = anim2
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
end
end
end
#------------------------------------------------------------------------
def engage
@engaged = true
engage_troops
@dis_cooldown = 500
reset
event = $game_map.events[@event_id]
@move_type = event.move_type
@move_frequency = event.move_frequency
@move_speed = event.move_speed
event.move_type = 2
event.move_frequency = 5
event.move_speed = 5
end
#------------------------------------------------------------------------
def engage_troops
for enemy in $ABS.enemies.values
if enemy.troop == @troop
enemy.engage unless enemy.engaged
end
end
end
#------------------------------------------------------------------------
def disengage
@engaged = false
event = $game_map.events[@event_id]
event.move_type = @move_type
event.move_frequency = @move_frequency
event.move_speed = @move_speed
end
#------------------------------------------------------------------------
def check_disengage
@dis_cooldown -= 1
if @dis_cooldown == 0
disengage
end
end
#------------------------------------------------------------------------
def check_status
if hp < (maxhp / 25)
event = $game_map.events[@event_id]
event.move_type = 4
event.move_frequency = 5
event.move_speed = 5
else
event = $game_map.events[@event_id]
event.move_type = 2
event.move_frequency = 5
event.move_speed = 5
end
end
#------------------------------------------------------------------------
def path_find
return if $game_map.events[@event_id].runpath
$game_map.events[@event_id].find_object($game_player)
end
#------------------------------------------------------------------------
def id
return @enemy_id
end
#------------------------------------------------------------------------
def name
return $data_enemies[@enemy_id].name
end
#------------------------------------------------------------------------
def base_maxhp
return $data_enemies[@enemy_id].maxhp
end
#------------------------------------------------------------------------
def base_maxsp
return $data_enemies[@enemy_id].maxsp
end
#------------------------------------------------------------------------
def base_str
return $data_enemies[@enemy_id].str
end
#------------------------------------------------------------------------
def base_dex
return $data_enemies[@enemy_id].dex
end
#------------------------------------------------------------------------
def base_agi
return $data_enemies[@enemy_id].agi
end
#------------------------------------------------------------------------
def base_int
return $data_enemies[@enemy_id].int
end
#------------------------------------------------------------------------
def base_atk
return $data_enemies[@enemy_id].atk
end
#------------------------------------------------------------------------
def base_pdef
return $data_enemies[@enemy_id].pdef
end
#------------------------------------------------------------------------
def base_mdef
return $data_enemies[@enemy_id].mdef
end
#------------------------------------------------------------------------
def base_eva
return $data_enemies[@enemy_id].eva
end
#------------------------------------------------------------------------
def animation1_id
return $data_enemies[@enemy_id].animation1_id
end
#------------------------------------------------------------------------
def animation2_id
return $data_enemies[@enemy_id].animation2_id
end
#------------------------------------------------------------------------
def element_rate(element_id)
table = [0,200,150,100,50,0,-100]
result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
for i in @states
result /= 2 if $data_states[i].guard_element_set.include?(element_id)
end
return result
end
#------------------------------------------------------------------------
def state_ranks
return $data_enemies[@enemy_id].state_ranks
end
#------------------------------------------------------------------------
def state_guard?(state_id)
return false
end
#------------------------------------------------------------------------
def element_set
return []
end
#------------------------------------------------------------------------
def plus_state_set
return []
end
#------------------------------------------------------------------------
def minus_state_set
return []
end
#------------------------------------------------------------------------
def actions
return $data_enemies[@enemy_id].actions
end
#------------------------------------------------------------------------
def exp
return $data_enemies[@enemy_id].exp
end
#------------------------------------------------------------------------
def gold
return $data_enemies[@enemy_id].gold
end
#------------------------------------------------------------------------
def item_id
return $data_enemies[@enemy_id].item_id
end
#------------------------------------------------------------------------
def weapon_id
return $data_enemies[@enemy_id].weapon_id
end
#------------------------------------------------------------------------
def armor_id
return $data_enemies[@enemy_id].armor_id
end
#------------------------------------------------------------------------
def treasure_prob
return $data_enemies[@enemy_id].treasure_prob
end
end # End ABS::Enemy Class
end # End ABS Class
#------------------------------------------------------------------------
# * Game Actor ABS Clsas
#------------------------------------------------------------------------
# This is how the Player interacts with enemies and hotkeys
#------------------------------------------------------------------------
class Game_Actor
attr_accessor :abs
#------------------------------------------------------------------------
alias prexus_abs_g_actor_setup setup
#------------------------------------------------------------------------
def setup(actor_id)
prexus_abs_g_actor_setup(actor_id)
@abs = Game_Actor::ABS.new # Setup the ABS class
end
#------------------------------------------------------------------------
class ABS
attr_accessor :cooldown
attr_accessor :acted
attr_accessor :hot_key
#----------------------------------------------------------------------
def initialize
@cooldown = 0 # Attacking/casting cooldown
@acted = false # Flag for whether or not you've acted recently
@hot_key = [nil, nil, nil] # Hot key array
end
#----------------------------------------------------------------------
# * Cooldown/input methods
#----------------------------------------------------------------------
def chill
@cooldown -= 1 if @acted and @cooldown != 0
end
#----------------------------------------------------------------------
def reset
@cooldown = ((Graphics.frame_rate * ((500 + (999 -
$game_party.actors[0].agi)*1.2) / 1000)) * 1.5).floor / 2 unless @acted
end
#----------------------------------------------------------------------
# * Attacking/Spell Casting Methods
#----------------------------------------------------------------------
def attack
# Animate Actor:
$ABS.animate($game_player, $game_player.character_name + '-atk',
$game_player.direction/2, 4, 3) if $ABS.p_animations
$game_player.animation_id = $ABS.player.animation1_id unless $ABS.p_animations
for enemy in $ABS.enemies.values
next if !$ABS.check_range($game_player, enemy, 1) # If enemy is in range
next if !$ABS.check_facing($game_player, enemy) # and not behind
enemy.attack_effect($ABS.player) # hit the enemy
event = $game_map.events[enemy.event_id]
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == event
end
sprite.damage(enemy.damage, enemy.critical) if sprite # show damage
if enemy.damage != 'Miss' and enemy.damage != 0 # if the attack hit
# Animate Enemy:
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
event.animation_id = $ABS.player.animation2_id
end
@acted = true # Yes you've recently attacked!
end
end
#----------------------------------------------------------------------
def cast(skill)
return unless skill
skill = $data_skills[skill]
return unless skill or $ABS.player.skill_can_use?(skill.id) # Can use?
return if $ABS.player.sp < skill.sp_cost # We sure about that?
@acted = true # Then you've acted!
reset # Reset the cooldown for some reason
# Animate Actor:
$game_player.animation_id = skill.animation1_id
$ABS.animate($game_player, $game_player.character_name + '-cast',
$game_player.direction/2, 4, 3, 0) if $ABS.p_animations
# Deal with SP
$ABS.player.sp -= skill.sp_cost
case skill.scope
when 1 # One Enemy
target = find_single_target(skill) # Find closest enemy
return unless target # If you found a valid enemy
target.skill_effect($ABS.player, skill) # Hit enemy
event = $game_map.events[target.event_id]
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == event
end
sprite.damage(target.damage, target.critical) if sprite # Show damage
# Animate Enemy:
event.animation_id = skill.animation2_id
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
when 2 # Multiple Enemies
target = find_all_target(skill) # Find all enemies in range
return unless target # If you found valid enemies
for tar in target # For all the enemies:
tar.skill_effect($ABS.player, skill) # Hit enemy
event = $game_map.events[tar.event_id]
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == event
end
sprite.damage(tar.damage, tar.critical) if sprite # Show damage
# Animate Enemy:
event.animation_id = skill.animation2_id
$ABS.animate(event, event.page.graphic.character_name + '-hit',
event.direction/2, 4, 3, 0) if $ABS.e_animations
end
when 3..4,7 # For yourself
$ABS.player.skill_effect($ABS.player, skill) # Hit yourself
sprite = nil
for spr in $scene.spriteset.character_sprites
sprite = spr if spr.character == $game_player
end
sprite.damage($ABS.player.damage, $ABS.player.critical) if sprite # Show heal
# Animate self:
$game_player.animation_id = skill.animation2_id
else
return
end
end
#----------------------------------------------------------------------
# * Target Finding Methods
#----------------------------------------------------------------------
def find_single_target(skill)
targets = [] # Holds the valid targets
target_range = [] # Holds their range from player
final_targets = [] # Holds final targets (only valids)
for enemy in $ABS.enemies.values
next if !$ABS.check_range($game_player, enemy, skill.range) # If in range
next if !$ABS.check_facing($game_player, enemy) # If player can see
targets.push(enemy) # Shove the enemy
target_range.push($ABS.find_range($game_player, enemy)) # Shove his range
end
big_range = 0 # Lowest Range from Player
for i in target_range # Finding the lowest range of valid targets
big_range = i if i > big_range
end
for i in 0...targets.size # Finding the targets inside that range
final_targets.push(targets[i]) if target_range[i] <= big_range
end
random = rand(final_targets.size)-1 # Selecting one of the targets
random = 0 if random < 0
return final_targets[random] # Return that target
end
#----------------------------------------------------------------------
def find_all_target(skill)
targets = [] # All Targets
for enemy in $ABS.enemies.values
next if !$ABS.check_range($game_player, enemy, skill.range) # If in range
next if !$ABS.check_facing($game_player, enemy) # If player can see
targets.push(enemy) # Shove enemy
end
return targets # Return all enemies
end
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end # End SDK Check
#==============================================================================
# * Prexus ABS
#------------------------------------------------------------------------------
# Prexus
# Version 1 Final Build
# 18.12.05
#==============================================================================
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.state('Prexus ABS') == true
class Game_Map
alias prexus_abs_g_map_setup setup
def setup(map_id)
prexus_abs_g_map_setup(map_id)
$ABS = ABS.new if !$ABS
$ABS.setup_enemies(@events)
end
end
#--------------------------------------------------------------------------
class Scene_Map
attr_accessor :spriteset
alias prexus_abs_s_map_update update
def update
$ABS.update if $ABS.enabled
if !$ABS.player.abs.acted and !$game_party.actors[0].guarding? and $ABS.enabled
$ABS.player.abs.attack if Input.trigger?(Input::A) and $ABS.player.weapon_id > 0
$ABS.player.abs.cast($ABS.player.abs.hot_key[0]) if Input.trigger?(Input::X)
$ABS.player.abs.cast($ABS.player.abs.hot_key[1]) if Input.trigger?(Input::Y)
$ABS.player.abs.cast($ABS.player.abs.hot_key[2]) if Input.trigger?(Input::Z)
end
prexus_abs_s_map_update
end
end
#--------------------------------------------------------------------------
class Game_Actor
#------------------------------------------------------------------------
def guarding?
return true if Input.press?(Input::L)
return false
end
end
#--------------------------------------------------------------------------
class Game_Event
attr_reader :page
attr_reader :map_id
def name
return @event.name
end
end
#--------------------------------------------------------------------------
class Game_Character
attr_accessor :move_type
attr_accessor :move_frequency
attr_accessor :move_speed
attr_accessor :character_name
attr_accessor :wait
attr_accessor :old_chr_name
attr_accessor :old_dir
attr_accessor :animating
#------------------------------------------------------------------------
alias animation_engine_game_character_initialize initialize
#------------------------------------------------------------------------
def initialize
animation_engine_game_character_initialize
@animating = false
@wait = false
@old_chr_name = @character_name
@old_dir = @direction
end
#------------------------------------------------------------------------
def animate(animation_name, position, frames, wait, repeat)
@character_name = animation_name if @animating == false
@pattern = 0
@count = 0
@repeat = repeat
@direction_fix = true
@old_dir = @direction
@direction = position * 2
@frames = frames
lock
@animating = true
@wait = wait
@anim_wait_count = @wait
update
return
end
#------------------------------------------------------------------------
def update_animate
if @anim_wait_count > 0
@anim_wait_count -= 1
return
end
if @pattern >= @frames or moving?
if !moving?
if @count < @repeat
@pattern = 0
@count += 1
@anim_wait_count = @wait
update
return
end
end
unlock
@animating = false
@pattern = 0
@direction_fix = false
@direction = @old_dir
if self.is_a?(Game_Event)
@character_name = @page != nil ? @page.graphic.character_name : ''
else
@character_name = @old_chr_name
end
$game_player.refresh
$game_map.refresh
return
end
@pattern += 1
@anim_wait_count = @wait
update
end
#------------------------------------------------------------------------
def update_movement_type
if @animating == true
update_animate
return
end
if jumping?
update_jump
elsif moving?
update_move
else
update_stop
end
end
#------------------------------------------------------------------------
def update_movement
if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
case @move_type
when 1 # Random
move_type_random
when 2
if @runpath
run_path
else
move_type_toward_player
end
when 3
move_type_custom
when 4
move_type_escape_player
end
end
end
#------------------------------------------------------------------------
# * Move Type : Escape
#------------------------------------------------------------------------
def move_type_escape_player
sx = @x - $game_player.x
sy = @y - $game_player.y
abs_sx = sx > 0 ? sx : -sx
abs_sy = sy > 0 ? sy : -sy
if sx + sy >= 20
move_random
return
end
move_away_from_player
end
#------------------------------------------------------------------------
# * Move Type : Approach
#------------------------------------------------------------------------
def move_type_toward_player
sx = @x - $game_player.x
sy = @y - $game_player.y
abs_sx = sx > 0 ? sx : -sx
abs_sy = sy > 0 ? sy : -sy
if sx + sy >= 20
move_random
return
end
move_toward_player
end
#------------------------------------------------------------------------
# * Move away from Player
#------------------------------------------------------------------------
def move_away_from_player
sx = @x - $game_player.x
sy = @y - $game_player.y
if sx == 0 and sy == 0
return
end
abs_sx = sx.abs
abs_sy = sy.abs
if abs_sx == abs_sy
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
if abs_sx > abs_sy
sx > 0 ? move_right : move_left
if not moving?
rand(2) == 1 ? move_down : move_up
end
else
sy > 0 ? move_down : move_up
if not moving?
rand(2) == 1
Créditos e Agradecimentos
Prexus, Apidcloud, HugoLinux