$imported = {} if $imported.nil?
$imported["YEA-BattleEngine"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.03.04 - Bug fixed: Input crash bug.
# 2012.02.13 - Bug fixed: Odd Victory game crash fixed.
# 2012.02.12 - Bug fixed: Displayed damage in combat log is correct now.
# 2012.01.29 - Visual Changes: Buff stacks now show one popup upon one skill.
# 2012.01.24 - Compatibility Update: Enemy Levels
# 2012.01.18 - Bug Fixed: Help Window clears text upon selecting nil items.
# 2012.01.11 - Added <one animation> tag for multi-hit skills to play an
# animation only once.
# - Reduced lag from battle system constantly recreating bitmaps.
# 2012.01.10 - Compatibility Update: Battle System FTB
# 2012.01.09 - Anticrash methods implemented.
# - Damage Popups are now separate for damage formulas and recovery.
# 2012.01.05 - Bug fixed: Game no longer crashes with escape skills/items.
# 2012.01.02 - Compatibility Update: Target Manager
# - Added Option: AUTO_FAST
# - Random hits now show animations individually.
# 2011.12.30 - Compatibility Update: Enemy Levels
# - Added Option to center the actors in the HUD.
# 2011.12.27 - Bug fixed: TP Damage skills and items no longer crash game.
# - Default battle system bug fixes are now included from YEA's Ace
# Core Engine.
# - Groundwork is also made to support future battle system types.
# - Multi-hit actions no longer linger when a target dies during the
# middle of one of the hits.
# - Compatibility Update: Lunatic Objects v1.02
# 2011.12.26 - Bug fixed: Multi-hit popups occured even after an enemy's dead.
# 2011.12.22 - Bug fixed: Elemental Resistance popup didn't show.
# 2011.12.20 - Bug fixed: Death state popups against immortal states.
# - Bug fixed: During State popup fix.
# - Added HIDE_POPUP_SWITCH.
# 2011.12.17 - Compatibiilty Update: Cast Animations
# 2011.12.15 - Compatibility Update: Battle Command List
# 2011.12.14 - Compatibility Update: Lunatic Objects
# 2011.12.13 - Compatibility Update: Command Party
# 2011.12.12 - Bug fixed: Turn stalling if no inputable members.
# 2011.12.10 - Compatibility update for Automatic Party HUD.
# - Popup graphical bug fixed.
# - Bug fixed: Didn't wait for boss dead animations.
# - Bug fixed: Surprise attacks that froze the game.
# - Bug fixed: Popups didn't show for straight recovery effects.
# 2011.12.08 - Finished Script.
# 2011.12.04 - Started Script.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Ace Battle Engine works as a foundation for future battle engine add-ons. It
# allows for easier management of the battle engine without adding too many
# features, allowing users to customize what they want as they see fit. While
# the Ace Battle Engine isn't an entirely new engine, it gives users control
# that RPG Maker VX Ace didn't originally give them.
#
# Furthermore, this script provides some new features. They are as follows:
#
# -----------------------------------------------------------------------------
# Animation Fixes
# -----------------------------------------------------------------------------
# Though the Yanfly Engine Ace - Ace Core Engine script contains these fixes,
# these fixes are included in this script as well to ensure it's working for
# the battle script in the event someone chooses not to work with the Ace Core
# Engine script. The animation fixes prevent excessive animation overlaying
# (and making the screen look really ugly) and prevents animation clashing
# between two dual wielding normal attack animations.
#
# -----------------------------------------------------------------------------
# Enemy Animations
# -----------------------------------------------------------------------------
# Enemies now show battle animations when they deliver attacks and skills
# against the player's party. Before in RPG Maker VX Ace, it was nothing more
# than just sound effects and the screen shaking. Now, animations play where
# the status window is and relative to the position of each party member.
#
# -----------------------------------------------------------------------------
# Left/Right Command Selection
# -----------------------------------------------------------------------------
# While choosing actions, the player can press Left or Right to move freely
# between (alive) actors to change their skills. Players no longer have to
# cancel all the way back to change one person's skill and reselect everything.
# On that note, there is now the option that when a battle starts or at the
# end of a turn, players will start immediately at command selection rather
# than needing to select "Fight" in the Party Command Window.
#
# -----------------------------------------------------------------------------
# Popups
# -----------------------------------------------------------------------------
# Dealing damage, inflicting states, adding buffs, landing critical hits,
# striking weaknesses, missing attacks, you name it, there's probably a popup
# for it. Popups deliver information to the player in a quick or orderly
# fashion without requiring the player to read lines of text.
#
# -----------------------------------------------------------------------------
# Targeting Window
# -----------------------------------------------------------------------------
# When targeting enemies, the window is no longer displayed. Instead, the
# targeted enemies are highlighted and their names are shown at the top of the
# screen in a help window. Another thing that's changed is when skills that
# target multiple targets are selected, there is a confirmation step that the
# player must take before continuing. In this confirmation step, all of the
# multiple targets are selected and in the help window would display the scope
# of the skill (such as "All Foes" or "Random Foes"). RPG Maker VX Ace skipped
# this step by default.
#
# -----------------------------------------------------------------------------
# Toggling On and Off Special Effects and Text
# -----------------------------------------------------------------------------
# Not everybody likes having the screen shake or the enemies blink when they
# take damage. These effects can now be toggled on and off. Certain text can
# also be toggled on and off from appearing. A lot of the displayed text has
# been rendered redundant through the use of popups.
#
# -----------------------------------------------------------------------------
# Visual Battle Status Window
# -----------------------------------------------------------------------------
# Rather than just having rows of names with HP and MP bars next to them, the
# Battle Status Window now displays actors' faces and their gauges aligned at
# the bottom. More status effects can be shown in addition to showing more
# members on screen at once. The Battle Status Window is also optimized to
# refresh less (thus, removing potential lag from the system).
#
# -----------------------------------------------------------------------------
# Window Position Changes
# -----------------------------------------------------------------------------
# Windows such as the Skill Window and Item Window have been rearranged to
# always provide the player a clear view of the battlefield rather than opening
# up and covering everything. As such, the window positions are placed at the
# bottom of the screen and are repositioned.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skills notebox in the database.
# -----------------------------------------------------------------------------
# <one animation>
# Causes the action to display the action animation only once, even if it's a
# multi-hit action. This is used primarily for non-all scope targeting.
#
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the items notebox in the database.
# -----------------------------------------------------------------------------
# <one animation>
# Causes the action to display the action animation only once, even if it's a
# multi-hit action. This is used primarily for non-all scope targeting.
#
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemy notebox in the database.
# -----------------------------------------------------------------------------
# <atk ani 1: x>
# <atk ani 2: x>
# Changes the normal attack animation of the particular enemy to animation x.
# Attack animation 1 is the first one that plays. If there's a second animation
# then the second one will play after in mirrored form.
#
# -----------------------------------------------------------------------------
# State Notetags - These notetags go in the state notebox in the database.
# -----------------------------------------------------------------------------
# <popup add: string>
# <popup rem: string>
# <popup dur: string>
# Status effects now create popups whenever they're inflicted. However, if you
# don't like that a certain status effect uses a particular colour setting,
# change "string" to one of the rulesets below to cause that popup to use a
# different ruleset.
#
# <popup hide add>
# <popup hide rem>
# <popup hide dur>
# Not everybody wants status effects to show popups when inflicted. When this
# is the case, insert the respective tag to hide popups from appearing when the
# state is added, removed, or during the stand-by phases.
#
# -----------------------------------------------------------------------------
# Debug Tools - These tools only work during Test Play.
# -----------------------------------------------------------------------------
# - F5 Key -
# Recovers all actors. Restores their HP and MP to max. Does not affect TP.
# All states and buffs are removed whether they are positive or negative.
#
# - F6 Key -
# Sets all actors to have 1 HP, 0 MP, and 0 TP. States are unaffected.
#
# - F7 Key -
# Sets all actors to have max TP. Everything else is unaffected.
#
# - F8 Key -
# Kills all enemies in battle. Ends the battle quickly.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YEA
module BATTLE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Battle Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings are adjusted for the overall battle system. These are
# various miscellaneous options to adjust. Each of the settings below will
# explain what they do. Change default enemy battle animations here, too.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
BLINK_EFFECTS = false # Blink sprite when damaged?
FLASH_WHITE_EFFECT = true # Flash enemy white when it starts an attack.
SCREEN_SHAKE = false # Shake screen in battle?
SKIP_PARTY_COMMAND = true # Skips the Fight/Escape menu.
AUTO_FAST = false # Causes message windows to not wait.
ENEMY_ATK_ANI = 36 # Sets default attack animation for enemies.
# If this switch is ON, popups will be hidden. If OFF, the popups will be
# shown. If you do not wish to use this switch, set it to 0.
HIDE_POPUP_SWITCH = 0
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Battle Status Window -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This sets the default battle system your game will use. If your game
# doesn't have any other battle systems installed, it will use :dtb.
#
# Battle System Requirement
# :dtb - Default Turn Battle. Default system.
# :ftb - YEA Battle System Add-On: Free Turn Battle
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
DEFAULT_BATTLE_SYSTEM = :dtb # Default battle system set.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Battle Status Window -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Here, you can adjust the settings for the battle status window. The
# battle status window, by default, will show the actor's face, HP, MP, TP
# (if viable), and any inflicted status effects.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
BATTLESTATUS_NAME_FONT_SIZE = 20 # Font size used for name.
BATTLESTATUS_TEXT_FONT_SIZE = 16 # Font size used for HP, MP, TP.
BATTLESTATUS_NO_ACTION_ICON = 185 # No action icon.
BATTLESTATUS_HPGAUGE_Y_PLUS = 11 # Y Location buffer used for HP gauge.
BATTLESTATUS_CENTER_FACES = false # Center faces for the Battle Status.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Help Window Text -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# When selecting a target to attack, this is the text that will be shown
# in place of a target's name for special cases. These special cases are
# for selections that were originally non-targetable battle scopes.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
HELP_TEXT_ALL_FOES = "全部敌人"
HELP_TEXT_ONE_RANDOM_FOE = "一个随机敌人"
HELP_TEXT_MANY_RANDOM_FOE = "%d 个随机敌人"
HELP_TEXT_ALL_ALLIES = "全部队友"
HELP_TEXT_ALL_DEAD_ALLIES = "全部死亡队友"
HELP_TEXT_ONE_RANDOM_ALLY = "一个随机队友"
HELP_TEXT_RANDOM_ALLIES = "%d 个随机队友"
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Popup Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings will adjust the popups that appear in battle. Popups
# deliver information to your player as battlers deal damage, inflict
# status effects, and more.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
ENABLE_POPUPS = true # Set this to false if you wish to disable them.
FLASH_CRITICAL = true # Sets critical hits to flash.
# This hash adjusts the popup settings that will govern how popups appear.
# Adjust them accordingly.
POPUP_SETTINGS ={
:offset => -24, # Height offset of a popup.
:fade => 12, # Fade rate for each popup.
:full => 60, # Frames before a popup fades.
:hp_dmg => "-%s ", # SprintF for HP damage.
:hp_heal => "+%s ", # SprintF for HP healing.
:mp_dmg => "-%s MP", # SprintF for MP damage.
:mp_heal => "+%s MP", # SprintF for MP healing.
:tp_dmg => "-%s TP", # SprintF for MP damage.
:tp_heal => "+%s TP", # SprintF for MP healing.
:drained => "耗尽", # Text display for draining HP/MP.
:critical => "关键一击!", # Text display for critical hit.
:missed => "未击中", # Text display for missed attack.
:evaded => "回避!", # Text display for evaded attack.
:nulled => "无效", # Text display for nulled attack.
:failed => "失败", # Text display for a failed attack.
:add_state => "+%s", # SprintF for added states.
:rem_state => "-%s", # SprintF for removed states.
:dur_state => "%s", # SprintF for during states.
:ele_rates => true, # This will display elemental affinities.
:ele_wait => 60, # This is how many frames will wait.
:weakpoint => "弱点", # Appears if foe is weak to element.
:resistant => "抵抗", # Appears if foe is resistant to element.
:immune => "免疫", # Appears if foe is immune to element.
:absorbed => "吸收", # Appears if foe can absorb the element.
:add_buff => "%s+", # Appears when a positive buff is applied.
:add_debuff => "%s-", # Appears when a negative buff is applied.
} # Do not remove this.
# This is the default font used for the popups. Adjust them accordingly
# or even add new ones.
DEFAULT = ["VL Gothic", "Verdana", "Arial", "Courier"]
# The following are the various rules that govern the individual popup
# types that will appear. Adjust them accordingly. Here is a list of what
# each category does.
# Zoom1 The zoom the popup starts at. Values over 2.0 may cause lag.
# Zoom2 The zoom the popup goes to. Values over 2.0 may cause lag.
# Sz The font size used for the popup text.
# Bold Applying bold for the popup text.
# Italic Applying italic for the popup text.
# Red The red value of the popup text.
# Grn The green value of the popup text.
# Blu The blue value of the popup text.
# Font The font used for the popup text.
POPUP_RULES ={
# Type => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font]
"DEFAULT" => [ 2.0, 1.0, 24, true, false, 255, 255, 255, DEFAULT],
"CRITICAL" => [ 2.0, 1.0, 24, true, false, 255, 80, 80, DEFAULT],
"HP_DMG" => [ 2.0, 1.0, 36, true, false, 255, 255, 255, DEFAULT],
"HP_HEAL" => [ 2.0, 1.0, 36, true, false, 130, 250, 130, DEFAULT],
"MP_DMG" => [ 2.0, 1.0, 36, true, false, 220, 180, 255, DEFAULT],
"MP_HEAL" => [ 2.0, 1.0, 36, true, false, 160, 230, 255, DEFAULT],
"TP_DMG" => [ 2.0, 1.0, 36, true, false, 242, 108, 78, DEFAULT],
"TP_HEAL" => [ 2.0, 1.0, 36, true, false, 251, 175, 92, DEFAULT],
"ADDSTATE" => [ 2.0, 1.0, 24, true, false, 240, 100, 100, DEFAULT],
"REMSTATE" => [ 2.0, 1.0, 24, true, false, 125, 170, 225, DEFAULT],
"DURSTATE" => [ 2.0, 1.0, 24, true, false, 255, 240, 150, DEFAULT],
"DRAIN" => [ 2.0, 1.0, 36, true, false, 250, 190, 255, DEFAULT],
"POSITIVE" => [ 2.0, 1.0, 24, true, false, 110, 210, 245, DEFAULT],
"NEGATIVE" => [ 2.0, 1.0, 24, true, false, 245, 155, 195, DEFAULT],
"WEAK_ELE" => [ 0.5, 1.0, 24, true, false, 240, 110, 80, DEFAULT],
"IMMU_ELE" => [ 0.5, 1.0, 24, true, false, 185, 235, 255, DEFAULT],
"REST_ELE" => [ 0.5, 1.0, 24, true, false, 145, 230, 180, DEFAULT],
"ABSB_ELE" => [ 0.5, 1.0, 24, true, false, 250, 190, 255, DEFAULT],
"BUFF" => [ 2.0, 1.0, 24, true, false, 255, 240, 100, DEFAULT],
"DEBUFF" => [ 2.0, 1.0, 24, true, false, 160, 130, 200, DEFAULT],
} # Do not remove this.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Streamlined Messages -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Want to remove some of those annoying messages that appear all the time?
# Now you can! Select which messages you want to enable or disable. Some of
# these messages will be rendered useless due to popups.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
MSG_ENEMY_APPEARS = true # Message when enemy appears start of battle.
MSG_CURRENT_STATE = true # Show which states has affected battler.
MSG_CURRENT_ACTION = true # Show the current action of the battler.
MSG_COUNTERATTACK = true # Show the message for a counterattack.
MSG_REFLECT_MAGIC = true # Show message for reflecting magic attacks.
MSG_SUBSTITUTE_HIT = true # Show message for ally taking another's hit.
MSG_FAILURE_HIT = true # Show effect failed against target.
MSG_CRITICAL_HIT = true # Show attack was a critical hit.
MSG_HIT_MISSED = true # Show attack missed the target.
MSG_EVASION = true # Show attack was evaded by the target.
MSG_HP_DAMAGE = true # Show HP damage to target.
MSG_MP_DAMAGE = true # Show MP damage to target.
MSG_TP_DAMAGE = true # Show TP damage to target.
MSG_ADDED_STATES = true # Show target's added states.
MSG_REMOVED_STATES = true # Show target's removed states.
MSG_CHANGED_BUFFS = true # Show target's changed buffs.
end # BATTLE
end # YEA
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
module YEA
module REGEXP
module ENEMY
ATK_ANI1 = /<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
ATK_ANI2 = /<(?:ATK_ANI_2|atk ani 2):[ ]*(\d+)>/i
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_abe load_database; end
def self.load_database
load_database_abe
load_notetags_abe
end
#--------------------------------------------------------------------------
# new method: load_notetags_abe
#--------------------------------------------------------------------------
def self.load_notetags_abe
groups = [$data_enemies, $data_states, $data_skills, $data_items]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_abe
end
end
end
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :one_animation
#--------------------------------------------------------------------------
# common cache: load_notetags_abe
#--------------------------------------------------------------------------
def load_notetags_abe
@one_animation = false
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::USABLEITEM::ONE_ANIMATION
@one_animation = true
end
} # self.note.split
#---
end
#--------------------------------------------------------------------------
# overwrite method: action_forced_battler
#--------------------------------------------------------------------------
def self.action_forced_battler
@action_forced.shift
end
#--------------------------------------------------------------------------
# overwrite method: clear_action_force
#--------------------------------------------------------------------------
def self.clear_action_force
return if @action_forced.nil?
@action_forced = nil if @action_forced.empty?
end
#--------------------------------------------------------------------------
# new method: self.init_battle_type
#--------------------------------------------------------------------------
def self.init_battle_type
set_btype($game_system.battle_system)
end
#--------------------------------------------------------------------------
# new method: self.set_btype
#--------------------------------------------------------------------------
def self.set_btype(btype = :dtb)
@battle_type = btype
end
#--------------------------------------------------------------------------
# new method: self.btype?
#--------------------------------------------------------------------------
def self.btype?(btype)
return @battle_type == btype
end
#--------------------------------------------------------------------------
# new method: battle_system
#--------------------------------------------------------------------------
def battle_system
if @battle_system.nil?
return battle_system_corrected(YEA::BATTLE::DEFAULT_BATTLE_SYSTEM)
else
return battle_system_corrected(@battle_system)
end
end
#--------------------------------------------------------------------------
# new method: set_battle_system
#--------------------------------------------------------------------------
def set_battle_system(type)
case type
when :dtb; @battle_system = :dtb
when :ftb; @battle_system = $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
else; @battle_system = :dtb
end
end
#--------------------------------------------------------------------------
# new method: battle_system_corrected
#--------------------------------------------------------------------------
def battle_system_corrected(type)
case type
when :dtb; return :dtb
when :ftb; return $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
else; return :dtb
end
end
#--------------------------------------------------------------------------
# alias method: initialize
#--------------------------------------------------------------------------
alias sprite_battler_initialize_abe initialize
def initialize(viewport, battler = nil)
sprite_battler_initialize_abe(viewport, battler)
@popups = []
@popup_flags = []
end
#--------------------------------------------------------------------------
# alias method: update_bitmap
#--------------------------------------------------------------------------
alias sprite_battler_update_bitmap_abe update_bitmap
def update_bitmap
return if @battler.actor? && @battler.battler_name == ""
sprite_battler_update_bitmap_abe
end
#--------------------------------------------------------------------------
# alias method: setup_new_animation
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
alias sprite_battler_setup_new_animation_abe setup_new_animation
def setup_new_animation
sprite_battler_setup_new_animation_abe
return if @battler.pseudo_ani_id <= 0
animation = $data_animations[@battler.pseudo_ani_id]
mirror = @battler.animation_mirror
start_pseudo_animation(animation, mirror)
@battler.pseudo_ani_id = 0
end
end # $imported["YEA-CoreEngine"]
#--------------------------------------------------------------------------
# alias method: setup_new_effect
#--------------------------------------------------------------------------
alias sprite_battler_setup_new_effect_abe setup_new_effect
def setup_new_effect
sprite_battler_setup_new_effect_abe
setup_popups
end
#--------------------------------------------------------------------------
# new method: setup_popups
#--------------------------------------------------------------------------
def setup_popups
return unless @battler.use_sprite?
@battler.popups = [] if @battler.popups.nil?
return if @battler.popups == []
array = @battler.popups.shift
create_new_popup(array[0], array[1], array[2])
end
#--------------------------------------------------------------------------
# new method: create_new_popup
#--------------------------------------------------------------------------
def create_new_popup(value, rules, flags)
return if @battler == nil
return if flags & @popup_flags != []
array = YEA::BATTLE::POPUP_RULES[rules]
for popup in @popups
popup.y -= 24
end
return unless SceneManager.scene.is_a?(Scene_Battle)
return if SceneManager.scene.spriteset.nil?
view = SceneManager.scene.spriteset.viewportPopups
new_popup = Sprite_Popup.new(view, @battler, value, rules, flags)
@popups.push(new_popup)
@popup_flags.push("weakness") if flags.include?("weakness")
@popup_flags.push("resistant") if flags.include?("resistant")
@popup_flags.push("immune") if flags.include?("immune")
@popup_flags.push("absorbed") if flags.include?("absorbed")
end
#--------------------------------------------------------------------------
# alias method: update_effect
#--------------------------------------------------------------------------
alias sprite_battler_update_effect_abe update_effect
def update_effect
sprite_battler_update_effect_abe
update_popups
end
#--------------------------------------------------------------------------
# new method: update_popups
#--------------------------------------------------------------------------
def update_popups
for popup in @popups
popup.update
next unless popup.opacity <= 0
popup.bitmap.dispose
popup.dispose
@popups.delete(popup)
popup = nil
end
@popup_flags = [] if @popups == [] && @popup_flags != []
return unless SceneManager.scene_is?(Scene_Battle)
if @current_active_battler != SceneManager.scene.subject
@current_active_battler = SceneManager.scene.subject
@popup_flags = []
end
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
#---
if @flags.include?("critical") && YEA::BATTLE::FLASH_CRITICAL
@hue_duration = 2 if @hue_duration == nil || @hue_duration == 0
@hue_duration -= 1
self.bitmap.hue_change(15) if @hue_duration <= 0
end
#---
if @zoom_direction == "up"
self.zoom_x = [self.zoom_x + 0.075, @target_zoom].min
self.zoom_y = [self.zoom_y + 0.075, @target_zoom].min
else
self.zoom_x = [self.zoom_x - 0.075, @target_zoom].max
self.zoom_y = [self.zoom_y - 0.075, @target_zoom].max
end
#---
@full -= 1
return if @full > 0
self.y -= 1
self.opacity -= @fade
end
#--------------------------------------------------------------------------
# flag_state_icon
#--------------------------------------------------------------------------
def flag_state_icon
for item in @flags; return item if item.is_a?(Integer); end
return 0
end
#--------------------------------------------------------------------------
# alias method: create_viewports
#--------------------------------------------------------------------------
alias spriteset_battle_create_viewports_abe create_viewports
def create_viewports
spriteset_battle_create_viewports_abe
@viewportPopups = Viewport.new
@viewportPopups.z = 200
end
#--------------------------------------------------------------------------
# alias method: dispose_viewports
#--------------------------------------------------------------------------
alias spriteset_battle_dispose_viewports_abe dispose_viewports
def dispose_viewports
spriteset_battle_dispose_viewports_abe
@viewportPopups.dispose
end
#--------------------------------------------------------------------------
# alias method: update_viewports
#--------------------------------------------------------------------------
alias spriteset_battle_update_viewports_abe update_viewports
def update_viewports
spriteset_battle_update_viewports_abe
@viewportPopups.update
end
#--------------------------------------------------------------------------
# overwrite method: speed
#--------------------------------------------------------------------------
def speed
speed = subject.agi
speed += item.speed if item
speed += subject.atk_speed if attack?
return speed
end
#--------------------------------------------------------------------------
# alias method: evaluate_item_with_target
#--------------------------------------------------------------------------
alias evaluate_item_with_target_abe evaluate_item_with_target
def evaluate_item_with_target(target)
$game_temp.evaluating = true
result = evaluate_item_with_target_abe(target)
$game_temp.evaluating = false
return result
end
#--------------------------------------------------------------------------
# alias method: clear
#--------------------------------------------------------------------------
alias game_actionresult_clear_abe clear
def clear
game_actionresult_clear_abe
clear_stored_damage
end
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :popups
#--------------------------------------------------------------------------
# new method: create_popup
#--------------------------------------------------------------------------
def create_popup(value, rules = "DEFAULT", flags = [])
return unless SceneManager.scene_is?(Scene_Battle)
return unless YEA::BATTLE::ENABLE_POPUPS
return if Switch.hide_popups
@popups = [] if @popups.nil?
@popups.push([value, rules, flags])
end
#--------------------------------------------------------------------------
# new method: make_damage_popups
#--------------------------------------------------------------------------
def make_damage_popups(user)
if @result.hp_drain != 0
text = YEA::BATTLE::POPUP_SETTINGS[:drained]
rules = "DRAIN"
user.create_popup(text, rules)
setting = :hp_dmg if @result.hp_drain < 0
setting = :hp_heal if @result.hp_drain > 0
rules = "HP_DMG" if @result.hp_drain < 0
rules = "HP_HEAL" if @result.hp_drain > 0
value = @result.hp_drain.abs
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
user.create_popup(text, rules)
end
if @result.mp_drain != 0
text = YEA::BATTLE::POPUP_SETTINGS[:drained]
rules = "DRAIN"
user.create_popup(text, rules)
setting = :mp_dmg if @result.mp_drain < 0
setting = :mp_heal if @result.mp_drain > 0
rules = "HP_DMG" if @result.mp_drain < 0
rules = "HP_HEAL" if @result.mp_drain > 0
value = @result.mp_drain.abs
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
user.create_popup(text, rules)
end
#---
flags = []
flags.push("critical") if @result.critical
if @result.hp_damage != 0
setting = :hp_dmg if @result.hp_damage > 0
setting = :hp_heal if @result.hp_damage < 0
rules = "HP_DMG" if @result.hp_damage > 0
rules = "HP_HEAL" if @result.hp_damage < 0
value = @result.hp_damage.abs
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
create_popup(text, rules, flags)
end
if @result.mp_damage != 0
setting = :mp_dmg if @result.mp_damage > 0
setting = :mp_heal if @result.mp_damage < 0
rules = "MP_DMG" if @result.mp_damage > 0
rules = "MP_HEAL" if @result.mp_damage < 0
value = @result.mp_damage.abs
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
create_popup(text, rules, flags)
end
if @result.tp_damage != 0
setting = :tp_dmg if @result.tp_damage > 0
setting = :tp_heal if @result.tp_damage < 0
rules = "TP_DMG" if @result.tp_damage > 0
rules = "TP_HEAL" if @result.tp_damage < 0
value = @result.tp_damage.abs
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
create_popup(text, rules)
end
@result.store_damage
@result.clear_damage_values
end
#--------------------------------------------------------------------------
# alias method: erase_state
#--------------------------------------------------------------------------
alias game_battlerbase_erase_state_abe erase_state
def erase_state(state_id)
make_state_popup(state_id, :rem_state) if @states.include?(state_id)
game_battlerbase_erase_state_abe(state_id)
end
#--------------------------------------------------------------------------
# new method: make_during_state_popup
#--------------------------------------------------------------------------
def make_during_state_popup
state_id = most_important_state_id
return if state_id == 0
make_state_popup(state_id, :dur_state)
end
#--------------------------------------------------------------------------
# new method: most_important_state_id
#--------------------------------------------------------------------------
def most_important_state_id
states.each {|state| return state.id unless state.message3.empty? }
return 0
end
#--------------------------------------------------------------------------
# new method: make_state_popup
#--------------------------------------------------------------------------
def make_state_popup(state_id, type)
state = $data_states[state_id]
return if state.icon_index == 0
rules = state.popup_rules[type]
return if rules.nil?
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[type], state.name)
flags = ["state", state.icon_index]
create_popup(text, rules, flags)
end
#--------------------------------------------------------------------------
# new method: make_miss_popups
#--------------------------------------------------------------------------
def make_miss_popups(user, item)
return if dead?
if @result.missed
text = YEA::BATTLE::POPUP_SETTINGS[:missed]
rules = "DEFAULT"
create_popup(text, rules)
end
if @result.evaded
text = YEA::BATTLE::POPUP_SETTINGS[:evaded]
rules = "DEFAULT"
create_popup(text, rules)
end
if @result.hit? && [email protected]
text = YEA::BATTLE::POPUP_SETTINGS[:failed]
rules = "DEFAULT"
create_popup(text, rules)
end
if @result.hit? && item.damage.to_hp?
if @result.hp_damage == 0 && @result.hp_damage == 0
text = YEA::BATTLE::POPUP_SETTINGS[:nulled]
rules = "DEFAULT"
create_popup(text, rules)
end
end
end
#--------------------------------------------------------------------------
# new method: make_rate_popup
#--------------------------------------------------------------------------
def make_rate_popup(rate)
return if rate == 1.0
flags = []
if rate > 1.0
text = YEA::BATTLE::POPUP_SETTINGS[:weakpoint]
rules = "WEAK_ELE"
flags.push("weakness")
elsif rate == 0.0
text = YEA::BATTLE::POPUP_SETTINGS[:immune]
rules = "IMMU_ELE"
flags.push("immune")
elsif rate < 0.0
text = YEA::BATTLE::POPUP_SETTINGS[:absorbed]
rules = "ABSB_ELE"
flags.push("absorbed")
else
text = YEA::BATTLE::POPUP_SETTINGS[:resistant]
rules = "REST_ELE"
flags.push("resistant")
end
create_popup(text, rules, flags)
end
#--------------------------------------------------------------------------
# new method: make_buff_popup
#--------------------------------------------------------------------------
def make_buff_popup(param_id, positive = true)
return unless SceneManager.scene_is?(Scene_Battle)
return unless alive?
name = Vocab::param(param_id)
if positive
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_buff], name)
rules = "BUFF"
buff_level = 1
else
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_debuff], name)
rules = "DEBUFF"
buff_level = -1
end
icon = buff_icon_index(buff_level, param_id)
flags = ["buff", icon]
return if @popups.include?([text, rules, flags])
create_popup(text, rules, flags)
end
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :pseudo_ani_id
#--------------------------------------------------------------------------
# alias method: on_battle_end
#--------------------------------------------------------------------------
alias game_battler_on_battle_end_abe on_battle_end
def on_battle_end
game_battler_on_battle_end_abe
@popups = []
end
#--------------------------------------------------------------------------
# alias method: clear_sprite_effects
#--------------------------------------------------------------------------
alias game_battler_clear_sprite_effects_abe clear_sprite_effects
def clear_sprite_effects
game_battler_clear_sprite_effects_abe
@pseudo_ani_id = 0
end
#--------------------------------------------------------------------------
# alias method: item_apply
#--------------------------------------------------------------------------
alias game_battler_item_apply_abe item_apply
def item_apply(user, item)
game_battler_item_apply_abe(user, item)
make_miss_popups(user, item)
end
#--------------------------------------------------------------------------
# alias method: make_damage_value
#--------------------------------------------------------------------------
alias game_battler_make_damage_value_abe make_damage_value
def make_damage_value(user, item)
game_battler_make_damage_value_abe(user, item)
rate = item_element_rate(user, item)
make_rate_popup(rate) unless $game_temp.evaluating
end
#--------------------------------------------------------------------------
# alias method: execute_damage
#--------------------------------------------------------------------------
alias game_battler_execute_damage_abe execute_damage
def execute_damage(user)
game_battler_execute_damage_abe(user)
make_damage_popups(user)
end
#--------------------------------------------------------------------------
# alias method: item_effect_recover_hp
#--------------------------------------------------------------------------
alias game_battler_item_effect_recover_hp_abe item_effect_recover_hp
def item_effect_recover_hp(user, item, effect)
game_battler_item_effect_recover_hp_abe(user, item, effect)
make_damage_popups(user)
end
#--------------------------------------------------------------------------
# alias method: item_effect_recover_mp
#--------------------------------------------------------------------------
alias game_battler_item_effect_recover_mp_abe item_effect_recover_mp
def item_effect_recover_mp(user, item, effect)
game_battler_item_effect_recover_mp_abe(user, item, effect)
make_damage_popups(user)
end
#--------------------------------------------------------------------------
# alias method: item_effect_gain_tp
#--------------------------------------------------------------------------
alias game_battler_item_effect_gain_tp_abe item_effect_gain_tp
def item_effect_gain_tp(user, item, effect)
game_battler_item_effect_gain_tp_abe(user, item, effect)
make_damage_popups(user)
end
#--------------------------------------------------------------------------
# alias method: item_user_effect
#--------------------------------------------------------------------------
alias game_battler_item_user_effect_abe item_user_effect
def item_user_effect(user, item)
game_battler_item_user_effect_abe(user, item)
@result.restore_damage
end
#--------------------------------------------------------------------------
# alias method: add_new_state
#--------------------------------------------------------------------------
alias game_battler_add_new_state_abe add_new_state
def add_new_state(state_id)
game_battler_add_new_state_abe(state_id)
make_state_popup(state_id, :add_state) if @states.include?(state_id)
end
#--------------------------------------------------------------------------
# alias method: add_buff
#--------------------------------------------------------------------------
alias game_battler_add_buff_abe add_buff
def add_buff(param_id, turns)
make_buff_popup(param_id, true)
game_battler_add_buff_abe(param_id, turns)
end
#--------------------------------------------------------------------------
# alias method: add_debuff
#--------------------------------------------------------------------------
alias game_battler_add_debuff_abe add_debuff
def add_debuff(param_id, turns)
make_buff_popup(param_id, false)
game_battler_add_debuff_abe(param_id, turns)
end
#--------------------------------------------------------------------------
# alias method: regenerate_all
#--------------------------------------------------------------------------
alias game_battler_regenerate_all_abe regenerate_all
def regenerate_all
game_battler_regenerate_all_abe
return unless alive?
make_damage_popups(self)
end
#--------------------------------------------------------------------------
# new method: can_collapse?
#--------------------------------------------------------------------------
def can_collapse?
return false unless dead?
unless actor?
return false unless sprite.battler_visible
array = [:collapse, :boss_collapse, :instant_collapse]
return false if array.include?(sprite.effect_type)
end
return true
end
#--------------------------------------------------------------------------
# new method: draw_mp?
#--------------------------------------------------------------------------
def draw_mp?; return true; end
#--------------------------------------------------------------------------
# new method: draw_tp?
#--------------------------------------------------------------------------
def draw_tp?
return $data_system.opt_display_tp
end
#--------------------------------------------------------------------------
# new method: screen_y
#--------------------------------------------------------------------------
def screen_y
return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
return Graphics.height - 120 if SceneManager.scene.status_window.nil?
return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
end
#--------------------------------------------------------------------------
# new method: screen_z
#--------------------------------------------------------------------------
def screen_z; return 100; end
#--------------------------------------------------------------------------
# new method: sprite
#--------------------------------------------------------------------------
def sprite
index = $game_party.battle_members.index(self)
return SceneManager.scene.spriteset.actor_sprites[index]
end
#--------------------------------------------------------------------------
# new method: draw_mp?
#--------------------------------------------------------------------------
def draw_mp?
return true unless draw_tp?
for skill in skills
next unless added_skill_types.include?(skill.stype_id)
return true if skill.mp_cost > 0
end
return false
end
#--------------------------------------------------------------------------
# new method: draw_tp?
#--------------------------------------------------------------------------
def draw_tp?
return false unless $data_system.opt_display_tp
for skill in skills
next unless added_skill_types.include?(skill.stype_id)
return true if skill.tp_cost > 0
end
return false
end
#--------------------------------------------------------------------------
# alias method: input
#--------------------------------------------------------------------------
alias game_actor_input_abe input
def input
if @actions.nil?
make_actions
@action_input_index = 0
end
if @actions[@action_input_index].nil?
@actions[@action_input_index] = Game_Action.new(self)
end
return game_actor_input_abe
end
#--------------------------------------------------------------------------
# alias method: make_actions
#--------------------------------------------------------------------------
alias game_unit_make_actions_abe make_actions
def make_actions
game_unit_make_actions_abe
refresh_autobattler_status_window
end
#--------------------------------------------------------------------------
# new method: refresh_autobattler_status_window
#--------------------------------------------------------------------------
def refresh_autobattler_status_window
return unless SceneManager.scene_is?(Scene_Battle)
return unless self.is_a?(Game_Party)
SceneManager.scene.refresh_autobattler_status_window
end
#--------------------------------------------------------------------------
# overwrite method: process_handling
#--------------------------------------------------------------------------
def process_handling
return unless open? && active
return process_dir6 if Input.repeat?(:RIGHT)
return super
end
#--------------------------------------------------------------------------
# new method: process_dir6
#--------------------------------------------------------------------------
def process_dir6
Sound.play_cursor
Input.update
deactivate
call_handler(:dir6)
end
#--------------------------------------------------------------------------
# overwrite method: process_handling
#--------------------------------------------------------------------------
def process_handling
return unless open? && active
return process_dir4 if Input.repeat?(:LEFT)
return process_dir6 if Input.repeat?(:RIGHT)
return super
end
#--------------------------------------------------------------------------
# new method: process_dir4
#--------------------------------------------------------------------------
def process_dir4
Sound.play_cursor
Input.update
deactivate
call_handler(:cancel)
end
#--------------------------------------------------------------------------
# new method: process_dir6
#--------------------------------------------------------------------------
def process_dir6
Sound.play_cursor
Input.update
deactivate
call_handler(:dir6)
end
#--------------------------------------------------------------------------
# new method: battle_members
#--------------------------------------------------------------------------
def battle_members; return $game_party.battle_members; end
#--------------------------------------------------------------------------
# new method: actor
#--------------------------------------------------------------------------
def actor; return battle_members[@index]; end
#--------------------------------------------------------------------------
# overwrite method: update
#--------------------------------------------------------------------------
def update
super
return if @party == $game_party.battle_members
@party = $game_party.battle_members.clone
refresh
end
#--------------------------------------------------------------------------
# new method: draw_actor_action
#--------------------------------------------------------------------------
def draw_actor_action(actor, dx, dy)
draw_icon(action_icon(actor), dx, dy)
end
#--------------------------------------------------------------------------
# new method: action_icon
#--------------------------------------------------------------------------
def action_icon(actor)
return Icon.no_action if actor.current_action.nil?
return Icon.no_action if actor.current_action.item.nil?
return actor.current_action.item.icon_index
end
#--------------------------------------------------------------------------
# new method: draw_tp?
#--------------------------------------------------------------------------
def draw_tp?(actor)
return actor.draw_tp?
end
#--------------------------------------------------------------------------
# new method: draw_mp?
#--------------------------------------------------------------------------
def draw_mp?(actor)
return actor.draw_mp?
end
#--------------------------------------------------------------------------
# overwrite method: show
#--------------------------------------------------------------------------
def show
create_flags
super
end
#--------------------------------------------------------------------------
# new method: create_flags
#--------------------------------------------------------------------------
def create_flags
set_select_flag(:any)
select(0)
return if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
select(0)
set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_user?
battler = BattleManager.actor
id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
select(id)
set_select_flag(:user)
elsif $game_temp.battle_aid.for_all?
select(0)
set_select_flag(:all)
set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_random?
select(0)
set_select_flag(:random) if $game_temp.battle_aid.for_random?
end
end
#--------------------------------------------------------------------------
# new method: set_flag
#--------------------------------------------------------------------------
def set_select_flag(flag)
@select_flag = flag
case @select_flag
when :all, :all_dead, :random
@cursor_all = true
else
@cursor_all = false
end
end
#--------------------------------------------------------------------------
# overwrite method: update_cursor
#--------------------------------------------------------------------------
def update_cursor
if @cursor_all
cursor_rect.set(0, 0, contents.width, contents.height)
self.top_row = 0
elsif @index < 0
cursor_rect.empty
else
ensure_cursor_visible
cursor_rect.set(item_rect(@index))
end
end
#--------------------------------------------------------------------------
# overwrite method: cursor_movable?
#--------------------------------------------------------------------------
def cursor_movable?
return false if @select_flag == :user
return super
end
#--------------------------------------------------------------------------
# overwrite method: current_item_enabled?
#--------------------------------------------------------------------------
def current_item_enabled?
return true if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
member = $game_party.battle_members[@index]
return member.dead? if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_dead_friend?
for member in $game_party.battle_members
return true if member.dead?
end
return false
end
return true
end
#--------------------------------------------------------------------------
# overwrite method: show
#--------------------------------------------------------------------------
def show
super
refresh
end
#--------------------------------------------------------------------------
# overwrite method: refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
return if @status_window.nil?
draw_item(@status_window.index)
end
#--------------------------------------------------------------------------
# overwrite method: show
#--------------------------------------------------------------------------
def show
create_flags
super
end
#--------------------------------------------------------------------------
# new method: create_flags
#--------------------------------------------------------------------------
def create_flags
set_select_flag(:any)
select(0)
return if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
select(0)
elsif $game_temp.battle_aid.for_all?
select(0)
set_select_flag(:all)
elsif $game_temp.battle_aid.for_random?
select(0)
set_select_flag(:random)
end
end
#--------------------------------------------------------------------------
# new method: set_flag
#--------------------------------------------------------------------------
def set_select_flag(flag)
@select_flag = flag
case @select_flag
when :all, :random
@cursor_all = true
else
@cursor_all = false
end
end
#--------------------------------------------------------------------------
# new method: select_all?
#--------------------------------------------------------------------------
def select_all?
return true if @select_flag == :all
return true if @select_flag == :random
return false
end
#--------------------------------------------------------------------------
# overwrite method: update_cursor
#--------------------------------------------------------------------------
def update_cursor
if @cursor_all
cursor_rect.set(0, 0, contents.width, contents.height)
self.top_row = 0
elsif @index < 0
cursor_rect.empty
else
ensure_cursor_visible
cursor_rect.set(item_rect(@index))
end
end
#--------------------------------------------------------------------------
# overwrite method: cursor_movable?
#--------------------------------------------------------------------------
def cursor_movable?
return false if @select_flag == :user
return super
end
#--------------------------------------------------------------------------
# overwrite method: current_item_enabled?
#--------------------------------------------------------------------------
def current_item_enabled?
return true if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
member = $game_party.battle_members[@index]
return member.dead? if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_dead_friend?
for member in $game_party.battle_members
return true if member.dead?
end
return false
end
return true
end
#--------------------------------------------------------------------------
# overwrite method: enemy
#--------------------------------------------------------------------------
def enemy; @data[index]; end
#--------------------------------------------------------------------------
# overwrite method: draw_item
#--------------------------------------------------------------------------
def draw_item(index); return; end
#--------------------------------------------------------------------------
# overwrite method: update
#--------------------------------------------------------------------------
def update
super
return unless active
enemy.sprite_effect_type = :whiten
return unless select_all?
for enemy in $game_troop.alive_members
enemy.sprite_effect_type = :whiten
end
end
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :actor_window
attr_accessor :enemy_window
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
if !self.visible and @text != ""
@text = ""
return refresh
end
update_battler_name
end
#--------------------------------------------------------------------------
# update_battler_name
#--------------------------------------------------------------------------
def update_battler_name
return unless @actor_window.active || @enemy_window.active
if @actor_window.active
battler = $game_party.battle_members[@actor_window.index]
elsif @enemy_window.active
battler = @enemy_window.enemy
end
if special_display?
refresh_special_case(battler)
else
refresh_battler_name(battler) if battler_name(battler) != @text
end
end
#--------------------------------------------------------------------------
# battler_name
#--------------------------------------------------------------------------
def battler_name(battler)
text = battler.name.clone
return text
end
#--------------------------------------------------------------------------
# special_display?
#--------------------------------------------------------------------------
def special_display?
return false if $game_temp.battle_aid.nil?
return false if $game_temp.battle_aid.for_user?
return !$game_temp.battle_aid.need_selection?
end
#--------------------------------------------------------------------------
# refresh_special_case
#--------------------------------------------------------------------------
def refresh_special_case(battler)
if $game_temp.battle_aid.for_opponent?
if $game_temp.battle_aid.for_all?
text = YEA::BATTLE::HELP_TEXT_ALL_FOES
else
case $game_temp.battle_aid.number_of_targets
when 1
text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
else
number = $game_temp.battle_aid.number_of_targets
text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
end
end
else # $game_temp.battle_aid.for_friend?
if $game_temp.battle_aid.for_dead_friend?
text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
elsif $game_temp.battle_aid.for_random?
case $game_temp.battle_aid.number_of_targets
when 1
text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
else
number = $game_temp.battle_aid.number_of_targets
text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
end
else
text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
end
end
return if text == @text
@text = text
contents.clear
reset_font_settings
draw_text(0, 0, contents.width, line_height*2, @text, 1)
end
#--------------------------------------------------------------------------
# alias method: display_current_state
#--------------------------------------------------------------------------
alias window_battlelog_display_current_state_abe display_current_state
def display_current_state(subject)
subject.make_during_state_popup
return unless YEA::BATTLE::MSG_CURRENT_STATE
window_battlelog_display_current_state_abe(subject)
end
#--------------------------------------------------------------------------
# alias method: display_use_item
#--------------------------------------------------------------------------
alias window_battlelog_display_use_item_abe display_use_item
def display_use_item(subject, item)
return unless YEA::BATTLE::MSG_CURRENT_ACTION
window_battlelog_display_use_item_abe(subject, item)
end
#--------------------------------------------------------------------------
# alias method: display_counter
#--------------------------------------------------------------------------
alias window_battlelog_display_counter_abe display_counter
def display_counter(target, item)
if YEA::BATTLE::MSG_COUNTERATTACK
window_battlelog_display_counter_abe(target, item)
else
Sound.play_evasion
end
end
#--------------------------------------------------------------------------
# alias method: display_reflection
#--------------------------------------------------------------------------
alias window_battlelog_display_reflection_abe display_reflection
def display_reflection(target, item)
if YEA::BATTLE::MSG_REFLECT_MAGIC
window_battlelog_display_reflection_abe(target, item)
else
Sound.play_reflection
end
end
#--------------------------------------------------------------------------
# alias method: display_substitute
#--------------------------------------------------------------------------
alias window_battlelog_display_substitute_abe display_substitute
def display_substitute(substitute, target)
return unless YEA::BATTLE::MSG_SUBSTITUTE_HIT
window_battlelog_display_substitute_abe(substitute, target)
end
#--------------------------------------------------------------------------
# alias method: display_failure
#--------------------------------------------------------------------------
alias window_battlelog_display_failure_abe display_failure
def display_failure(target, item)
return unless YEA::BATTLE::MSG_FAILURE_HIT
window_battlelog_display_failure_abe(target, item)
end
#--------------------------------------------------------------------------
# alias method: display_critical
#--------------------------------------------------------------------------
alias window_battlelog_display_critical_abe display_critical
def display_critical(target, item)
return unless YEA::BATTLE::MSG_CRITICAL_HIT
window_battlelog_display_critical_abe(target, item)
end
#--------------------------------------------------------------------------
# alias method: display_miss
#--------------------------------------------------------------------------
alias window_battlelog_display_miss_abe display_miss
def display_miss(target, item)
return unless YEA::BATTLE::MSG_HIT_MISSED
window_battlelog_display_miss_abe(target, item)
end
#--------------------------------------------------------------------------
# alias method: display_evasion
#--------------------------------------------------------------------------
alias window_battlelog_display_evasion_abe display_evasion
def display_evasion(target, item)
if YEA::BATTLE::MSG_EVASION
window_battlelog_display_evasion_abe(target, item)
else
if !item || item.physical?
Sound.play_evasion
else
Sound.play_magic_evasion
end
end
end
#--------------------------------------------------------------------------
# overwrite method: display_hp_damage
#--------------------------------------------------------------------------
def display_hp_damage(target, item)
return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
if target.result.hp_damage > 0 && target.result.hp_drain == 0
target.perform_damage_effect
end
Sound.play_recovery if target.result.hp_damage < 0
return unless YEA::BATTLE::MSG_HP_DAMAGE
add_text(target.result.hp_damage_text)
wait
end
#--------------------------------------------------------------------------
# overwrite method: display_mp_damage
#--------------------------------------------------------------------------
def display_mp_damage(target, item)
return if target.dead? || target.result.mp_damage == 0
Sound.play_recovery if target.result.mp_damage < 0
return unless YEA::BATTLE::MSG_MP_DAMAGE
add_text(target.result.mp_damage_text)
wait
end
#--------------------------------------------------------------------------
# overwrite method: display_tp_damage
#--------------------------------------------------------------------------
def display_tp_damage(target, item)
return if target.dead? || target.result.tp_damage == 0
Sound.play_recovery if target.result.tp_damage < 0
return unless YEA::BATTLE::MSG_TP_DAMAGE
add_text(target.result.tp_damage_text)
wait
end
#--------------------------------------------------------------------------
# alias method: display_added_states
#--------------------------------------------------------------------------
alias window_battlelog_display_added_states_abe display_added_states
def display_added_states(target)
return unless YEA::BATTLE::MSG_ADDED_STATES
window_battlelog_display_added_states_abe(target)
end
#--------------------------------------------------------------------------
# alias method: display_removed_states
#--------------------------------------------------------------------------
alias window_battlelog_display_removed_states_abe display_removed_states
def display_removed_states(target)
return unless YEA::BATTLE::MSG_REMOVED_STATES
window_battlelog_display_removed_states_abe(target)
end
#--------------------------------------------------------------------------
# alias method: display_changed_buffs
#--------------------------------------------------------------------------
alias window_battlelog_display_changed_buffs_abe display_changed_buffs
def display_changed_buffs(target)
return unless YEA::BATTLE::MSG_CHANGED_BUFFS
window_battlelog_display_changed_buffs_abe(target)
end
#--------------------------------------------------------------------------
# overwrite method: spacing
#--------------------------------------------------------------------------
def spacing
return 8 if $game_party.in_battle
return super
end
#--------------------------------------------------------------------------
# overwrite method: spacing
#--------------------------------------------------------------------------
def spacing
return 8 if $game_party.in_battle
return super
end
#--------------------------------------------------------------------------
# alias method: create_spriteset
#--------------------------------------------------------------------------
alias scene_battle_create_spriteset_abe create_spriteset
def create_spriteset
BattleManager.init_battle_type
scene_battle_create_spriteset_abe
end
#--------------------------------------------------------------------------
# alias method: update_basic
#--------------------------------------------------------------------------
alias scene_battle_update_basic_abe update_basic
def update_basic
scene_battle_update_basic_abe
update_debug
end
#--------------------------------------------------------------------------
# new method: update_debug
#--------------------------------------------------------------------------
def update_debug
return unless $TEST || $BTEST
debug_heal_party if Input.trigger?(:F5)
debug_damage_party if Input.trigger?(:F6)
debug_fill_tp if Input.trigger?(:F7)
debug_kill_all if Input.trigger?(:F8)
end
#--------------------------------------------------------------------------
# new method: debug_heal_party
#--------------------------------------------------------------------------
def debug_heal_party
Sound.play_recovery
for member in $game_party.battle_members
member.recover_all
end
@status_window.refresh
end
#--------------------------------------------------------------------------
# new method: debug_damage_party
#--------------------------------------------------------------------------
def debug_damage_party
Sound.play_actor_damage
for member in $game_party.alive_members
member.hp = 1
member.mp = 0
member.tp = 0
end
@status_window.refresh
end
#--------------------------------------------------------------------------
# new method: debug_fill_tp
#--------------------------------------------------------------------------
def debug_fill_tp
Sound.play_recovery
for member in $game_party.alive_members
member.tp = member.max_tp
end
@status_window.refresh
end
#--------------------------------------------------------------------------
# new method: debug_kill_all
#--------------------------------------------------------------------------
def debug_kill_all
for enemy in $game_troop.alive_members
enemy.hp = 0
enemy.perform_collapse_effect
end
BattleManager.judge_win_loss
@log_window.wait
@log_window.wait_for_effect
end
#--------------------------------------------------------------------------
# alias method: create_all_windows
#--------------------------------------------------------------------------
alias scene_battle_create_all_windows_abe create_all_windows
def create_all_windows
scene_battle_create_all_windows_abe
create_battle_status_aid_window
set_help_window
end
#--------------------------------------------------------------------------
# alias method: create_info_viewport
#--------------------------------------------------------------------------
alias scene_battle_create_info_viewport_abe create_info_viewport
def create_info_viewport
scene_battle_create_info_viewport_abe
@status_window.refresh
end
#--------------------------------------------------------------------------
# new method: set_help_window
#--------------------------------------------------------------------------
def set_help_window
@help_window.actor_window = @actor_window
@help_window.enemy_window = @enemy_window
end
#--------------------------------------------------------------------------
# alias method: create_party_command_window
#--------------------------------------------------------------------------
alias scene_battle_create_party_command_window_abe create_party_command_window
def create_party_command_window
scene_battle_create_party_command_window_abe
@party_command_window.set_handler(:dir6, method(:command_fight))
end
#--------------------------------------------------------------------------
# alias method: create_actor_command_window
#--------------------------------------------------------------------------
alias scene_battle_create_actor_command_window_abe create_actor_command_window
def create_actor_command_window
scene_battle_create_actor_command_window_abe
@actor_command_window.set_handler(:dir4, method(:prior_command))
@actor_command_window.set_handler(:dir6, method(:next_command))
end
#--------------------------------------------------------------------------
# alias method: create_skill_window
#--------------------------------------------------------------------------
alias scene_battle_create_skill_window_abe create_skill_window
def create_skill_window
scene_battle_create_skill_window_abe
@skill_window.height = @info_viewport.rect.height
@skill_window.width = Graphics.width - @actor_command_window.width
@skill_window.y = Graphics.height - @skill_window.height
end
#--------------------------------------------------------------------------
# alias method: create_item_window
#--------------------------------------------------------------------------
alias scene_battle_create_item_window_abe create_item_window
def create_item_window
scene_battle_create_item_window_abe
@item_window.height = @skill_window.height
@item_window.width = @skill_window.width
@item_window.y = Graphics.height - @item_window.height
end
#--------------------------------------------------------------------------
# alias method: show_fast?
#--------------------------------------------------------------------------
alias scene_battle_show_fast_abe show_fast?
def show_fast?
return true if YEA::BATTLE::AUTO_FAST
return scene_battle_show_fast_abe
end
#--------------------------------------------------------------------------
# alias method: next_command
#--------------------------------------------------------------------------
alias scene_battle_next_command_abe next_command
def next_command
@status_window.show
redraw_current_status
@actor_command_window.show
@status_aid_window.hide
scene_battle_next_command_abe
end
#--------------------------------------------------------------------------
# alias method: prior_command
#--------------------------------------------------------------------------
alias scene_battle_prior_command_abe prior_command
def prior_command
redraw_current_status
scene_battle_prior_command_abe
end
#--------------------------------------------------------------------------
# new method: redraw_current_status
#--------------------------------------------------------------------------
def redraw_current_status
return if @status_window.index < 0
@status_window.draw_item(@status_window.index)
end
#--------------------------------------------------------------------------
# alias method: command_attack
#--------------------------------------------------------------------------
alias scene_battle_command_attack_abe command_attack
def command_attack
$game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
scene_battle_command_attack_abe
end
#--------------------------------------------------------------------------
# alias method: command_skill
#--------------------------------------------------------------------------
alias scene_battle_command_skill_abe command_skill
def command_skill
scene_battle_command_skill_abe
@status_window.hide
@actor_command_window.hide
@status_aid_window.show
end
#--------------------------------------------------------------------------
# alias method: command_item
#--------------------------------------------------------------------------
alias scene_battle_command_item_abe command_item
def command_item
scene_battle_command_item_abe
@status_window.hide
@actor_command_window.hide
@status_aid_window.show
end
#--------------------------------------------------------------------------
# alias method: on_item_cancel
#--------------------------------------------------------------------------
alias scene_battle_on_item_cancel_abe on_item_cancel
def on_item_cancel
scene_battle_on_item_cancel_abe
@status_window.show
@actor_command_window.show
@status_aid_window.hide
end
#--------------------------------------------------------------------------
# alias method: select_actor_selection
#--------------------------------------------------------------------------
alias scene_battle_select_actor_selection_abe select_actor_selection
def select_actor_selection
@status_aid_window.refresh
scene_battle_select_actor_selection_abe
@status_window.hide
@skill_window.hide
@item_window.hide
@help_window.show
end
#--------------------------------------------------------------------------
# alias method: on_actor_ok
#--------------------------------------------------------------------------
alias scene_battle_on_actor_ok_abe on_actor_ok
def on_actor_ok
$game_temp.battle_aid = nil
scene_battle_on_actor_ok_abe
@status_window.show
if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
@actor_command_window.visible = !@confirm_command_window.visible
else
@actor_command_window.show
end
@status_aid_window.hide
end
#--------------------------------------------------------------------------
# alias method: on_actor_cancel
#--------------------------------------------------------------------------
alias scene_battle_on_actor_cancel_abe on_actor_cancel
def on_actor_cancel
BattleManager.actor.input.clear
@status_aid_window.refresh
$game_temp.battle_aid = nil
scene_battle_on_actor_cancel_abe
case @actor_command_window.current_symbol
when :skill
@skill_window.show
when :item
@item_window.show
end
end
#--------------------------------------------------------------------------
# alias method: select_enemy_selection
#--------------------------------------------------------------------------
alias scene_battle_select_enemy_selection_abe select_enemy_selection
def select_enemy_selection
@status_aid_window.refresh
scene_battle_select_enemy_selection_abe
@help_window.show
end
#--------------------------------------------------------------------------
# alias method: on_enemy_ok
#--------------------------------------------------------------------------
alias scene_battle_on_enemy_ok_abe on_enemy_ok
def on_enemy_ok
$game_temp.battle_aid = nil
scene_battle_on_enemy_ok_abe
end
#--------------------------------------------------------------------------
# alias method: on_enemy_cancel
#--------------------------------------------------------------------------
alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
def on_enemy_cancel
BattleManager.actor.input.clear
@status_aid_window.refresh
$game_temp.battle_aid = nil
scene_battle_on_enemy_cancel_abe
if @skill_window.visible || @item_window.visible
@help_window.show
else
@help_window.hide
end
end
#--------------------------------------------------------------------------
# alias method: battle_start
#--------------------------------------------------------------------------
alias scene_battle_battle_start_abe battle_start
def battle_start
scene_battle_battle_start_abe
return unless YEA::BATTLE::SKIP_PARTY_COMMAND
@party_command_window.deactivate
if BattleManager.input_start
command_fight
else
turn_start
end
end
#--------------------------------------------------------------------------
# overwrite method: turn_end
#--------------------------------------------------------------------------
def turn_end
all_battle_members.each do |battler|
battler.on_turn_end
status_redraw_target(battler)
@log_window.display_auto_affected_status(battler)
@log_window.wait_and_clear
end
update_party_cooldowns if $imported["YEA-CommandParty"]
BattleManager.turn_end
process_event
start_party_command_selection
return if end_battle_conditions?
return unless YEA::BATTLE::SKIP_PARTY_COMMAND
if BattleManager.input_start
@party_command_window.deactivate
command_fight
else
@party_command_window.deactivate
turn_start
end
end
#--------------------------------------------------------------------------
# new method: end_battle_conditions?
#--------------------------------------------------------------------------
def end_battle_conditions?
return true if $game_party.members.empty?
return true if $game_party.all_dead?
return true if $game_troop.all_dead?
return true if BattleManager.aborting?
return false
end
#--------------------------------------------------------------------------
# overwrite method: execute_action
#--------------------------------------------------------------------------
def execute_action
@subject.sprite_effect_type = :whiten if YEA::BATTLE::FLASH_WHITE_EFFECT
use_item
@log_window.wait_and_clear
end
#--------------------------------------------------------------------------
# overwrite method: apply_item_effects
#--------------------------------------------------------------------------
def apply_item_effects(target, item)
if $imported["YEA-LunaticObjects"]
lunatic_object_effect(:prepare, item, @subject, target)
end
target.item_apply(@subject, item)
status_redraw_target(@subject)
status_redraw_target(target) unless target == @subject
@log_window.display_action_results(target, item)
if $imported["YEA-LunaticObjects"]
lunatic_object_effect(:during, item, @subject, target)
end
perform_collapse_check(target)
end
#--------------------------------------------------------------------------
# new method: perform_collapse_check
#--------------------------------------------------------------------------
def perform_collapse_check(target)
return if YEA::BATTLE::MSG_ADDED_STATES
target.perform_collapse_effect if target.can_collapse?
@log_window.wait
@log_window.wait_for_effect
end
#--------------------------------------------------------------------------
# overwrite method: use_item
#--------------------------------------------------------------------------
def use_item
item = @subject.current_action.item
@log_window.display_use_item(@subject, item)
@subject.use_item(item)
status_redraw_target(@subject)
if $imported["YEA-LunaticObjects"]
lunatic_object_effect(:before, item, @subject, @subject)
end
process_casting_animation if $imported["YEA-CastAnimations"]
targets = @subject.current_action.make_targets.compact rescue []
show_animation(targets, item.animation_id) if show_all_animation?(item)
targets.each {|target|
if $imported["YEA-TargetManager"]
target = alive_random_target(target, item) if item.for_random?
end
item.repeats.times { invoke_item(target, item) } }
if $imported["YEA-LunaticObjects"]
lunatic_object_effect(:after, item, @subject, @subject)
end
end
#--------------------------------------------------------------------------
# alias method: invoke_item
#--------------------------------------------------------------------------
alias scene_battle_invoke_item_abe invoke_item
def invoke_item(target, item)
show_animation([target], item.animation_id) if separate_ani?(target, item)
if target.dead? != item.for_dead_friend?
@subject.last_target_index = target.index
return
end
scene_battle_invoke_item_abe(target, item)
end
#--------------------------------------------------------------------------
# new method: show_all_animation?
#--------------------------------------------------------------------------
def show_all_animation?(item)
return true if item.one_animation
return false if $data_animations[item.animation_id].nil?
return false unless $data_animations[item.animation_id].to_screen?
return true
end
#--------------------------------------------------------------------------
# new method: separate_ani?
#--------------------------------------------------------------------------
def separate_ani?(target, item)
return false if item.one_animation
return false if $data_animations[item.animation_id].nil?
return false if $data_animations[item.animation_id].to_screen?
return target.dead? == item.for_dead_friend?
end
#--------------------------------------------------------------------------
# new method: status_redraw_target
#--------------------------------------------------------------------------
def status_redraw_target(target)
return unless target.actor?
@status_window.draw_item($game_party.battle_members.index(target))
end
#--------------------------------------------------------------------------
# alias method: start_party_command_selection
#--------------------------------------------------------------------------
alias start_party_command_selection_abe start_party_command_selection
def start_party_command_selection
@status_window.refresh unless scene_changing?
start_party_command_selection_abe
end
#--------------------------------------------------------------------------
# overwrite method: refresh_status
#--------------------------------------------------------------------------
def refresh_status; return; end
#--------------------------------------------------------------------------
# new method: refresh_autobattler_status_window
#--------------------------------------------------------------------------
def refresh_autobattler_status_window
for member in $game_party.battle_members
next unless member.auto_battle?
@status_window.draw_item(member.index)
end
end
#--------------------------------------------------------------------------
# new method: hide_extra_gauges
#--------------------------------------------------------------------------
def hide_extra_gauges
# Made for compatibility
end
#--------------------------------------------------------------------------
# new method: show_extra_gauges
#--------------------------------------------------------------------------
def show_extra_gauges
# Made for compatibility
end
end # Scene_Battle
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
战斗显示角色行走图:
#===============================================================================
# Side-View Battle System(Patch Behind)
# By Jet10985 (Jet)
#===============================================================================
# This script will allow you to have battle where all the actor's sprites are
# display on the behind of the characters.
# This script has: 10 customization options.
#===============================================================================
# Overwritten Methods:
# Scene_Battle: show_attack_animation
# Spriteset_Battle: update_actors
#-------------------------------------------------------------------------------
# Aliased methods:
# Spriteset_Battle: create_actors, create_enemies
# Sprite_Character: initialize, update, dispose, start_new_effect
# Scene_Battle: use_item, next_command, prior_command
# Game_Character: screen_x, screen_y
#===============================================================================
# These are the attack animations for enemies when they use a regular attack.
# It follows this format: enemy_id => animation_id
ENEMY_ATK_ANIMS = {
}
# This is the default enemy attack animation, used when they do not have a
# specific attack animation above.
ENEMY_ATK_ANIMS.default = 1
# This is a list of enemies whose portraits should be flipped in battle.
FLIPPED_ENEMIES = [2, 3, 4, 5, 8, 10, 12, 13, 14, 16, 17, 18, 19]
#===========================================================================
# ACTOR OPTIONS
#===========================================================================
# Should the player sprite have a shadow beneath them?
PLAYER_SHADOW = true
# These are sprite changes depending on state infliction.
# It follows this format: state_id => "sprite_appention"
# This means if the state is inflicted, the sprite will look for a graphic
# that is the same name as the character's sprite, plus the appended option.
# EX: Ralph's sprite's name is $ralph. Ralph gets knocked-out. This means
# state 1 was inflicted, and my below config for 1 was: 1 => "_dead"
# Now, his shown sprite will be $ralph_dead. If the sprite does not exist,
# no change will be made.
# The sprite index will be the same as the actor's.
STATE_SPRITES = {
# It follows this format: state_id => animation_id
STATE_ANIMATIONS = {
1 => 56,
2 => 50,
3 => 51
}
#===========================================================================
# FIELD OPTIONS
#===========================================================================
# This is where the line-up begins. [x, y]. The higher the x, the further
# right and the higher the y the further down.
FIELD_POS = [170, 350]
# This is how far down, and to the right each player is from the previous
# actor. [x, y]. Same rules as above.
FIELD_SPACING = [100, 0]
end
end
#===============================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#===============================================================================
%w[screen_x screen_y].each {|a|
aStr = %Q{
alias jet6372_#{a} #{a}
def #{a}(*args, &block)
$BTEST ? 0 : jet6372_#{a}(*args, &block)
end
}
module_eval(aStr)
}
end
class Game_Actor
def animation_id=(t)
self.battle_sprite.start_animation($data_animations[t]) rescue nil
end
end
class Game_Battler
def battle_sprite
return nil unless SceneManager.scene_is?(Scene_Battle)
SceneManager.scene.spriteset.battler_sprites.each {|a|
return a if a.battler == self
}
return nil
end
end
class Spriteset_Battle
alias jet2847_create_enemies create_enemies
def create_enemies(*args, &block)
jet2847_create_enemies(*args, &block)
@enemy_sprites.each {|a|
a.mirror = Jet::Sideview::FLIPPED_ENEMIES.include?(a.battler.enemy.id)
}
end
alias jet3835_create_actors create_actors
def create_actors(*args, &block)
jet3835_create_actors(*args, &block)
@jet_party = $game_party.members
@actor_sprites.each {|a|
a.dispose
}
@actor_sprites = []
$game_party.members.each {|a|
f = Game_Character.new
f.set_graphic(a.character_name, a.character_index)
f.step_anime = true
f.set_direction(8)
n = Sprite_Character.new(@viewport1, f)
n.jet_x = Jet::Sideview::FIELD_POS[0] + a.index * Jet::Sideview::FIELD_SPACING[0]
n.jet_y = Jet::Sideview::FIELD_POS[1] + a.index * Jet::Sideview::FIELD_SPACING[1]
n.battler = a
n.battle_sprite = true
if Jet::Sideview::PLAYER_SHADOW
v = Sprite.new(nil)
v.bitmap = Cache.system("Shadow")
n.shadow_sprite = v
end
@actor_sprites.push(n)
}
end
def update_actors
if @jet_party != $game_party.members
@actor_sprites.each {|a|
a.dispose
}
@actor_sprites = []
create_actors
end
@actor_sprites.each {|a| a.update }
end
end
alias jet4646_initialize initialize
def initialize(*args, &block)
@battle_sprite = false
jet4646_initialize(*args, &block)
end
alias jet3645_update update
def update(*args, &block)
jet3645_update(*args, &block)
if @battle_sprite
@character.step_anime = [email protected]?
@character.update
self.x = @jet_x
self.y = @jet_y
if [email protected]?
f = @battler.states.dup
f.sort! {|a, b|
a.priority <=> b.priority
}.reverse!
for i in 0...f.size
a = Jet::Sideview::STATE_SPRITES[f.id]
next if a.nil?
b = (Cache.character(@character.character_name + a) rescue false)
next unless b
index = @character.character_index
@character.set_graphic(@character.character_name + a, index)
break
end
end
if !@shadow_sprite.nil?
@shadow_sprite.x = self.x - @shadow_sprite.width / 2
@shadow_sprite.y = self.y - 28
@shadow_sprite.visible = self.visible
@shadow_sprite.viewport = self.viewport
@shadow_sprite.z = self.z - 1
end
end
end
alias jet5484_dispose dispose
def dispose(*args, &block)
@shadow_sprite.dispose if !@shadow_sprite.nil?
jet5484_dispose(*args, &block)
end
def move_x(times, amount)
i = 0
until i == times
self.jet_y += amount
i += 1
[Graphics, SceneManager.scene.spriteset].each {|a| a.update }
end
end
def effect?
false
end
end
class Game_Enemy
def atk_animation_id1
return Jet::Sideview::ENEMY_ATK_ANIMS[@enemy_id]
end
def atk_animation_id2
return 0
end
end
class Scene_Battle
attr_reader :spriteset
alias jet2711_use_item use_item
def use_item(*args, &block)
if @subject.is_a?(Game_Actor)
if [email protected]_action.guard?
@subject.battle_sprite.move_x(11, -4)
end
end
jet2711_use_item(*args, &block)
if @subject.is_a?(Game_Actor)
if [email protected]_action.guard?
@subject.battle_sprite.move_x(11, 4)
end
end
end
%w[next prior].each {|a|
aStr = %Q{
alias jet3734_#{a}_command #{a}_command
def #{a}_command(*args, &block)
f = BattleManager.actor
f.battle_sprite.move_x(6, 4) if f.is_a?(Game_Actor)
jet3734_#{a}_command(*args, &block)
f = BattleManager.actor
f.battle_sprite.move_x(6, -4) if f.is_a?(Game_Actor)
end
}
module_eval(aStr)
}
end
class Game_Action
def guard?
item == $data_skills[subject.guard_skill_id]
end
end
if $imported[:jet][:BattlePopUps]
class Sprite_Character
attr_accessor :popups
alias jet4758_initialize initialize
def initialize(*args, &block)
@popups = []
@updating_sprites = []
@popup_wait = 0
jet4758_initialize(*args, &block)
end
alias jet7467_update update
def update(*args, &block)
jet7467_update(*args, &block)
if @popup_wait == 0
if [email protected]?
@updating_sprites.push(@popups.pop)
@popup_wait = 30
end
else
@popup_wait -= 1
end
@updating_sprites.each {|a|
a.visible = true if !a.visible
a.update
@updating_sprites.delete(a) if a.disposed?
}
end
alias jet5483_dispose dispose
def dispose(*args, &block)
(@updating_sprites + @popups).each {|a| a.dispose }
jet5483_dispose(*args, &block)
end
alias jet3745_setup_new_effect setup_new_effect
def setup_new_effect(*args, &block)
jet3745_setup_new_effect(*args, &block)
do_sprite_popups
end
def make_popup(text, color)
@popups.unshift(Sprite_JetPopup.new(text.to_s, color, self))
end
def do_sprite_popups
return if @battler.nil?
if @battler_struct.nil?
@battler_struct = Struct.new(:hp, :mp, :tp).new(0, 0, 0)
@battler_struct.hp = @battler.hp
@battler_struct.mp = @battler.mp
@battler_struct.tp = @battler.tp
end
check_success_popup
check_hp_popup
check_mp_popup
check_tp_popup
end
def check_success_popup
if @battler.result.success
if @battler.result.critical
make_popup(Jet::BattlePopUps::CRITICAL_TEXT, Jet::BattlePopUps::CRITICAL_COLOR)
elsif @battler.result.missed
make_popup(Jet::BattlePopUps::MISSED_TEXT, Jet::BattlePopUps::MISS_COLOR)
elsif @battler.result.evaded
make_popup(Jet::BattlePopUps::EVADED_TEXT, Jet::BattlePopUps::EVADE_COLOR)
end
@battler.result.clear_hit_flags
end
end
def check_hp_popup
if @battler_struct.hp != @battler.hp
f = @battler_struct.hp - @battler.hp
if f > 0
make_popup(Jet::BattlePopUps::HURT_TEXT + f.to_s, Jet::BattlePopUps::HURT_COLOR)
elsif f < 0
make_popup(Jet::BattlePopUps::HEAL_TEXT + f.abs.to_s, Jet::BattlePopUps::HEAL_COLOR)
end
@battler_struct.hp = @battler.hp
end
end
def check_mp_popup
if @battler_struct.mp != @battler.mp
f = @battler_struct.mp - @battler.mp
if f > 0
make_popup(Jet::BattlePopUps::HURT_TEXT_MP + f.to_s, Jet::BattlePopUps::HURT_COLOR_MP)
elsif f < 0
make_popup(Jet::BattlePopUps::HEAL_TEXT_MP + f.abs.to_s, Jet::BattlePopUps::HEAL_COLOR_MP)
end
@battler_struct.mp = @battler.mp
end
end
def check_tp_popup
if @battler_struct.tp != @battler.tp
f = (@battler_struct.tp - @battler.tp).round
if f > 0
make_popup(Jet::BattlePopUps::HURT_TEXT_TP + f.to_s, Jet::BattlePopUps::HURT_COLOR_TP)
elsif f < 0
make_popup(Jet::BattlePopUps::HEAL_TEXT_TP + f.abs.to_s, Jet::BattlePopUps::HEAL_COLOR_TP)
end
@battler_struct.tp = @battler.tp
end
end
end
end 作者: jianyulei 时间: 2016-6-23 15:10
战斗界面最好只用一种,我感觉你就算解决了这个问题也还是会出现其他问题的
你应该想想自己是为什么需要第二个脚本,然后将你需要的东西作为问题单独提出来,论坛里不会有人愿意修改别人制作的脚本的。