赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 285 |
最后登录 | 2012-2-6 |
在线时间 | 5 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 5 小时
- 注册时间
- 2012-2-4
- 帖子
- 16
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 倒转甲马 于 2012-2-4 12:07 编辑
难度写着VERYHARD,但我觉得是个菜鸟级别的横版。
地址http://ramirormvxa.wordpress.com ... -battle-engine-rbs/
翻墙:
Geolocation:Miami
IP adress:ssh2.heyxin.com
tunnel port: 22
username: bestssh
password: comehere
不懂得我解释了你也不懂,懂得就不用我解释了。- #===============================================================================
- # RBS - Ramiro's Battle System
- # Version 2.0
- # Difficulty: Very hard
- #-------------------------------------------------------------------------------
- # Instructions:
- # Paste above main and after all other script, unless that script says other
- # thing.
- #-------------------------------------------------------------------------------
- # WARNING: THIS IS THE CONFIGURATION FILE!
- # Each change made on this script will be reflected on the system.
- # Use with care.
- #-------------------------------------------------------------------------------
- # License:
- #Copyright (c) 2012, Ramiro Rojo
- #All rights reserved.
- #
- #Redistribution and use in source and binary forms, with or without
- #modification, are permitted provided that the following conditions are met:
- #
- #1. Redistributions of source code must retain the above copyright notice, this
- # list of conditions and the following disclaimer.
- #2. Redistributions in binary form must reproduce the above copyright notice,
- # this list of conditions and the following disclaimer in the documentation
- # and/or other materials provided with the distribution.
- #
- #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- #DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- #ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- #ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #
- #The views and conclusions contained in the software and documentation are those
- #of the authors and should not be interpreted as representing official policies,
- #either expressed or implied, of the FreeBSD Project.
- #===============================================================================
- module BattleConfig
-
- # If the value is true, the camera will be in a more panoramic style.
- BattleCamera_UsePanoramicCamera = true
-
- # show the positions of the party member by index.
-
- if BattleCamera_UsePanoramicCamera
- ActorPos = [[410, 265], [430, 275], [450, 285], [470, 295]]
- else
- ActorPos = [[410, 210], [430, 235], [450, 260], [470, 295]]
- end
-
- # the bitmap name of the cursor for targeting in system folder
- CursorBitmap = 'battle cursor'
- # the number of frames of the cursor
- CursorFrames = 1
- # the delay between each frame of the cursor.
- CursorDelay = 8
-
- # default enemy animation ids
- DefaultEnemey_Ani1ID = 1
- DefaultEnemey_Ani2ID = 0
-
- # the number of poses that the standart battles have
- DefaultPoses = 1
- # the number of frames that the standart battles have
- DefaultFrames = 1
-
- # the default sprite acotr an eney indexes for a battle
- DefaultActorIndex = 0
- DefaultEnemyIndex = 0
-
- # if set to true, the x correction will be inverted for actor sequences
- # when using movement commands.
- InvertXCorrection = true
- # if set to true, the y correction will be inverted for actor sequences
- # when using movement commands.
- InvertYCorrection = false
-
- # display skill names on the log window when used?
- Log_DisplaySkillName = false
- # display the messages 1 and 2 for skill on the log window when used?
- Log_DisplaySkillMsg1 = true
- Log_DisplaySkillMsg2 = true
-
- # display item names on the log window when used?
- Log_DisplayItemName = false
- # display item usage on the log window when used?
- Log_DisplayItemUsage = true
-
- # display critical message on log?
- Log_DisplayCritical = false
- # display failure message on log?
- Log_DisplayFailure = false
- # display miss message on log?
- Log_DisplayMiss = false
- # display evasi髇 message on log?
- Log_DisplayEvasion = false
-
- # display the damage or recovery to TP, MP or Hp on log? (if set to false,
- # please consider using the popup.
- Log_DisplayHpDamage = false
- Log_DisplayMpDamage = false
- Log_DisplayTpDamage = false
-
- # display counterattack message?
- Log_DisplayCounterattack = true
- # display reflection message?
- Log_DisplayReflection = true
- # display substitute message?
- Log_DisplaySubstitute = true
-
- # display messages of removed states?
- Log_DisplayRemovedStates = false
- # display messages of added states?
- Log_DisplayAddedStates = false
-
- # display buffs with the log ?
- Log_DisplayBuffs = false
- # display debuffs with the log ?
- Log_DisplayDebuffs = false
- # display removed buffs with the log ?
- Log_DisplayRemovedBuffs = false
-
- # set this to true to correct the battlebacks with the camera if you are using
- # the rtp's battlebacks or the same style and sizes.
- UsingDefaultBattlebacks = true
-
- # change the default scale of the battleback (not supported)
- Battleback_NormalZoom = 1
-
- # the default notres for each action are defined here.
- Default_SequenceNotes = "
-
- # called when the battler's selection turn has started
- <sequence:turn start>
- pose: 'user', 0, 2, -2, -1, 9;
- move: 'user', 'origin', 32, 0, 0, 20;
- wait: 20;
- pose: 'user', 0, 0, 1, -1, 12;
- wait: 20;
- </sequence>
-
- # called when the battler's selection turn has ended
- <sequence:turn end>
- pose: 'user', 0, 1, -2, -1, 9;
- move: 'user', 'origin', 0, 0, 0, 20;
- wait: 30;
- pose: 'user', 0, 2, -2, -1, 12;
- wait: 20;
- </sequence>
-
- # called when the battle starts as normal
- <sequence:presentation>
- pose: 'user', 0, 2, -2, -1, 12;
- opacity: 'user', 0, 1;
- move: 'user', 'origin', -300, 0, 0, 1;
- wait: 1;
- opacity: 'user', 255, 40;
- move: 'user', 'origin', 0, 0, 0, 60;
- wait: 60;
- </sequence>
-
- # called when the user is surprized.
- <sequence:surprised>
- balloon: 'user', 1;
- opacity: 'user', 0, 1;
- wait: 1;
- opacity: 'user', 255, 20;
- mirror: 'user', true;
- wait: 20;
- move: 'user', 'origin', 0, 0, 30, 20;
- wait: 10;
- mirror: 'user', false;
- wait: 10;
- </sequence>
- # called when the user has an advantage turn
- <sequence:preemptive>
- pose: 'user', 0, 2, -2, -1, 12;
- opacity: 'user', 0, 1;
- move: 'user', 'origin', -300, 0, 0, 1;
- wait: 1;
- opacity: 'user', 255, 40;
- move: 'user', 'origin', 0, 0, 20, 60;
- wait: 60;
- </sequence>
- # called when the user attacks or the skill/item is used
- <sequence:attack>
- afterimage: 'user', 3, 3;
- pose: 'user', 0, 2, -2, -1, 16;
- move: 'user', 'targets', -80, 0, 0, 20;
- wait: 20;
- check counter;
- check substitute;
- wait: 1;
- weapon: 'user', 2, -12, 0, -90, 10, false, false;
- animation: 'target', -1, false;
- wait: 20;
- weapon: 'user', 2, -12, -90, 0, 10, true, true;
- animation: 'target', -2, true;
- zoom camera: 150, 20;
- move camera: 'user', 0, 0, 20;
- damage;
- wait: 20;
- move: 'user', 'origin', 0, 0, 20, 20;
- zoom camera: 100, 20;
- move camera: 'screen', 272, 208, 20;
- wait: 20;
- afterimage: 'user', 0;
- </sequence>
- # called when the user defends
- <sequence:guard>
- damage;
- </sequence>
-
- # calls when a user makes a counter
- <sequence:counter>
- afterimage: 'target', 0;
- balloon: 'user', 1;
- wait: 20;
- afterimage: 'user', 3, 3;
- pose: 'user', 0, 2, -2, -1, 16;
- move: 'user', 'targets', -80, 0, 0, 20;
- wait: 20;
- weapon: 'user', 2, -8, 0, 50, 10, false, false;
- animation: 'target', -1, false;
- damage;
- wait: 20;
- move: 'user', 'origin', 0, 0, 20, 20;
- move: 'target', 'origin', 0, 0, 20, 20;
- wait: 20;
- zoom camera: 100, 20;
- move camera: 'screen', 272, 208, 20;
- wait: 20;
- afterimage: 'user', 0;
- </sequence>
- # called when the user dies
- <sequence:die>
- opacity: 'user', 255, 20;
- pose: 'user', 0, 3, 1, -1, 16;
- angle: 'user', -90, 20;
- wait: 20;
- </sequence>
- # called when the user is dead when enters the battle
- <sequence:dead>
- opacity: 'user', 255, 20;
- pose: 'user', 0, 3, 1, -1, 16;
- angle: 'user', -90, 1;
- wait: 20;
- </sequence>
-
- # called when the user revives
- <sequence:revive>
- pose: 'user', 0, 2, 1, -1, 16;
- angle: 'user', 0, 20;
- wait: 20;
- </sequence>
-
- # called when the user wins
- <sequence:victory>
- move: 'user', 'origin', 0, 0, 20, 14;
- pose: 'user', 0, 0, 0, 1;
- wait: 2;
- pose: 'user', 0, 1, 0, 1;
- wait: 2;
- pose: 'user', 0, 2, 0, 1;
- wait: 2;
- pose: 'user', 0, 3, 0, 1;
- wait: 2;
- pose: 'user', 0, 0, 0, 1;
- wait: 2;
- pose: 'user', 0, 1, 0, 1;
- wait: 2;
- pose: 'user', 0, 2, 0, 1;
- wait: 2;
- move: 'user', 'origin', Graphics.width, 0, 0, 120;
- wait: 120;
- </sequence>
- # called when the user runs to protect someone
- #(the target is the person to protect, and the user is the substitute)
- <sequence:substitute>
- balloon: 'user', 1;
- wait: 60;
- opacity: 'user', 0, 20;
- opacity: 'target', 0, 20;
- wait: 20;
- move: 'user', 'target', 0, 0, 8, 1;
- move: 'target', 'user', 0, 0, 8, 1;
- wait: 20;
- opacity: 'user', 255, 20;
- opacity: 'target', 255, 20;
- wait: 20;
- </sequence>
- # called when a magic is reflected
- <sequence:reflect>
- animation: 'user', 94, false;
- wait: 20;
- </sequence>
- # called when the item does not have an attack animation
- <sequence:item>
- pose: 'user', 0, 2, -2, -1, 9;
- move: 'user', 'origin', 32, 0, 0, 20;
- wait: 20;
- pose: 'user', 0, 0, 1, -1, 12;
- show pic: 1, 0, 1, 0, 0, 0, 0, 0, 0;
- move pic ex: 1, 'user', 0, 0, 1;
- wait: 1;
- move pic ex: 1, 'user', 0, -16, 20;
- zoom pic: 1, 100, 100, 20;
- opacity pic: 1, 255, 20;
- wait: 20;
- animation: 'target', 0;
- damage;
- wait: 20;
- zoom pic: 1, 0, 0, 20;
- opacity pic: 1, 0, 20;
- wait: 20;
- delete pic: 1;
- pose: 'user', 0, 1, -2, -1, 9;
- move: 'user', 'origin', 0, 0, 0, 20;
- wait: 20;
- pose: 'user', 0, 2, -2, -1, 12;
- wait: 20;
-
- </sequence>
- # called when the skill does not have an attack animation
- <sequence:skill>
- pose: 'user', 0, 2, -2, -1, 9;
- move: 'user', 'origin', 32, 0, 0, 20;
- wait: 20;
- weapon: 'user', -2, -12, -45, 45, 11, false, false;
- animation: 'user', 81;
- wait: 10;
- weapon: 'user', 2, -12, 45, 45, 50, false, false;
- wait: 50;
- check reflect;
- animation: 'target', 0;
- damage;
- wait: 20;
- pose: 'user', 0, 1, -2, -1, 9;
- move: 'user', 'origin', 0, 0, 0, 20;
- wait: 20;
- pose: 'user', 0, 2, -2, -1, 12;
- wait: 20;
- </sequence>
- # called when the user is standig you can get it with states too.
- <sequence:stand>
- </sequence>
- # called when the user is standig you can get it with states too.
- <sequence:return position>
- opacity: 'user', 0, 20;
- wait: 20;
- move: 'user', 'origin', 0, 0, 0, 1;
- opacity: 'user', 255, 20;
- wait: 20;
- </sequence>
-
- # called when the user evades an attack
- <sequence:evade>
- </sequence>
- # called when the target misses
- <sequence:miss>
- </sequence>
-
- # called when the actor is selecting something.
- <sequence:action selection>
- </sequence>
- "
-
- end
- #==============================================================================
- # ?Vocab
- #------------------------------------------------------------------------------
- # ?????????????????????????????????????
- # ??????????? $data_system ??????????????
- #==============================================================================
- module Vocab
-
- Error_CommandNotRecognized = 'The command %s is not recognized by the system'
- Error_TagSintaxError = 'There is an error in your syntax'
- Error_ScreenNotValid = 'The screen cannot be targeted in this way'
- Error_OriginNotValid = 'The origin cannot be targeted in this way'
- end
- $imported = {} if $imported.nil?
- $imported['Ramiro-RBS'] = true
- #===============================================================================
- # ** RBS - Ramiro's Battle System (PART II - Classes And Modules)
- # Version 2.0
- # Difficulty Very Hard.
- #-------------------------------------------------------------------------------
- # If you don't know what to do... DO NOT EDIT THIS FILE.
- #-------------------------------------------------------------------------------
- # YANFLY SCRIPTS COMPATIBILITY:
- #
- # Common ways to test if an YF script works:
- #
- # First of all, put the Unlisted YEA script BEFORE the RBS, why before? because
- # YEA is 'older' (in terms of published date) and the compatibility patches are
- # made with the RBS (that supports a way to mix both battle systems altogether)
- #
- # If the script does not work properly, you may put it AFTER RBS and TRY AGAIN.
- #
- # If even with that change the script does not work, you may then call it a
- # "compatibility issue" and I will, eventually, make a patch for it.
- #
- # Why are you making compatibility patches?
- #
- # It's quite simple, YF scripts sometimes overrite some methods that I had to
- # alias or vice-versa. in that cases, Yanfly or I should need to make a Patch.
- # To run the scripts toguether.
- #
- # The next section will show HOW TO APPLY each script, knowkn in wich order
- # and if it needs or not this patch.
- #
- #
- #
- # List of Compatible YEA scripts:
- # BATTLE SCRIPTS:
- # - Ace Battle Engine (Insert BEFORE RBS)
- # Known Issues: Disable one of the popup systems or YEA popup or
- # RBS popup.
- # - Lunatic Objects (Doesn't infleunce the place)
- # Known Issues: None.
- # - TargetManager (Doesn't infleunce the place)
- # Known Issues: None.
- # - CastAnimations (Doesn't infleunce the place)
- # Known Issues: None.
- #
- # OTHER YF SCRIPTS:
- # Because other YF scripts won't collide with this battle system.
- # They should be compatible. If there is an incompatibility issue, just
- # ask and I'll do as much as I can to repair it.
- #-------------------------------------------------------------------------------
- # License:
- #Copyright (c) 2012, Ramiro Rojo
- #All rights reserved.
- #
- #Redistribution and use in source and binary forms, with or without
- #modification, are permitted provided that the following conditions are met:
- #
- #1. Redistributions of source code must retain the above copyright notice, this
- # list of conditions and the following disclaimer.
- #2. Redistributions in binary form must reproduce the above copyright notice,
- # this list of conditions and the following disclaimer in the documentation
- # and/or other materials provided with the distribution.
- #
- #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- #DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- #ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- #ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #
- #The views and conclusions contained in the software and documentation are those
- #of the authors and should not be interpreted as representing official policies,
- #either expressed or implied, of the FreeBSD Project.
- #===============================================================================
- #===============================================================================
- # BEGIN MODULE SECTION
- #===============================================================================
- module Cache
-
- #-----------------------------------------------------------------------------
- # Constants
- #-----------------------------------------------------------------------------
- @@icon_bitmaps = {}
-
- def self.get_icon_bitmap(icon_index)
- if !@@icon_bitmaps[icon_index] || @@icon_bitmaps[icon_index].disposed?
- bmp = Bitmap.new(24,24)
- bitmap = Cache.system("Iconset")
- rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
- bmp.blt(0, 0, bitmap, rect)
- @@icon_bitmaps[icon_index] = bmp
- end
- @@icon_bitmaps[icon_index]
- end
-
- class << self
- alias rbs_cache_clear clear
-
- def clear
- @@icon_bitmaps ||= {}
- @@icon_bitmaps.clear
- rbs_cache_clear
- end
- end
-
- end
- #===============================================================================
- # * BattleCamera module
- #-------------------------------------------------------------------------------
- # Controls the camera`s position on the battlefield.
- # It can be zoomed in and out.
- #===============================================================================
- module BattleCamera
-
- #-----------------------------------------------------------------------------
- # Starts the camera
- #-----------------------------------------------------------------------------
- def self.start
- self.reset
- end
-
- #-----------------------------------------------------------------------------
- # Resets the camera
- #-----------------------------------------------------------------------------
- def self.reset
- @center_x = Graphics.width / 2
- @center_y = Graphics.height / 2
- @current_x = @desired_x = @center_x
- @current_y = @desired_y = @center_y
- @current_zoom = @desired_zoom = 1.0
- @zoom_time = 0
- @movement_time = 0
- @target = :screen
- end
-
- #-----------------------------------------------------------------------------
- # Corrects a position
- #-----------------------------------------------------------------------------
- def self.correct_position(pos, current, current_zoom, center)
- return ((pos - current) * (current_zoom - 1.0) + pos - (current - center))
- end
-
- #-----------------------------------------------------------------------------
- # Corrects the x position given
- #-----------------------------------------------------------------------------
- def self.correct_x(x)
- return correct_position(x, @current_x, @current_zoom, @center_x)
- end
-
- #-----------------------------------------------------------------------------
- # Corrects the y position given
- #-----------------------------------------------------------------------------
- def self.correct_y(y)
- return correct_position(y, @current_y, @current_zoom, @center_y)
- end
-
- #-----------------------------------------------------------------------------
- # Corrects the zoom given
- #-----------------------------------------------------------------------------
- def self.correct_zoom(zoom, x=nil, y=nil, zoom_effective=true)
- if BattleConfig::BattleCamera_UsePanoramicCamera
- if !x || !y || !zoom_effective
- return zoom * @current_zoom
- else
- return ((y - @center_y * 130 / 100) * 0.005 + 1.0) * @current_zoom
- end
- else
- return zoom * @current_zoom
- end
- end
-
- #-----------------------------------------------------------------------------
- # Corrects the angle given
- #-----------------------------------------------------------------------------
- def self.correct_angle(angle)
- return angle
- end
-
- #-----------------------------------------------------------------------------
- # Corrects the mirror value given
- #-----------------------------------------------------------------------------
- def self.correct_mirror(mirror)
- return mirror
- end
-
- #-----------------------------------------------------------------------------
- # Calculates the difference of movement in the frame
- #-----------------------------------------------------------------------------
- def self.calculate_display_change(current, desired, count)
- ((current * (count - 1) + desired) / count)
- end
-
- #-----------------------------------------------------------------------------
- # Updates the camera.
- #-----------------------------------------------------------------------------
- def self.update
- @center_x = Graphics.width / 2
- @center_y = Graphics.height / 2
- if @zoom_time > 0
- @current_zoom = self.calculate_display_change(@current_zoom, @desired_zoom, @zoom_time)
- @zoom_time -= 1
- end
-
- if @movement_time > 0
- @current_x = self.calculate_display_change(@current_x, @desired_x, @movement_time)
- @current_y = self.calculate_display_change(@current_y, @desired_y, @movement_time)
- @movement_time -= 1
- end
-
- if @target != :screen && !moving?
- cx = 0
- cy = 0
- @target.each do |i|
- cx += i.current_x
- cy += i.current_y
- end
- if @target.size > 0
- cx /= @target.size
- cy /= @target.size
- end
- @current_x = cx
- @current_y = cy
- end
- end
-
- #-----------------------------------------------------------------------------
- # Sets the movement of the Camera.
- #-----------------------------------------------------------------------------
- def self.set_movement(x, y, time)
- @desired_x = x
- @desired_y = y
- @movement_time = time
- end
-
- #-----------------------------------------------------------------------------
- # Sets the zoom of the Camera.
- #-----------------------------------------------------------------------------
- def self.set_zoom(zoom, time)
- @desired_zoom = zoom
- @zoom_time = time
- end
-
- #-----------------------------------------------------------------------------
- # Sets the target of the Camera.
- #-----------------------------------------------------------------------------
- def self.set_target(target)
- @target = target
- end
-
- #-----------------------------------------------------------------------------
- # Checks if the camera is moving.
- #-----------------------------------------------------------------------------
- def self.moving?
- return ( @movement_time > 0 || @zoom_time > 0 )
- end
-
- end
- #===============================================================================
- # * BattleInterpreter module
- #-------------------------------------------------------------------------------
- # This module manages the battle's actions and keeps track of all of them.
- # it can read commands for using in battle animations.
- #===============================================================================
- module BattleInterpreter
-
- #-----------------------------------------------------------------------------
- # CONSTANTS
- #-----------------------------------------------------------------------------
- Commands = {}
-
- #=============================================================================
- # * BattleInterpreter::Action
- #-----------------------------------------------------------------------------
- # An action used by the battle interpreter module.
- # It stores information of the action used and process part of them.
- #=============================================================================
- class Action
-
- #---------------------------------------------------------------------------
- # Class properties
- #---------------------------------------------------------------------------
- attr_reader :original_user
- attr_reader :original_target
- attr_accessor :user
- attr_accessor :targets
- attr_accessor :item
- attr_accessor :loop_depth
- attr_accessor :linked_actions
- attr_accessor :paused
-
- #---------------------------------------------------------------------------
- # Starts an action
- #---------------------------------------------------------------------------
- def initialize(spriteset, user, targets, sequence, item, can_counter=true)
- @extra_affected_battlers = []
- @sequence = sequence
- @user = user
- @targets = targets
- @item = item
- @loop_depth = 0
- @wait_count = 0
- @original_user = user
- @original_targets = targets
- @spriteset = spriteset
- @counter_check = can_counter
- @linked_actions = []
- @paused = false
- compile_data
- end
-
- #---------------------------------------------------------------------------
- # Checks if a counter can be realized
- #---------------------------------------------------------------------------
- def counter_active?
- return @counter_check
- end
-
- #---------------------------------------------------------------------------
- # Evaluates parameters
- #---------------------------------------------------------------------------
- def eval_data(data)
- make_parameters(data)[0]
- end
-
- #---------------------------------------------------------------------------
- # Sets the wait time of the action
- #---------------------------------------------------------------------------
- def wait(wait)
- @wait_count = wait
- end
-
- #---------------------------------------------------------------------------
- # Makes the parameters for an action
- #---------------------------------------------------------------------------
- def make_parameters(parameters)
- return [] if !parameters
- a = @user
- b = @targets[0]
- t = @targets
- s = $game_siwtches
- v = $game_variables
- result = []
- parameters.split(',').each do |i|
- r = Kernel.eval(i) rescue nil
- result.push(r)
- end
- return result
- end
-
- #---------------------------------------------------------------------------
- # Compiles the data for the action
- #---------------------------------------------------------------------------
- def compile_data
- @commands = []
- @sequence.split(';').each do |line|
- next if (line.gsub(/\s/mi) {''}) == ''
- line += ';'
- if line[/((\s+)?)(.*?)(:(.*?))?;/mi]
- @commands.push([$3.upcase, make_parameters($5)])
- end
- end
- end
-
- #---------------------------------------------------------------------------
- # Updates the action
- #---------------------------------------------------------------------------
- def update
- return if @paused
- if (@wait_count && @wait_count > 0)
- @wait_count -= 1
- return
- end
- call_next_command
- end
-
- #---------------------------------------------------------------------------
- # Calls next command
- #---------------------------------------------------------------------------
- def call_next_command
- return if @commands.size == 0 || (@wait_count && @wait_count > 0)
- initial_depth = current_depth = @loop_depth
- command, params = next_command
- raise sprintf(Vocab::Error_CommandNotRecognized, command) if !Commands[command]
- has_depth, link_method = Commands[command]
- current_depth += 1
- result = []
- if has_depth
- while initial_depth != current_depth && @commands.size > 0
- i = next_command
- nested_command, nested_params = i
- if Commands[nested_command] && Commands[nested_command][0]
- current_depth += 1
- elsif nested_command[/END/mi]
- current_depth -= 1
- end
- result.push(i)
- end
- if initial_depth == current_depth
- params.push(result)
- @loop_depth += 1
- else
- raise Vocab::Error_TagSintaxError
- end
- end
- link_method.call(self, params)
- call_next_command
- end
-
- #---------------------------------------------------------------------------
- # Gets the next command
- #---------------------------------------------------------------------------
- def next_command
- @commands.shift
- end
-
- #---------------------------------------------------------------------------
- # Insert commands as next
- #---------------------------------------------------------------------------
- def insert_commands_as_next(commands)
- @commands = commands + @commands
- end
-
- #---------------------------------------------------------------------------
- # Checks if the action is running
- #---------------------------------------------------------------------------
- def running?
- return (@commands.size > 0 || @wait_count > 0)
- end
-
- #---------------------------------------------------------------------------
- # Pauses the action
- #---------------------------------------------------------------------------
- def pause
- @paused = true
- end
-
- #---------------------------------------------------------------------------
- # Checks if the action is paused
- #---------------------------------------------------------------------------
- def paused?
- @paused
- end
-
- #---------------------------------------------------------------------------
- # Resumes the action
- #---------------------------------------------------------------------------
- def resume
- @paused = false
- call_next_command
- end
-
- #---------------------------------------------------------------------------
- # Stops the action
- #---------------------------------------------------------------------------
- def abort
- @commands.clear
- @wait_count = 0
- end
-
- #---------------------------------------------------------------------------
- # Analizes targets by a string
- #---------------------------------------------------------------------------
- def analize_target_string(string, origin_valid = true, screen_valid = false)
- case string
- when /(.*?) except (.*)/im
- t1 = analize_target_string($1, origin_valid, screen_valid)
- t2 = analize_target_string($2, origin_valid, screen_valid)
- return t1 - t2
- when /(.*?) but (.*)/im
- t1 = analize_target_string($1, origin_valid, screen_valid)
- t2 = analize_target_string($2, origin_valid, screen_valid)
- return t1 - t2
- when /(\d+) random ([\w\s]+)/im
- num = $1.to_i
- targets = analize_target_string($2, false, false)
- result = []
- num.times do |i|
- result.push(targets[rand(targets.size)])
- end
- return result
- when /original (\w+)/im
- case $1
- when /user/im
- return [@original_user]
- when /target(s?)/im
- return @original_targets
- end
- when /dead battler(s?)/im
- return $game_troop.dead_members + $game_party.dead_members
- when /dead all(y||es)/im
- case @user.confusion_level
- when 0
- return @user.friend_unit.dead_members
- when 1
- return @[email protected]_unit.dead_members
- when 2
- return @user.enemy_unit.dead_members
- end
- when /dead enem(y||ies)/im
- case @user.confusion_level
- when 0
- return @user.enemy_unit.dead_members
- when 1
- return @[email protected]_unit.dead_members
- when 2
- return @user.friend_unit.dead_members
- end
- when /battler(s?)/im
- return $game_troop.alive_members + $game_party.alive_members
- when /all(y||es)/im
- case @user.confusion_level
- when 0
- return @user.friend_unit.alive_members
- when 1
- return @[email protected]_unit.alive_members
- when 2
- return @user.enemy_unit.alive_members
- end
- when /friend(s?)/im
- case @user.confusion_level
- when 0
- group = @user.friend_unit.alive_members
- when 1
- group = @[email protected]_unit.alive_members
- when 2
- group = @user.enemy_unit.alive_members
- end
- return group - [@user]
- when /enem(y||ies)/im
- case @user.confusion_level
- when 0
- return @user.enemy_unit.alive_members
- when 1
- return @[email protected]_unit.alive_members
- when 2
- return @user.friend_unit.alive_members
- end
- when /target(s?)/im
- return @targets
- when /user/im
- return [@user]
- when /screen/im
- if screen_valid
- return :screen
- else
- raise Vocab::Error_ScreenNotValid
- end
- when /origin/im
- if origin_valid
- return :origin
- else
- raise Vocab::Error_OriginNotValid
- end
- end
- return nil
-
- end
-
- #---------------------------------------------------------------------------
- # Get the sprites of battlers.
- #---------------------------------------------------------------------------
- def get_battler_sprites(battlers)
- result = []
- @spriteset.battler_sprites.each do |i|
- result.push(i) if battlers.any? {|j| i.battler == j }
- end
- return result
- end
-
- #---------------------------------------------------------------------------
- # gets the battler sprites of a determined target string
- #---------------------------------------------------------------------------
- def analize_battler_sprites_string(string, origin_valid = true, screen_valid = false)
- battlers = analize_target_string(string, origin_valid, screen_valid)
- return battlers if battlers.is_a?(Symbol)
- return battlers ? get_battler_sprites(battlers) : []
- end
-
- def affected_battlers
- targets + [user] + @extra_affected_battlers
- end
-
- end
-
- class LoopingAction < BattleInterpreter::Action
-
- def next_command
- new_command = @commands.shift
- @commands.push(new_command)
- return new_command
- end
-
- end
-
- #-----------------------------------------------------------------------------
- # Starts the interpreter
- #-----------------------------------------------------------------------------
- def self.start(spriteset)
- self.reset
- @spriteset = spriteset
- end
-
- #-----------------------------------------------------------------------------
- # Resets the interpreter
- #-----------------------------------------------------------------------------
- def self.reset
- Commands.clear
- @looping_actions = {}
- @actions = []
- end
-
- #-----------------------------------------------------------------------------
- # Adds an action
- #-----------------------------------------------------------------------------
- def self.add_action(user, targets, sequence, item, can_counter = true)
- action = BattleInterpreter::Action.new(@spriteset, user, targets, sequence, item, can_counter)
- @actions.push(action)
- action
- end
-
- #-----------------------------------------------------------------------------
- # Updates the interpreter
- #-----------------------------------------------------------------------------
- def self.update
- current_battlers = []
- @actions.each do |i|
- i.update
- if i.running?
- i.affected_battlers.each do |j|
- current_battlers.push(j)
- end
- else
- @actions.delete(i)
- end
- end
- @looping_actions.each_pair do |battler, action|
- action.update if !current_battlers.include?(battler)
- end
- end
-
- #-----------------------------------------------------------------------------
- # Checks if the interpreter is running
- #-----------------------------------------------------------------------------
- def self.running?
- return true if @actions.any? {|i| i.running? && !i.paused?}
- return true if BattleCamera.moving?
- return true if @spriteset.animation?
- return false
- end
-
- #-----------------------------------------------------------------------------
- # Adds a looping action to an user
- #-----------------------------------------------------------------------------
- def self.add_looping_action(user, sequence)
- action = BattleInterpreter::LoopingAction.new(@spriteset, user, [user], sequence, nil)
- @looping_actions[user] = action
- action
- end
-
- def self.pause_looping_action(user)
- @looping_actions[user].pause if @looping_actions[user]
- end
-
- def self.resume_looping_action(user)
- @looping_actions[user].resume if @looping_actions[user]
- end
-
- end
- #==============================================================================
- # ?BattleManager
- #==============================================================================
- module BattleManager
-
- #-----------------------------------------------------------------------------
- # Checks if the battle is a surprise battle
- #-----------------------------------------------------------------------------
- def self.surprise?
- return @surprise
- end
-
- #-----------------------------------------------------------------------------
- # Checks if the battle is a preemptive battle
- #-----------------------------------------------------------------------------
- def self.preemptive?
- return @preemptive
- end
-
- class << self
-
- #---------------------------------------------------------------------------
- # Alias methods
- #---------------------------------------------------------------------------
- alias rbs_battle_manager_process_victory process_victory
-
- #-----------------------------------------------------------------------------
- # Process victory
- #-----------------------------------------------------------------------------
- def process_victory
- for member in $game_party.alive_members
- sequence = member.get_victory_sequence
- BattleInterpreter.add_action(member, [member], sequence, nil, false)
- end
- rbs_battle_manager_process_victory
- end
- end
-
- end
- #===============================================================================
- # END MODULE SECTION
- #===============================================================================
- #===============================================================================
- # BEGIN SPRITE SECTION
- #===============================================================================
- #===============================================================================
- # ?Sprite_Battler
- #===============================================================================
- class Sprite_Battler < Sprite_Base
-
- #-----------------------------------------------------------------------------
- # Alias methods
- #-----------------------------------------------------------------------------
- alias rbs_sprite_battler_initialize initialize
- alias rbs_sprite_battler_update update
- alias rbs_sprite_battler_animation? animation?
- alias rbs_sprite_battler_dispose dispose
-
- #-----------------------------------------------------------------------------
- # Class Properties
- #-----------------------------------------------------------------------------
- attr_reader :current_x
- attr_reader :current_y
- attr_reader :original_x
- attr_reader :original_y
-
- #-----------------------------------------------------------------------------
- # Resets the position.
- #-----------------------------------------------------------------------------
- def reset_position
- @character_started = true
- @original_battler = @battler
- @original_x = @battler.screen_x
- @original_y = @battler.screen_y
- @current_x = @desired_x = @original_x
- @current_y = @desired_y = @original_y
- @jump_count = 0
- @jump_axis = 0
- @jump_value = 0
- @movement_count = 0
- @frame_count = 0
- @frame_delay = 16
- @last_battler = battler
- @battler_index = @battler.default_battler_index
- @frame = 0
- @pose = 0
- @poses = 1
- @frames = 1
- @frame_style = :rmvx
- @loops = 0
- @last_battle_index = 0
- @desired_zoom_x = @current_zoom_x = 1
- @desired_zoom_y = @current_zoom_y = 1
- @current_angle = @desired_angle = 0
- @angle_time = 0
- @zoom_time = 0
- @current_opacity = @desired_opacity = 0
- @opacity_time = 0
- @battler_name_result = @battler.battler_name
- @mirrored_sprite = false
- @effect_opacity = 255
- @effect_ox = 0
- @effect_height = 0
- @balloon_id = 0
- @need_refresh = true
- @last_battler = nil
- @last_battler_name = ''
- @last_battler_hue = 0
- end
-
- def make_return_sequence
- return if !@battler
- seq = ''
- if (@original_x != @current_x) || (@original_y != @current_y)
- seq = @battler.get_return_sequence
- end
- BattleInterpreter.add_action(@battler, [@battler], seq, nil, false)
- if @battler.alive?
- BattleInterpreter.add_looping_action(@battler, @battler.get_stand_sequence)
- end
- end
-
- #-----------------------------------------------------------------------------
- # Sets the mirror value
- #-----------------------------------------------------------------------------
- def set_mirror_value(value)
- @mirrored_sprite = value
- end
- #-----------------------------------------------------------------------------
- # Creates the sprite
- #-----------------------------------------------------------------------------
- def initialize(viewport, battler=nil)
- @weapon_sprites = []
- @character_started = false
- @afterimages = []
- @afterimages_visible = false
- @afterimage_separation = 8
- @animation_reg = []
- rbs_sprite_battler_initialize(viewport, battler)
- end
-
- #-----------------------------------------------------------------------------
- # Dispose
- #-----------------------------------------------------------------------------
- def dispose
- #dispose_damage_sprites
- dispose_afterimages
- dispose_weapon_sprites
- dispose_balloon
- rbs_sprite_battler_dispose
- end
-
- #-----------------------------------------------------------------------------
- # Dispose afterimages
- #-----------------------------------------------------------------------------
- def dispose_afterimages
- @afterimages.each do |i|
- i.dispose
- end
- @afterimages.clear
- end
-
- #-----------------------------------------------------------------------------
- # Dispose weapon sprites
- #-----------------------------------------------------------------------------
- def dispose_weapon_sprites
- @weapon_sprites.each do |i|
- i.dispose
- end
- end
-
- #-----------------------------------------------------------------------------
- # Checks if the sprite is moving?
- #-----------------------------------------------------------------------------
- def moving?
- return false if !@battler
- return (@movement_count > 0 || @angle_time > 0 || @zoom_time > 0 || @opacity_time > 0 )
- end
-
- #--------------------------------------------------------------------------
- # ? Update blink effect
- #--------------------------------------------------------------------------
- def update_blink
- @effect_opacity = (@effect_duration % 10 < 5) ? 255 : 0
- end
- #--------------------------------------------------------------------------
- # ? Opdates appear effect
- #--------------------------------------------------------------------------
- def update_appear
- @effect_opacity = (16 - @effect_duration) * 16
- end
- #--------------------------------------------------------------------------
- # ? Opdates disappear effect
- #--------------------------------------------------------------------------
- def update_disappear
- @effect_opacity = 256 - (32 - @effect_duration) * 10
- end
- #--------------------------------------------------------------------------
- # ? Update collapse effect
- #--------------------------------------------------------------------------
- def update_collapse
- self.blend_type = 1
- self.color.set(255, 128, 128, 128)
- @effect_opacity = 256 - (48 - @effect_duration) * 6
- end
-
- #--------------------------------------------------------------------------
- # ? Reverts the sprite to normal
- #--------------------------------------------------------------------------
- def revert_to_normal
- self.blend_type = 0
- self.color.set(0, 0, 0, 0)
- @effect_opacity = 255
- @effect_ox = @battler_width / 2 if bitmap
- @effect_height = 0
- end
-
- #--------------------------------------------------------------------------
- # ? Updates boss collpase
- #--------------------------------------------------------------------------
- def update_boss_collapse
- alpha = @effect_duration * 120 / bitmap.height
- @effect_ox = @battler_width / 2 + @effect_duration % 2 * 4 - 2
- self.blend_type = 1
- self.color.set(255, 255, 255, 255 - alpha)
- @effect_opacity = alpha
- @effect_height -= 1
- Sound.play_boss_collapse2 if @effect_duration % 20 == 19
- end
- #--------------------------------------------------------------------------
- # ? updates instant collapse
- #--------------------------------------------------------------------------
- def update_instant_collapse
- @effect_opacity = 0
- end
-
- #-----------------------------------------------------------------------------
- # Frame update
- #-----------------------------------------------------------------------------
- def update
- if @battler && (!@character_started || @battler != @original_battler)
- reset_position
- end
- set_animation_origin if @animation
- rbs_sprite_battler_update
- if @battler
- update_battler_position
- update_battler_pose
- update_afterimages
- update_weapon_sprites
- update_balloon
- end
- end
-
- #-----------------------------------------------------------------------------
- # Update positions.
- #-----------------------------------------------------------------------------
- def update_battler_position
- if @movement_count > 0
- @current_x = BattleCamera.calculate_display_change(@current_x, @desired_x, @movement_count)
- @current_y = BattleCamera.calculate_display_change(@current_y, @desired_y, @movement_count)
- if @jump_count > 0
- @jump_value = BattleCamera.calculate_display_change(@jump_value, @jump_axis, @jump_count)
- @jump_count -= 1
- elsif @jump_value != 0
- @jump_axis = 0
- @jump_count = @movement_count - 1
- end
- @movement_count -= 1
- end
-
- if @zoom_time > 0
- @current_zoom_x = BattleCamera.calculate_display_change(@current_zoom_x, @desired_zoom_x, @zoom_time)
- @current_zoom_y = BattleCamera.calculate_display_change(@current_zoom_y, @desired_zoom_y, @zoom_time)
- @zoom_time -= 1
- end
-
- if @angle_time > 0
- @current_angle = BattleCamera.calculate_display_change(@current_angle, @desired_angle, @angle_time)
- @angle_time -= 1
- end
- if @opacity_time > 0
- @current_opacity = BattleCamera.calculate_display_change(@current_opacity, @desired_opacity, @opacity_time)
- @opacity_time -= 1
- end
-
- self.x = BattleCamera.correct_x( @current_x )
- self.y = BattleCamera.correct_y( @current_y - @jump_value - @effect_height / 2)
- self.z = @current_y + 100
- self.zoom_x = BattleCamera.correct_zoom(@current_zoom_x, @current_x, @current_y, @battler.zoom_effective?)
- self.zoom_y = BattleCamera.correct_zoom(@current_zoom_y, @current_x, @current_y, @battler.zoom_effective?)
- self.angle = BattleCamera.correct_angle(@current_angle)
- self.mirror = BattleCamera.correct_mirror(@battler.enemy? ? @mirrored_sprite : !@mirrored_sprite)
- self.opacity = @current_opacity * @effect_opacity / 255
- end
-
- #-----------------------------------------------------------------------------
- # Get the max frame number
- #-----------------------------------------------------------------------------
- def max_frames
- return @frame_style == -2 ? @frames * 2 : @frames
- end
-
- #-----------------------------------------------------------------------------
- # Gets the real frame number
- #-----------------------------------------------------------------------------
- def real_frame
- return @frame < @frames ? @frame : (max_frames - @frame - 1)
- end
-
- #-----------------------------------------------------------------------------
- # Updates the current pose
- #-----------------------------------------------------------------------------
- def update_battler_pose
-
- if @loops != 0
- if @frame_style < 0
- @frame_count = (@frame_count + 1) % @frame_delay
- if @frame_count == 0
- @frame = (@frame + 1) % max_frames
- @loops -= 1 if @frame == 0 && @loops > 0
- end
- else
- @frame = @frame_style
- end
- end
- o_x = @battler_width * real_frame
- o_y = @battler_height * @pose + @effect_height
- bh = [@battler_height + @effect_height, 1].max
- self.src_rect.set(o_x, o_y, @battler_width, bh)
- end
- #-----------------------------------------------------------------------------
- # Makes the new battler name
- #-----------------------------------------------------------------------------
- def make_battler_name
- if @need_refresh || @last_battler != self.battler ||
- @last_battler_name != battler.battler_name ||
- @last_battler_hue != battler.battler_hue
- @last_battler_name = battler.battler_name
- @last_battler_hue = battler.battler_hue
- @need_refresh = false
- @last_battler = self.battler
- battler_name = @battler.battler_name.sub(/\[(\d+),(\d+)\]/i) { '' }
- battler_name = @battler_index == 0 ? @battler.battler_name : "#{@battler.battler_name}_#{@battler_index}"
- files = Dir.glob("Graphics/Battlers/#{battler_name}*")
- @battler_name_result = (files.size > 0) ? files[0] : battler_name
- @battler_name_result.gsub! (/Graphics\/Battlers\//mi) {''}
- end
- return @battler_name_result
- end
-
- #-----------------------------------------------------------------------------
- # Updates the bitmap
- #-----------------------------------------------------------------------------
- def update_bitmap
- battler_name = make_battler_name
- new_bitmap = Cache.battler(battler_name, @battler.battler_hue)
- if bitmap != new_bitmap
- data = []
- if battler_name[/\[(.*?),(.*?)\]/i]
- @frames = eval($1)
- @poses = eval($2)
- else
- @poses = BattleConfig::DefaultPoses
- @frames = BattleConfig::DefaultFrames
- end
- @frame_delay = 16
- @frame_style = -2
- @loops = -1
- self.bitmap = new_bitmap
- @battler_width = self.bitmap.width / @frames
- @battler_height = self.bitmap.height / @poses
- @effect_ox = @battler_width / 2 if bitmap
- init_visibility
- end
- end
- #-----------------------------------------------------------------------------
- # Updates the weapon sprites
- #-----------------------------------------------------------------------------
- def update_weapon_sprites
- @weapon_sprites.each do |i|
- if i.animation?
- i.update
- else
- i.dispose
- @weapon_sprites.delete(i)
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Updates original position.
- #-----------------------------------------------------------------------------
- def update_origin
- if bitmap
- self.ox = @effect_ox
- self.oy = @battler_height + @effect_height
- end
- end
- #-----------------------------------------------------------------------------
- # Sets the movememnt
- #-----------------------------------------------------------------------------
- def set_movement(x, y, jump, time)
- @desired_x = x
- @desired_y = y
- @jump_count = time / 2
- @jump_axis = jump
- @jump_value = 0
- @movement_count = time
- end
- #-----------------------------------------------------------------------------
- # Sets the pose
- #-----------------------------------------------------------------------------
- def set_pose(character_index, pose, style, loops, interval)
- @battler_index = character_index
- @frame = 0
- @frame_delay = interval
- @pose = pose if pose < @poses
- @frame_style = style
- @loops = loops
- @need_refresh = true
- end
- #-----------------------------------------------------------------------------
- # Sets the zoom
- #-----------------------------------------------------------------------------
- def set_zoom(x, y, time)
- @desired_zoom_x = x
- @desired_zoom_y = y
- @zoom_time = time
- end
-
- #-----------------------------------------------------------------------------
- # Sets the angle
- #-----------------------------------------------------------------------------
- def set_angle(angle, time)
- @desired_angle = angle
- @angle_time = time
- end
-
- #-----------------------------------------------------------------------------
- # Sets the opacity
- #-----------------------------------------------------------------------------
- def set_opacity(opacity, time)
- @desired_opacity = opacity
- @opacity_time = time
- end
-
- #-----------------------------------------------------------------------------
- # Checks if the sprite is on animation
- #-----------------------------------------------------------------------------
- def animation?
- return rbs_sprite_battler_animation? || moving? || (@effect_duration > 0)
- end
-
- #--------------------------------------------------------------------------
- # ? Starts new effect
- #--------------------------------------------------------------------------
- def start_effect(effect_type)
- @effect_type = effect_type
- case @effect_type
- when :appear
- @effect_duration = 16
- @battler_visible = true
- when :disappear
- @effect_duration = 32
- @battler_visible = false
- when :whiten
- @effect_duration = 16
- @battler_visible = true
- when :blink
- @effect_duration = 20
- @battler_visible = true
- when :collapse
- @effect_duration = 48
- @battler_visible = false
- when :boss_collapse
- @effect_duration = @battler_height
- @battler_visible = false
- when :instant_collapse
- @effect_duration = 16
- @battler_visible = false
- end
- revert_to_normal
- end
-
- #-----------------------------------------------------------------------------
- # Sets the sprites of the animation
- #-----------------------------------------------------------------------------
- def animation_set_sprites(frame)
- cell_data = frame.cell_data
- @ani_sprites.each_with_index do |sprite, i|
- next unless sprite
- pattern = cell_data[i, 0]
- if !pattern || pattern < 0
- sprite.visible = false
- next
- end
- sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
- sprite.visible = true
- sprite.src_rect.set(pattern % 5 * 192,
- pattern % 100 / 5 * 192, 192, 192)
- if @ani_mirror
- sprite.x = @ani_ox - cell_data[i, 1]
- sprite.y = @ani_oy + cell_data[i, 2]
- sprite.angle = BattleCamera.correct_angle(360 - cell_data[i, 4])
- sprite.mirror = BattleCamera.correct_mirror(cell_data[i, 5] == 0)
- else
- sprite.x = @ani_ox + cell_data[i, 1]
- sprite.y = @ani_oy + cell_data[i, 2]
- sprite.angle = BattleCamera.correct_angle(cell_data[i, 4])
- sprite.mirror = BattleCamera.correct_mirror(cell_data[i, 5] == 1)
- end
- sprite.z = self.z + 300 + i
- sprite.ox = 96
- sprite.oy = 96
- sprite.zoom_x = BattleCamera.correct_zoom(cell_data[i, 3] / 100.0, @current_x, @current_y, @battler.zoom_effective?)
- sprite.zoom_y = BattleCamera.correct_zoom(cell_data[i, 3] / 100.0, @current_x, @current_y, @battler.zoom_effective?)
- sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
- sprite.blend_type = cell_data[i, 7]
- end
- end
-
- #-----------------------------------------------------------------------------
- # Updates the animation
- #-----------------------------------------------------------------------------
- def update_animation
- return unless @animation
- @ani_duration -= 1
- if @ani_duration % @ani_rate == 0
- if @ani_duration > 0
- frame_index = @animation.frame_max
- frame_index -= (@ani_duration + @ani_rate - 1) / @ani_rate
- animation_set_sprites(@animation.frames[frame_index])
- @animation.timings.each do |timing|
- animation_process_timing(timing) if timing.frame == frame_index
- end
- else
- end_animation
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Updates afterimages
- #-----------------------------------------------------------------------------
- def update_afterimages
- @animation_reg.push([self.bitmap, @current_x, @current_y - @jump_value,
- self.z,
- @current_zoom_x, @current_zoom_y,
- self.src_rect.clone, self.ox, self.oy,
- @current_angle, self.mirror])
- @afterimages.each_with_index do |afterimage, i|
- j = @animation_reg.size - ((i + 1) * @afterimage_separation)
- reg = @animation_reg[j]
- next if !reg
- afterimage.update(i, @afterimages.size, reg, self)
- end
- end
-
- #-----------------------------------------------------------------------------
- # Sets the afterimages
- #-----------------------------------------------------------------------------
- def set_aftermages(value, count, separation)
- @afterimages_visible = value
- dispose_afterimages
- @afterimages.clear
- if @afterimages_visible
- count.times do |i|
- @afterimages.push(Sprite_Afterimage.new(viewport))
- end
- end
- @afterimage_separation = separation
- end
-
- #-----------------------------------------------------------------------------
- # Sets a weapon sprite by icons
- #-----------------------------------------------------------------------------
- def set_weapon_icon(x_corr, y_corr, start_angle, end_angle, time, left_hand=false, over=false)
- if left_hand
- if @battler.weapons[1]
- bitmap = get_equip_sprite_icon(@battler.weapons[1])
- else
- return
- end
- else
- if @battler.weapons[0]
- bitmap = get_equip_sprite_icon(@battler.weapons[0])
- else
- return
- end
- end
- sprite = Sprite_Weapon.new(self, bitmap, time, 1, 1, over, true)
- sprite.set_angles(start_angle, end_angle)
- sprite.setup_correction(x_corr, y_corr)
- @weapon_sprites.push(sprite)
- end
-
- def get_equip_sprite_icon(equip)
- Cache.get_icon_bitmap(equip.icon_index)
- end
-
- def set_weapon_sprite(bitmap_name, x_corr, y_corr, frames, interval, over)
- time = frames * interval + 1
- bitmap = get_weapon_bitmap_anime(bitmap_name)
- sprite = Sprite_Weapon.new(self, bitmap, time, frames, interval, over, false)
- sprite.setup_correction(x_corr, y_corr)
- @weapon_sprites.push(sprite)
- end
-
- def get_weapon_bitmap_anime(bitmap, hue=0)
- name = @battler.battler_name.sub(/\[(\d+),(\d+)\]/i) { '' }
- bitmap_name = "#{name}_#{bitmap}"
- if FileTest.exists?("Graphics/Battlers/#{bitmap_name}")
- return Cache.battler(bitmap_name, hue)
- else
- return Cache.battler(bitmap, hue)
- end
- end
-
- #--------------------------------------------------------------------------
- # ? ?????????????
- #--------------------------------------------------------------------------
- def start_balloon(balloon_id)
- dispose_balloon
- @balloon_id = balloon_id
- @balloon_duration = 8 * balloon_speed + balloon_wait
- @balloon_sprite = ::Sprite.new(viewport)
- @balloon_sprite.bitmap = Cache.system("Balloon")
- @balloon_sprite.ox = 16
- @balloon_sprite.oy = 32
- update_balloon
- end
- #--------------------------------------------------------------------------
- # ? ???????????
- #--------------------------------------------------------------------------
- def dispose_balloon
- if @balloon_sprite
- @balloon_sprite.dispose
- @balloon_sprite = nil
- end
- @balloon_id = 0
- end
- #--------------------------------------------------------------------------
- # ? ???????????
- #--------------------------------------------------------------------------
- def update_balloon
- return if @balloon_id == 0
- if @balloon_duration > 0
- @balloon_duration -= 1
- if @balloon_duration > 0
- @balloon_sprite.x = BattleCamera.correct_x(@current_x)
- @balloon_sprite.y = BattleCamera.correct_y(@current_y - @battler_height)
- @balloon_sprite.z = self.z + 200
- sx = balloon_frame_index * 32
- sy = (@balloon_id - 1) * 32
- @balloon_sprite.src_rect.set(sx, sy, 32, 32)
- else
- end_balloon
- end
- end
- end
- #--------------------------------------------------------------------------
- # ? ???????????
- #--------------------------------------------------------------------------
- def end_balloon
- dispose_balloon
- @balloon_id = 0
- end
- #--------------------------------------------------------------------------
- # ? ?????????????
- #--------------------------------------------------------------------------
- def balloon_speed
- return 8
- end
- #--------------------------------------------------------------------------
- # ? ?????????????????
- #--------------------------------------------------------------------------
- def balloon_wait
- return 12
- end
- #--------------------------------------------------------------------------
- # ? ???????????????
- #--------------------------------------------------------------------------
- def balloon_frame_index
- return 7 - [(@balloon_duration - balloon_wait) / balloon_speed, 0].max
- end
-
- end
- #===============================================================================
- # ?Sprite_Weapon
- #-------------------------------------------------------------------------------
- # The class that controls weapon animations.
- #===============================================================================
- class Sprite_Weapon < Sprite
-
- attr_reader :anime_count
-
- def initialize(sprite, bitmap, anime_count, frames=1, frame_interval=1, over=false, icon=false)
- super(sprite.viewport)
- @sprite = sprite
- @anime_count = anime_count
- @current_angle = 0
- @end_angle = 0
- @frames = frames
- @frame_interval = frame_interval
- @frame_count = 0
- @frame = 0
- @over = over
- @x_correction = @y_correction = 0
- self.bitmap = bitmap
- @bw = self.bitmap.width / @frames
- @bh = self.bitmap.height
- self.mirror = sprite.battler.enemy?
- self.ox = icon ? @bw : @bw / 2
- self.oy = @bh
- update_rect
- end
-
- def update
- super
- return if @anime_count < 1
- update_animation
- @anime_count -= 1
- end
-
- def update_animation
- update_angle
- update_frame
- update_rect
- update_coordinates
- end
-
- def update_angle
- @current_angle = (@current_angle * (@anime_count - 1) + @end_angle) / @anime_count
- self.angle = @sprite.angle + @current_angle
- end
-
- def update_frame
- @frame_count = (@frame_count + 1) % @frame_interval
- @frame = (@frame + 1) % @frames if @frame_count == 0
- end
-
- def update_rect
- self.src_rect.set(@bw * @frame, 0, @bw, @bh)
- end
-
- def animation?
- return (@anime_count > 0)
- end
-
- def update_coordinates
- self.x = BattleCamera.correct_x(@sprite.current_x + @x_correction)
- self.y = BattleCamera.correct_y(@sprite.current_y + @y_correction)
- self.z = @over ? @sprite.z + 1 : @sprite.z - 1
- self.zoom_x = @sprite.zoom_x
- self.zoom_y = @sprite.zoom_y
-
- end
-
- def set_angles(start_angle, end_angle)
- @current_angle = start_angle
- @end_angle = end_angle
- end
-
- def setup_correction(x, y)
- @x_correction = x
- @y_correction = y
- end
-
- end
- #===============================================================================
- # ?Sprite_Afterimage
- #-------------------------------------------------------------------------------
- # The class that controls afterimage processing.
- #===============================================================================
- class Sprite_Afterimage < Sprite
-
- #-----------------------------------------------------------------------------
- # Updates the afterimage
- #-----------------------------------------------------------------------------
- def update(index, size, data, sprite)
- super()
- self.bitmap = data[0]
- self.x = BattleCamera.correct_x(data[1])
- self.y = BattleCamera.correct_y(data[2])
- self.z = data[3]
- self.zoom_x = BattleCamera.correct_zoom(data[4], data[1], data[2], sprite.battler.zoom_effective?)
- self.zoom_y = BattleCamera.correct_zoom(data[5], data[1], data[2], sprite.battler.zoom_effective?)
- self.src_rect = data[6]
- self.ox = data[7]
- self.oy = data[8]
- self.angle = BattleCamera.correct_angle(data[9])
- self.mirror = data[10]
- self.opacity = 255 - (index * 255 / size)
- end
-
- end
- #===============================================================================
- # ?Sprite_TargetCursor
- #-------------------------------------------------------------------------------
- # This class controls Target selection and animation of the cursor.
- #===============================================================================
- class Sprite_TargetCursor < Sprite
-
- #--------------------------------------------------------------------------
- # ? Class Properties
- #--------------------------------------------------------------------------
- attr_accessor :screen_x
- attr_accessor :screen_y
-
- #--------------------------------------------------------------------------
- # ? Creates a new cursor.
- #--------------------------------------------------------------------------
- def initialize
- super()
- self.z = 999999
- self.bitmap = Cache.system(BattleConfig::CursorBitmap)
- @frames = BattleConfig::CursorFrames
- @delay = BattleConfig::CursorDelay
- @frame_width = self.bitmap.width / @frames
- @frame_count = 0
- @frame = 0
- @screen_x = 0
- @screen_y = 0
- self.src_rect.width = @frame_width
- self.ox = @frame_width / 2
- self.oy = self.bitmap.width / 2
- update
- end
-
- #--------------------------------------------------------------------------
- # ? Dispose
- #--------------------------------------------------------------------------
- def dispose
- super
- self.bitmap.dispose if self.bitmap
- end
-
- #--------------------------------------------------------------------------
- # ? Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- @frame_count = (@frame_count + 1) % @delay
- @frame = (@frame + 1) % @frames if @frame_count == 0
- self.src_rect.x = @frame * @frame_width
- self.x = BattleCamera.correct_x(@screen_x)
- self.y = BattleCamera.correct_y(@screen_y)
- self.zoom_x = self.zoom_y = BattleCamera.correct_zoom(1.0, @screen_x, @screen_y)
- end
-
- end
- #==============================================================================
- # ?Sprite_BattlePicture
- #==============================================================================
- class Sprite_BattlePicture < Sprite_Base
- #--------------------------------------------------------------------------
- # ? ?????????
- # picture : Game_Picture
- #--------------------------------------------------------------------------
- def initialize(viewport, picture)
- super(viewport)
- @picture = picture
- update
- end
- #--------------------------------------------------------------------------
- # ? ??
- #--------------------------------------------------------------------------
- def dispose
- bitmap.dispose if bitmap
- super
- end
- #--------------------------------------------------------------------------
- # ? ??????
- #--------------------------------------------------------------------------
- def update
- super
- update_bitmap
- update_origin
- update_position
- update_zoom
- update_other
- end
- #-----------------------------------------------------------------------------
- # Updates the bitmap
- #-----------------------------------------------------------------------------
- def update_bitmap
- if @picture.name.is_a?(Integer)
- self.bitmap = Cache.get_icon_bitmap(@picture.name)
- else
- self.bitmap = Cache.picture(@picture.name)
- end
- end
-
- #--------------------------------------------------------------------------
- # ? ?????
- #--------------------------------------------------------------------------
- def update_origin
- if @picture.origin == 0
- self.ox = 0
- self.oy = 0
- else
- self.ox = bitmap.width / 2
- self.oy = bitmap.height / 2
- end
- end
- #--------------------------------------------------------------------------
- # ? ?????
- #--------------------------------------------------------------------------
- def update_position
- self.x = BattleCamera.correct_x(@picture.x)
- self.y = BattleCamera.correct_y(@picture.y)
- self.z = @picture.number
- end
- #--------------------------------------------------------------------------
- # ? ??????
- #--------------------------------------------------------------------------
- def update_zoom
- self.zoom_x = BattleCamera.correct_zoom(@picture.zoom_x / 100.0)
- self.zoom_y = BattleCamera.correct_zoom(@picture.zoom_y / 100.0)
- end
- #--------------------------------------------------------------------------
- # ? ??????
- #--------------------------------------------------------------------------
- def update_other
- self.opacity = @picture.opacity
- self.blend_type = @picture.blend_type
- self.angle = @picture.angle
- self.tone.set(@picture.tone)
- end
-
- def start_animation_ex(animation, mirror = false)
- start_animation(animation, mirror)
- end
-
-
-
- end
- #===============================================================================
- # ?Spriteset_Battle
- #===============================================================================
- class Spriteset_Battle
-
- #--------------------------------------------------------------------------
- # ? Class variables
- #--------------------------------------------------------------------------
- @@inverted_x_cache = {}
- @@inverted_y_cache = {}
- @@inverted_both_cache = {}
-
- #--------------------------------------------------------------------------
- # ? Alias methods
- #--------------------------------------------------------------------------
- alias rbs_spriteset_battle_initialize initialize
- alias rbs_spriteset_battle_battleback1_bitmap battleback1_bitmap
- alias rbs_spriteset_battle_battleback2_bitmap battleback2_bitmap
-
- #--------------------------------------------------------------------------
- # ? Creates the spriteset
- #--------------------------------------------------------------------------
- def initialize
- rbs_spriteset_battle_initialize
- @battler_sprites = @enemy_sprites + @actor_sprites
- @icon_sprites = {}
- end
- #--------------------------------------------------------------------------
- # ? checks if animating
- #--------------------------------------------------------------------------
- def animation?
- battler_sprites.any? {|sprite| sprite.animation? || sprite.moving? || BattleCamera.moving? }
- end
-
- #--------------------------------------------------------------------------
- # ? gets the battler sprites
- #--------------------------------------------------------------------------
- def battler_sprites
- @battler_sprites
- end
-
- #--------------------------------------------------------------------------
- # ? Get the battler sprite of a target
- #--------------------------------------------------------------------------
- def battler_sprite(battler)
- @battler_sprites.each do |i|
- return i if i.battler == battler
- end
- end
-
- #--------------------------------------------------------------------------
- # ? Creates the lower battleback
- #--------------------------------------------------------------------------
- def create_battleback1
- @back1_sprite = Plane.new(@viewport1)
- @back1_sprite.bitmap = battleback1_bitmap
- @back1_sprite.z = 0
- end
- #--------------------------------------------------------------------------
- # ? Creats the upper battleback
- #--------------------------------------------------------------------------
- def create_battleback2
- @back2_sprite = Plane.new(@viewport1)
- @back2_sprite.bitmap = battleback2_bitmap
- @back2_sprite.z = 1
- end
-
- #--------------------------------------------------------------------------
- # ? Updates lower battleback
- #--------------------------------------------------------------------------
- def update_battleback1
- z = BattleConfig::Battleback_NormalZoom
- ox = @back1_sprite.bitmap.width * 3 / 4
- oy = @back1_sprite.bitmap.height * 3 / 4
- @back1_sprite.ox = -BattleCamera.correct_x(ox)
- @back1_sprite.oy = -BattleCamera.correct_y(oy)
- zoom = BattleCamera.correct_zoom(BattleConfig::Battleback_NormalZoom)
- @back1_sprite.zoom_x = @back1_sprite.zoom_y = zoom
- end
- #--------------------------------------------------------------------------
- # ? Updates upper battleback
- #--------------------------------------------------------------------------
- def update_battleback2
- z = BattleConfig::Battleback_NormalZoom
- ox = @back2_sprite.bitmap.width * 3 / 4
- oy = @back2_sprite.bitmap.height * 3 / 4
- @back2_sprite.ox = -BattleCamera.correct_x(ox)
- @back2_sprite.oy = -BattleCamera.correct_y(oy)
- zoom = BattleCamera.correct_zoom(BattleConfig::Battleback_NormalZoom)
- @back2_sprite.zoom_x = @back2_sprite.zoom_y = zoom
- end
-
- #--------------------------------------------------------------------------
- # ? Gets the bitmap of lower battleback
- #--------------------------------------------------------------------------
- def battleback1_bitmap
- if BattleConfig::UsingDefaultBattlebacks
- return create_mirrored_battleback(rbs_spriteset_battle_battleback1_bitmap)
- else
- return rbs_spriteset_battle_battleback1_bitmap
- end
- end
-
- #--------------------------------------------------------------------------
- # ? Gets the bitmap of upper battleback
- #--------------------------------------------------------------------------
- def battleback2_bitmap
- if BattleConfig::UsingDefaultBattlebacks
- return create_mirrored_battleback(rbs_spriteset_battle_battleback2_bitmap)
- else
- return rbs_spriteset_battle_battleback2_bitmap
- end
- end
-
- #--------------------------------------------------------------------------
- # ? Creates the sprite of the battleback for compatibility
- #--------------------------------------------------------------------------
- def create_mirrored_battleback(battleback)
- org_w = battleback.width
- org_h = battleback.height
- bw = battleback.width << 1
- bh = battleback.height << 1
- bmp = Bitmap.new(bw, bh)
- bmp.blt(org_w >> 1, org_h >> 1, battleback, battleback.rect)
- battleback.dispose
- return bmp
- end
- def make_return_sequence
- battler_sprites.each do |i|
- i.make_return_sequence
- end
- end
-
- #--------------------------------------------------------------------------
- # ? ????????????
- #--------------------------------------------------------------------------
- def update_pictures
- $game_troop.screen.pictures.each do |pic|
- @picture_sprites[pic.number] ||= Sprite_BattlePicture.new(@viewport2, pic)
- @picture_sprites[pic.number].update
- end
- end
-
- end
- #===============================================================================
- # END SPRITE SECTION
- #===============================================================================
- #===============================================================================
- # BEGIN GAME DATA SECTION
- #===============================================================================
- #===============================================================================
- # * RPG::BaseItem
- #===============================================================================
- module RPG
- class BaseItem
-
- #---------------------------------------------------------------------------
- # Gets attack skill id
- #---------------------------------------------------------------------------
- def get_atk_skill_id
- return self.note[/<atk skill id:(.*?)>/mi] ? eval($1) : nil
- end
-
- #---------------------------------------------------------------------------
- # Gets guard skill id
- #---------------------------------------------------------------------------
- def get_guard_skill_id
- return self.note[/<guard skill id:(.*?)>/mi] ? eval($1) : nil
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_sequence(key)
- ex = BattleConfig::Default_SequenceNotes
- reg = /<sequence:#{key}>(.*?)<\/sequence>/mi
- ex_r = ''
- if self.is_a?(RPG::Actor) || self.is_a?(RPG::Enemy)
- ex_r = (ex[reg] ? $1 : '')
- end
- return self.note[reg] ? $1 : ex_r
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_turn_start_sequence
- get_sequence('turn start')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_turn_end_sequence
- get_sequence('turn end')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_presentation_sequence
- get_sequence('presentation')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_surprised_sequence
- get_sequence('surprised')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_preemptive_sequence
- get_sequence('preemptive')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_attack_sequence
- get_sequence('attack')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_guard_sequence
- get_sequence('guard')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_counter_sequence
- get_sequence('counter')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_die_sequence
- get_sequence('die')
- end
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_dead_sequence
- get_sequence('dead')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_revive_sequence
- get_sequence('revive')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_victory_sequence
- get_sequence('victory')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_substitute_sequence
- get_sequence('substitute')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_reflect_sequence
- get_sequence('reflect')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_item_use_sequence
- get_sequence('item')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_skill_use_sequence
- get_sequence('skill')
- end
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_stand_sequence
- get_sequence('stand')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_evade_sequence
- get_sequence('evade')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_miss_sequence
- get_sequence('miss')
- end
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_return_sequence
- get_sequence('return position')
- end
-
- #---------------------------------------------------------------------------
- # Gets the sequence used when actor is processing an input
- #---------------------------------------------------------------------------
- def get_action_selection_sequence
- get_sequence('action selection')
- end
-
- #---------------------------------------------------------------------------
- # Gets the default battler index
- #---------------------------------------------------------------------------
- def get_default_battler_index
- return self.note[/<default battler index:(.*?)>/mi] ? eval($1) : nil
- end
-
- end
- end
- class RPG::Skill < RPG::UsableItem
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_attack_sequence
- get_sequence('skill') == '' ? get_sequence('attack') : get_sequence('skill')
- end
-
- end
- class RPG::Item < RPG::UsableItem
-
- #---------------------------------------------------------------------------
- # Gets a sequence
- #---------------------------------------------------------------------------
- def get_attack_sequence
- get_sequence('item') == '' ? get_sequence('attack') : get_sequence('skill')
- end
-
- end
- #===============================================================================
- # END GAME DATA SECTION
- #===============================================================================
- #===============================================================================
- # BEGIN GAME OBJECTS SECTION
- #===============================================================================
- #===============================================================================
- # ?Game_Battler
- #===============================================================================
- class Game_Battler
-
- def friend_unit
- return []
- end
-
- def enemy_unit
- return []
- end
-
- def counter_skill_id
- return attack_skill_id
- end
- def zoom_effective?
- return true
- end
-
- end
- #==============================================================================
- # ?Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
-
- #-----------------------------------------------------------------------------
- # Class atributes
- #-----------------------------------------------------------------------------
- attr_reader :atk_animation_id1
- attr_reader :atk_animation_id2
-
- #-----------------------------------------------------------------------------
- # Alias methods
- #-----------------------------------------------------------------------------
- alias rbs_game_enemy_initialize initialize
-
- #-----------------------------------------------------------------------------
- # Object Creation
- #-----------------------------------------------------------------------------
- def initialize(index, enemy_id)
- rbs_game_enemy_initialize(index, enemy_id)
- @atk_animation_id1 = enemy.note[/<atk ani1:(.*?)>/im] ? eval($1) : BattleConfig::DefaultEnemey_Ani1ID
- @atk_animation_id2 = enemy.note[/<atk ani2:(.*?)>/im] ? eval($1) : BattleConfig::DefaultEnemey_Ani2ID
- @counter_skill_id = enemy.note[/<counter skill id:(.*?)>/im] ? eval($1) : attack_skill_id
- @weapon_1_id = enemy.note[/<weapon 1 id:(.*?)>/im] ? eval($1) : 0
- @weapon_2_id = enemy.note[/<weapon 2 id:(.*?)>/im] ? eval($1) : 0
- end
-
- #--------------------------------------------------------------------------
- # ? Get the attack skll id
- #--------------------------------------------------------------------------
- def attack_skill_id
- id = enemy.get_atk_skill_id
- return id ? id : super
- end
- #--------------------------------------------------------------------------
- # ? Get the guard skill id
- #--------------------------------------------------------------------------
- def guard_skill_id
- id = enemy.get_guard_skill_id
- return id ? id : super
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_turn_start_sequence
- return enemy.presentation_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_turn_end_sequence
- return enemy.presentation_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_presentation_sequence
- return enemy.get_presentation_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_surprised_sequence
- return enemy.get_surprised_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_preemptive_sequence
- return enemy.get_preemptive_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_attack_sequence
- return enemy.get_attack_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_guard_sequence
- return enemy.get_guard_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_counter_sequence
- return enemy.get_counter_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_die_sequence
- return enemy.get_die_sequence
- end
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_dead_sequence
- return enemy.get_dead_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_revive_sequence
- return enemy.get_revive_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_victory_sequence
- return enemy.get_victory_sequence
- end
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_substitute_sequence
- return enemy.get_substitute_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_reflect_sequence
- return enemy.get_substitute_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_item_use_sequence
- return enemy.get_item_use_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_skill_use_sequence
- return enemy.get_skill_use_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_stand_sequence
- seq = ''
- states.each do |i|
- next if !i
- seq += i.get_stand_sequence
- end
- return seq == '' ? enemy.get_stand_sequence : seq
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_evade_sequence
- return enemy.get_evade_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_miss_sequence
- return enemy.get_miss_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_return_sequence
- return enemy.get_return_sequence
- end
-
- #-----------------------------------------------------------------------------
- # Gets friend unit
- #-----------------------------------------------------------------------------
- def friend_unit
- return $game_troop
- end
-
- #-----------------------------------------------------------------------------
- # Gets enemy unit
- #-----------------------------------------------------------------------------
- def enemy_unit
- return $game_party
- end
-
- #-----------------------------------------------------------------------------
- # Gets default battler index
- #-----------------------------------------------------------------------------
- def default_battler_index
- a = enemy.get_default_battler_index
- return a ? a : BattleConfig::DefaultEnemyIndex
- end
-
- #-----------------------------------------------------------------------------
- # Gets the real presentation action according to situation
- #-----------------------------------------------------------------------------
- def get_real_presentation_action
- return get_dead_sequence if dead?
- BattleManager.surprise? ? get_preemptive_sequence : (BattleManager.preemptive? ? get_surprised_sequence : get_presentation_sequence )
- end
-
- #-----------------------------------------------------------------------------
- # Gets the counter skill id
- #-----------------------------------------------------------------------------
- def counter_skill_id
- return @counter_skill_id
- end
-
- #-----------------------------------------------------------------------------
- # has dia sequence?
- #-----------------------------------------------------------------------------
- def die_sequence?
- return enemy.note[/<die sequence on>/mi] ? true : false
- end
-
- #-----------------------------------------------------------------------------
- # Get weapons
- #-----------------------------------------------------------------------------
- def weapons
- result = []
- result.push($data_weapons[@weapon_1_id]) if @weapon_1_id > 0
- result.push($data_weapons[@weapon_2_id]) if @weapon_2_id > 0
- return result
- end
-
- end
- #==============================================================================
- # ?Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
-
- #-----------------------------------------------------------------------------
- # Class atributes
- #-----------------------------------------------------------------------------
- attr_accessor :battler_name
- attr_accessor :battler_hue
- attr_accessor :counter_skill_id
-
- #-----------------------------------------------------------------------------
- # Alias methods
- #-----------------------------------------------------------------------------
- alias rbs_game_actor_setup setup
- alias rbs_game_actor_make_actions make_actions
-
- #--------------------------------------------------------------------------
- # ? Setups an actor by ID
- #--------------------------------------------------------------------------
- def setup(actor_id)
- rbs_game_actor_setup(actor_id)
- @battler_name = actor.note[/<battler name:(.*?)>/im] ? $1 : @character_name
- @battler_hue = actor.note[/<battler hue:(.*?)>/im] ? $1.to_i : 0
- @custom_screen_x = actor.note[/<screen x:(.*?)>/im] ? $1.to_i : nil
- @custom_screen_y = actor.note[/<screen y:(.*?)>/im] ? $1.to_i : nil
- id1 = actor.note[/<atk ani1:(.*?)>/im] ? Kernel.eval($1) : ($data_classes[@class_id].note[/<atk ani1:(.*?)>/im] ? Kernel.eval($1) : BattleConfig::DefaultEnemey_Ani1ID)
- id2 = actor.note[/<atk ani2:(.*?)>/im] ? Kernel.eval($1) : ($data_classes[@class_id].note[/<atk ani2:(.*?)>/im] ? Kernel.eval($1) : BattleConfig::DefaultEnemey_Ani2ID)
- @default_atk_animation_id1 = id1
- @default_atk_animation_id2 = id2
- c_s_id = $data_classes[@class_id].note[/<counter skill id:(.*?)>/im] ? Kernel.eval($1) : attack_skill_id
- @counter_skill_id = actor.note[/<counter skill id:(.*?)>/im] ? Kernel.eval($1) : c_s_id
- end
-
- #--------------------------------------------------------------------------
- # ? Use sprite?
- #--------------------------------------------------------------------------
- def use_sprite?
- return true
- end
-
- #--------------------------------------------------------------------------
- # ? Get battle screen x position
- #--------------------------------------------------------------------------
- def screen_x
- return @custom_screen_x ? @custom_screen_x : BattleConfig::ActorPos[self.index][0]
- end
-
- #--------------------------------------------------------------------------
- # ? Get battle screen y position
- #--------------------------------------------------------------------------
- def screen_y
- return @custom_screen_y ? @custom_screen_y : BattleConfig::ActorPos[self.index][1]
- end
-
- #--------------------------------------------------------------------------
- # ? Get battle screen z position
- #--------------------------------------------------------------------------
- def screen_z
- return 100
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_turn_start_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_turn_start_sequence
- end
- return seq != '' ? seq : actor.get_turn_start_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_turn_end_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_turn_end_sequence
- end
- return seq != '' ? seq : actor.get_turn_end_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_presentation_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_presentation_sequence
- end
- return seq != '' ? seq : actor.get_presentation_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_surprised_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_surprised_sequence
- end
- return seq != '' ? seq : actor.get_surprised_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_preemptive_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_preemptive_sequence
- end
- return seq != '' ? seq : actor.get_preemptive_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_attack_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_attack_sequence
- end
- return seq != '' ? seq : actor.get_attack_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_guard_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_guard_sequence
- end
- return seq != '' ? seq : actor.get_guard_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_counter_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_counter_sequence
- end
- return seq != '' ? seq : actor.get_counter_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_die_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_die_sequence
- end
- return seq != '' ? seq : actor.get_die_sequence
- end
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_dead_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_dead_sequence
- end
- return seq != '' ? seq : actor.get_dead_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_revive_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_revive_sequence
- end
- return seq != '' ? seq : actor.get_revive_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_victory_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_victory_sequence
- end
- return seq != '' ? seq : actor.get_victory_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_substitute_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_substitute_sequence
- end
- return seq != '' ? seq : actor.get_substitute_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_reflect_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_reflect_sequence
- end
- return seq != '' ? seq : actor.get_reflect_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_item_use_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_item_use_sequence
- end
- return seq != '' ? seq : actor.get_item_use_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_skill_use_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_skill_use_sequence
- end
- return seq != '' ? seq : actor.get_skill_use_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_stand_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_stand_sequence if seq == ''
- end
- states.each do |i|
- next if !i
- seq += i.get_stand_sequence if seq == ''
- end
- return seq != '' ? seq : actor.get_stand_sequence
- end
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_evade_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_evade_sequence
- end
- return seq != '' ? seq : actor.get_evade_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_miss_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_miss_sequence if seq == ''
- end
- return seq != '' ? seq : actor.get_miss_sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Get sequence
- #--------------------------------------------------------------------------
- def get_return_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_return_sequence if seq == ''
- end
- states.each do |i|
- next if !i
- seq += i.get_return_sequence if seq == ''
- end
- return seq != '' ? seq : actor.get_return_sequence
- end
-
- #---------------------------------------------------------------------------
- # Gets the sequence used when actor is processing an input
- #---------------------------------------------------------------------------
- def get_action_selection_sequence
- seq = ''
- equips.each do |i|
- next if !i
- seq += i.get_action_selection_sequence if seq == ''
- end
- states.each do |i|
- next if !i
- seq += i.get_action_selection_sequence if seq == ''
- end
- return seq != '' ? seq : actor.get_action_selection_sequence
- end
-
- #-----------------------------------------------------------------------------
- # Gets the real presentation action according to situation
- #-----------------------------------------------------------------------------
- def get_real_presentation_action
- return get_dead_sequence if dead?
- BattleManager.surprise? ? get_surprised_sequence : (BattleManager.preemptive? ? get_preemptive_sequence : get_presentation_sequence )
- end
-
- #-----------------------------------------------------------------------------
- # Performs collapse effect
- #-----------------------------------------------------------------------------
- def perform_collapse_effect
- 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
-
- #-----------------------------------------------------------------------------
- # Has die sequence
- #-----------------------------------------------------------------------------
- def die_sequence?
- return actor.note[/<die sequence on>/mi] ? true : false
- end
-
- #--------------------------------------------------------------------------
- # ? Get the attack skill id
- #--------------------------------------------------------------------------
- def attack_skill_id
- id = actor.get_atk_skill_id
- wpns = weapons.compact
- if wpns.size > 0
- w = wpns[rand(wpns.size)]
- id2 = w.get_atk_skill_id
- id = id2 if id2
- end
- return id ? id : super
- end
- #--------------------------------------------------------------------------
- # ? Get the guard skill id
- #--------------------------------------------------------------------------
- def guard_skill_id
- id = actor.get_guard_skill_id
- armrs = armors.compact
- if armrs.size > 0
- a = armrs[rand(armrs.size)]
- id2 = a.get_guard_skill_id
- id = id2 if id2
- end
- return id ? id : super
- end
-
- #-----------------------------------------------------------------------------
- # Get friend unit
- #-----------------------------------------------------------------------------
- def friend_unit
- return $game_party
- end
-
- #-----------------------------------------------------------------------------
- # Get enemy unit
- #-----------------------------------------------------------------------------
- def enemy_unit
- return $game_troop
- end
-
- #-----------------------------------------------------------------------------
- # Get default battler index
- #-----------------------------------------------------------------------------
- def default_battler_index
- a = actor.get_default_battler_index
- return a ? a : BattleConfig::DefaultActorIndex
- end
- #-----------------------------------------------------------------------------
- # Get attack animation 1
- #-----------------------------------------------------------------------------
- def atk_animation_id1
- if dual_wield?
- return weapons[0].animation_id if weapons[0]
- return weapons[1] ? 0 : @default_atk_animation_id1
- else
- return weapons[0] ? weapons[0].animation_id : 1
- end
- end
- #-----------------------------------------------------------------------------
- # Get attack animation 2
- #-----------------------------------------------------------------------------
- def atk_animation_id2
- if dual_wield?
- return weapons[1] ? weapons[1].animation_id : @default_atk_animation_id2
- else
- return 0
- end
- end
-
- #-----------------------------------------------------------------------------
- # Get counter attack skill id
- #-----------------------------------------------------------------------------
- def counter_skill_id
- id = @counter_skill_id
- equips.each do |i|
- next if !i
- id = i.note[/<counter skill id:(.*?)>/im] ? Kernel.eval($1) : id
- end
- return id
- end
-
- end
- #==============================================================================
- # ?Game_Picture
- #------------------------------------------------------------------------------
- # ??????????????????? Game_Pictures ??????????
- # ??????????????????????????
- #==============================================================================
- class Game_Picture
-
- #-----------------------------------------------------------------------------
- # Class atributes
- #-----------------------------------------------------------------------------
- attr_accessor :animation_id
- attr_accessor :animation_flip
-
- #-----------------------------------------------------------------------------
- # Alias methods
- #-----------------------------------------------------------------------------
- alias rbs_game_picture_init_basic init_basic
-
- #-----------------------------------------------------------------------------
- # Start basic information
- #-----------------------------------------------------------------------------
- def init_basic
- @animation_id = 0
- @animation_flip = false
- rbs_game_picture_init_basic
- end
-
- #-----------------------------------------------------------------------------
- # Move ex
- #-----------------------------------------------------------------------------
- def move_ex(x, y, duration)
- @target_x = x.to_f
- @target_y = y.to_f
- @duration = duration
- end
-
- #-----------------------------------------------------------------------------
- # Set zoom
- #-----------------------------------------------------------------------------
- def set_zoom(zoom_x, zoom_y, duration)
- @target_zoom_x = zoom_x.to_f
- @target_zoom_y = zoom_y.to_f
- @duration = duration
- end
-
- #-----------------------------------------------------------------------------
- # Set opacity
- #-----------------------------------------------------------------------------
- def set_opacity(opacity, duration)
- @target_opacity = opacity.to_f
- @duration = duration
- end
-
- #-----------------------------------------------------------------------------
- # Set animation
- #-----------------------------------------------------------------------------
- def set_animation(animation_id, flip=false)
- @animation_id = animation_id
- @animation_flip = flip
- end
-
- end
- #===============================================================================
- # END GAME OBJECTS SECTION
- #===============================================================================
- #===============================================================================
- # BEGIN WINDOW SECTION
- #===============================================================================
- if !$imported["YEA-BattleEngine"] # If you use YEA please configure it from YEA.
- #==============================================================================
- # ?Window_BattleLog
- #==============================================================================
- class Window_BattleLog < Window_Selectable
- #--------------------------------------------------------------------------
- # ? Display the use item
- #--------------------------------------------------------------------------
- def display_use_item(subject, item)
- if item.is_a?(RPG::Skill)
- if BattleConfig::Log_DisplaySkillName
- add_text("\\I[#{item.icon_index}]#{item.name}")
- end
- if BattleConfig::Log_DisplaySkillMsg1
- add_text(subject.name + item.message1)
- end
- if BattleConfig::Log_DisplaySkillMsg2 && !item.message2.empty?
- wait
- add_text(item.message2)
- end
- elsif
- if BattleConfig::Log_DisplayItemName
- add_text("\\I[#{item.icon_index}]#{item.name}")
- end
- if BattleConfig::Log_DisplayItemUsage
- add_text(sprintf(Vocab::UseItem, subject.name, item.name))
- end
- end
- end
-
- #--------------------------------------------------------------------------
- # ? Display action results
- #--------------------------------------------------------------------------
- def display_action_results(target, item)
- if target.result.used
- last_line_number = line_number
- display_critical(target, item) if BattleConfig::Log_DisplayCritical
- display_damage(target, item)
- display_affected_status(target, item)
- display_failure(target, item) if BattleConfig::Log_DisplayFailure
- wait if line_number > last_line_number
- back_to(last_line_number)
- end
- end
-
- #--------------------------------------------------------------------------
- # ? Display damage
- #--------------------------------------------------------------------------
- def display_damage(target, item)
- if target.result.missed
- display_miss(target, item) if BattleConfig::Log_DisplayMiss
- elsif target.result.evaded
- display_evasion(target, item) if BattleConfig::Log_DisplayEvasion
- else
- display_hp_damage(target, item) if BattleConfig::Log_DisplayHpDamage
- display_mp_damage(target, item) if BattleConfig::Log_DisplayMpDamage
- display_tp_damage(target, item) if BattleConfig::Log_DisplayTpDamage
- end
- end
-
- #--------------------------------------------------------------------------
- # ? Display changed states
- #--------------------------------------------------------------------------
- def display_changed_states(target)
- display_added_states(target) if BattleConfig::Log_DisplayAddedStates
- display_removed_states(target) if BattleConfig::Log_DisplayRemovedStates
- end
-
- #--------------------------------------------------------------------------
- # ? Display added states
- #--------------------------------------------------------------------------
- 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
-
- #--------------------------------------------------------------------------
- # ? Display changed buffs
- #--------------------------------------------------------------------------
- def display_changed_buffs(target)
- display_buffs(target, target.result.added_buffs, Vocab::BuffAdd) if BattleConfig::Log_DisplayBuffs
- display_buffs(target, target.result.added_debuffs, Vocab::DebuffAdd) if BattleConfig::Log_DisplayDebuffs
- display_buffs(target, target.result.removed_buffs, Vocab::BuffRemove) if BattleConfig::Log_DisplayRemovedBuffs
- end
-
- end
- end # if $imported["YEA-BattleEngine"]
- #==============================================================================
- # ?Window_BattleItem
- #==============================================================================
- class Window_BattleItem < Window_ItemList
-
- #--------------------------------------------------------------------------
- # ? Object creation
- #--------------------------------------------------------------------------
- def initialize(help_window, info_viewport)
- y = Graphics.height - window_height
- super(0, y, window_width, window_height)
- self.visible = false
- @help_window = help_window
- @info_viewport = info_viewport
- end
-
- #--------------------------------------------------------------------------
- # ? Get window width
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width
- end
-
- #--------------------------------------------------------------------------
- # ? Get window height
- #--------------------------------------------------------------------------
- def window_height
- fitting_height(visible_line_number)
- end
- #--------------------------------------------------------------------------
- # ? Get visible line muber
- #--------------------------------------------------------------------------
- def visible_line_number
- return 4
- end
-
-
- end
- #==============================================================================
- # ?Window_BattleSkill
- #------------------------------------------------------------------------------
- # ???????????????????????????
- #==============================================================================
- class Window_BattleSkill < Window_SkillList
-
- #--------------------------------------------------------------------------
- # ? Object Creation
- #--------------------------------------------------------------------------
- def initialize(help_window, info_viewport)
- y = Graphics.height - window_height
- super(0, y, window_width, window_height)
- self.visible = false
- @help_window = help_window
- @info_viewport = info_viewport
- end
- #--------------------------------------------------------------------------
- # ? Gets window width
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width
- end
- #--------------------------------------------------------------------------
- # ? Gets window height
- #--------------------------------------------------------------------------
- def window_height
- fitting_height(visible_line_number)
- end
-
- #--------------------------------------------------------------------------
- # ? Get visible line muber
- #--------------------------------------------------------------------------
- def visible_line_number
- return 4
- end
- end
- #===============================================================================
- # END WINDOW SECTION
- #===============================================================================
- #===============================================================================
- # BEGIN SCENE SECTION
- #===============================================================================
- #==============================================================================
- # ?Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ? Alias methods
- #--------------------------------------------------------------------------
- alias rbs_scene_battle_start start
- alias rbs_scene_battle_post_start post_start
- alias rbs_scene_battle_battle_start battle_start
- alias rbs_scene_battle_use_item use_item
- alias rbs_scene_battle_update_basic update_basic
- alias rbs_scene_battle_start_actor_command_selection start_actor_command_selection
- alias rbs_scene_battle_next_command next_command
- alias rbs_scene_battle_prior_command prior_command
-
- #--------------------------------------------------------------------------
- # ? Start scene
- #--------------------------------------------------------------------------
- def start
- BattleCamera.start
- rbs_scene_battle_start
- BattleInterpreter.start(@spriteset)
- setup_battle_commands
- end
-
- #--------------------------------------------------------------------------
- # ? Post star scene
- #--------------------------------------------------------------------------
- def post_start
- rbs_scene_battle_post_start
- show_presentation_animation
- end
-
- #--------------------------------------------------------------------------
- # ? Start battle
- #--------------------------------------------------------------------------
- def battle_start
- rbs_scene_battle_battle_start
- end
-
- #--------------------------------------------------------------------------
- # ? Get next command
- #--------------------------------------------------------------------------
- def next_command
- if BattleManager.actor
- actor = BattleManager.actor
- BattleInterpreter.add_looping_action(actor, actor.get_stand_sequence)
- BattleInterpreter.add_action(actor, [actor], actor.get_turn_end_sequence, $data_skills[1])
- wait_for_battle_interpreter
- end
- rbs_scene_battle_next_command
- end
-
- #--------------------------------------------------------------------------
- # ? Get Prior command
- #--------------------------------------------------------------------------
- def prior_command
- if BattleManager.actor
- actor = BattleManager.actor
- BattleInterpreter.add_looping_action(actor, actor.get_stand_sequence)
- BattleInterpreter.add_action(actor, [actor], actor.get_turn_end_sequence, $data_skills[1])
- wait_for_battle_interpreter
- end
- rbs_scene_battle_prior_command
- end
-
- #--------------------------------------------------------------------------
- # ? Show presentation animation
- #--------------------------------------------------------------------------
- def show_presentation_animation
- @spriteset.update
- act = @party_command_window.active
- @party_command_window.deactivate
- @party_command_window.hide
- for member in $game_party.members+$game_troop.members
- sequence = member.get_real_presentation_action
- BattleInterpreter.add_action(member, [member], sequence, $data_skills[1])
- end
- wait_for_battle_interpreter
- wait(20)
- @spriteset.make_return_sequence
- wait_for_battle_interpreter
- if $imported["YEA-BattleEngine"]
- @party_command_window.show
- @party_command_window.active = act
- else
- @party_command_window.activate
- @party_command_window.show
- end
- end
-
- #--------------------------------------------------------------------------
- # ? Start actor command selection
- #--------------------------------------------------------------------------
- def start_actor_command_selection
- if BattleManager.actor
- actor = BattleManager.actor
- BattleInterpreter.add_looping_action(actor, actor.get_action_selection_sequence)
- BattleInterpreter.add_action(actor, [actor], actor.get_turn_start_sequence, $data_skills[1])
- wait_for_battle_interpreter
- end
- rbs_scene_battle_start_actor_command_selection
- end
- #--------------------------------------------------------------------------
- # ? 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
- #--------------------------------------------------------------------------
- # ? Use item
- #--------------------------------------------------------------------------
- def use_item
- setup_dead_battlers
- item = @subject.current_action.item
- sequence = get_sequence(@subject, item)
- @log_window.display_use_item(@subject, item)
- @subject.use_item(item)
- if $imported["YEA-LunaticObjects"]
- lunatic_object_effect(:before, item, @subject, @subject)
- end
- if sequence == ''
- refresh_status
- targets = @subject.current_action.make_targets.compact
- show_animation(targets, item.animation_id)
- targets.each {|target| item.repeats.times { invoke_item(target, item) } }
- else
- targets = @subject.current_action.make_targets.compact
- if $imported["YEA-TargetManager"]
- targets = [alive_random_target(target, item)] if item.for_random?
- end
- process_casting_animation if $imported["YEA-CastAnimations"]
- BattleInterpreter.add_action(@subject, targets, sequence, item)
- wait_for_battle_interpreter
- end
- if $imported["YEA-LunaticObjects"]
- lunatic_object_effect(:after, item, @subject, @subject)
- end
- finish_item_use
- end
-
- def setup_dead_battlers
- @dead_battlers = []
- for battler in $game_troop.dead_members+$game_party.dead_members
- @dead_battlers.push(battler) if battler.dead?
- end
- end
-
- def finish_item_use
- @spriteset.make_return_sequence
- wait_for_battle_interpreter
- for battler in $game_troop.members+$game_party.members
- if battler.dead? && !@dead_battlers.include?(battler)
- @dead_battlers.delete(battler)
- if battler.die_sequence?
- sequence = battler.get_die_sequence
- BattleInterpreter.add_action(battler, [battler], sequence, nil, false)
- else
- battler.perform_collapse_effect
- end
- elsif battler.alive? && @dead_battlers.include?(battler)
- sequence = battler.get_revive_sequence
- BattleInterpreter.add_action(battler, [battler], sequence, nil, false)
- end
- end
- wait_for_battle_interpreter
- end
-
- #--------------------------------------------------------------------------
- # ? Gets the sequence for an item
- #--------------------------------------------------------------------------
- def get_sequence(subject, item)
- sequence = item.get_attack_sequence
- if item.is_a?(RPG::Skill) and item.id == subject.attack_skill_id
- seq = subject.get_attack_sequence
- if seq != ''
- sequence = seq
- end
- elsif item.is_a?(RPG::Skill) and item.id == subject.guard_skill_id
- seq = subject.get_guard_sequence
- if seq != ''
- sequence = seq
- end
- end
- if sequence == ''
- if item.is_a?(RPG::Skill)
- seq = subject.get_skill_use_sequence
- if seq != ''
- sequence = seq
- end
- elsif item.is_a?(RPG::Item)
- seq = subject.get_item_use_sequence
- if seq != ''
- sequence = seq
- end
- end
- end
- return sequence
- end
-
- #--------------------------------------------------------------------------
- # ? Wait for battle interpreter
- #--------------------------------------------------------------------------
- def wait_for_battle_interpreter
- update_for_wait while BattleInterpreter.running?
- wait_for_animation
- end
-
- #--------------------------------------------------------------------------
- # ? Basic update
- #--------------------------------------------------------------------------
- def update_basic
- rbs_scene_battle_update_basic
- BattleCamera.update
- BattleInterpreter.update
- end
-
- #--------------------------------------------------------------------------
- # ? Show animation ex
- #--------------------------------------------------------------------------
- def show_animation_ex(targets, animation_id, mirror = false)
- return if !targets || targets.empty?
- animation = $data_animations[animation_id]
- if animation
- if animation.to_screen?
- target = targets[0]
- target.start_animation(animation, mirror)
- else
- targets.each do |target|
- target.start_animation(animation, mirror)
- end
- end
- end
- end
-
- #--------------------------------------------------------------------------
- # ? Apply item efects
- #--------------------------------------------------------------------------
- def apply_item_effects_ex(user, target, item)
- if $imported["YEA-LunaticObjects"]
- lunatic_object_effect(:prepare, item, @subject, target)
- end
- target.item_apply(user, item)
- if $imported["YEA-LunaticObjects"]
- lunatic_object_effect(:during, item, @subject, target)
- end
- refresh_status
- @log_window.display_action_results(target, item)
- end
-
- #--------------------------------------------------------------------------
- # ? Invoke counter attack
- #--------------------------------------------------------------------------
- def invoke_counter_attack_ex(user, target, item)
- if BattleConfig::Log_DisplayCounterattack
- @log_window.display_counter(target, item)
- end
- attack_skill = $data_skills[target.counter_skill_id]
- sequence = attack_skill.get_counter_sequence
- sequence = target.get_counter_sequence if sequence == ''
- BattleInterpreter.add_action(target, [user], sequence, attack_skill, false)
- @log_window.display_action_results(target, attack_skill)
- end
-
- #--------------------------------------------------------------------------
- # ? Invoke magic reflection
- #--------------------------------------------------------------------------
- def invoke_magic_reflection_ex(action, target)
- item = action.item
- user = action.user
- if BattleConfig::Log_DisplayReflection
- @log_window.display_reflection(target, item)
- end
- action.targets.delete(target)
- action.targets.push(user)
- sequence = target.get_reflect_sequence
- BattleInterpreter.add_action(target, [user], sequence, item, false)
- end
-
- #--------------------------------------------------------------------------
- # ? Apply substitute
- #--------------------------------------------------------------------------
- def apply_substitute_ex(action, target, item)
- if check_substitute(target, item)
- substitute = target.friends_unit.substitute_battler
- if substitute && target != substitute && [email protected]?(substitute)
- if BattleConfig::Log_DisplaySubstitute
- @log_window.display_substitute(substitute, target)
- end
- sequence = substitute.get_substitute_sequence
- action.targets.delete(target)
- action.targets.push(substitute)
- @substitutes.push(substitute)
- BattleInterpreter.add_action(substitute, [target], sequence, item)
- end
- end
- end
-
- if !$imported["YEA-BattleEngine"] # If YEA is imported, please consider using
- # the YEA target selection
- #--------------------------------------------------------------------------
- # ? Selects an enemy
- #--------------------------------------------------------------------------
- def select_enemy_selection
- @actor_input = false
- @skill_window.hide
- @item_window.hide
- @target_index = 0
- @target_sprites = get_sprites($game_troop.members).compact
- @target_size = $game_troop.members.size
- @cursor_sprite = Sprite_TargetCursor.new
- while !@actor_input && $game_troop.members[@target_index].dead?
- @target_index = (@target_index + 1) % @target_size
- end
- loop do
- update_for_wait
- if Input.trigger?(:C)
- Sound.play_ok
- @cursor_sprite.dispose
- on_enemy_ok
- return
- elsif Input.trigger?(:B)
- Sound.play_cancel
- @cursor_sprite.dispose
- on_enemy_cancel
- return
- end
- update_target_selection
- end
- end
-
- #--------------------------------------------------------------------------
- # ? Selects an actor
- #--------------------------------------------------------------------------
- def select_actor_selection
- @actor_input = true
- @skill_window.hide
- @item_window.hide
- @target_index = 0
- @target_sprites = get_sprites($game_party.members).compact
- @target_size = $game_party.members.size
- @cursor_sprite = Sprite_TargetCursor.new
- loop do
- update_for_wait
- if Input.trigger?(:C)
- Sound.play_ok
- @cursor_sprite.dispose
- on_actor_ok
- break
- elsif Input.trigger?(:B)
- Sound.play_cancel
- @cursor_sprite.dispose
- on_actor_cancel
- break
- end
- update_target_selection
- end
-
- end
-
- #--------------------------------------------------------------------------
- # ? Update target selction
- #--------------------------------------------------------------------------
- def update_target_selection
- if Input.repeat?(:UP) || Input.repeat?(:RIGHT)
- Sound.play_cursor
- @target_index = (@target_index + 1) % @target_size
- while !@actor_input && $game_troop.members[@target_index].dead?
- @target_index = (@target_index + 1) % @target_size
- end
- elsif Input.repeat?(:DOWN) || Input.repeat?(:LEFT)
- Sound.play_cursor
- @target_index = (@target_index - 1) % @target_size
- while !@actor_input && $game_troop.members[@target_index].dead?
- @target_index = (@target_index - 1) % @target_size
- end
- end
- sprite = @target_sprites[@target_index]
- @cursor_sprite.screen_x = sprite.current_x
- @cursor_sprite.screen_y = sprite.current_y
- @cursor_sprite.update
- end
-
- #--------------------------------------------------------------------------
- # ? On actor ok
- #--------------------------------------------------------------------------
- def on_actor_ok
- BattleManager.actor.input.target_index = @target_index
- @actor_window.hide
- @skill_window.hide
- @item_window.hide
- next_command
- end
-
- #--------------------------------------------------------------------------
- # ? On enemy ok
- #--------------------------------------------------------------------------
- def on_enemy_ok
- BattleManager.actor.input.target_index = @target_index
- @enemy_window.hide
- @skill_window.hide
- @item_window.hide
- next_command
- end
-
- #--------------------------------------------------------------------------
- # ? On actor cancel
- #--------------------------------------------------------------------------
- def on_actor_cancel
- @actor_window.hide
- case @actor_command_window.current_symbol
- when :skill
- @skill_window.show
- @skill_window.activate
- when :item
- @item_window.show
- @item_window.activate
- end
- end
-
- #--------------------------------------------------------------------------
- # ? On enemy cancel
- #--------------------------------------------------------------------------
- def on_enemy_cancel
- @enemy_window.hide
- case @actor_command_window.current_symbol
- when :attack
- @actor_command_window.activate
- when :skill
- @skill_window.show
- @skill_window.activate
- when :item
- @item_window.show
- @item_window.activate
- end
- end
-
- end # if !$imported["YEA-BattleEngine"]
-
- #--------------------------------------------------------------------------
- # ? Get battler sprites
- #--------------------------------------------------------------------------
- def get_sprites(battlers)
- result = []
- battlers.each do |battler|
- result.push(@spriteset.battler_sprite(battler))
- end
- return result
- end
-
- end
- #===============================================================================
- # END SCENE SECTION
- #===============================================================================
- #===============================================================================
- # START YEA COMPATIBILITY
- #===============================================================================
- if $imported["YEA-BattleEngine"]
-
- #==============================================================================
- # ?Sprite_Popup
- #==============================================================================
- class Scene_Battle < Scene_Base
- attr_accessor :spriteset
- end
- class Sprite_Popup < Sprite_Base
-
- attr_accessor :current_x
- attr_accessor :current_y
-
- alias rbs_yea_sprite_popup_create_popup_bitmap create_popup_bitmap
-
- #--------------------------------------------------------------------------
- # create_popup_bitmap
- #--------------------------------------------------------------------------
- def create_popup_bitmap
- rbs_yea_sprite_popup_create_popup_bitmap
- @current_x = @battler.sprite.current_x
- @current_y = @battler.sprite.current_y
- @current_x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
- @current_x -= SceneManager.scene.spriteset.viewport1.ox
- @current_y = @battler.sprite.current_y - @battler.sprite.oy/2
- @current_y -= @battler.sprite.oy/2 if @battler.actor?
- @current_y -= SceneManager.scene.spriteset.viewport1.oy
- update
- end
-
- #--------------------------------------------------------------------------
- # update
- #--------------------------------------------------------------------------
- def update
- super
- @current_zoom_x = 0 if !@current_zoom_x
- @current_zoom_y = 0 if !@current_zoom_y
- @current_x = self.x if !@current_x
- @current_y = self.y if !@current_y
- #---
- 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"
- @current_zoom_x = [@current_zoom_x + 0.075, @target_zoom].min
- @current_zoom_y = [@current_zoom_y + 0.075, @target_zoom].min
- else
- @current_zoom_x = [@current_zoom_x - 0.075, @target_zoom].max
- @current_zoom_y = [@current_zoom_y - 0.075, @target_zoom].max
- end
- self.zoom_x = BattleCamera.correct_zoom(@current_zoom_x)
- self.zoom_y = BattleCamera.correct_zoom(@current_zoom_y)
-
- self.x = BattleCamera.correct_x(@current_x)
- self.y = BattleCamera.correct_y(@current_y)
-
- #---
- @full -= 1
- return if @full > 0
- @current_y -= 1
- self.opacity -= @fade
- self.y = BattleCamera.correct_y(@current_y)
- end
-
- end
-
- class Sprite_Battler < Sprite_Base
- alias rbs_yea_create_new_popup create_new_popup
-
- #--------------------------------------------------------------------------
- # new method: create_new_popup
- #--------------------------------------------------------------------------
- def create_new_popup(value, rules, flags)
- return if @battler == nil
- return if flags & @popup_flags != []
- for popup in @popups
- popup.current_y -= 24
- end
- rbs_yea_create_new_popup(value, rules, flags)
- end
-
- end
- end
- #===============================================================================
- # END YEA COMPATIBILITY
- #===============================================================================
- #===============================================================================
- # END OF FILE!!!
- #===============================================================================
- #===============================================================================
- # ** RBS - Ramiro's Battle System (PART II - Classes And Modules)
- # Version 2.0
- # Difficulty Very Hard.
- #-------------------------------------------------------------------------------
- # If you don't know what to do... DO NOT EDIT THIS FILE.
- #-------------------------------------------------------------------------------
- # License:
- #Copyright (c) 2012, Ramiro Rojo
- #All rights reserved.
- #
- #Redistribution and use in source and binary forms, with or without
- #modification, are permitted provided that the following conditions are met:
- #
- #1. Redistributions of source code must retain the above copyright notice, this
- # list of conditions and the following disclaimer.
- #2. Redistributions in binary form must reproduce the above copyright notice,
- # this list of conditions and the following disclaimer in the documentation
- # and/or other materials provided with the distribution.
- #
- #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- #DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- #ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- #ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #
- #The views and conclusions contained in the software and documentation are those
- #of the authors and should not be interpreted as representing official policies,
- #either expressed or implied, of the FreeBSD Project.
- #===============================================================================
- #==============================================================================
- # ?Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
-
- def setup_battle_commands
-
- # ADDING A COMMAND:
- # BattleInterpreter::Commands['command in upercase'] = [needs close, linked method]
-
- # <pose: target, character_index, pose_id, style, loops, interval> (WORKS!)
- BattleInterpreter::Commands['POSE'] = [false, method(:on_pose_command)]
- # <wait: time> (WORKS!)
- BattleInterpreter::Commands['WAIT'] = [false, method(:on_wait_command)]
- # <move: mover, target, x_correction, y_correction, jump, time> (WORKS!)
- BattleInterpreter::Commands['MOVE'] = [false, method(:on_move_command)]
- # <zoom: target, zoom_x, zoom_y, time> (WORKS!)
- BattleInterpreter::Commands['ZOOM'] = [false, method(:on_zoom_command)]
- # <angle: target, angle, time> (WORKS!)
- BattleInterpreter::Commands['ANGLE'] = [false, method(:on_angle_command)]
- # <opacity: target, opacity, time> (WORKS!)
- BattleInterpreter::Commands['OPACITY'] = [false, method(:on_opacity_command)]
- # <animation: target, animation_id, flip> (WORKS!)
- BattleInterpreter::Commands['ANIMATION'] = [false, method(:on_animation_command)]
- # <effects>
- BattleInterpreter::Commands['EFFECTS'] = [false, method(:on_effects_command)]
- # <if: 'evaluating condition'> (WORKS!)
- BattleInterpreter::Commands['IF'] = [true, method(:on_if_command)]
- # <repeat: 'times'> (WORKS!)
- BattleInterpreter::Commands['REPEAT'] = [true, method(:on_repeat_command)]
- # <while: 'evaluating condition'> (WORKS!)
- BattleInterpreter::Commands['WHILE'] = [true, method(:on_while_command)]
- # <afterimage: target, count, separation> (WORKS!)
- BattleInterpreter::Commands['AFTERIMAGE'] = [false, method(:on_afterimage_command)]
- # <mirror: target, value> (WORKS!)
- BattleInterpreter::Commands['MIRROR'] = [false, method(:on_mirror_command)]
- # <show pic: id, name, origin, x, y, zoom_x, zoom_y, opacity, blend_type> (WORKS!)
- BattleInterpreter::Commands['SHOW PIC'] = [false, method(:on_show_picture_command)]
- # <move pic: id, origin, x, y, zoom_x, zoom_y, opacity, blend_type, duration> (WORKS!)
- BattleInterpreter::Commands['MOVE PIC'] = [false, method(:on_move_picture_command)]
- # <move pic ex: id, target, x_correction, y_correction, time> (WORKS!)
- BattleInterpreter::Commands['MOVE PIC EX'] = [false, method(:on_move_picture_ex_command)]
- # <zoom pic ex: id, zoom_x, zoom_y, time> (WORKS!)
- BattleInterpreter::Commands['ZOOM PIC'] = [false, method(:on_zoom_picture_command)]
- # <opacity pic ex: id, opacity, time> (WORKS!)
- BattleInterpreter::Commands['OPACITY PIC'] = [false, method(:on_opacity_picture_command)]
- # <anime pic: id, animation_id, flip> (WORKS!)
- BattleInterpreter::Commands['ANIME PIC'] = [false, method(:on_anime_picture_command)]
- # <rotate pic: id, speed> (WORKS!)
- BattleInterpreter::Commands['ROTATE PIC'] = [false, method(:on_rotate_picture_command)]
- # <tone pic: id, red, green, blue, gray>, time (WORKS!)
- BattleInterpreter::Commands['TONE PIC'] = [false, method(:on_tone_picture_command)]
- # <delete pic: id> (WORKS!)
- BattleInterpreter::Commands['DELETE PIC'] = [false, method(:on_delete_picture_command)]
- # <ruby: script> (WORKS!)
- BattleInterpreter::Commands['RUBY'] = [false, method(:on_ruby_script_command)]
- # <each process: target> (WORKS!)
- BattleInterpreter::Commands['EACH PROCESS'] = [true, method(:on_each_process_command)]
- # <change target: target> (WORKS!)
- BattleInterpreter::Commands['CHANGE TARGET'] = [false, method(:on_target_change_command)]
- # <target change: battler_array> (used by some Commands) (WORKS!)
- BattleInterpreter::Commands['TARGET CHANGE EX'] = [false, method(:on_target_change_special_command)]
- # <end> (WORKS!)
- BattleInterpreter::Commands['END'] = [false, method(:on_end_command)]
- # <check counter> (READY!)
- BattleInterpreter::Commands['CHECK COUNTER'] = [false, method(:on_counter_check_command)]
- # <check reflect> (READY!)
- BattleInterpreter::Commands['CHECK REFLECT'] = [false, method(:on_reflect_check_command)]
- # <check substitute> (READY!)
- BattleInterpreter::Commands['CHECK SUBSTITUTE'] = [false, method(:on_substitute_check_command)]
- # <link skill: skill_id, chance> (READY!)
- BattleInterpreter::Commands['LINK SKILL'] = [false, method(:on_link_skill_command)]
- # <link item: item_id, chance> (READY!)
- BattleInterpreter::Commands['LINK ITEM'] = [false, method(:on_link_item_command)]
- # <damage>
- BattleInterpreter::Commands['DAMAGE'] = [false, method(:on_damage_command)]
- # <move camera: target, x, y, time>
- BattleInterpreter::Commands['MOVE CAMERA'] = [false, method(:on_move_camera_command)]
- # <zoom camera: zoom, time>
- BattleInterpreter::Commands['ZOOM CAMERA'] = [false, method(:on_zoom_camera_command)]
- # <target camera: target>
- BattleInterpreter::Commands['TARGET CAMERA'] = [false, method(:on_target_camera_command)]
- # <perform collapse>
- BattleInterpreter::Commands['PERFORM COLLAPSE'] = [false, method(:on_perform_collapse_command)]
- # <abort>
- BattleInterpreter::Commands['ABORT'] = [false, method(:on_abort_command)]
- # 1.1 and bigger ===============================================================================
- # <weapon: target, x_corr, y_corr, start_angle, end_angle, time, left_hand, over>
- BattleInterpreter::Commands['WEAPON'] = [false, method(:on_weapon_command)]
- # <weapon ex: target, bitmap, x _corr, y_corr, frames, interval, over> (WORKS!)
- BattleInterpreter::Commands['WEAPON EX'] = [false, method(:on_weapon_ex_command)]
- # <log text: text> (WORKS!)
- BattleInterpreter::Commands['LOG TEXT'] = [false, method(:on_log_text_command)]
- # <balloon: target, balloon_id> (WORKS!)
- BattleInterpreter::Commands['BALLOON'] = [false, method(:on_balloon_command)]
- # 1.2 and bigger ===============================================================================
- # <fps: frames> (WORKS!)
- BattleInterpreter::Commands['FPS'] = [false, method(:on_fps_command)]
- # <switch: id, value> (WORKS!)
- BattleInterpreter::Commands['SWITCH'] = [false, method(:on_switch_command)]
- # <variable: id, value> (WORKS!)
- BattleInterpreter::Commands['VARIABLE'] = [false, method(:on_variable_command)]
- # <movie: name> (WORKS!)
- BattleInterpreter::Commands['MOVIE'] = [false, method(:on_movie_command)]
- # <save bgm> (WORKS!)
- BattleInterpreter::Commands['SAVE BGM'] = [false, method(:on_save_bgm_command)]
- # <replay bgm> (WORKS!)
- BattleInterpreter::Commands['REPLAY BGM'] = [false, method(:on_replay_bgm_command)]
- # <save bgs> (WORKS!)
- BattleInterpreter::Commands['SAVE BGS'] = [false, method(:on_save_bgs_command)]
- # <replay bgs> (WORKS!)
- BattleInterpreter::Commands['REPLAY BGS'] = [false, method(:on_replay_bgs_command)]
- # <play bgm: name, volume, pitch, pos> (WORKS!)
- BattleInterpreter::Commands['PLAY BGM'] = [false, method(:on_play_bgm_command)]
- # <play bgs: name, volume, pitch, pos> (WORKS!)
- BattleInterpreter::Commands['PLAY BGS'] = [false, method(:on_play_bgs_command)]
- # <play me: name, volume, pitch> (WORKS!)
- BattleInterpreter::Commands['PLAY ME'] = [false, method(:on_play_me_command)]
- # <play se: name, volume, pitch> (WORKS!)
- BattleInterpreter::Commands['PLAY SE'] = [false, method(:on_play_se_command)]
- # <stop bgm> (WORKS!)
- BattleInterpreter::Commands['STOP BGM'] = [false, method(:on_stop_bgm_command)]
- # <stop bgs> (WORKS!)
- BattleInterpreter::Commands['STOP BGS'] = [false, method(:on_stop_bgs_command)]
- # <stop me> (WORKS!)
- BattleInterpreter::Commands['STOP ME'] = [false, method(:on_stop_me_command)]
- # <stop se> (WORKS!)
- BattleInterpreter::Commands['STOP SE'] = [false, method(:on_stop_se_command)]
- # <fade bgm: time> (WORKS!)
- BattleInterpreter::Commands['FADE BGM'] = [false, method(:on_fade_bgm_command)]
- # <fade bgs: time> (WORKS!)
- BattleInterpreter::Commands['FADE BGS'] = [false, method(:on_fade_bgs_command)]
- # <fade me: time> (WORKS!)
- BattleInterpreter::Commands['FADE ME'] = [false, method(:on_fade_me_command)]
- end
-
- def on_pose_command(action, params)
- action.analize_battler_sprites_string(params[0], false, false).each do |i|
- i.set_pose(params[1], params[2], params[3], params[4], params[5])
- end
- end
-
- def on_wait_command(action, params)
- if params[0].is_a?(String) && params[0][/animation/mi]
- wait_for_battle_interpreter
- elsif params[0].is_a?(String)
- action.wait(action.eval_data(params[0]))
- else
- action.wait(params[0])
- end
- end
-
- def on_move_command(action, params)
- users = action.analize_battler_sprites_string(params[0], false, false)
- targets = action.analize_battler_sprites_string(params[1], true, true)
- if targets == :screen
- users.each do |i|
- i.set_movement(params[2], params[3], params[4], params[5])
- end
- elsif targets == :origin
- users.each do |i|
- corr_x = params[2]
- corr_y = params[3]
- corr_x *= -1 if i.battler.actor? && BattleConfig::InvertXCorrection
- corr_y *= -1 if i.battler.actor? && BattleConfig::InvertYCorrection
- i.set_movement(corr_x+i.original_x, corr_y+i.original_y, params[4], params[5])
- end
- else
- pos_x = 0
- pos_y = 0
- targets.each do |i|
- pos_x += i.current_x
- pos_y += i.current_y
- end
- if targets.size > 0
- pos_x /= targets.size
- pos_y /= targets.size
- else
- return
- end
- users.each do |i|
- x = pos_x
- y = pos_y
- x += i.battler.actor? && BattleConfig::InvertXCorrection ? -params[2] : params[2]
- y += i.battler.actor? && BattleConfig::InvertYCorrection ? -params[3] : params[3]
- i.set_movement(x, y, params[4], params[5])
- end
- end
- end
-
- def on_zoom_command(action, params)
- action.analize_battler_sprites_string(params[0], false, false).each do |i|
- i.set_zoom(params[1] / 100.0, params[2] / 100.0, params[3])
- end
- end
-
- def on_angle_command(action, params)
- action.analize_battler_sprites_string(params[0], false, false).each do |i|
- i.set_angle(params[1], params[2])
- end
- end
-
- def on_opacity_command(action, params)
- action.analize_battler_sprites_string(params[0], false, false).each do |i|
- i.set_opacity(params[1], params[2])
- end
- end
- def on_animation_command(action, params)
- animations = []
- if params[1] < 0
- if params[1] == -1
- animations.push(action.user.atk_animation_id1)
- else
- animations.push(action.user.atk_animation_id2)
- end
- elsif params[1] == 0
- id = action.item.animation_id
- if id < 1
- animations.push(action.user.atk_animation_id1)
- animations.push(action.user.atk_animation_id2)
- else
- animations.push(id)
- end
- else
- animations.push(params[1])
- end
- targets = action.analize_battler_sprites_string(params[0], false, false)
- show_animation_ex(targets, animations[0], params[2])
- if animations[1]
- wait_for_animation
- show_animation_ex(targets, animations[1], !params[2])
- end
- end
-
- def on_effects_command(action, params)
- end
-
- def on_if_command(action, params)
- check = params[0].is_a?(String) ? action.eval_data(params[0]) : params[0]
- if check
- action.insert_commands_as_next(params[1])
- end
- end
-
- def on_repeat_command(action, params)
- t = params[0].is_a?(String) ? action.eval_data(params[0]) : params[0]
- t.times do |i|
- action.insert_commands_as_next(params[1])
- end
- end
-
- def on_while_command(action, params)
- check = params[0].is_a?(String) ? action.eval_data(params[0]) : params[0]
- if check
- action.insert_commands_as_next([['END', [] ]])
- action.insert_commands_as_next(params[1])
- action.insert_commands_as_next([ ['WHILE', [ params[0] ] ] ])
- action.insert_commands_as_next(params[1])
- end
- end
-
- def on_afterimage_command(action, params)
- action.analize_battler_sprites_string(params[0], false, false).each do |i|
- visible = params[1] <= 0 ? false : true
- i.set_aftermages(visible, params[1], params[2])
- end
- end
-
- def on_mirror_command(action, params)
- targets = action.analize_battler_sprites_string(params[0], false, false)
- targets.each do |target|
- target.set_mirror_value(params[1])
- end
- end
-
- def on_show_picture_command(action, params)
- picture = $game_troop.screen.pictures[params[0]]
- i = params[1]
- wpns = action.user.weapons
- wpn = wpns[-i - 1] ? wpns[-i - 1] : (wpns[0] ? wpns[0] : nil)
- index = wpn ? wpn.icon_index : 0
- index = i == 0 ? action.item.icon_index : index
- bmp = i.is_a?(String) ? i : (i > 0 ? i : index)
- picture.show(bmp, params[2], params[3], params[4], params[5],
- params[6], params[7], params[8])
- end
-
- def on_move_picture_command(action, params)
- picture = $game_troop.screen.pictures[params[0]]
- picture.move(params[1], params[2], params[3], params[4], params[5],
- params[6], params[7], params[8])
- end
-
- def on_move_picture_ex_command(action, params)
- picture = $game_troop.screen.pictures[params[0]]
- targets = action.analize_battler_sprites_string(params[1], false, true)
- pos_x = 0
- pos_y = 0
- if targets != :screen
- targets.each do |i|
- pos_x += i.current_x
- pos_y += i.current_y
- end
- if targets.size > 0
- pos_x /= targets.size
- pos_y /= targets.size
- else
- return
- end
- end
- pos_x += params[2]
- pos_y += params[3]
-
- picture.move_ex(pos_x, pos_y, params[4])
- end
-
- def on_zoom_picture_command(action, params)
- picture = $game_troop.screen.pictures[params[0]]
- picture.set_zoom(params[1], params[2], params[3])
- end
-
- def on_opacity_picture_command(action, params)
- picture = $game_troop.screen.pictures[params[0]]
- picture.set_opacity(params[1], params[2])
- end
-
- def on_anime_picture_command(action, params)
- picture = $game_troop.screen.pictures[params[0]]
- if params[1] < 0
- if params[1] == -1
- animation_id = action.user.atk_animation_id1
- else
- animation_id = action.user.atk_animation_id2
- end
- else
- animation_id = params[1]
- end
- picture.set_animation(animation_id, params[2])
- end
- def on_rotate_picture_command(action, params)
- picture = $game_troop.screen.pictures[params[0]]
- picture.rotate(params[1])
- end
-
- def on_delete_picture_command(action, params)
- picture = $game_troop.screen.pictures[params[0]]
- picture.erase
- end
-
- def on_tone_picture_command(action, params)
- picture = $game_troop.screen.pictures[params[0]]
- picture.start_tone_change(Tone.new(params[1], params[2], params[3],
- params[4]), params[5])
- end
-
- def on_ruby_script_command(action, params)
- action.eval_data(params[0])
- end
-
- def on_each_process_command(action, params)
- @new_targets = action.analize_target_string(params[0])
- return if @new_targets.size == 0
- @for_alive_targets = @new_targets[0] && @new_targets[0].alive?
- @for_friend_target = @new_targets[0] && @new_targets[0].actor? == action.user.actor?
- @target_size = 1
- @last_targets = action.targets
- @remove_targets = []
- comm = []
- @new_targets.each do |i|
- comm += [['TARGET CHANGE EX', [i] ]] + params[1]
- end
- action.insert_commands_as_next(comm + [['TARGET CHANGE EX', @last_targets]])
- end
-
- def on_target_change_special_command(action, params)
- if @collapse_checked
- params.each do |battler|
- if battler.alive? != @for_alive_targets
- params.delete(battler)
- end
- end
- if params.size <= 0
- unit = @for_friend_target ? acion.user.friend_unit : action.user.enemy_unit
- params = @for_alive_targets ? unit.alive_members : unit.dead_members
- params = params[0...@target_size].compact
- end
- @collapse_checked = false
- end
- action.targets = params
- action.linked_actions.each do |a|
- a.targets = action.targets
- end
- end
-
- def on_target_change_command(action, params)
- action.targets = action.analize_target_string(params[0])
- action.linked_actions.each do |a|
- a.targets = action.targets
- end
- end
-
- def on_end_command(action, params)
- action.loop_depth -= 1
- end
-
- def on_counter_check_command(action, params)
- action.pause
- action.targets.each do |target|
- if rand < target.item_cnt(action.user, action.item) && action.counter_active?
- action.abort
- invoke_counter_attack_ex(action.user, target, action.item)
- end
- end
- wait_for_battle_interpreter
- action.resume
- end
-
- def on_reflect_check_command(action, params)
- action.pause
- action.targets.each do |target|
- if rand < target.item_mrf(action.user, action.item)
- invoke_magic_reflection_ex(action, target)
- end
- end
- wait_for_battle_interpreter
- action.resume
- end
-
- def on_substitute_check_command(action, params)
- @substitutes = []
- action.pause
- action.targets.each do |target|
- apply_substitute_ex(action, target, action.item)
- end
- wait_for_battle_interpreter
- action.resume
- @substitutes.clear
- end
-
- def on_link_skill_command(action, params)
- result = params[1].is_a?(String) ? action.eval_data(params[1]) : params[1]
- if rand(100) < result
- if params[0] < 1
- id = action.user.attack_skill_id
- else
- id = params[0]
- end
- action.abort
- action.user.current_action.set_skill(id)
- @subject = action.user
- use_item
- end
- end
-
- def on_link_item_command(action, params)
- result = params[1].is_a?(String) ? action.eval_data(params[1]) : params[1]
- if rand(100) < result
- action.abort
- user.current_action.set_item(id)
- @subject = action.user
- use_item
- end
- end
-
- def on_damage_command(action, params)
- action.targets.each do |target|
- apply_item_effects_ex(action.user, target, action.item)
- end
- end
-
- def on_move_camera_command(action, params)
- target = action.analize_battler_sprites_string(params[0], false, true)
- if target == :screen
- BattleCamera.set_movement(params[1], params[2], params[3])
- else
- cx = 0
- cy = 0
- target.each do |i|
- cx += i.current_x
- cy += i.current_y
- end
- if target.size > 0
- cx /= target.size
- cy /= target.size
- end
- BattleCamera.set_movement(cx+params[1], cy+params[2], params[3])
- end
- end
-
- def on_zoom_camera_command(action, params)
- BattleCamera.set_zoom(params[0] / 100.0, params[1])
- end
-
- def on_target_camera_command(action, params)
- target = action.analize_battler_sprites_string(params[0], false, true)
- BattleCamera.set_target(target)
- end
-
- def on_perform_collapse_command(action, params)
- @collapse_checked = true
- action.targets.each do |target|
- if target.dead?
- if target.die_sequence?
- sequence = target.get_die_sequence
- BattleInterpreter.add_action(target, [target], sequence, nil, false)
- else
- target.perform_collapse_effect
- end
- action.targets.delete(target)
- @dead_battlers.push(target)
- @last_targets.delete(target) if @last_targets
- @remove_targets.push(target) if @remove_targets
- end
- end
- end
-
- def on_abort_command(action, params)
- action.abort
- end
-
- def on_weapon_command(action, params)
- targets = action.analize_battler_sprites_string(params[0], false, false)
- targets.each do |target|
- x = target.battler.actor? && BattleConfig::InvertXCorrection ? -params[1] : params[1]
- y = target.battler.actor? && BattleConfig::InvertYCorrection ? -params[2] : params[2]
- sa = target.battler.actor? ? 360 - params[3] : params[3]
- ea = target.battler.actor? ? 360 - params[4] : params[4]
- target.set_weapon_icon(x, y, sa, ea, params[5], params[6], params[7])
- end
- end
-
- def on_weapon_ex_command(action, params)
- targets = action.analize_battler_sprites_string(params[0], false, false)
- targets.each do |target|
- x = target.battler.actor? && BattleConfig::InvertXCorrection ? -params[2] : params[2]
- y = target.battler.actor? && BattleConfig::InvertYCorrection ? -params[3] : params[3]
- target.set_weapon_sprite(params[1], x, y, params[4], params[5], params[6])
- end
- end
-
- def on_log_text_command(action, params)
- @log_window.add_text(params[0])
- end
-
- def on_balloon_command(action, params)
- targets = action.analize_battler_sprites_string(params[0], false, false)
- targets.each do |target|
- target.start_balloon(params[1])
- end
- end
-
- def on_fps_command(action, params)
- Graphics.frame_rate = params[0]
- end
-
- def on_switch_command(action, params)
- $game_switches[params[0]] = params[1]
- end
-
- def on_variable_command(action, params)
- $game_variables[params[0]] = params[1]
- end
-
- def on_movie_command(action, params)
- Graphics.play_movie(params[0])
- end
-
- def on_save_bgm_command(action, params)
- @last_bgm_played = RPG::BGM.last
- end
-
- def on_replay_bgm_command(action, params)
- @last_bgm_played.replay if @last_bgm_played
- @last_bgm_played = nil
- end
-
- def on_save_bgs_command(action, params)
- @last_bgs_played = RPG::BGS.last
- end
-
- def on_replay_bgs_command(action, params)
- @last_bgs_played.replay if @last_bgs_played
- @last_bgs_played = nil
- end
-
- def on_play_bgm_command(action, params)
- RPG::BGM.new(params[0], params[1], params[2], params[3]).play
- end
-
- def on_play_bgs_command(action, params)
- RPG::BGS.new(params[0], params[1], params[2], params[3]).play
- end
-
- def on_play_me_command(action, params)
- RPG::ME.new(params[0], params[1], params[2]).play
- end
-
- def on_play_se_command(action, params)
- RPG::SE.new(params[0], params[1], params[2]).play
- end
-
- def on_stop_bgm_command(action, params)
- Audio.bgm_stop
- end
-
- def on_stop_bgs_command(action, params)
- Audio.bgs_stop
- end
-
- def on_stop_me_command(action, params)
- Audio.me_stop
- end
-
- def on_stop_se_command(action, params)
- Audio.se_stop
- end
-
- def on_fade_bgm_command(action, params)
- Audio.bgm_fade(params[0])
- end
-
- def on_fade_bgs_command(action, params)
- Audio.bgs_fade(params[0])
- end
-
- def on_fade_me_command(action, params)
- Audio.me_fade(params[0])
- end
-
- end
复制代码 |
评分
-
查看全部评分
|