#==============================================================================
# ** Victor Engine - Basic Module
#------------------------------------------------------------------------------
# Author : Victor Sant
#
# Version History:
# v 1.00 - 2011.12.19 > First relase
# v 1.01 - 2011.12.21 > Added Event Troop notes
# v 1.02 - 2011.12.22 > Added character frames value
# v 1.03 - 2011.12.30 > Added Actor and Enemy notes
# v 1.04 - 2012.01.01 > Added party average level and map actors
# v 1.05 - 2012.01.04 > Compatibility for Characters Scripts
# v 1.06 - 2012.01.07 > Compatibility for Fog and Light Effect
# > Added new Sprite Character functions
# v 1.07 - 2012.01.11 > Compatibility for Control Text and Codes
# v 1.08 - 2012.01.13 > Compatibility for Trait Control
# v 1.09 - 2012.01.15 > Fixed the Regular Expressions problem with "" and “”
# v 1.10 - 2012.01.18 > Compatibility for Automatic Battlers
# v 1.11 - 2012.01.20 > Compatibility for Followers Options
# v 1.12 - 2012.01.26 > Compatibility for Animated Battle
#------------------------------------------------------------------------------
# This is the basic script for the system from Victory Engine and is
# required to use the scripts from the engine. This script offer some new
# functions to be used within many scripts of the engine.
#------------------------------------------------------------------------------
# Compatibility
# Required for the Victor Engine
#
# * Overwrite methods (Default)
# module Cache
# def self.character(filename)
#
# class Sprite_Character < Sprite_Base
# def set_character_bitmap
#
# * Alias methods (Default)
# class Game_Interpreter
# def command_108
#
# class Window_Base < Window
# def convert_escape_characters(text)
#
#------------------------------------------------------------------------------
# Instructions:
# To instal the script, open you script editor and paste this script on
# a new section on bellow the Materials section.
#
#------------------------------------------------------------------------------
# New functions
#
# * Random number between two vales
# rand_between(min, max)
# min : min value
# max : max value
# Can be called from any class, this method return an random value between
# two specific numbers
#
# * Random array value
# <Array>.random
# <Array>.random!
# Returns a random object from the array, the method .random! is destructive,
# removing the value returned from the array.
#
# * Sum of the numeric values of a array
# <Array>.sum
# Returns the sum of all numeric values
#
# * Avarage of all numeric values from the array
# <Array>.average(float = false)
# float : float flag
# Returns the average of all numeric values, if floa is true, the value
# returned is a float, otherwise it's a integer.
#
# * Note for events
# <Event>.note
# By default, events doesn't have note boxes. This command allows to use
# comments as note boxes, following the same format as the ones on the
# database. Returns all comments on the active page of the event.
#
# * Comment calls
# <Event>.comment_call
# Another function for comment boxes, by default, they have absolutely no
# effect in game when called. But this method allows to make the comment
# box to behave like an script call, but with the versatility of the
# note boxes. Remember that the commands will only take effect if there
# is scripts to respond to the comment code.
#
#==============================================================================
#==============================================================================
# ** Victor Engine
#------------------------------------------------------------------------------
# Setting module for the Victor Engine
#==============================================================================
module Victor_Engine
end
$imported = {} if !$imported
$imported[:ve_basic] = true
#==============================================================================
# ** Object
#------------------------------------------------------------------------------
# This class is the superclass of all other classes.
#==============================================================================
class Object
#--------------------------------------------------------------------------
# * Include setting module
#--------------------------------------------------------------------------
include Victor_Engine
#-------------------------------------------------------------------------
# * New method: rand_between
#-------------------------------------------------------------------------
def rand_between(min, max)
min + rand(max - min + 1)
end
#--------------------------------------------------------------------------
# * New method: numeric?
#--------------------------------------------------------------------------
def numeric?
return false
end
#--------------------------------------------------------------------------
# * New method: float?
#--------------------------------------------------------------------------
def float?
return false
end
#--------------------------------------------------------------------------
# * New method: item?
#--------------------------------------------------------------------------
def item?
return false
end
#--------------------------------------------------------------------------
# * New method: skill?
#--------------------------------------------------------------------------
def skill?
return false
end
#--------------------------------------------------------------------------
# * New method: file_exist?
#--------------------------------------------------------------------------
def file_exist?(path, filename)
$file_list ||= {}
$file_list[path] ||= get_file_list(path)
$file_list[path].include?(filename)
end
#--------------------------------------------------------------------------
# * New method: et_file_list
#--------------------------------------------------------------------------
def get_file_list(path)
Dir.entries("#{path}").collect {|name| name.slice(/[^\.]*/) }
end
#--------------------------------------------------------------------------
# * New method: character_exist?
#--------------------------------------------------------------------------
def character_exist?(filename)
file_exist?("Graphics/Characters/", filename)
end
#--------------------------------------------------------------------------
# * New method: battler_exist?
#--------------------------------------------------------------------------
def battler_exist?(filename)
file_exist?("Graphics/Battlers/", filename)
end
#--------------------------------------------------------------------------
# * New method: get_filename
#--------------------------------------------------------------------------
def get_filename
"[\"'“‘]([^\"'”‘”’]+)[\"'”’]"
end
#--------------------------------------------------------------------------
# * New method: make_symbol
#--------------------------------------------------------------------------
def make_symbol(string)
string.downcase.gsub(" ", "_").to_sym
end
#--------------------------------------------------------------------------
# * New method: make_string
#--------------------------------------------------------------------------
def make_string(symbol)
symbol.to_s.gsub("_", " ").upcase
end
end
#==============================================================================
# ** Numeric
#------------------------------------------------------------------------------
# This is the abstract class for numbers.
#==============================================================================
class Numeric
#--------------------------------------------------------------------------
# * New method: numeric?
#--------------------------------------------------------------------------
def numeric?
return true
end
end
#==============================================================================
# ** Float
#------------------------------------------------------------------------------
# This is the abstract class for the floating point values.
#==============================================================================
class Float
#--------------------------------------------------------------------------
# * New method: float?
#--------------------------------------------------------------------------
def float?
return true
end
end
#==============================================================================
# ** Array
#------------------------------------------------------------------------------
# This class store arbitrary Ruby objects.
#==============================================================================
class Array
#-------------------------------------------------------------------------
# * New method: random
#-------------------------------------------------------------------------
def random
self[rand(size)]
end
#-------------------------------------------------------------------------
# * New method: random!
#-------------------------------------------------------------------------
def random!
self.delete_at(rand(size))
end
#---------------------------------------------------------------------------
# * New method: sum
#---------------------------------------------------------------------------
def sum
self.inject(0) {|r, n| r += (n.numeric? ? n : 0)}
end
#---------------------------------------------------------------------------
# * New method: average
#---------------------------------------------------------------------------
def average(float = false)
self.sum / [(float ? size.to_f : size.to_i), 1].max
end
#---------------------------------------------------------------------------
# * New method: next_item
#---------------------------------------------------------------------------
def next_item
item = self.shift
self.push(item)
item
end
#---------------------------------------------------------------------------
# * New method: previous_item
#---------------------------------------------------------------------------
def previous_item
item = self.pop
self.unshift(item)
item
end
end
#==============================================================================
# ** RPG::Troop::Page
#------------------------------------------------------------------------------
# This is the data class for battle events (pages).
#==============================================================================
class RPG::Troop::Page
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
return "" if !@list || @list.size <= 0
comment_list = []
@list.each do |item|
next unless item && (item.code == 108 || item.code == 408)
comment_list.push(item.parameters[0])
end
comment_list.join("\r\n")
end
end
#==============================================================================
# ** RPG::Skill
#------------------------------------------------------------------------------
# This is the data class for skills.
#==============================================================================
class RPG::Skill
#--------------------------------------------------------------------------
# * New method: item?
#--------------------------------------------------------------------------
def item?
return false
end
#--------------------------------------------------------------------------
# * New method: skill?
#--------------------------------------------------------------------------
def skill?
return true
end
end
#==============================================================================
# ** RPG::Item
#------------------------------------------------------------------------------
# This is the data class for sitems.
#==============================================================================
class RPG::Item
#--------------------------------------------------------------------------
# * New method: item?
#--------------------------------------------------------------------------
def item?
return true
end
#--------------------------------------------------------------------------
# * New method: skill?
#--------------------------------------------------------------------------
def skill?
return false
end
end
#==============================================================================
# ** RPG::UsableItem
#------------------------------------------------------------------------------
# This is the superclass for skills and items.
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# * New method: for_all_targets?
#--------------------------------------------------------------------------
def for_all_targets?
return false
end
end
#==============================================================================
# ** Cache
#------------------------------------------------------------------------------
# This module loads each of graphics, creates a Bitmap object, and retains it.
# To speed up load times and conserve memory, this module holds the created
# Bitmap object in the internal hash, allowing the program to return
# preexisting objects when the same bitmap is requested again.
#==============================================================================
module Cache
#--------------------------------------------------------------------------
# * New method: character
#--------------------------------------------------------------------------
def self.character(filename, hue = 0)
load_bitmap("Graphics/Characters/", filename, hue)
end
end
#==============================================================================
# ** Game_BattlerBase
#------------------------------------------------------------------------------
# This class handles battlers. It's used as a superclass of the Game_Battler
# classes.
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :buffs
#--------------------------------------------------------------------------
# * New method: get_cond
#--------------------------------------------------------------------------
def get_cond(text)
case text.upcase
when "HIGHER" then ">"
when "LOWER" then "<"
when "EQUAL" then "=="
when "DIFFERENT" then "!="
else "!="
end
end
#--------------------------------------------------------------------------
# * New method: get_param
#--------------------------------------------------------------------------
def get_param(text)
case text.upcase
when "MAXHP" then self.mhp
when "MAXMP" then self.mmp
when "MAXTP" then self.max_tp
else eval("self.#{text.downcase}")
end
end
#--------------------------------------------------------------------------
# * New method: get_param_id
#--------------------------------------------------------------------------
def get_param_id(text)
case text.upcase
when "MAXHP", "HP" then 0
when "MAXMP", "MP" then 1
when "ATK" then 2
when "DEF" then 3
when "MAT" then 4
when "MDF" then 5
when "AGI" then 6
when "LUK" then 7
end
end
#--------------------------------------------------------------------------
# * New method: danger?
#--------------------------------------------------------------------------
def danger?
hp < mhp * 25 / 100
end
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemy characters. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
enemy ? enemy.note : ""
end
#--------------------------------------------------------------------------
# * New method: get_all_notes
#--------------------------------------------------------------------------
def get_all_notes
result = note
states.compact.each {|state| result += state.note }
result
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
actor ? actor.note : ""
end
#--------------------------------------------------------------------------
# * New method: hue
#--------------------------------------------------------------------------
def hue
@hue ? @hue : 0
end
#--------------------------------------------------------------------------
# * New method: get_all_notes
#--------------------------------------------------------------------------
def get_all_notes
result = note
result += self.class.note
equips.compact.each {|equip| result += equip.note }
states.compact.each {|state| result += state.note }
result
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. The instance of this class is referenced by $game_party.
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# * New method: average_level
#--------------------------------------------------------------------------
def average_level
battle_members.collect {|actor| actor.level }.average
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * New method: event_list
#--------------------------------------------------------------------------
def event_list
events.values
end
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
@map ? @map.note : ""
end
#--------------------------------------------------------------------------
# * New method: vehicles
#--------------------------------------------------------------------------
def vehicles
@vehicles
end
#--------------------------------------------------------------------------
# * New method: actors
#--------------------------------------------------------------------------
def actors
[$game_player] + $game_player.followers.visible_folloers
end
end
#==============================================================================
# ** Game_CharacterBase
#------------------------------------------------------------------------------
# This class deals with characters. Common to all characters, stores basic
# data, such as coordinates and graphics. It's used as a superclass of the
# Game_Character class.
#==============================================================================
class Game_CharacterBase
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :move_speed
attr_accessor :move_frequency
#--------------------------------------------------------------------------
# * New method: is_player?
#--------------------------------------------------------------------------
def is_player?
return false
end
#--------------------------------------------------------------------------
# * New method: is_event?
#--------------------------------------------------------------------------
def is_event?
return false
end
#--------------------------------------------------------------------------
# * New method: is_follower?
#--------------------------------------------------------------------------
def is_follower?
return false
end
#--------------------------------------------------------------------------
# * New method: is_vehicle?
#--------------------------------------------------------------------------
def is_vehicle?
return false
end
#--------------------------------------------------------------------------
# * New method: frames
#--------------------------------------------------------------------------
def frames
return 3
end
#--------------------------------------------------------------------------
# * New method: hue
#--------------------------------------------------------------------------
def hue
@hue ? @hue : 0
end
end
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# This class handles the player.
# The instance of this class is referenced by $game_map.
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * New method: is_player?
#--------------------------------------------------------------------------
def is_player?
return true
end
#--------------------------------------------------------------------------
# * New method: perform_transfer
#--------------------------------------------------------------------------
def new_map_id
@new_map_id
end
#--------------------------------------------------------------------------
# * New method: hue
#--------------------------------------------------------------------------
def hue
actor ? actor.hue : 0
end
end
#==============================================================================
# ** Game_Follower
#------------------------------------------------------------------------------
# This class handles the followers. Followers are the actors of the party
# that follows the leader in a line. It's used within the Game_Followers class.
#==============================================================================
class Game_Follower < Game_Character
#--------------------------------------------------------------------------
# * New method: is_follower?
#--------------------------------------------------------------------------
def is_follower?
return true
end
#--------------------------------------------------------------------------
# * New method: index
#--------------------------------------------------------------------------
def index
@member_index
end
end
#==============================================================================
# ** Game_Vehicle
#------------------------------------------------------------------------------
# This class handles vehicles. It's used within the Game_Map class. If there
# are no vehicles on the current map, the coordinates is set to (-1,-1).
#==============================================================================
class Game_Vehicle < Game_Character
#--------------------------------------------------------------------------
# * New method: is_vehicle?
#--------------------------------------------------------------------------
def is_vehicle?
return true
end
#--------------------------------------------------------------------------
# * New method: map_id
#--------------------------------------------------------------------------
def map_id
@map_id
end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
# This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * New method: name
#--------------------------------------------------------------------------
def name
@event.name
end
#--------------------------------------------------------------------------
# * New method: is_event?
#--------------------------------------------------------------------------
def is_event?
return true
end
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
return "" if !@page || !@page.list || @page.list.size <= 0
comment_list = []
@page.list.each do |item|
next unless item && (item.code == 108 || item.code == 408)
comment_list.push(item.parameters[0])
end
comment_list.join("\r\n")
end
end
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Alias method: command_108
#--------------------------------------------------------------------------
alias :command_108_ve_basic_module :command_108
def command_108
command_108_ve_basic_module
comment_call
end
#--------------------------------------------------------------------------
# * New method: comment_call
#--------------------------------------------------------------------------
def comment_call
end
#--------------------------------------------------------------------------
# * New method: note
#--------------------------------------------------------------------------
def note
@comments ? @comments.join("\r\n") : ""
end
end
#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
# This sprite is used to display characters. It observes a instance of the
# Game_Character class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# * Overwrite method: set_character_bitmap
#--------------------------------------------------------------------------
def set_character_bitmap
update_character_info
set_bitmap
set_bitmap_position
end
#--------------------------------------------------------------------------
# * New method: center_y
#--------------------------------------------------------------------------
def actor?
@character.is_a?(Game_Player) || @character.is_a?(Game_Follower)
end
#--------------------------------------------------------------------------
# * New method: center_y
#--------------------------------------------------------------------------
def actor
actor? ? @character.actor : nil
end
#--------------------------------------------------------------------------
# * New method: update_character_info
#--------------------------------------------------------------------------
def update_character_info
end
#--------------------------------------------------------------------------
# * New method: hue
#--------------------------------------------------------------------------
def hue
@character.hue
end
#--------------------------------------------------------------------------
# * New method: set_bitmap
#--------------------------------------------------------------------------
def set_bitmap
self.bitmap = Cache.character(set_bitmap_name, hue)
end
#--------------------------------------------------------------------------
# * New method: set_bitmap_name
#--------------------------------------------------------------------------
def set_bitmap_name
@character_name
end
#--------------------------------------------------------------------------
# * New method: set_bitmap_position
#--------------------------------------------------------------------------
def set_bitmap_position
sign = get_sign
if sign && sign.include?('$')
@cw = bitmap.width / @character.frames
@ch = bitmap.height / 4
else
@cw = bitmap.width / (@character.frames * 4)
@ch = bitmap.height / 8
end
self.ox = @cw / 2
self.oy = @ch
end
#--------------------------------------------------------------------------
# * New method: get_sign
#--------------------------------------------------------------------------
def get_sign
@character_name[/^[\!\$]./]
end
end
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display battlers. It observes a instance of the
# Game_Battler class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :dmg_mirror
#--------------------------------------------------------------------------
# * New method: center_x
#--------------------------------------------------------------------------
def center_x
self.ox
end
#--------------------------------------------------------------------------
# * New method: center_y
#--------------------------------------------------------------------------
def center_y
self.oy / 2
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within the
# Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * New method: sprite
#--------------------------------------------------------------------------
def sprite(subject)
battler_sprites.compact.select {|sprite| sprite.battler == subject }.first
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a superclass of all windows in the game.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Alias method: convert_escape_characters
#--------------------------------------------------------------------------
alias :convert_escape_ve_basic_module :convert_escape_characters
def convert_escape_characters(text)
result = text.to_s.clone
result = text_replace(result)
result = convert_escape_ve_basic_module(text)
result
end
#--------------------------------------------------------------------------
# * New method: text_replace
#--------------------------------------------------------------------------
def text_replace(result)
result.gsub!(/\r/) { "" }
result.gsub!(/\\/) { "\e" }
result
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :spriteset
end
#==============================================================================
# ** Victor Engine - Animated Battle
#------------------------------------------------------------------------------
# Author : Victor Sant
#
# Version History:
# v beta - 2012.01.28 > Beta relase
#------------------------------------------------------------------------------
# VE - Animated battle Beta
#------------------------------------------------------------------------------
# Compatibility
# Requires the script 'Victor Engine - Basic Module'
#
#------------------------------------------------------------------------------
# Instructions:
# To instal the script, open you script editor and paste this script on
# a new section on bellow the Materials section. This script must also
# be bellow the script 'Victor Engine - Basic'
#==============================================================================
#==============================================================================
# ** Victor Engine
#------------------------------------------------------------------------------
# Setting module for the Victor Engine
#==============================================================================
module Victor_Engine
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
VE_ACTION_SETTINGS = {}
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
VE_ANIMATED_BATTLER_SUFIX = "[anim]"
VE_BATTLE_INTRO_FADE = true
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
VE_POSE_SETTINGS = {
# Main Poses
# name: row,
idle: 1, # Idle pose
guard: 2, # Guard pose
evade: 2, # Evade pose
danger: 3, # Low HP pose
hurt: 4, # Damage pose
attack: 5, # Physical attack pose
use: 6, # No type use pose
item: 6, # Item use pose
skill: 7, # Skill use pose
magic: 8, # Magic use pose
advance: 9, # Advance pose
retreat: 10, # Retreat pose
escape: 10, # Escape pose
victory: 11, # Victory pose
intro: 12, # Battle start pose
dead: 13, # Incapacited pose
# Advanced poses,
# name: row,
advance_start: nil, # Pose before the advance movement start
retreat_start: nil, # Pose before the retreat movement start
advance_end: nil, # Pose after the advance movement end
retreat_end: nil, # Pose after the retreat movement end
default_cast: 11, # Default casting pose
item_cast: nil, # Item casting pose
magic_cast: nil, # Magic casting pose
skill_cast: nil, # Skill casting pose
critical_damage: nil, # Critical damage pose
} # Não remover
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
VE_DEFAULT_SPRITE = {frames: 4, rows: 14, mirror: false, mode: :sprite}
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
VE_SPRITE_SETTINGS = {
'Filename' => {frames: 4, rows: 14, mirror: false, mode: :sprite},
}
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
VE_DEFAULT_ACTION = "
<action: idle, loop>
pose: user, row idle, all frames, wait 8;
wait: 32;
</action>
<action: dead, loop>
pose: user, row dead, all frames, wait 8;
wait: 32;
</action>
<action: danger, loop>
pose: user, row danger, all frames, wait 8;
wait: 32;
</action>
<action: intro, reset>
pose: user, row intro, all frames, wait 16;
wait: 64;
</action>
<action: victory>
pose: user, row victory, all frames, wait 16;
wait: 64;
</action>
<action: default cast, loop>
pose: user, row skill cast, frame 1;
wait: 32;
</action>
<action: guarding, loop>
pose: user, row guard, all frames, wait 12;
wait: 48;
</action>
<action: danger, loop>
pose: user, row idle, all frames, wait 8;
wait: 32;
</action>
<action: evade, reset>
pose: user, row evade, all frames, wait 4;
wait: 16;
</action>
<action: hurt, reset>
pose: user, row hurt, all frames, wait 4;
wait: 16
</action>
<action: inactive>
inactive;
</action>
<action: advance>
wait: animation;
move: user, move to;
jump: user, move, height 7;
pose: user, row advance, all frames, wait 4;
wait: movement;
</action>
<action: retreat, reset>
move: user, retreat;
pose: user, row retreat, all frames, wait 4;
wait: movement;
</action>
<action: escape, reset>
move: user, escape;
pose: user, row retreat, all frames, wait 4;
wait: movement;
</action>
<action: defend, reset>
pose: user, row guard, all frames, wait 8;
wait: 4;
anim: target, effect;
wait: 4;
effect: 100%;
wait: 20;
</action>
<action: attack, reset>
pose: user, row attack, all frames, wait 4;
wait: 4;
anim: target, effect;
wait: 8;
effect: 100%;
wait: 20;
</action>
<action: dual attack, reset>
pose: user, row attack, all frames, wait 4;
wait: 4;
anim: target, weapon 1;
wait: 8;
effect: 75%, weapon 1;
wait: 4;
wait: animation;
pose: user, row skill, all frames, wait 4;
wait: 8;
anim: target, weapon 2;
wait: 4;
effect: 75%, weapon 2;
jump: target, height 12, speed 5, hit only;
wait: 20;
</action>
<action: use, reset>
wait: animation;
pose: user, row item, all frames, wait 4;
wait: 4;
anim: target, effect;
wait: 4;
effect: 100%;
wait: 20;
</action>
<action: item, reset>
wait: animation;
pose: user, row item, all frames, wait 4;
wait: 4;
anim: target, effect;
wait: 4;
effect: 100%;
wait: 20;
</action>
<action: magic, reset>
wait: animation;
pose: user, row magic, all frames, wait 4;
wait: 4;
anim: target, effect;
wait: 8;
effect: 100%;
wait: 20;
</action>
<action: skill, reset>
pose: user, row attack, all frames, wait 4;
wait: 4;
anim: target, effect;
wait: 8;
effect: 100%;
wait: 20;
</action>
<action: throw weapon, reset>
pose: user, row attack, all frames, wait 4;
action: target, target throw;
wait: action;
</action>
<action: target throw, reset>
throw: self, weapon 1, arc 10, spin +45, speed 15;
wait: throw;
throw: self, weapon 1, arc 10, spin +45, speed 15, return, revert;
anim: self, weapon 1;
effect: self, 100%;
wait: throw;
wait: animation;
</action>
"
VE_ACTION_SETTINGS['Hero_m'] = "
<action: advance>
wait: animation;
move: user, move to;
pose: user, row advance, all frames, wait 4;
wait: movement;
</action>
"
VE_SPRITE_SETTINGS.default = VE_DEFAULT_SPRITE
end
#==============================================================================
# ** Victor Engine - Animated Battle
#------------------------------------------------------------------------------
# Author : Victor Sant
#
# Version History:
# v beta - 2012.01.28 > Beta relase
#------------------------------------------------------------------------------
# VE - Animated battle Beta
#------------------------------------------------------------------------------
# Compatibility
# Requires the script 'Victor Engine - Basic Module'
#
#------------------------------------------------------------------------------
# Instructions:
# To instal the script, open you script editor and paste this script on
# a new section on bellow the Materials section. This script must also
# be bellow the script 'Victor Engine - Basic'
#==============================================================================
#==============================================================================
# ** Victor Engine
#------------------------------------------------------------------------------
# Setting module for the Victor Engine
#==============================================================================
$imported[:ve_animated_battle] = true
#==============================================================================
# ** RPG::Skill
#------------------------------------------------------------------------------
# This is the data class for skills.
#==============================================================================
class RPG::Skill
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def custom_pose?
note =~ /<ACTION: CUSTOM([^>]*)>(.*)<\/action>/im
end
end
#==============================================================================
# ** RPG::Item
#------------------------------------------------------------------------------
# This is the data class for sitems.
#==============================================================================
class RPG::Item
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def custom_pose?
note =~ /<ACTION: CUSTOM([^>]*)>(.*)<\/action>/im
end
end
#==============================================================================
# ** RPG::State
#------------------------------------------------------------------------------
# This is the data class for states.
#==============================================================================
class RPG::State
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def state_pose
note =~ /<STATE POSE: (\w[\w ]+)>/i ? make_symbol($1) : nil
end
end
#==============================================================================
# ** BattleManager
#------------------------------------------------------------------------------
# This module handles the battle processing
#==============================================================================
class << BattleManager
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :init_members_ve_animated_battle :init_members
def init_members
$game_party.members.each {|member| member.clear_poses }
init_members_ve_animated_battle
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :battle_end_ve_animated_battle :battle_end
def battle_end(result)
$game_party.members.each {|member| member.clear_poses }
battle_end_ve_animated_battle(result)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :process_victory_ve_animated_battle :process_victory
def process_victory
process_victory_pose
process_victory_ve_animated_battle
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :process_escape_ve_animated_battle :process_escape
def process_escape
@escaping = true
success = process_escape_ve_animated_battle
@escaping = false
return success
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :process_abort_ve_animated_battle :process_abort
def process_abort
process_escape_pose if @escaping
process_abort_ve_animated_battle
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def process_victory_pose
SceneManager.scene.update_basic while $game_party.not_in_position?
$game_party.movable_members.each do |member|
member.clear_idle_poses
member.call_pose(:victory)
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def process_escape_pose
$game_party.movable_members.each do |member|
member.clear_idle_poses
member.call_pose(:escape)
end
5.times { SceneManager.scene.update_basic }
SceneManager.scene.update_basic while $game_party.moving?
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_active_pose
return unless actor
actor.set_active_pose
actor.reset_pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def clear_active_pose
return unless actor
actor.active_pose = nil
actor.reset_pose
end
end
#==============================================================================
# ** Game_ActionResult
#------------------------------------------------------------------------------
# This class handles the results of actions. This class is used within the
# Game_Battler class.
#==============================================================================
class Game_ActionResult
#--------------------------------------------------------------------------
# * New method: damage_value_adjust
#--------------------------------------------------------------------------
def damage_value_adjust(value, item)
@hp_damage *= value
@mp_damage *= value
@hp_damage = @hp_damage.to_i
@mp_damage = [@battler.mp, @mp_damage.to_i].min
@hp_drain = @hp_damage if item.damage.drain?
@mp_drain = @mp_damage if item.damage.drain?
@hp_drain = [@battler.hp, @hp_drain].min
end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
attr_accessor :row
attr_accessor :frame
attr_accessor :timing
attr_accessor :direction
attr_accessor :move_speed
attr_accessor :jumping
attr_accessor :pose_list
attr_accessor :immortals
attr_accessor :attack_flag
attr_accessor :damage_flag
attr_accessor :result_flag
attr_accessor :target_flag
attr_accessor :sufix
attr_accessor :active
attr_accessor :targets
attr_accessor :teleport
attr_accessor :call_anim
attr_accessor :call_effect
attr_accessor :animation
attr_accessor :action_targets
attr_accessor :active_pose
attr_accessor :pose_loop_anim
attr_accessor :icon_list
attr_accessor :throw_list
attr_accessor :current_item
attr_accessor :target_position
attr_accessor :current_position
attr_accessor :default_position
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :initialize_ve_animated_battle :initialize
def initialize
init_anim_battlers_variables
initialize_ve_animated_battle
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :item_apply_ve_animated_battle :item_apply
def item_apply(user, item)
item_apply_ve_animated_battle(user, item)
call_pose(:hurt, true, item) if @result.hit? && @result.hp_damage > 0
call_pose(:evade, true, item) if @result.evaded
call_pose(:critical_damage, true, item) if @result.critical
user.result_flag = @result.hit? ? :hit : :miss
end
#--------------------------------------------------------------------------
# * Alias method: make_damage_value
#--------------------------------------------------------------------------
alias :make_damage_value_ve_animated_battle :make_damage_value
def make_damage_value(user, item)
make_damage_value_ve_animated_battle(user, item)
@result.damage_value_adjust(user.damage_flag, item) if user.damage_flag
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :regenerate_hp_ve_animated_battle :regenerate_hp
def regenerate_hp
regenerate_hp_ve_animated_battle
call_pose(:hurt, true) if @result.hp_damage > 0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def dead?
super && !immortal?
end
#--------------------------------------------------------------------------
# * Renovação
#--------------------------------------------------------------------------
def refresh
state_resist_set.each {|state_id| erase_state(state_id) }
@hp = [[@hp, mhp].min, 0].max
@mp = [[@mp, mmp].min, 0].max
die if [url=home.php?mod=space&uid=90807]@Dying[/url] && !immortal?
return if @dying
valid = @hp == 0 && !immortal?
valid ? add_state(death_state_id) : remove_state(death_state_id)
reset_pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def immortal?
return false unless $game_party.in_battle
members = $game_troop.members + $game_party.battle_members
members.any? {|member| member.immortals.include?(self) }
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :die_ve_animated_battle :die
def die
return @dying = true if immortal?
@dying = false
die_ve_animated_battle
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def init_anim_battlers_variables
clear_poses
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def clear_poses
@sufix = ""
@row = 0
@frame = 0
@direction = 2
@move_speed = 1.0
@pose_list = []
@targets = []
@immortals = []
@throw_list = []
@icon_list = {}
@timing = {}
@action_targets = []
@target_position = {x: 0, y: 0, h: 0, j: 0}
@current_position = {x: 0, y: 0, h: 0, j: 0}
@default_position = {x: 0, y: 0, h: 0, j: 0}
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def call_pose(symbol, insert = false, item = nil, battler = nil)
@pose_list.shift if insert && pose_name_list.first == symbol
pose = make_string(symbol)
note = item ? item.note : ""
notes = note + get_all_notes + battler_settings + default_settings
code = "ACTION: #{pose}((?: *, *[\\w ]+)+)?"
setup_pose(symbol, notes, code, insert, battler)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def default_settings
VE_DEFAULT_ACTION
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def battler_settings
VE_ACTION_SETTINGS[@battler_name] ? VE_ACTION_SETTINGS[@battler_name] : ""
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_pose(pose, notes, code, insert, battler)
regexp = /<#{code}>((?:[^<]|<[^\/])*)<\/ACTION>/im
if notes.gsub(/\r\n/i, "") =~ regexp
time, last = get_values($1)
value = setup_value($2, battler)
time.times do
list = {pose: pose, next: last, value: value.dup}
insert ? @pose_list.unshift(list) : @pose_list.push(list)
end
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def pose_name_list
@pose_list.collect {|pose| pose[:pose]}
end
#--------------------------------------------------------------------------
# *
def pose_name
pose_name_list.first
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def get_values(value)
if value
time = value =~ /([^,]+) TIMES/i ? [eval($1), 1].max : 1
last = value =~ /(\w[\w ]+)/i ? make_symbol($1) : nil
[time, last]
else
[1, nil]
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def clear_idle_poses
@pose_list.delete_if {|pose| idle_pose?(pose[:pose]) }
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def battler
@pose[:battler] ? @pose[:battler] : self
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def idle_pose?(pose)
idle_pose_list.include?(pose.downcase.to_sym)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def idle_pose_list
[:idle, :guarding, :danger, :dead, :item_cast, :magic_cast, :skill_cast,
:default_cast] + states_pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def states_pose
$data_states.compact.collect {|state| state.state_pose }.compact
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_value(settings, battler)
values = []
settings.scan(/(\w+)(?:: ([^;]+)[;\n\r])?/i) do |type, value|
values.push(set_pose_value(type, value ? value : '', battler))
end
values
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_pose_value(type, value, battler)
@pose = {}
@pose[:battler] = battler
@pose[:type] = make_symbol(type)
@pose[:hit] = value =~ /HIT ONLY/i ? true : false
@pose[:miss] = value =~ /MISS ONLY/i ? true : false
set_pose_setting("#{type} #{value}")
@pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_pose_setting(value)
case value
when /^POSE (.*)/i then set_pose($1)
when /^WAIT (.*)/i then set_wait($1)
when /^MOVE (.*)/i then set_move($1)
when /^JUMP (.*)/i then set_jump($1)
when /^ANIM (.*)/i then set_anim($1)
when /^ICON (.*)/i then set_icon($1)
when /^LOOP (.*)/i then set_loop($1)
when /^THROW (.*)/i then set_throw($1)
when /^ACTION (.*)/i then set_action($1)
when /^EFFECT (.*)/i then set_effect($1)
when /^DIRECTION (.*)/i then set_direction($1)
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_pose(value)
@pose[:target] = set_targets(value)
@pose[:row] = battler.set_row(value)
@pose[:sufix] = value =~ /SUFIX ([\[\]\w]+)/i ? $1.to_s : ""
if value =~ /(\d+|ALL) FRAMES?/i
wait = [value =~ /WAIT (\d+)/i ? $1.to_i : 1, 1].max
max_frame = /(\d+) FRAMES/i ? $1.to_i : :all
@pose[:frame] = value =~ /FRAME (\d+)/i ? $1.to_i : 1
@pose[:pose] = {wait: wait, time: wait, frame: max_frame}
else
@pose[:pose] = {}
@pose[:frame] = value =~ /FRAME (\d+)/i ? $1.to_i : 1
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_wait(value)
@pose[:target] = set_targets(value)
case value
when /(\d+)/i
@pose[:time] = $1.to_i
@pose[:wait] = $1.to_i
when /(ACTION|ANIMATION|MOVEMENT|THROW)/i
@pose[:time] = make_symbol($1)
@pose[:wait] = make_symbol($1)
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_move(value)
regexp = /(MOVE TO|STEP FOWARD|RETREAT|ESCAPE)/i
@pose[:value] = make_symbol($1) if value =~ regexp
@pose[:target] = battler. set_targets(value)
@pose[:x] = value =~ /X ([+-]?\d+)/i ? $1.to_i : 0
@pose[:y] = value =~ /Y ([+-]?\d+)/i ? $1.to_i : 0
@pose[:h] = value =~ /HEIGHT (\d+)/i ? $1.to_i : 0
@pose[:speed] = value =~ /SPEED (\d+)/i ? $1.to_i / 10.0 : 1.0
@pose[:targets] = @action_targets if @pose[:value] == :move_to
@pose[:teleport] = value =~ /TELEPORT/i
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_jump(value)
@pose[:target] = set_targets(value)
@pose[:move] = value =~ /MOVE/i
@pose[:height] = value =~ /HEIGHT (\d+)/i ? [$1.to_i, 1].max : 5
@pose[:speed] = value =~ /SPEED (\d+)/i ? [$1.to_i, 1].max : 10
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_action(value)
@pose[:target] = set_targets(value)
value.scan(/(\w[\w ]+)/) do
not_action = ['target','actor','friend','enemy', 'user','self']
next if not_action.include?($1.downcase)
@pose[:action] = make_symbol($1)
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_anim(value)
@pose[:target] = set_targets(value)
item = current_action ? current_action.item : nil
case value
when /CAST/i
cast = item && $imported[:ve_cast_animation]
anim = cast ? battler.cast_animation_id(item) : 0
@pose[:anim] = anim
when /EFFECT/i
@pose[:anim] = item ? item.animation_id : 0
when /ID (\d+)/i
@pose[:anim] = $1.to_i
when /WEAPON *(\d+)?/i
@pose[:anim] = battler.atk_animation_id1
@pose[:anim] = battler.atk_animation_id2 if $1 && $1.to_i == 2
else
@pose[:anim] = 0
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_icon(value)
@pose[:target] = set_targets(value)
@pose[:index] = /INDEX (\d+)/i ? $1.to_i : 0
@pose[:delete] = value =~ /DELETE/i ? true : false
return if @pose[:delete]
set_action_icon(value)
@pose[:x] = value =~ /X ([+-]?\d+)/i ? $1.to_i : 0
@pose[:y] = value =~ /Y ([+-]?\d+)/i ? $1.to_i : 0
@pose[:z] = value =~ /Z ([+-]?\d+)/i ? $1.to_i : -1
@pose[:a] = value =~ /ANGLE (\d+)/i ? $1.to_i : 0
@pose[:o] = value =~ /OPACITY (\d+)/i ? $1.to_i : 255
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_throw(value)
@pose[:target] = set_targets(value)
set_action_icon(value)
@pose[:revert] = value =~ /REVERT/i
@pose[:return] = value =~ /RETURN/i
@pose[:init_x] = value =~ /INIT X (\d+)/i ? $1.to_i : 0
@pose[:init_y] = value =~ /INIT Y (\d+)/i ? $1.to_i : 0
@pose[:end_x] = value =~ /END X (\d+)/i ? $1.to_i : 0
@pose[:end_y] = value =~ /END X (\d+)/i ? $1.to_i : 0
@pose[:anim] = value =~ /ANIM (\d+)/i ? $1.to_i : nil
@pose[:arc] = value =~ /ARC (\d+)/i ? $1.to_i : 0
@pose[:angle] = value =~ /ANGLE (\d+)/i ? $1.to_i : 0
@pose[:speed] = value =~ /SPEED (\d+)/i ? $1.to_i / 10.0 : 1.0
@pose[:z] = value =~ /Z ([+-]?\d+)/i ? $1.to_i : -1
@pose[:a] = value =~ /SPIN ([+-]\d+)/i ? $1.to_i : 0
@pose[:o] = value =~ /OPACITY (\d+)/i ? $1.to_i : 255
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_action_icon(value)
icon = weapon_icon($1.to_i) if value =~ /WEAPON (\d+)/i && battler.actor?
icon = armor_icon($1.to_i) if value =~ /ARMOR (\d+)/i && battler.actor?
icon = $1.to_i if value =~ /ICON (\d+)/i
@pose[:icon] = icon ? icon : 0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_loop(value)
@pose[:target] = set_targets(value)
@pose[:loop_anim] = value =~ /ANIM (\d+)/i ? $1.to_i : 0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_effect(value)
@pose[:target] = set_targets(value)
@pose[:damage] = $1.to_i / 100.0 if value =~ /(\d+)%/i
@pose[:weapon] = [$1.to_i, 1].max if value =~ /WEAPON (\d+)/i
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_targets(value)
case value
when /TARGET/i
battler.action_targets.dup
when /ACTOR ([^>,]+)/i
acotor = $game_actors[eval($1)]
target = $game_party.battle_members.include?(actor) ? [actor] : []
when /FRIEND ([^>,]+)/i
[$game_party.battle_members[eval($1)]].compact
when /ENEMY ([^>,]+)/i
[$game_troop.members[eval($1)]].compact
when /RANDOM ENEMY/i
battler.opponents_unit.members.random
when /RANDOM FRIEND/i
battler.firends_unit.members.random
when /ALL ENEMIES/i
battler.opponents_unit.members
when /ALL FRIENDS/i
battler.firends_unit.members
when /SELF/i
[self]
else
nil
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_row(value)
pose = VE_POSE_SETTINGS[make_symbol($1)] if value =~ /ROW (\w+)/i
pose = $1.to_i if value =~ /ROW (\d+)/i
pose ? pose : 0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_direction(value)
@pose[:targets] = value =~ /TARGETS/i
@pose[:direction] = 2 if value =~ /DOWN/i
@pose[:direction] = 4 if value =~ /LEFT/i
@pose[:direction] = 6 if value =~ /RIGHT/i
@pose[:direction] = 8 if value =~ /UP/i
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def weapon_icon(index)
battler.weapons[index - 1] ? battler.weapons[index - 1].icon_index : nil
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def armor_icon(index)
battler.armors[index - 1] ? battler.armors[index - 1].icon_index : nil
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def active?
@active
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def down?
@direction == 2
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def left?
@direction == 4
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def right?
@direction == 6
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def up?
@direction == 8
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def returning?
pose_name_list.first == :retreat || pose_name_list.first == :escape
end
#--------------------------------------------------------------------------
# Definição de direção do battler de acordo com o ponto alvo
#--------------------------------------------------------------------------
def target_direction(x, y)
relative_x = @current_position[:x] - x
relative_y = @current_position[:y] - y
if relative_y.abs > relative_x.abs
directions = returning? ? [8, 2] : [2, 8]
@direction = (relative_y < 0 ? directions[0] : directions[1])
elsif relative_x.abs >= relative_y.abs
directions = returning? ? [4, 6] : [6, 4]
@direction = (relative_x < 0 ? directions[0] : directions[1])
end
end
#--------------------------------------------------------------------------
# Definição de direção da ação do battler
#--------------------------------------------------------------------------
def action_direction
units = @action_targets
target_x = units.collect {|member| member.current_position[:x] }.average
target_y = units.collect {|member| member.current_position[:y] }.average
relative_x = current_position[:x] - target_x
relative_y = current_position[:y] - target_y
if relative_y.abs > relative_x.abs
@direction = relative_y < 0 ? 2 : 8
elsif relative_x.abs >= relative_y.abs
@direction = relative_x < 0 ? 6 : 4
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def target_distance(symbol)
@target_position[symbol] - @current_position[symbol]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def moving?
@current_position != @target_position
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def activate
return unless current_action
@active = true
@active_pose = nil
@action_targets = current_action.make_targets.compact.dup
@action_targets.each {|target| immortals.push(target) unless target.dead? }
immortals.uniq!
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def deactivate
@active = false
@attack_flag = nil
@result_flag = nil
immortals = @immortals.dup
@immortals.clear
immortals.each {|member| member.refresh }
@action_targets.clear
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def action_pose(item)
activate
@current_item = item
pose = set_action_pose(item)
call_action_poses(pose, item)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_action_pose(item)
pose = [:use, false, item]
pose = [:item, false, item] if item.item?
pose = [:skill, false, item] if item.skill?
pose = [:magic, false, item] if item.magical?
pose = set_attack_pose(item) if item.skill? && item.id == attack_skill_id
pose = [:defend, false, item] if item.skill? && item.id == guard_skill_id
pose = [:custom, false, item] if item.custom_pose?
pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def call_action_poses(pose, item)
clear_idle_poses
call_pose(:advance, false, item) if need_move
call_pose(*pose)
call_pose(:inactive)
call_pose(:retreat, false, item) if need_move
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def need_move
item = current_item
return false if ranged?
return true if item.skill? && item.physical?
return true if item.skill? && item.id == attack_skill_id
return false
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_attack_pose(item)
pose = [:attack, false, item]
pose = [:dual_attack, false, item] if double_attack?
pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_active_pose
item = current_action.item
pose = :default_cast if VE_POSE_SETTINGS[:default_cast]
pose = :item_cast if item.item? && VE_POSE_SETTINGS[:item_cast]
pose = :magic_cast if item.magical? && VE_POSE_SETTINGS[:magic_cast]
pose = :skill_cast if item.physical? && VE_POSE_SETTINGS[:skill_cast]
@active_pose = pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def ranged?
get_all_notes =~ /<RANGED ATTACK>/i
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def double_attack?
actor? && dual_wield? && weapons.size > 1
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def not_in_position?
@current_position[:x] != screen_x || @current_position[:y] != screen_y
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def state_pose?
state_pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def state_pose
state = states.find {|state| state.state_pose }
state ? state.state_pose : nil
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def reset_pose
return unless $game_party.in_battle
SceneManager.scene.spriteset.sprite(self).reset_pose
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def perform_collapse_effect
if $game_party.in_battle
reset_pose
case collapse_type
when 0
@sprite_effect_type = :collapse
Sound.play_enemy_collapse
when 1
@sprite_effect_type = :boss_collapse
Sound.play_boss_collapse1
when 2
@sprite_effect_type = :instant_collapse
end
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def perform_damage_effect
$game_troop.screen.start_shake(5, 5, 10) unless use_sprite?
Sound.play_actor_damage
end
#--------------------------------------------------------------------------
# * Aquisição do valor adicional do parâmetro
# param_id : ID do parâmetro
#--------------------------------------------------------------------------
alias :param_plus_ve_animated_battle :param_plus
def param_plus(param_id)
if param_id > 1 && double_attack? && @attack_flag
equip = [weapons[@attack_flag - 1]] + armors
equip.compact.inject(super) {|r, item| r += item.params[param_id] }
else
param_plus_ve_animated_battle(param_id)
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def default_direction
units = opponents_unit.members
relative_x = screen_x - units.collect {|member| member.screen_x }.average
relative_y = screen_y - units.collect {|member| member.screen_y }.average
if relative_y.abs > relative_x.abs
@direction = relative_y < 0 ? 2 : 8
elsif relative_x.abs >= relative_y.abs
@direction = relative_x < 0 ? 6 : 4
end
end
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemy characters. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :perform_collapse_effect_ve_animated_battle :perform_collapse_effect
def perform_collapse_effect
reset_pose
perform_collapse_effect_ve_animated_battle
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def perform_damage_effect
Sound.play_enemy_damage
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def character_name
@battler_name
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def character_hue
@battler_hue
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def character_index
0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def visual_items
[default_part]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def default_part
{name: character_name.dup, index1: character_index, index2: character_index,
hue: character_hue, priority: 0}
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def default_direction
units = opponents_unit.battle_members
relative_x = screen_x - units.collect {|member| member.screen_x }.average
relative_y = screen_y - units.collect {|member| member.screen_y }.average
if relative_y.abs > relative_x.abs
@direction = relative_y < 0 ? 2 : 8
elsif relative_x.abs >= relative_y.abs
@direction = relative_x < 0 ? 6 : 4
end
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. The instance of this class is referenced by $game_party.
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def not_in_position?
movable_members.any? {|member| member.not_in_position? }
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def moving?
movable_members.any? {|member| member.moving? }
end
end
#==============================================================================
# ** Game_Troop
#------------------------------------------------------------------------------
# This class handles enemy groups and battle-related data. Also performs
# battle events. The instance of this class is referenced by $game_troop.
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
attr_accessor :back_attack
end
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display battlers. It observes a instance of the
# Game_Battler class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
attr_accessor :battler
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :initialize_ve_animated_battle :initialize
def initialize(viewport, battler = nil)
initialize_ve_animated_battle(viewport, battler)
init_variables
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :update_effect_ve_animated_battle :update_effect
def update_effect
setup_collapse
update_effect_ve_animated_battle
update_pose
update_pose_loop_anim if $imported[:ve_loop_animation]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :revert_to_normal_ve_animated_battle :revert_to_normal
def revert_to_normal
revert_to_normal_ve_animated_battle
update_rect if bitmap
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_collapse
if @battler.dead? && !@dead
@battler.perform_collapse_effect
@dead = true
elsif @dead && !@battler.dead?
@dead = false
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_bitmap
setup_bitmap if graphic_changed?
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def init_visibility
@battler_visible = !@battler.hidden?
self.opacity = 0 unless @battler_visible
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def init_variables
@sufix = ""
@pose_sufix = ""
@anim_sufix = VE_ANIMATED_BATTLER_SUFIX
@frame_width = 0
@frame_height = 0
@pose_value = {}
@icon_list = {}
@throw_list = []
start_effect(:appear) if VE_BATTLE_INTRO_FADE && !@battler.hidden?
@battler.clear_poses
setup_positions
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def subject
(@pose && @pose[:battler]) ? @pose[:battler] : @battler
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def sprite_settings
VE_SPRITE_SETTINGS[@battler_name]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def graphic_changed?
actor_name_change? || battler_name_change? || misc_change?
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def actor_name_change?
use_charset? && (@battler_name != @battler.character_name ||
@battler_index != @battler.character_index ||
@battler_hue != @battler.character_hue)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def battler_name_change?
!use_charset? && (@battler_name != @battler.battler_name ||
@battler_hue != @battler.battler_hue)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def misc_change?
(visual_equip? && @visual_items != @battler.visual_items) ||
@sufix != @battler.sufix || @direction != @battler.direction
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def use_charset?
sprite_settings[:mode] == :charset
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def visual_equip?
$imported[:ve_visual_equip]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_bitmap
if use_charset?
@battler_name = @battler.character_name
@battler_hue = @battler.character_hue
@battler_index = @battler.character_index
else
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
end
@sufix = @battler.sufix
@direction = @battler.direction
@visual_items = @battler.visual_items.dup if visual_equip?
init_bitmap
init_frame
init_visibility
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def init_bitmap
case sprite_settings[:mode]
when :charset
if visual_equip?
args = [get_name, @battler_hue, @visual_items, sufix]
self.bitmap = Cache.character(*args)
else
self.bitmap = Cache.character(get_name, @battler_hue)
end
when :single
self.bitmap = Cache.battler(get_name, @battler_hue)
when :sprite
self.bitmap = Cache.battler(get_name, @battler_hue)
else
self.bitmap = Cache.battler(@battler_name, @battler_hue)
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def sufix
case sprite_settings[:mode]
when :charset then @sufix
when :single then @pose_sufix + @sufix
when :sprite then @anim_sufix + @sufix
else ""
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def get_name
name = @battler_name + sufix
battler_exist?(name) ? name : @battler_name
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def init_frame
@frame_width = bitmap.width / frame_number
@frame_height = bitmap.height / row_number
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def frame_number
return 1 unless battler_exist?(@battler_name + sufix)
return @battler.frames if use_charset? && @battler_name[/^$./]
return @battler.frames * 4 if use_charset? && !@battler_name[/^$./]
return sprite_settings[:frames] if sprite_settings[:mode] == :single
return sprite_settings[:frames] if sprite_settings[:mode] == :sprite
return 1
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def row_number
return 1 unless battler_exist?(@battler_name + sufix)
return 4 if use_charset? && @battler_name[/^$./]
return 8 if use_charset? && !@battler_name[/^$./]
return sprite_settings[:rows] if sprite_settings[:mode] == :sprite
return 1
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_origin
update_rect if bitmap
update_icon
update_throw
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_rect
setup_frame
setup_rect
self.ox = @frame_width / 2
self.oy = @frame_height
self.mirror = pose_mirror
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def pose_mirror
mirror = sprite_settings[:mirror]
return !mirror if @battler.right?
return mirror
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_frame
return if @battler.timing.empty?
value = @battler.timing
value[:time] -= 1
value[:time] = value[:wait] if value[:time] == 0
return if value[:time] != value[:wait]
max = value[:frame] == :all ? sprite_settings[:frames] : value[:frame]
@battler.frame = @battler.frame + 1
@battler.timing = {} if @battler.frame == max - 1
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_rect
sign = @battler_name[/^[$]./]
if use_charset? && sign && !sign.include?('$')
index = @battler_index
frame = (index % 4 * @battler.frames + @battler.frame) * @frame_width
row = (index / 4 * 4 + @battler.row) * @frame_height
else
frame = [@battler.frame, frame_number - 1].min * @frame_width
row = [@battler.row , row_number - 1].min * @frame_height
end
self.src_rect.set(frame, row, @frame_width, @frame_height)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose
setup_pose
return if !@pose || !@pose[:type].is_a?(Symbol)
update_pose_type
next_pose unless @waiting
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_pose
@current_pose = pose_list.first
return unless @current_pose
@pose_value = @current_pose[:value]
@pose = @pose_value.first
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def pose_list
@battler.pose_list
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_type
@waiting = false
return if @pose[:hit] && @battler.result_flag != :hit
return if @pose[:miss] && @battler.result_flag != :miss
eval("update_pose_#{@pose[:type]}") #rescue ""
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def next_pose
return unless @current_pose
case @current_pose[:next]
when :loop
@pose_value.next_item
when :reset
@pose_value.shift
reset_pose if @pose_value.empty?
when Symbol
@pose_value.shift
@battler.call_pose(@current_pose[:next]) if @pose_value.empty?
else
last_value = @pose_value.shift
end
@pose_value.unshift(last_value) if @pose_value.empty? && pose_list.empty?
@battler.pose_list.shift if @pose_value.empty?
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_wait
if @pose[:time] == :animation
@waiting = SceneManager.scene.spriteset.animation?
elsif @pose[:time] == :action
@waiting = SceneManager.scene.spriteset.action?(subject)
elsif @pose[:time] == :movement
@waiting = subject.moving?
elsif @pose[:time] == :throw
@waiting = throwing?
else
@pose[:time] -= 1
@pose[:time] = @pose[:wait] if @pose[:time] == 0
@waiting = @pose[:time] != @pose[:wait]
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_clear
battler.pose_list.clear
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_action
get_target.each do |target|
target.call_pose(@pose[:action], true, nil, @battler)
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_anim
subject.targets = get_target
subject.call_anim = true
subject.animation = @pose[:anim]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_effect
subject.call_effect = true
subject.attack_flag = @pose[:weapon]
subject.damage_flag = @pose[:damage]
subject.target_flag = @pose[:target] ? @pose[:target] : subject.targets
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_loop
get_target.each {|target| target.pose_loop_anim = @pose[:loop_anim] }
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_pose
get_target.each do |target|
target.row = @pose[:row] - 1
target.sufix = @pose[:sufix]
target.timing = @pose[:pose]
target.frame = @pose[:frame] - 1
target.frame = target.frame % sprite_settings[:frames]
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_move
get_target.each do |target|
target.teleport = @pose[:teleport]
setup_target_position(target)
target.target_position[:x] += subject.left? ? @pose[:x] : -@pose[:x]
target.target_position[:y] += subject.down? ? @pose[:y] : -@pose[:y]
target.target_position[:h] += @pose[:h]
target.move_speed = @pose[:speed]
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_jump
get_target.each do |target|
if @pose[:move]
x_plus = (target.target_distance(:x) / 32.0).abs
y_plus = (target.target_distance(:y) / 32.0).abs
speed = Math.sqrt((x_plus ** 2) + (y_plus ** 2))
target.jumping[:speed] = @pose[:height] * 5.0 / [speed, 1].max
else
target.jumping[:speed] = @pose[:speed]
end
target.jumping[:height] = @pose[:height]
target.jumping[:count] = target.jumping[:height] * 2
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_inactive
subject.deactivate
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_direction
subject.action_direction if @pose[:targets]
subject.direction = @pose[:direction] if @pose[:direction]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_icon
get_target.each do |target|
if @pose[:delete]
target.icon_list.delete(@pose[:index])
else
target.icon_list[@pose[:index]] = @pose.dup
end
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_throw
get_target.each do |target|
value = @pose.dup
value[:user] = SceneManager.scene.spriteset.sprite(subject)
target.throw_list.push(value.dup)
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_target_position(target)
if @pose[:value] == :move_to
setup_move_to_target_position(target)
elsif @pose[:value] == :step_foward
setup_step_foward_position(target)
elsif @pose[:value] == :step_backward
setup_step_backward_position(target)
elsif @pose[:value] == :escape
setup_escape_position(target)
elsif @pose[:value] == :retreat
setup_retreat_position(target)
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_move_to_target_position(target)
targets = @pose[:targets]
return @waiting = true if targets.any? {|target| target.moving?}
x = targets.collect {|target| target.current_position[:x]}.average
y = targets.collect {|target| target.current_position[:y]}.average
target.target_direction(x, y)
y -= 32 if @battler.down?
x += 32 if @battler.left?
x -= 32 if @battler.right?
y += 32 if @battler.up?
target.target_position[:x] = x
target.target_position[:y] = y
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_step_foward_position(target)
target.target_position[:y] += 32 if @battler.down?
target.target_position[:x] -= 32 if @battler.left?
target.target_position[:x] += 32 if @battler.right?
target.target_position[:y] -= 32 if @battler.up?
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_step_backward_position(target)
target.target_position[:y] -= 32 if @battler.down?
target.target_position[:x] += 32 if @battler.left?
target.target_position[:x] -= 32 if @battler.right?
target.target_position[:y] += 32 if @battler.up?
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_escape_position(target)
target.target_position[:y] -= 240 if @battler.down?
target.target_position[:x] += 240 if @battler.left?
target.target_position[:x] -= 240 if @battler.right?
target.target_position[:y] += 240 if @battler.up?
position = target.target_position
target.target_direction(position[:x], position[:y])
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_retreat_position(target)
target.target_position[:x] = target.screen_x
target.target_position[:y] = target.screen_y
position = target.target_position
target.target_direction(position[:x], position[:y])
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def reset_pose
old_pose = @battler.pose_name
@battler.default_direction
@battler.clear_idle_poses
new_pose = get_idle_pose
@battler.call_pose(new_pose)
setup_pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def get_idle_pose
pose = :idle
pose = :danger if @battler.danger?
pose = @battler.state_pose if @battler.state_pose?
pose = :guarding if @battler.guard?
pose = @battler.active_pose if @battler.active_pose
pose = :dead if @battler.dead?
pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def get_target
@pose[:target] ? @pose[:target] : [subject]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_positions
positions = {x: @battler.screen_x, y: @battler.screen_y, h: 0, j: 0}
@battler.target_position = positions.dup
@battler.current_position = positions.dup
@battler.default_position = positions.dup
@battler.jumping = {count: 0, height: 0, speed: 10}
reset_pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def position
@battler.current_position
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_position
update_movement
update_jumping
self.x = position[:x]
self.y = position[:y] - position[:h] - position[:j]
self.z = position[:y] + 1
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_movement
return unless @battler.moving?
@battler.teleport ? update_teleport_movement : update_normal_movement
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_movement_teleport
@battler.current_position[:x] = @battler.target_position[:x]
@battler.current_position[:y] = @battler.target_position[:y]
@battler.current_position[:h] = [@battler.target_position[:h], 0].max
@battler.teleport = false
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_normal_movement
distance = set_distance
move = {x: 1.0, y: 1.0, h: 1.0}
if distance[:x].abs < distance[:y].abs
move[:x] = 1.0 / (distance[:y].abs.to_f / distance[:x].abs)
elsif distance[:y].abs < distance[:x].abs
move[:y] = 1.0 / (distance[:x].abs.to_f / distance[:y].abs)
elsif distance[:h].abs < distance[:x].abs
move[:h] = 1.0 / (distance[:x].abs.to_f / distance[:h].abs)
end
speed = set_speed(distance)
x = (move[:x] * speed[:x]).round
y = (move[:y] * speed[:y]).round
h = (move[:h] * speed[:h]).round
set_movement(x, y, h)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_distance
x = @battler.target_distance(:x)
y = @battler.target_distance(:y)
h = @battler.target_distance(:h)
{x: x, y: y, h: h}
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_speed(distance)
move_speed = @battler.move_speed
x = move_speed * (distance[:x] == 0 ? 0 : (distance[:x] > 0 ? 8 : -8))
y = move_speed * (distance[:y] == 0 ? 0 : (distance[:y] > 0 ? 8 : -8))
h = move_speed * (distance[:h] == 0 ? 0 : (distance[:h] > 0 ? 8 : -8))
{x: x, y: y, h: h}
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_movement(x, y, h)
target = @battler.target_position
current = @battler.current_position
current[:x] += x
current[:y] += y
current[:h] += h
current[:x] = target[:x] if in_distance?(current[:x], target[:x], x)
current[:y] = target[:y] if in_distance?(current[:y], target[:y], y)
current[:h] = target[:h] if in_distance?(current[:h], target[:h], h)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def in_distance?(x, y, z)
x.between?(y - z - 1, y + z + 1)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_jumping
return if @battler.jumping[:count] == 0
jump = @battler.jumping
jump[:count] = [jump[:count] - (1 * jump[:speed] / 10.0), 0].max.to_f
count = jump[:count]
speed = jump[:speed]
peak = jump[:height]
height = count >= peak ? count - peak : peak - count
result = (peak ** 2 - height ** 2).to_i
@battler.current_position[:j] = [result, 0].max
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_icon
@battler.icon_list.each do |key, value|
icon = @icon_list[key]
@icon_list[key] = Sprite_Icon.new(self, value) if !icon
icon.refresh if list && value[:icon] != icon.icon
icon.value = value if icon && icon.value != value
end
@icon_list.each do |key, value|
value.update
delete_icon(key) if value && !@battler.icon_list[key]
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_throw
@battler.throw_list.each do |value|
@throw_list.push(Sprite_Throw.new(self, value.dup))
@battler.throw_list.delete(value)
end
@throw_list.each_with_index do |value, index|
value.update
delete_throw(index) if value.disposing?
end
@throw_list.compact!
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def delete_icon(key)
@icon_list[key].dispose
@icon_list.delete(key)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def delete_throw(index)
@throw_list[index].dispose
@throw_list.delete_at(index)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def throwing?
!@throw_list.empty?
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_pose_loop_anim
if @battler.pose_loop_anim && !loop_anim?(:pose_anim)
@pose_name_list = @battler.pose_name_list.first
animation = {type: :pose_anim, anim: @battler.pose_loop_anim, loop: 1}
add_loop_animation(animation)
end
if @battler.pose_loop_anim && loop_anim?(:pose_anim) &&
@pose_name_list != @battler.pose_name_list.first
@pose_loop_anim = nil
@battler.pose_loop_anim = nil
end_loop_anim(:pose_anim)
end
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within the
# Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :create_pictures_ve_animated_battle :create_pictures
def create_pictures
battler_sprites.each {|battler| battler.setup_positions }
create_pictures_ve_animated_battle
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def action?(subject)
battler_sprites.compact.any? do |sprite|
sprite.subject == subject && sprite.battler != subject &&
sprite.subject != sprite.battler
end
end
end
#==============================================================================
# ** Window_BattleLog
#------------------------------------------------------------------------------
# This window shows the battle progress. Do not show the window frame.
#==============================================================================
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def display_added_states(target)
target.result.added_state_objects.each do |state|
state_msg = target.actor? ? state.message1 : state.message2
next if state_msg.empty?
replace_text(target.name + state_msg)
wait
wait_for_effect
end
end
end
#==============================================================================
# ** Sprite_Icon
#------------------------------------------------------------------------------
# This sprite is used to display icons.
#==============================================================================
class Sprite_Icon < Sprite_Base
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
attr_accessor :value
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def initialize(battler, value)
super(battler.viewport)
@battler = battler
@value = value.dup
refresh
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def icon
value[:icon]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def refresh
self.bitmap = Cache.system("Iconset")
self.src_rect.set(icon % 16 * 24, icon / 16 * 24, 24, 24)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update
super
update_position
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_position
self.x = pos[:x] + value[:x] - @battler.ox / 2
self.y = pos[:y] - pos[:h] - pos[:j] + value[:y] - @battler.oy / 2
self.z = pos[:y] + value[:z]
self.ox = 12
self.oy = 12
self.opacity = value[:o]
self.angle = value[:a] if self.angle != value[:a]
self.mirror = @battler.mirror
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def pos
@battler.position
end
end
#==============================================================================
# ** Sprite_Throw
#------------------------------------------------------------------------------
# This sprite is used to display throw animations.
#==============================================================================
class Sprite_Throw < Sprite_Base
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def initialize(target, settings)
super(target.viewport)
@active = settings[:user]
@target = target
@values = settings.dup
setup_throw
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_throw
set_initial_position
setup_arc
setup_icon
setup_animation if $imported[:ve_loop_animation] && value[:anim]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_initial_position
if value[:return]
@current_position = @target.position.dup
@target_position = @active.position.dup
init_oy = @target.oy / 2
end_oy = @active.oy / 2
else
@current_position = @active.position.dup
@target_position = @target.position.dup
init_oy = @active.oy / 2
end_oy = @target.oy / 2
end
@current_position[:x] += value[:init_x]
@current_position[:y] += value[:init_y] - init_oy
@target_position[:x] += value[:end_x]
@target_position[:y] += value[:end_y] - end_oy
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_arc
@arc = {}
x_plus = (target_distance(:x) / 48.0).abs
y_plus = (target_distance(:y) / 48.0).abs
speed = Math.sqrt((x_plus ** 2) + (y_plus ** 2))
@arc[:speed] = value[:arc] * 5.0 / [speed, 1].max
@arc[:height] = value[:arc]
@arc[:count] = value[:arc] * 2
@current_position[:a] = 0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_icon
self.bitmap = Cache.system("Iconset")
self.src_rect.set(value[:icon] % 16 * 24, value[:icon] / 16 * 24, 24, 24)
self.angle = value[:angle]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_animation
animation = {type: :throw, anim: value[:anim], loop: 1}
add_loop_animation(animation)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def value
@values
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update
super
update_move
update_arc
update_position
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_move
distance = set_distance
move = {x: 1.0, y: 1.0}
if distance[:x].abs < distance[:y].abs
move[:x] = 1.0 / (distance[:y].abs.to_f / distance[:x].abs)
elsif distance[:y].abs < distance[:x].abs
move[:y] = 1.0 / (distance[:x].abs.to_f / distance[:y].abs)
end
speed = set_speed(distance)
x = (move[:x] * speed[:x]).round
y = (move[:y] * speed[:y]).round
set_movement(x, y)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_distance
{x: target_distance(:x), y: target_distance(:y)}
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def target_distance(symbol)
@target_position[symbol] - @current_position[symbol]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_speed(distance)
x = value[:speed] * (distance[:x] == 0 ? 0 : (distance[:x] > 0 ? 8 : -8))
y = value[:speed] * (distance[:y] == 0 ? 0 : (distance[:y] > 0 ? 8 : -8))
{x: x, y: y}
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_movement(x, y)
target = @target_position
current = @current_position
current[:x] += x
current[:y] += y
current[:x] = target[:x] if in_distance?(current[:x], target[:x], x)
current[:y] = target[:y] if in_distance?(current[:y], target[:y], y)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def in_distance?(x, y, z)
x.between?(y - z - 1, y + z + 1)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_arc
return if @arc[:count] == 0
@arc[:count] = [@arc[:count] - (1 * @arc[:speed] / 10.0), 0].max.to_f
count = @arc[:count]
speed = @arc[:speed]
peak = @arc[:height]
height = count >= peak ? count - peak : peak - count
result = [peak ** 2 - height ** 2, 0].max.to_i
@current_position[:a] = value[:revert] ? -result : result
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_position
self.x = position[:x]
self.y = position[:y] - position[:h] - position[:a]
self.z = position[:y] + value[:z]
self.ox = 12
self.oy = 12
self.opacity = value[:o]
self.angle += value[:a] if Graphics.frame_count % 2 == 0
self.mirror = @active.mirror
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def position
@current_position
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def target
@target_position
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def disposing?
position[:x] == target[:x] && position[:y] == target[:y]
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def abs_wait_short
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def wait_for_animation
update_for_wait
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def wait_for_effect
update_for_wait
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :create_spriteset_ve_animated_battle :create_spriteset
def create_spriteset
create_spriteset_ve_animated_battle
$game_party.movable_members.each {|member| member.call_pose(:intro, true) }
3.times { @spriteset.update }
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :update_basic_ve_animated_battle :update_basic
def update_basic
update_basic_ve_animated_battle
update_sprite_action
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :turn_end_ve_animated_battle :turn_end
def turn_end
turn_end_ve_animated_battle
@spriteset.battler_sprites.each {|sprite| sprite.reset_pose }
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def process_action
return if scene_changing?
if next_subject?
@subject = BattleManager.next_subject
@subject.activate if @subject
end
return turn_end unless @subject
return process_action_end if !@subject.active && !@subject.current_action
if @subject.current_action
@subject.current_action.prepare
if @subject.current_action.valid?
@status_window.open
execute_action
end
@subject.remove_current_action
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def next_command
BattleManager.set_active_pose
if BattleManager.next_command
start_actor_command_selection
else
turn_start
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def prior_command
if BattleManager.prior_command
start_actor_command_selection
else
start_party_command_selection
end
BattleManager.clear_active_pose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def show_animation(targets, animation_id)
if animation_id < 0
show_animated_attack_animation(targets)
else
show_normal_animation(targets, animation_id)
end
wait_for_animation
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def show_animated_attack_animation(targets)
if @subject.actor? || $imported[:ve_actor_battlers]
show_normal_animation(targets, @subject.atk_animation_id1, false)
else
Sound.play_enemy_attack
abs_wait_short
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def next_subject?
!@subject || !@subject.active?
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def active?
members = $game_troop.members + $game_party.battle_members
members.any? {|member| member.active }
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def execute_action
use_item
@log_window.wait_and_clear
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def use_item
item = @subject.current_action.item
@log_window.display_use_item(@subject, item)
@subject.action_pose(item)
@subject.use_item(item)
refresh_status
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_sprite_action
@old_subject = @subject
battlers = $game_party.battle_members + $game_troop.members
battlers.each do |subject|
@subject = subject
call_animation if @subject.call_anim
call_effect if @subject.call_effect
end
@subject = @old_subject
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def call_animation
@subject.call_anim = false
animation = @subject.animation
@subject.animation = 0
show_animation(@subject.targets, animation)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def call_effect
@subject.call_effect = false
targets = @subject.target_flag ? @subject.target_flag : @subject.targets
item = @subject.current_item
targets.each {|target| item.repeats.times { invoke_item(target, item) } }
end
end
#==============================================================================
# ** Victor Engine - Actors Battlers
#------------------------------------------------------------------------------
# Author : Victor Sant
#
# Version History:
# v 1.00 - 2011.12.19 > First relase
# v 1.01 - 2011.12.30 > Faster Regular Expressions
# v 1.02 - 2012.01.15 > Compatibility for Target Arrow
#------------------------------------------------------------------------------
# This script adds visible battler graphics for the party actors actors
# during combat. With the visible battlers, new options will be available
# like setting actor's battlers positions and attack animations.
#------------------------------------------------------------------------------
# Compatibility
# Requires the script 'Victor Engine - Basic Module' v 1.09 or higher
#
# * Overwrite methods (Default)
# class Spriteset_Battle
# def create_actors
# def update_actors
#
# class Scene_Battle < Scene_Base
# def show_attack_animation(targets)
#
# * Alias methods (Default)
# class << DataManager
# def setup_new_game
# def create_game_objects
# def make_save_contents
# def extract_save_contents(contents)
#
# class Game_Actor < Game_Battler
# def setup(actor_id)
#
# * Alias methods (Basic Module)
# class Game_Interpreter
# def comment_call
#
#------------------------------------------------------------------------------
# Instructions:
# To instal the script, open you script editor and paste this script on
# a new section on bellow the Materials section. This script must also
# be bellow the script 'Victor Engine - Basic'
#
#------------------------------------------------------------------------------
# Comment calls note tags:
# Tags to be used in events comment box, works like a script call.
#
# <battler name id: x>
# This tag allows to change the actor battler graphic.
# id : actor ID
# x : battler graphic filename
#
# <battler hue id: x>
# This tag allows to change the actor battler graphic.
# id : actor ID
# x : battler graphic hue (0-360)
#
# <battler position i: x, y>
# This tag allows to change the battler position during combat.
# only valid if VE_BATTLE_FORMATION = :custom
# i : position index
# x : new coorditante X
# y : new coorditante X
#
#------------------------------------------------------------------------------
# Actors note tags:
# Tags to be used on the Actors note box in the database
#
# <battler name: x>
# This tag allows to set the initial battler graphic filename for the actor.
# x : battler graphic filename
#
# <battler hue: x>
# This tag allows to set the initial battler graphic hur for the actor.
# x : battler graphic hue (0-360)
#
#------------------------------------------------------------------------------
# Enemies note tags:
# Tags to be used on the Enemies note box in the database
#
# <attack animation: x>
# This tag allows to set the normal attack animation for the enemy
# x : animation ID
#
#==============================================================================
#==============================================================================
# ** Victor Engine
#------------------------------------------------------------------------------
# Setting module for the Victor Engine
#==============================================================================
module Victor_Engine
#--------------------------------------------------------------------------
# * Set the battle formation
# Choose here how the actors battlers will be placed on the combat.
# :front : horizontal placement
# :side : vertical placement
# :iso : isometric placement
# :custom : custom placement
#--------------------------------------------------------------------------
VE_BATTLE_FORMATION = :side
#--------------------------------------------------------------------------
# * Set battler centralization
# When true, battlers are centralized automatically.
# Not valid if VE_BATTLE_FORMATION = :custom
#--------------------------------------------------------------------------
VE_BATTLE_CENTRALIZE = true
#--------------------------------------------------------------------------
# * Set battlers custom positions
# Only if VE_BATTLE_FORMATION = :custom, allows to set the position of
# all party actors, don't forget to add values for all positions
# available if using a party bigger than the default.
#--------------------------------------------------------------------------
VE_CUSTOM_POSTION = {
# Position
1 => {x: 460, y: 180}, # Postion for the first actor.
2 => {x: 480, y: 210}, # Postion for the second actor.
3 => {x: 500, y: 240}, # Postion for the fourth actor.
4 => {x: 520, y: 270}, # Postion for the fifth actor.
} # Don't remove
#--------------------------------------------------------------------------
# * Actors battlers position adjust
# Used to adjust the position of all actors battlers.
#--------------------------------------------------------------------------
VE_POSITION_ADJUST = {x: 0, y: 0}
end
$imported[:ve_actor_battlers] = true
#==============================================================================
# ** DataManager
#------------------------------------------------------------------------------
# This module handles the game and database objects used in game.
# Almost all global variables are initialized on this module
#==============================================================================
class << DataManager
#--------------------------------------------------------------------------
# * Alias method: setup_new_game
#--------------------------------------------------------------------------
alias :setup_new_game_ve_actor_battlers :setup_new_game
def setup_new_game
setup_new_game_ve_actor_battlers
$game_custom_positions = VE_CUSTOM_POSTION.dup
end
#--------------------------------------------------------------------------
# * Alias method: create_game_objects
#--------------------------------------------------------------------------
alias :create_game_objects_ve_actor_battlers :create_game_objects
def create_game_objects
create_game_objects_ve_actor_battlers
$game_custom_positions = {}
end
#--------------------------------------------------------------------------
# * Alias method: make_save_contents
#--------------------------------------------------------------------------
alias :make_save_contents_ve_actor_battlers :make_save_contents
def make_save_contents
contents = make_save_contents_ve_actor_battlers
contents[:formations_ve] = $game_custom_positions
contents
end
#--------------------------------------------------------------------------
# * Alias method: extract_save_contents
#--------------------------------------------------------------------------
alias :extract_save_contents_ve_actor_battlers :extract_save_contents
def extract_save_contents(contents)
extract_save_contents_ve_actor_battlers(contents)
$game_custom_positions = contents[:formations_ve]
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :screen_x # Coordenada X na tela
attr_accessor :screen_y # Coordenada Y na tela
#--------------------------------------------------------------------------
# * Alias method: setup
#--------------------------------------------------------------------------
alias :setup_ve_actor_battlers :setup
def setup(actor_id)
setup_ve_actor_battlers(actor_id)
@battler_name = actor_battler_name
@battler_hue = actor_battler_hue
end
#--------------------------------------------------------------------------
# * Overwrite method: use_sprite?
#--------------------------------------------------------------------------
def use_sprite?
return true
end
#--------------------------------------------------------------------------
# * Overwrite method: screen_z
#--------------------------------------------------------------------------
def screen_z
return 100
end
#--------------------------------------------------------------------------
# * New method: actor_battler_name
#--------------------------------------------------------------------------
def actor_battler_name
actor.note =~ /<BATTLER NAME: ([^><]*)>/i ? $1.to_s : ""
end
#--------------------------------------------------------------------------
# * New method: actor_battler_hue
#--------------------------------------------------------------------------
def actor_battler_hue
actor.note =~ /<BATTLER HUE: (\d+)>/i ? $1.to_i : 0
end
#--------------------------------------------------------------------------
# * New method: battler_name
#--------------------------------------------------------------------------
def battler_name=(name)
@battler_name = name if name.is_a?(String)
end
#--------------------------------------------------------------------------
# * New method: battler_hue
#--------------------------------------------------------------------------
def battler_hue=(hue)
@battler_hue = hue if hue.numeric?
end
#--------------------------------------------------------------------------
# * New method: screen_x
#--------------------------------------------------------------------------
def screen_x
setup_x
end
#--------------------------------------------------------------------------
# * New method: screen_y
#--------------------------------------------------------------------------
def screen_y
setup_y
end
#--------------------------------------------------------------------------
# * New method: setup_x
#--------------------------------------------------------------------------
def setup_x
case VE_BATTLE_FORMATION
when :front then position = get_frontal_x
when :side then position = get_sideview_x
when :iso then position = get_isometric_x
when :custom then position = $game_custom_positions[index + 1][:x]
end
position + VE_POSITION_ADJUST[:x]
end
#--------------------------------------------------------------------------
# * New method: setup_y
#--------------------------------------------------------------------------
def setup_y
case VE_BATTLE_FORMATION
when :front then position = get_frontal_y
when :side then position = get_sideview_y
when :iso then position = get_isometric_y
when :custom then position = $game_custom_positions[index + 1][:y]
end
position + VE_POSITION_ADJUST[:y]
end
#--------------------------------------------------------------------------
# * New method: get_frontal_x
#--------------------------------------------------------------------------
def get_frontal_x
if VE_BATTLE_CENTRALIZE
size = $game_party.battle_members.size
position = (index + 1) * Graphics.width / (size + 1)
else
size = $game_party.max_battle_members
position = index * Graphics.width / size + 64
end
position
end
#--------------------------------------------------------------------------
# * New method: get_frontal_y
#--------------------------------------------------------------------------
def get_frontal_y
Graphics.height - 16
end
#--------------------------------------------------------------------------
# * New method: get_sideview_x
#--------------------------------------------------------------------------
def get_sideview_x
if VE_BATTLE_CENTRALIZE
size = $game_party.max_battle_members
position = -index * (index * 6 - 6 * size) + Graphics.width - 160
else
position = index * 48 + Graphics.width - 192
end
position
end
#--------------------------------------------------------------------------
# * New method: get_sideview_y
#--------------------------------------------------------------------------
def get_sideview_y
if VE_BATTLE_CENTRALIZE
size = $game_party.battle_members.size
position = (index - size) * 40 + size * 20 + Graphics.height - 160
else
position = index * 32 + Graphics.height - 192
end
position
end
#--------------------------------------------------------------------------
# * New method: get_isometric_x
#--------------------------------------------------------------------------
def get_isometric_x
if VE_BATTLE_CENTRALIZE
position = -index * (index * 22 - 32) + Graphics.width - 160
else
position = index * 32 + Graphics.width - 192
end
position
end
#--------------------------------------------------------------------------
# * New method: get_isometric_y
#--------------------------------------------------------------------------
def get_isometric_y
if VE_BATTLE_CENTRALIZE
position = index * (40 - index * 6) + Graphics.height - 160
else
position = Graphics.height - 96 - index * 32
end
position
end
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemy characters. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * New method: atk_animation_id1
#--------------------------------------------------------------------------
def atk_animation_id1
enemy.note =~ /<ATTACK ANIM(?:ATION): (\d+)>/i ? $1.to_i : 1
end
#--------------------------------------------------------------------------
# * New method: atk_animation_id2
#--------------------------------------------------------------------------
def atk_animation_id2
return 0
end
end
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Alias method: comment_call
#--------------------------------------------------------------------------
alias :comment_call_ve_actor_battlers :comment_call
def comment_call
change_battler_name
change_battler_hue
change_position
comment_call_ve_actor_battlers
end
#--------------------------------------------------------------------------
# * New method: change_battler_name
#--------------------------------------------------------------------------
def change_battler_name
note.scan(/<BATTLER NAME (\d+): ([^><]*)>/i) do |id, name|
$game_actors[id.to_i].battler_name = name
end
end
#--------------------------------------------------------------------------
# * New method: change_battler_hue
#--------------------------------------------------------------------------
def change_battler_hue
note.scan(/<BATTLER HUE (\d+): (\d+)>/i) do |id, hue|
$game_actors[id.to_i].battler_hue = hue
end
end
#--------------------------------------------------------------------------
# * New method: change_position
#--------------------------------------------------------------------------
def change_position
regexp = /<CHANGE POSTION (\d+): (\d+) *, *(\d+)>/i
note.scan(regexp) do |i, x, y|
$game_custom_positions[i.to_i][:x] = x.to_i
$game_custom_positions[i.to_i][:y] = y.to_i
end
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within the
# Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Overwrite method: create_actors
#--------------------------------------------------------------------------
def create_actors
@actor_sprites = $game_party.battle_members.reverse.collect do |actor|
Sprite_Battler.new(@viewport1, actor)
end
@actors_party = $game_party.battle_members.dup
end
#--------------------------------------------------------------------------
# * Overwrite method: update_actors
#--------------------------------------------------------------------------
def update_actors
update_party if $game_party.battle_members != @actors_party
@actor_sprites.each {|sprite| sprite.update }
end
#--------------------------------------------------------------------------
# * New method: update_party
#--------------------------------------------------------------------------
def update_party
@actor_sprites.each_index do |i|
next if $game_party.battle_members.include?(@actor_sprites[i].battler)
@actor_sprites[i].dispose
@actor_sprites[i] = nil
end
$game_party.battle_members.collect do |actor|
next if @actors_party.include?(actor)
@actor_sprites.push(Sprite_Battler.new(@viewport1, actor))
end
@actor_sprites.compact!
@actors_party = $game_party.battle_members.dup
$game_party.battle_members.each do |actor|
old_position = [actor.screen_x, actor.screen_y]
actor.setup_position
if old_position != [actor.screen_x, actor.screen_y]
sprite(actor).start_effect(:appear)
end
end
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Overwrite method: show_attack_animation
#--------------------------------------------------------------------------
def show_attack_animation(targets)
show_normal_animation(targets, @subject.atk_animation_id1, false)
show_normal_animation(targets, @subject.atk_animation_id2, true)
end
end
#==============================================================================
#
# ▼ Yanfly Engine Ace - Ace Battle Engine v1.19
# -- Last Updated: 2012.01.29
# -- Level: Normal, Hard
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-BattleEngine"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 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 = true # 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 = :yctb # 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 = "All Foes"
HELP_TEXT_ONE_RANDOM_FOE = "One Random Foe"
HELP_TEXT_MANY_RANDOM_FOE = "%d Random Foes"
HELP_TEXT_ALL_ALLIES = "All Allies"
HELP_TEXT_ALL_DEAD_ALLIES = "All Dead Allies"
HELP_TEXT_ONE_RANDOM_ALLY = "One Random Ally"
HELP_TEXT_RANDOM_ALLIES = "%d Random Allies"
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - 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 => "DRAIN", # Text display for draining HP/MP.
:critical => "CRITICAL!", # Text display for critical hit.
:missed => "MISS", # Text display for missed attack.
:evaded => "EVADE!", # Text display for evaded attack.
:nulled => "NULL", # Text display for nulled attack.
:failed => "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 => 20, # This is how many frames will wait.
:weakpoint => "WEAKPOINT", # Appears if foe is weak to element.
:resistant => "RESIST", # Appears if foe is resistant to element.
:immune => "IMMUNE", # Appears if foe is immune to element.
:absorbed => "ABSORB", # 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 = false # Message when enemy appears start of battle.
MSG_CURRENT_STATE = false # 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 = false # Show effect failed against target.
MSG_CRITICAL_HIT = false # Show attack was a critical hit.
MSG_HIT_MISSED = false # Show attack missed the target.
MSG_EVASION = false # Show attack was evaded by the target.
MSG_HP_DAMAGE = false # Show HP damage to target.
MSG_MP_DAMAGE = false # Show MP damage to target.
MSG_TP_DAMAGE = false # Show TP damage to target.
MSG_ADDED_STATES = false # Show target's added states.
MSG_REMOVED_STATES = false # Show target's removed states.
MSG_CHANGED_BUFFS = false # 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
end # ENEMY
module USABLEITEM
ONE_ANIMATION = /<(?:ONE_ANIMATION|one animation)>/i
end # USABLEITEM
module STATE
POPUP_ADD = /<(?:POPUP_ADD_RULE|popup add rule|popup add):[ ](.*)>/i
POPUP_REM = /<(?:POPUP_REM_RULE|popup rem rule|popup rem):[ ](.*)>/i
POPUP_DUR = /<(?:POPUP_DUR_RULE|popup dur rule|popup dur):[ ](.*)>/i
HIDE_ADD = /<(?:POPUP_HIDE_ADD|popup hide add|hide add)>/i
HIDE_REM = /<(?:POPUP_HIDE_REM|popup hide rem|hide rem)>/i
HIDE_DUR = /<(?:POPUP_HIDE_DUR|popup hide dur|hide dur)>/i
end # STATE
end # REGEXP
end # YEA
#==============================================================================
# ■ Switch
#==============================================================================
module Switch
#--------------------------------------------------------------------------
# self.hide_popups
#--------------------------------------------------------------------------
def self.hide_popups
return false if YEA::BATTLE::HIDE_POPUP_SWITCH <= 0
return $game_switches[YEA::BATTLE::HIDE_POPUP_SWITCH]
end
end # Switch
#==============================================================================
# ■ Colour
#==============================================================================
module Colour
#--------------------------------------------------------------------------
# self.text_colour
#--------------------------------------------------------------------------
def self.text_colour(index)
windowskin = Cache.system("Window")
x = 64 + (index % 8) * 8
y = 96 + (index / 8) * 8
return windowskin.get_pixel(x, y)
end
end # Colour
#==============================================================================
# ■ Icon
#==============================================================================
module Icon
#--------------------------------------------------------------------------
# self.no_action
#--------------------------------------------------------------------------
def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
end # Icon
#==============================================================================
# ■ Numeric
#==============================================================================
class Numeric
#--------------------------------------------------------------------------
# new method: group_digits
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
def group; return self.to_s; end
end # $imported["YEA-CoreEngine"]
end # Numeric
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# 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
end # DataManager
#==============================================================================
# ■ RPG::UsableItem
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# 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
end # RPG::UsableItem
#==============================================================================
# ■ RPG::Enemy
#==============================================================================
class RPG::Enemy < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :atk_animation_id1
attr_accessor :atk_animation_id2
#--------------------------------------------------------------------------
# common cache: load_notetags_abe
#--------------------------------------------------------------------------
def load_notetags_abe
@atk_animation_id1 = YEA::BATTLE::ENEMY_ATK_ANI
@atk_animation_id2 = 0
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::ENEMY::ATK_ANI1
@atk_animation_id1 = $1.to_i
when YEA::REGEXP::ENEMY::ATK_ANI2
@atk_animation_id2 = $1.to_i
end
} # self.note.split
#---
end
end # RPG::Enemy
#==============================================================================
# ■ RPG::Enemy
#==============================================================================
class RPG::State < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :popup_rules
#--------------------------------------------------------------------------
# common cache: load_notetags_abe
#--------------------------------------------------------------------------
def load_notetags_abe
@popup_rules = {
:add_state => "ADDSTATE",
:rem_state => "REMSTATE",
:dur_state => nil
} # Do not remove this.
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::STATE::POPUP_ADD
@popup_rules[:add_state] = $1.upcase.to_s
when YEA::REGEXP::STATE::POPUP_REM
@popup_rules[:rem_state] = $1.upcase.to_s
when YEA::REGEXP::STATE::POPUP_DUR
@popup_rules[:dur_state] = $1.upcase.to_s
when YEA::REGEXP::STATE::HIDE_ADD
@popup_rules[:add_state] = nil
when YEA::REGEXP::STATE::HIDE_REM
@popup_rules[:rem_state] = nil
when YEA::REGEXP::STATE::HIDE_DUR
@popup_rules[:dur_state] = nil
end
} # self.note.split
#---
end
end # RPG::State
#==============================================================================
# ■ BattleManager
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# overwrite method: self.battle_start
#--------------------------------------------------------------------------
def self.battle_start
$game_system.battle_count += 1
$game_party.on_battle_start
$game_troop.on_battle_start
return unless YEA::BATTLE::MSG_ENEMY_APPEARS
$game_troop.enemy_names.each do |name|
$game_message.add(sprintf(Vocab::Emerge, name))
end
if @preemptive
$game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
elsif @surprise
$game_message.add(sprintf(Vocab::Surprise, $game_party.name))
end
wait_for_message
end
#--------------------------------------------------------------------------
# overwrite method: make_action_orders
#--------------------------------------------------------------------------
def self.make_action_orders
make_dtb_action_orders if btype?(:dtb)
end
#--------------------------------------------------------------------------
# new method: make_dtb_action_orders
#--------------------------------------------------------------------------
def self.make_dtb_action_orders
@action_battlers = []
@action_battlers += $game_party.members unless @surprise
@action_battlers += $game_troop.members unless @preemptive
@action_battlers.each {|battler| battler.make_speed }
@action_battlers.sort! {|a,b| b.speed - a.speed }
end
#--------------------------------------------------------------------------
# overwrite method: turn_start
#--------------------------------------------------------------------------
def self.turn_start
@phase = :turn
clear_actor
$game_troop.increase_turn
@performed_battlers = []
make_action_orders
end
#--------------------------------------------------------------------------
# overwrite method: next_subject
#--------------------------------------------------------------------------
def self.next_subject
@performed_battlers = [] if @performed_battlers.nil?
loop do
@action_battlers -= @performed_battlers
battler = @action_battlers.shift
return nil unless battler
next unless battler.index && battler.alive?
@performed_battlers.push(battler)
return battler
end
end
#--------------------------------------------------------------------------
# overwrite method: force_action
#--------------------------------------------------------------------------
def self.force_action(battler)
@action_forced = [] if @action_forced == nil
@action_forced.push(battler)
return unless Switch.forced_action_remove
@action_battlers.delete(battler)
end
#--------------------------------------------------------------------------
# overwrite method: action_forced?
#--------------------------------------------------------------------------
def self.action_forced?
@action_forced != nil
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
end # BattleManager
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# 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
end # Game_System
#==============================================================================
# ■ Sprite_Base
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# new method: start_pseudo_animation
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
def start_pseudo_animation(animation, mirror = false)
dispose_animation
@animation = animation
return if @animation.nil?
@ani_mirror = mirror
set_animation_rate
@ani_duration = @animation.frame_max * @ani_rate + 1
@ani_sprites = []
end
end # $imported["YEA-CoreEngine"]
end # Sprite_Base
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :effect_type
attr_accessor :battler_visible
attr_accessor :popups
#--------------------------------------------------------------------------
# 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
end # Sprite_Battler
#==============================================================================
# ■ Sprite_Popup
#==============================================================================
class Sprite_Popup < Sprite_Base
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :flags
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(viewport, battler, value, rules, flags)
super(viewport)
@value = value
@rules = rules
@rules = "DEFAULT" unless YEA::BATTLE::POPUP_RULES.include?(@rules)
@fade = YEA::BATTLE::POPUP_SETTINGS[:fade]
@full = YEA::BATTLE::POPUP_SETTINGS[:full]
@flags = flags
@battler = battler
create_popup_bitmap
end
#--------------------------------------------------------------------------
# create_popup_bitmap
#--------------------------------------------------------------------------
def create_popup_bitmap
rules_array = YEA::BATTLE::POPUP_RULES[@rules]
bw = Graphics.width
bw += 48 if @flags.include?("state")
bh = Font.default_size * 3
bitmap = Bitmap.new(bw, bh)
bitmap.font.name = rules_array[8]
size = @flags.include?("critical") ? rules_array[2] * 1.2 : rules_array[2]
bitmap.font.size = size
bitmap.font.bold = rules_array[3]
bitmap.font.italic = rules_array[4]
if flags.include?("critical")
crit = YEA::BATTLE::POPUP_RULES["CRITICAL"]
bitmap.font.out_color.set(crit[5], crit[6], crit[7], 255)
else
bitmap.font.out_color.set(0, 0, 0, 255)
end
dx = 0; dy = 0; dw = 0
dx += 24 if @flags.include?("state")
dw += 24 if @flags.include?("state")
if @flags.include?("state") || @flags.include?("buff")
c_width = bitmap.text_size(@value).width
icon_bitmap = $game_temp.iconset
icon_index = flag_state_icon
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
bitmap.blt(dx+(bw-c_width)/2-36, (bh - 24)/2, icon_bitmap, rect, 255)
end
bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
bitmap.draw_text(dx, dy, bw-dw, bh, @value, 1)
self.bitmap = bitmap
self.x = @battler.screen_x
self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
self.x -= SceneManager.scene.spriteset.viewport1.ox
self.y = @battler.screen_y - @battler.sprite.oy/2
self.y -= @battler.sprite.oy/2 if @battler.actor?
self.y -= SceneManager.scene.spriteset.viewport1.oy
self.ox = bw/2; self.oy = bh/2
self.zoom_x = self.zoom_y = rules_array[0]
if @flags.include?("no zoom")
self.zoom_x = self.zoom_y = rules_array[1]
end
@target_zoom = rules_array[1]
@zoom_direction = (self.zoom_x > @target_zoom) ? "down" : "up"
self.z = 500
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
end # Sprite_Popup
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :actor_sprites
attr_accessor :enemy_sprites
attr_accessor :viewport1
attr_accessor :viewportPopups
#--------------------------------------------------------------------------
# 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
end # Spriteset_Battle
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :battle_aid
attr_accessor :evaluating
attr_accessor :iconset
#--------------------------------------------------------------------------
# alias method: initialize
#--------------------------------------------------------------------------
alias game_temp_initialize_abe initialize
def initialize
game_temp_initialize_abe
@iconset = Cache.system("Iconset")
end
end # Game_Temp
#==============================================================================
# ■ Game_Action
#==============================================================================
class Game_Action
#--------------------------------------------------------------------------
# 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
end # Game_Action
#==============================================================================
# ■ Game_ActionResult
#==============================================================================
class Game_ActionResult
#--------------------------------------------------------------------------
# alias method: clear
#--------------------------------------------------------------------------
alias game_actionresult_clear_abe clear
def clear
game_actionresult_clear_abe
clear_stored_damage
end
#--------------------------------------------------------------------------
# new method: clear_stored_damage
#--------------------------------------------------------------------------
def clear_stored_damage
@stored_hp_damage = 0
@stored_mp_damage = 0
@stored_tp_damage = 0
@stored_hp_drain = 0
@stored_mp_drain = 0
end
#--------------------------------------------------------------------------
# new method: store_damage
#--------------------------------------------------------------------------
def store_damage
@stored_hp_damage += @hp_damage
@stored_mp_damage += @mp_damage
@stored_tp_damage += @tp_damage
@stored_hp_drain += @hp_drain
@stored_mp_drain += @mp_drain
end
#--------------------------------------------------------------------------
# new method: restore_damage
#--------------------------------------------------------------------------
def restore_damage
@hp_damage = @stored_hp_damage
@mp_damage = @stored_mp_damage
@tp_damage = @stored_tp_damage
@hp_drain = @stored_hp_drain
@mp_drain = @stored_mp_drain
end
end # Game_ActionResult
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# 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? && !@result.success
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 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
end # Game_BattlerBase
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# 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
end # Game_Battler
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#def battler_name
#return "Slime"
#end
#def battler_hue
#return 0
#end
#--------------------------------------------------------------------------
# overwrite method: perform_damage_effect
#--------------------------------------------------------------------------
def perform_damage_effect
$game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
@sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
Sound.play_actor_damage
end
#--------------------------------------------------------------------------
# overwrite method: use_sprite?
#--------------------------------------------------------------------------
def use_sprite?; return true; end
#--------------------------------------------------------------------------
# new method: screen_x
#--------------------------------------------------------------------------
def screen_x
return 0 unless SceneManager.scene_is?(Scene_Battle)
status_window = SceneManager.scene.status_window
return 0 if status_window.nil?
item_rect_width = (status_window.width-24) / $game_party.max_battle_members
ext = SceneManager.scene.info_viewport.ox
rect = SceneManager.scene.status_window.item_rect(self.index)
constant = 128 + 12
return constant + rect.x + item_rect_width / 2 - ext
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
end # Game_Actor
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# overwrite method: perform_damage_effect
#--------------------------------------------------------------------------
def perform_damage_effect
@sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
Sound.play_enemy_damage
end
#--------------------------------------------------------------------------
# new methods: attack_animation_id
#--------------------------------------------------------------------------
def atk_animation_id1; return enemy.atk_animation_id1; end
def atk_animation_id2; return enemy.atk_animation_id2; end
#--------------------------------------------------------------------------
# new method: sprite
#--------------------------------------------------------------------------
def sprite
return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
end
end # Game_Enemy
#==============================================================================
# ■ Game_Unit
#==============================================================================
class Game_Unit
#--------------------------------------------------------------------------
# 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
end # Game_Unit
#==============================================================================
# ■ Window_PartyCommand
#==============================================================================
class Window_PartyCommand < Window_Command
#--------------------------------------------------------------------------
# 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
end # Window_PartyCommand
#==============================================================================
# ■ Window_ActorCommand
#==============================================================================
class Window_ActorCommand < Window_Command
#--------------------------------------------------------------------------
# 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
end # Window_ActorCommand
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# overwrite method: initialize
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, window_height)
self.openness = 0
@party = $game_party.battle_members.clone
end
#--------------------------------------------------------------------------
# overwrite method: col_max
#--------------------------------------------------------------------------
def col_max; return $game_party.max_battle_members; 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
#--------------------------------------------------------------------------
# overwrite method: draw_item
#--------------------------------------------------------------------------
def draw_item(index)
return if index.nil?
clear_item(index)
actor = battle_members[index]
rect = item_rect(index)
return if actor.nil?
draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
draw_actor_name(actor, rect.x, rect.y, rect.width-8)
draw_actor_action(actor, rect.x, rect.y)
draw_actor_icons(actor, rect.x, line_height*1, rect.width)
gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
if draw_tp?(actor) && draw_mp?(actor)
dw = rect.width/2-2
dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
draw_actor_tp(actor, rect.x+2, line_height*3, dw)
dw = rect.width - rect.width/2 - 2
draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
elsif draw_tp?(actor) && !draw_mp?(actor)
draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
else
draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
end
end
#--------------------------------------------------------------------------
# overwrite method: item_rect
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = contents.width / $game_party.max_battle_members
rect.height = contents.height
rect.x = index * rect.width
if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
rect.x += (contents.width - $game_party.members.size * rect.width) / 2
end
rect.y = 0
return rect
end
#--------------------------------------------------------------------------
# overwrite method: draw_face
#--------------------------------------------------------------------------
def draw_face(face_name, face_index, dx, dy, enabled = true)
bitmap = Cache.face(face_name)
fx = [(96 - item_rect(0).width + 1) / 2, 0].max
fy = face_index / 4 * 96 + 2
fw = [item_rect(0).width - 4, 92].min
rect = Rect.new(fx, fy, fw, 92)
rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
#--------------------------------------------------------------------------
# overwrite method: draw_actor_name
#--------------------------------------------------------------------------
def draw_actor_name(actor, dx, dy, dw = 112)
reset_font_settings
contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
change_color(hp_color(actor))
draw_text(dx+24, dy, dw-24, line_height, actor.name)
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: draw_current_and_max_values
#--------------------------------------------------------------------------
def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
change_color(color1)
draw_text(dx, dy, dw, line_height, current.group, 2)
end
#--------------------------------------------------------------------------
# overwrite method: draw_actor_hp
#--------------------------------------------------------------------------
def draw_actor_hp(actor, dx, dy, width = 124)
draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
hp_color(actor), normal_color)
end
#--------------------------------------------------------------------------
# overwrite method: draw_actor_mp
#--------------------------------------------------------------------------
def draw_actor_mp(actor, dx, dy, width = 124)
draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
mp_color(actor), normal_color)
end
#--------------------------------------------------------------------------
# overwrite method: draw_actor_tp
#--------------------------------------------------------------------------
def draw_actor_tp(actor, dx, dy, width = 124)
draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
change_color(tp_color(actor))
draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
end
end # Window_BattleStatus
#==============================================================================
# ■ Window_BattleActor
#==============================================================================
class Window_BattleActor < Window_BattleStatus
#--------------------------------------------------------------------------
# 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
end # Window_BattleActor
#==============================================================================
# ■ Window_BattleStatusAid
#==============================================================================
class Window_BattleStatusAid < Window_BattleStatus
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :status_window
#--------------------------------------------------------------------------
# overwrite method: initialize
#--------------------------------------------------------------------------
def initialize
super
self.visible = false
self.openness = 255
end
#--------------------------------------------------------------------------
# overwrite method: window_width
#--------------------------------------------------------------------------
def window_width; return 128; 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: item_rect
#--------------------------------------------------------------------------
def item_rect(index)
return Rect.new(0, 0, contents.width, contents.height)
end
end # Window_BattleStatusAid
#==============================================================================
# ■ Window_BattleEnemy
#==============================================================================
class Window_BattleEnemy < Window_Selectable
#--------------------------------------------------------------------------
# overwrite method: initialize
#--------------------------------------------------------------------------
def initialize(info_viewport)
super(0, Graphics.height, window_width, fitting_height(1))
refresh
self.visible = false
@info_viewport = info_viewport
end
#--------------------------------------------------------------------------
# overwrite method: col_max
#--------------------------------------------------------------------------
def col_max; return item_max; 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: refresh
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# overwrite method: make_item_list
#--------------------------------------------------------------------------
def make_item_list
@data = $game_troop.alive_members
@data.sort! { |a,b| a.screen_x <=> b.screen_x }
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
end # Window_BattleEnemy
#==============================================================================
# ■ Window_BattleHelp
#==============================================================================
class Window_BattleHelp < Window_Help
#--------------------------------------------------------------------------
# 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
#--------------------------------------------------------------------------
# refresh_battler_name
#--------------------------------------------------------------------------
def refresh_battler_name(battler)
contents.clear
reset_font_settings
change_color(normal_color)
@text = battler_name(battler)
icons = battler.state_icons + battler.buff_icons
dy = icons.size <= 0 ? line_height / 2 : 0
draw_text(0, dy, contents.width, line_height, @text, 1)
dx = (contents.width - (icons.size * 24)) / 2
draw_actor_icons(battler, dx, line_height, contents.width)
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
end # Window_BattleHelp
#==============================================================================
# ■ Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# 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
end # Window_BattleLog
#==============================================================================
# ■ Window_SkillList
#==============================================================================
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# overwrite method: spacing
#--------------------------------------------------------------------------
def spacing
return 8 if $game_party.in_battle
return super
end
end # Window_SkillList
#==============================================================================
# ■ Window_ItemList
#==============================================================================
class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# overwrite method: spacing
#--------------------------------------------------------------------------
def spacing
return 8 if $game_party.in_battle
return super
end
end # Window_ItemList
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :enemy_window
attr_accessor :info_viewport
attr_accessor :spriteset
attr_accessor :status_window
attr_accessor :status_aid_window
attr_accessor :subject
#--------------------------------------------------------------------------
# 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: create_battle_status_aid_window
#--------------------------------------------------------------------------
def create_battle_status_aid_window
@status_aid_window = Window_BattleStatusAid.new
@status_aid_window.status_window = @status_window
@status_aid_window.x = Graphics.width - @status_aid_window.width
@status_aid_window.y = Graphics.height - @status_aid_window.height
end
#--------------------------------------------------------------------------
# overwrite method: create_help_window
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_BattleHelp.new
@help_window.hide
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
#--------------------------------------------------------------------------
# overwrite method: on_skill_ok
#--------------------------------------------------------------------------
def on_skill_ok
@skill = @skill_window.item
$game_temp.battle_aid = @skill
BattleManager.actor.input.set_skill(@skill.id)
BattleManager.actor.last_skill.object = @skill
if @skill.for_opponent?
select_enemy_selection
elsif @skill.for_friend?
select_actor_selection
else
@skill_window.hide
next_command
$game_temp.battle_aid = nil
end
end
#--------------------------------------------------------------------------
# alias method: on_skill_cancel
#--------------------------------------------------------------------------
alias scene_battle_on_skill_cancel_abe on_skill_cancel
def on_skill_cancel
scene_battle_on_skill_cancel_abe
@status_window.show
@actor_command_window.show
@status_aid_window.hide
end
#--------------------------------------------------------------------------
# overwrite method: on_item_ok
#--------------------------------------------------------------------------
def on_item_ok
@item = @item_window.item
$game_temp.battle_aid = @item
BattleManager.actor.input.set_item(@item.id)
if @item.for_opponent?
select_enemy_selection
elsif @item.for_friend?
select_actor_selection
else
@item_window.hide
next_command
$game_temp.battle_aid = nil
end
$game_party.last_item.object = @item
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 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
#--------------------------------------------------------------------------
# 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
#--------------------------------------------------------------------------
# overwite method: invoke_counter_attack
#--------------------------------------------------------------------------
def invoke_counter_attack(target, item)
@log_window.display_counter(target, item)
attack_skill = $data_skills[target.attack_skill_id]
@subject.item_apply(target, attack_skill)
status_redraw_target(@subject)
status_redraw_target(target) unless target == @subject
@log_window.display_action_results(@subject, attack_skill)
perform_collapse_check(target)
perform_collapse_check(@subject)
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: show_attack_animation
#--------------------------------------------------------------------------
def show_attack_animation(targets)
show_normal_animation(targets, @subject.atk_animation_id1, false)
wait_for_animation
show_normal_animation(targets, @subject.atk_animation_id2, true)
end
#--------------------------------------------------------------------------
# overwrite method: show_normal_animation
#--------------------------------------------------------------------------
def show_normal_animation(targets, animation_id, mirror = false)
animation = $data_animations[animation_id]
return if animation.nil?
ani_check = false
targets.each do |target|
if ani_check && target.animation_id <= 0
target.pseudo_ani_id = animation_id
else
target.animation_id = animation_id
end
target.animation_mirror = mirror
ani_check = true if animation.to_screen?
end
end
#--------------------------------------------------------------------------
# overwrite method: process_action_end
#--------------------------------------------------------------------------
def process_action_end
@subject.on_action_end
status_redraw_target(@subject)
@log_window.display_auto_affected_status(@subject)
@log_window.wait_and_clear
@log_window.display_current_state(@subject)
@log_window.wait_and_clear
BattleManager.judge_win_loss
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
#------------------------------------------------------------------------------
# Compatibility
# Requires the script 'Victor Engine - Basic Module'
#
#
#------------------------------------------------------------------------------
# Instructions:
# To instal the script, open you script editor and paste this script on
# a new section on bellow the Materials section. This script must also
# be bellow the script 'Victor Engine - Basic'
#
#------------------------------------------------------------------------------
# Additional instructions:
#
# The Yanfly Engine Ace scripts must be placed *bellow* the Victor Engine
# sctipts. This scripts must be placed bellow Yanfly Engine Ace scripts.
#
#==============================================================================
#==============================================================================
# ** VE - Animated Battle X YEA - Ace Batte Engie
#------------------------------------------------------------------------------
# Compatibility Patch for VE - Animated Battle and YEA - Ace Batte Engie
#==============================================================================
if $imported[:ve_animated_battle] && $imported["YEA-BattleEngine"]
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :turn_end_veyea_animated_battle :turn_end
def turn_end
turn_end_veyea_animated_battle
@spriteset.battler_sprites.each {|sprite| sprite.reset_pose }
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def use_item
item = @subject.current_action.item
@log_window.display_use_item(@subject, item)
@subject.action_pose(item)
@subject.use_item(item)
refresh_status
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def separate_ani?(target, item)
return false
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within the
# Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def create_actors
@actor_sprites = $game_party.battle_members.reverse.collect do |actor|
Sprite_Battler.new(@viewport1, actor)
end
@actors_party = $game_party.battle_members.dup
end
end
end
#==============================================================================
# ** VE - Actors Battler X YEA - Ace Batte Engie
#------------------------------------------------------------------------------
# Compatibility Patch for VE - Actors Battler and YEA - Ace Batte Engie
#==============================================================================
if $imported[:ve_actor_battlers] && $imported["YEA-BattleEngine"]
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def screen_x
setup_x
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def screen_y
setup_y
end
end
end