设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1307|回复: 8
打印 上一主题 下一主题

[已经解决] 关于va横版半即时的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
89
在线时间
76 小时
注册时间
2009-8-5
帖子
29
跳转到指定楼层
1
发表于 2014-2-9 02:52:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
我下载了 《我是临时工的》的半即时模板(作者忘记了。。)
        又复制了菜鸟横版脚本。。。
拼在一起,结果战斗测试的时候很流畅,但是运行的时候,一旦触发战斗事件就会卡,非常卡
新手,来学习的。

Lv1.梦旅人

梦石
0
星屑
89
在线时间
76 小时
注册时间
2009-8-5
帖子
29
2
 楼主| 发表于 2014-2-9 03:01:28 | 只看该作者
新手,来学习的。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
89
在线时间
76 小时
注册时间
2009-8-5
帖子
29
3
 楼主| 发表于 2014-2-9 03:22:45 | 只看该作者
这是半即时的脚本 转自韩云溪
  1. #------------------------------------------------------------------------------
  2. #本脚本作者:韩云溪
  3. #-------------------------------------------------------------------------------
  4. class RPG::UsableItem < RPG::BaseItem
  5.    AT_DELAY = /<AT_DELAY=(\d+)\s*>/i            
  6.    AT_ADVANCE = /<AT_ADVANCE>/
  7.    SKILL_USE_TIMES = /<SKILL_USE_TIMES=(\d+)\s*>/i
  8.    #--------------------------------------------------------------------------
  9.    # ● AT延迟率
  10.    #--------------------------------------------------------------------------
  11.    def at_delay_rate
  12.      return @note =~ AT_DELAY ? $1.to_i : 0
  13.    end
  14.    #--------------------------------------------------------------------------
  15.    # ● AT提前
  16.    #--------------------------------------------------------------------------
  17.    def at_advance
  18.      return true if @note =~ AT_ADVANCE
  19.      return false
  20.    end
  21.    def skill_use_times_request
  22.      return @note =~ SKILL_USE_TIMES ? $1.to_i : 0
  23.    end
  24. end

  25. class RPG::BaseItem
  26.   AT_ICON = /<AT_ICON=(\d+)\s*>/i  
  27.   AT_DELAY_RESIST = /<AT_DELAY_RESIST>/
  28. #~   ------------------------------------------------------------
  29. #~   AT图标
  30. #~   -------------------------------------------------------------
  31.   def at_icon_index
  32.     return @note =~ AT_ICON ? $1.to_i : 0
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ●抵抗AT延迟
  36.   #--------------------------------------------------------------------------
  37.   def at_delay_resist
  38.     return true if @note =~ AT_DELAY_RESIST
  39.     return false
  40.   end
  41. end

  42. #-----------------------------------------------------------------------------
  43. #●战斗者的抽象基类:增加at属性
  44. #------------------------------------------------------------------------------

  45. class Game_BattlerBase
  46.   attr_reader   :at
  47.   attr_accessor :turn_count
  48.   attr_accessor :my_turn
  49.   alias old_initialize initialize
  50.   def initialize
  51.     old_initialize
  52.     @at = 0
  53.     @turn_count = 0
  54.     @my_turn = false
  55.   end
  56.   def at=(at)
  57.     @at = [at,0].max
  58.   end
  59.   def at_full
  60.     @at <= 0
  61.   end

  62.   def at_advance
  63.     @at = 0
  64.   end
  65.   def inputable?
  66.     if @my_turn
  67.       return normal? && !auto_battle?
  68.     else
  69.       return false
  70.     end
  71.   end
  72. end
  73. #-----------------------------------------------------------------------------
  74. #●战斗者的基类:增加at延迟抵抗
  75. #------------------------------------------------------------------------------

  76. class Game_Battler < Game_BattlerBase
  77.   def at_delay_resist
  78.     if self.is_a?(Game_Actor)
  79.       return $data_classes[self.class.id].at_delay_resist
  80.       return $data_actors[self.id].at_delay_resist
  81.       for equip in self.equips
  82.         return equip.at_delay_resist
  83.       end
  84.       for state in self.states
  85.         return state.at_delay_resist
  86.       end
  87.     elsif self.is_a?(Game_Enemy)
  88.       return $data_enemies[self.id].at_delay_resist
  89.       for state in self.states
  90.         return state.at_delay_resist
  91.       end
  92.     end
  93.   end
  94.   def at_icon_index
  95.     if self.is_a?(Game_Actor)
  96.       return $data_classes[self.class.id].at_icon_index
  97.       return $data_actors[self.id].at_icon_index
  98.     elsif self.is_a?(Game_Enemy)
  99.       return $data_enemies[self.id].at_icon_index
  100.     end
  101.   end

  102.   
  103. end
  104. class Game_Party < Game_Unit
  105.   def make_action(member)
  106.     unless member == nil
  107.       member.make_actions unless member.inputable?
  108.     end
  109.   end
  110. end

  111. class Game_Troop < Game_Unit
  112.   def make_action(member)
  113.     member.make_actions unless member == nil
  114.   end

  115.   def increase_turn(enemy)
  116.     troop.pages.each {|page| @event_flags= false if page.span == 1 }
  117.     enemy.turn_count += 1
  118.     aaa = []
  119.     for iii in $game_troop.members
  120.       aaa.push(iii.turn_count)
  121.     end
  122.     @turn_count = aaa.min
  123.   end
  124. end

  125. #----------------------------------------------------------
  126. #at制的实现
  127. #-------------------------------------------------------------
  128. module BattleManager
  129.   def self.battle_start
  130.     $game_system.battle_count += 1
  131.     $game_party.on_battle_start
  132.     $game_troop.on_battle_start
  133.     $game_troop.enemy_names.each do |name|
  134.       $game_message.add(sprintf(Vocab::Emerge, name))
  135.     end
  136.     if @preemptive
  137.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  138.     elsif @surprise
  139.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  140.     end
  141.     wait_for_message
  142.     unless $game_party.all_dead?
  143.       init_at
  144.     end
  145.   end
  146.   def self.enable_go
  147.     @enable_go
  148.   end
  149.   def self.enable_go_clear
  150.     @enable_go = nil
  151.   end
  152.   def self.max_agi
  153.     @max_agi
  154.   end
  155.   
  156.   #----------------------------------------------------------------------------
  157.   #初始化at
  158.   #----------------------------------------------------------------------------
  159.   def self.init_at
  160.     a = []
  161.     for iii in $game_party.members + $game_troop.members
  162.       a.push(iii.agi)
  163.     end
  164.     @max_agi = a.max
  165.     if @preemptive
  166.       for iii in $game_party.members
  167.         iii.at = 1
  168.       end
  169.       for iii in $game_troop.members
  170.         iii.at = @max_agi * 4
  171.       end
  172.     elsif @surprise
  173.       for iii in $game_party.members
  174.         iii.at = @max_agi * 4
  175.       end
  176.       for iii in $game_troop.members
  177.         iii.at = 1
  178.       end
  179.     else
  180.       for iii in $game_party.members + $game_troop.members
  181.         iii.at = @max_agi * 4
  182.       end
  183.     end
  184.     for iii in $game_party.members + $game_troop.members
  185.       iii.turn_count = 0
  186.     end
  187.   end
  188.   #----------------------------------------------------------------------------
  189.   #更新at
  190.   #----------------------------------------------------------------------------
  191.   def self.update_at
  192.     for iii in $game_troop.members + $game_party.members
  193.       iii.at -= iii.agi  
  194.       if iii.at_full
  195.         @enable_go = iii
  196.         iii.my_turn = true
  197.         iii.at += @max_agi * 4
  198.         input_start
  199.         break
  200.       end         
  201.     end
  202.     unless at_updating?
  203.       return
  204.     end
  205.   end
  206.   
  207.   def self.at_updation
  208.     @phase = :at_update
  209.   end
  210.   
  211.   def self.at_updating?
  212.     @phase == :at_update
  213.   end
  214.   
  215.   
  216.   #-------------------------------------------------------------------------
  217.   #重定义:回合开始
  218.   #------------------------------------------------------------------------
  219.   def self.turn_start
  220.    
  221. #    self.tp += 10
  222.     @phase = :turn
  223.     clear_actor
  224.     make_action_orders
  225.   end
  226.   #-------------------------------------------------------------------------
  227.   #重定义:行动顺序
  228.   #------------------------------------------------------------------------
  229.   def self.make_action_orders
  230.     @action_battlers = []
  231.     for iii in $game_troop.members + $game_party.members
  232.       if iii.my_turn
  233.         @action_battlers.push(iii)
  234.       end
  235.     end
  236.   end
  237.   
  238. end

  239. class Window_AT < Window_Base
  240.   def initialize
  241.     super(Graphics.width-64,96,64,192)
  242.     create_contents
  243.     self.opacity = 0
  244.     @battlers = []
  245.   end
  246.   def create_contents
  247.     self.contents = Bitmap.new(self.width - 32,self.height - 32)
  248.   end
  249.   
  250.   def refresh
  251.     self.contents.clear
  252.     @battlers.clear
  253.     for battler in $game_party.members + $game_troop.members
  254.       @battlers.push(battler) if battler.alive?
  255.     end
  256.     @battlers.sort!{|b,a|a.at-b.at}
  257.     for battler in @battlers
  258.       self.process_draw_icon(battler.at_icon_index, {:x=>0,:y=>@battlers.index(battler)*24})
  259.     end
  260.   end
  261.   
  262. end

  263. class Scene_Battle
  264.   alias old_create create_all_windows
  265.   def create_all_windows
  266.     old_create
  267.     create_at_window
  268.   end
  269.   def create_at_window
  270.     @window_at = Window_AT.new
  271.   end

  272.   #-------------------------------------------------------------------------
  273.   #当at满时的操作
  274.   #------------------------------------------------------------------------
  275.   def on_at_full
  276.     BattleManager.at_updation
  277.     if BattleManager.enable_go.is_a?(Game_Actor) and
  278.       BattleManager.enable_go.inputable?
  279.       BattleManager.enable_go.on_turn_end
  280.       refresh_status
  281.       start_party_command_selection
  282.     else
  283.       if BattleManager.enable_go.is_a?(Game_Actor)
  284.         BattleManager.enable_go.on_turn_end
  285.         $game_party.make_action(BattleManager.enable_go)
  286.         turn_start
  287.       elsif BattleManager.enable_go.is_a?(Game_Enemy)
  288.         BattleManager.enable_go.on_turn_end
  289.         $game_troop.make_action(BattleManager.enable_go)
  290.         $game_troop.increase_turn(BattleManager.enable_go)
  291.         turn_start
  292.       end
  293.     end
  294.     @window_at.refresh
  295.     BattleManager.enable_go_clear
  296.   end
  297.   #-------------------------------------------------------------------------
  298.   #重定义:战斗开始
  299.   #------------------------------------------------------------------------
  300.   def battle_start
  301.     BattleManager.battle_start
  302.     process_event
  303.     on_at_full
  304.   end
  305.   #-------------------------------------------------------------------------
  306.   #重定义:画面更新
  307.   #------------------------------------------------------------------------
  308.   def update
  309.     super
  310.     if BattleManager.at_updating?
  311.       BattleManager.update_at
  312.       on_at_full
  313.     elsif BattleManager.in_turn?
  314.       process_event
  315.       on_at_full
  316.       process_action
  317.     end
  318.     BattleManager.judge_win_loss
  319.   end
  320.   #---------------------------------------------------------------------------
  321.   #行动过程
  322.   #---------------------------------------------------------------------------

  323.   #-------------------------------------------------------------------------
  324.   #重定义:行动结束
  325.   #------------------------------------------------------------------------
  326.   def process_action_end
  327.     @subject.on_action_end
  328.     @subject.my_turn = false
  329.     @window_at.refresh
  330.     refresh_status
  331.     @log_window.display_auto_affected_status(@subject)
  332.     @log_window.wait_and_clear
  333.     @log_window.display_current_state(@subject)
  334.     @log_window.wait_and_clear
  335.     BattleManager.judge_win_loss
  336.   end
  337.   #-------------------------------------------------------------------------
  338.   #重定义:回合结束
  339.   #------------------------------------------------------------------------
  340.    def turn_end
  341.      all_battle_members.each do |battler|
  342.        refresh_status
  343.        @log_window.display_auto_affected_status(battler)
  344.        @log_window.wait_and_clear
  345.      end
  346.      BattleManager.turn_end
  347.      process_event
  348.      on_at_full
  349.    end
  350.   #-------------------------------------------------------------------------
  351.   #重定义:技能、物品效果
  352.   #------------------------------------------------------------------------
  353.   def invoke_item(target, item)
  354.     @subject.add_skill_use_times(item,1)
  355.     if rand < target.item_mrf(@subject, item)
  356.       invoke_magic_reflection(target, item)
  357.     else
  358.       apply_item_effects(apply_substitute(target, item), item)
  359.       if rand < target.item_cnt(@subject, item)
  360.         invoke_counter_attack(target, item)
  361.       end
  362.       unless target.at_delay_resist
  363.         target.at += BattleManager.max_agi * item.at_delay_rate / 25
  364.       end
  365.       target.at_advance if item.at_advance
  366.     end
  367.     @subject.last_target_index = target.index
  368.   end
  369. end
复制代码
新手,来学习的。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
89
在线时间
76 小时
注册时间
2009-8-5
帖子
29
4
 楼主| 发表于 2014-2-9 03:23:34 | 只看该作者
这是横版脚本
  1. #===============================================================================
  2. # RBS - Ramiro's Battle System
  3. # Version 2.0
  4. # Difficulty: Very hard
  5. #-------------------------------------------------------------------------------
  6. # Instructions:
  7. # Paste above main and after all other script, unless that script says  other
  8. # thing.
  9. #-------------------------------------------------------------------------------
  10. # WARNING: THIS IS THE CONFIGURATION FILE!
  11. # Each change made on this script will be reflected on the system.
  12. # Use with care.
  13. #-------------------------------------------------------------------------------
  14. # License:
  15. #Copyright (c) 2012, Ramiro Rojo
  16. #All rights reserved.
  17. #
  18. #Redistribution and use in source and binary forms, with or without
  19. #modification, are permitted provided that the following conditions are met:
  20. #
  21. #1. Redistributions of source code must retain the above copyright notice, this
  22. #   list of conditions and the following disclaimer.
  23. #2. Redistributions in binary form must reproduce the above copyright notice,
  24. #   this list of conditions and the following disclaimer in the documentation
  25. #   and/or other materials provided with the distribution.
  26. #
  27. #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  28. #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  29. #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  30. #DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  31. #ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  32. #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  33. #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  34. #ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  35. #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  36. #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  37. #
  38. #The views and conclusions contained in the software and documentation are those
  39. #of the authors and should not be interpreted as representing official policies,
  40. #either expressed or implied, of the FreeBSD Project.
  41. #===============================================================================
  42. module BattleConfig
  43.   
  44.   # If the value is true, the camera will be in a more panoramic style.
  45.   BattleCamera_UsePanoramicCamera = true  
  46.   
  47.   # show the positions of the party member by index.
  48.   
  49.   if BattleCamera_UsePanoramicCamera
  50.     ActorPos = [[410, 265], [430, 275], [450, 285], [470, 295]]
  51.   else
  52.     ActorPos = [[410, 210], [430, 235], [450, 260], [470, 295]]
  53.   end
  54.   
  55.   # the bitmap name of the cursor for targeting in system folder
  56.   CursorBitmap = 'battle cursor'
  57.   # the number of frames of the cursor
  58.   CursorFrames = 1
  59.   # the delay between each frame of the cursor.
  60.   CursorDelay  = 8
  61.   
  62.   # default enemy animation ids
  63.   DefaultEnemey_Ani1ID = 1
  64.   DefaultEnemey_Ani2ID = 0
  65.   
  66.   # the number of poses that the standart battles have
  67.   DefaultPoses  = 1
  68.   # the number of frames that the standart battles have
  69.   DefaultFrames = 1
  70.   
  71.   # the default sprite acotr an eney indexes for a battle
  72.   DefaultActorIndex = 0
  73.   DefaultEnemyIndex = 0
  74.   
  75.   # if set to true, the x correction will be inverted for actor sequences
  76.   # when using movement commands.
  77.   InvertXCorrection = true

  78.   # if set to true, the y correction will be inverted for actor sequences
  79.   # when using movement commands.  
  80.   InvertYCorrection = false
  81.   
  82.   # display skill names on the log window when used?
  83.   Log_DisplaySkillName = false
  84.   # display the messages 1 and 2 for skill on the log window when used?
  85.   Log_DisplaySkillMsg1 = true
  86.   Log_DisplaySkillMsg2 = true
  87.   
  88.   # display item names on the log window when used?
  89.   Log_DisplayItemName  = false
  90.   # display item usage on the log window when used?
  91.   Log_DisplayItemUsage = true
  92.   
  93.   # display critical message on log?
  94.   Log_DisplayCritical = false
  95.   # display failure message on log?
  96.   Log_DisplayFailure  = false
  97.   # display miss message on log?
  98.   Log_DisplayMiss     = false
  99.   # display evasi髇 message on log?
  100.   Log_DisplayEvasion  = false
  101.   
  102.   # display the damage or recovery to TP, MP or Hp on log? (if set to false,
  103.   # please consider using the popup.
  104.   Log_DisplayHpDamage  = false
  105.   Log_DisplayMpDamage  = false
  106.   Log_DisplayTpDamage  = false
  107.   
  108.   # display counterattack message?
  109.   Log_DisplayCounterattack = true
  110.   # display reflection message?
  111.   Log_DisplayReflection    = true
  112.   # display substitute message?
  113.   Log_DisplaySubstitute    = true
  114.   
  115.   # display messages of removed states?
  116.   Log_DisplayRemovedStates = false
  117.   # display messages of added states?
  118.   Log_DisplayAddedStates   = false
  119.   
  120.   # display buffs with the log ?
  121.   Log_DisplayBuffs   = false
  122.   # display debuffs with the log ?
  123.   Log_DisplayDebuffs = false
  124.   # display removed buffs with the log ?
  125.   Log_DisplayRemovedBuffs = false
  126.   
  127.   # set this to true to correct the battlebacks with the camera if you are using
  128.   # the rtp's battlebacks or the same style and sizes.
  129.   UsingDefaultBattlebacks  = true
  130.   
  131.   # change the default scale of the battleback (not supported)
  132.   Battleback_NormalZoom = 1
  133.   
  134.   # the default notres for each action are defined here.
  135.   Default_SequenceNotes = "
  136.   
  137.     # called when the battler's selection turn has started
  138.     <sequence:turn start>
  139.       pose: 'user', 0, 2, -2, -1, 9;  
  140.       move: 'user', 'origin', 32, 0, 0, 20;
  141.       wait: 20;
  142.       pose: 'user', 0, 0, 1, -1, 12;     
  143.       wait: 20;
  144.     </sequence>
  145.    
  146.     # called when the battler's selection turn has ended
  147.     <sequence:turn end>
  148.       pose: 'user', 0, 1, -2, -1, 9;
  149.       move: 'user', 'origin', 0, 0, 0, 20;
  150.       wait: 30;   
  151.       pose: 'user', 0, 2, -2, -1, 12;
  152.       wait: 20;      
  153.     </sequence>
  154.    
  155.     # called when the battle starts as normal
  156.     <sequence:presentation>
  157.       pose: 'user', 0, 2, -2, -1, 12;
  158.       opacity: 'user', 0, 1;
  159.       move: 'user', 'origin', -300, 0, 0, 1;
  160.       wait: 1;
  161.       opacity: 'user', 255, 40;
  162.       move: 'user', 'origin', 0, 0, 0, 60;
  163.       wait: 60;
  164.     </sequence>
  165.    
  166.     # called when the user is surprized.
  167.     <sequence:surprised>
  168.       balloon: 'user', 1;
  169.       opacity: 'user', 0, 1;
  170.       wait: 1;
  171.       opacity: 'user', 255, 20;
  172.       mirror: 'user', true;
  173.       wait: 20;
  174.       move: 'user', 'origin', 0, 0, 30, 20;
  175.       wait: 10;
  176.       mirror: 'user', false;
  177.       wait: 10;
  178.     </sequence>

  179.     # called when the user has an advantage turn
  180.     <sequence:preemptive>
  181.       pose: 'user', 0, 2, -2, -1, 12;
  182.       opacity: 'user', 0, 1;
  183.       move: 'user', 'origin', -300, 0, 0, 1;
  184.       wait: 1;
  185.       opacity: 'user', 255, 40;
  186.       move: 'user', 'origin', 0, 0, 20, 60;
  187.       wait: 60;   
  188.     </sequence>

  189.     # called when the user attacks or the skill/item is used
  190.     <sequence:attack>
  191.       afterimage: 'user', 3, 3;
  192.       pose: 'user', 0, 2, -2, -1, 16;
  193.       move: 'user', 'targets', -80, 0, 0, 20;
  194.       wait: 20;
  195.       check counter;
  196.       check substitute;
  197.       wait: 1;
  198.       weapon: 'user', 2, -12, 0, -90, 10, false, false;
  199.       animation: 'target', -1, false;
  200.       wait: 20;
  201.       weapon: 'user', 2, -12, -90, 0, 10, true, true;
  202.       animation: 'target', -2, true;
  203.       zoom camera: 150, 20;
  204.       move camera: 'user', 0, 0, 20;      
  205.       damage;
  206.       wait: 20;
  207.       move: 'user', 'origin', 0, 0, 20, 20;
  208.       zoom camera: 100, 20;
  209.       move camera: 'screen', 272, 208, 20;      
  210.       wait: 20;
  211.       afterimage: 'user', 0;
  212.     </sequence>

  213.     # called when the user defends
  214.     <sequence:guard>
  215.       damage;
  216.     </sequence>   
  217.    
  218.     # calls when a user makes a counter
  219.     <sequence:counter>
  220.       afterimage: 'target', 0;
  221.       balloon: 'user', 1;
  222.       wait: 20;
  223.       afterimage: 'user', 3, 3;
  224.       pose: 'user', 0, 2, -2, -1, 16;
  225.       move: 'user', 'targets', -80, 0, 0, 20;
  226.       wait: 20;
  227.       weapon: 'user', 2, -8, 0, 50, 10, false, false;
  228.       animation: 'target', -1, false;
  229.       damage;
  230.       wait: 20;
  231.       move: 'user', 'origin', 0, 0, 20, 20;
  232.       move: 'target', 'origin', 0, 0, 20, 20;
  233.       wait: 20;
  234.       zoom camera: 100, 20;
  235.       move camera: 'screen', 272, 208, 20;      
  236.       wait: 20;
  237.       afterimage: 'user', 0;  
  238.     </sequence>

  239.     # called when the user dies
  240.     <sequence:die>
  241.       opacity: 'user', 255, 20;
  242.       pose: 'user', 0, 3, 1, -1, 16;
  243.       angle: 'user', -90, 20;
  244.       wait: 20;
  245.     </sequence>

  246.     # called when the user is dead when enters the battle
  247.     <sequence:dead>
  248.       opacity: 'user', 255, 20;
  249.       pose: 'user', 0, 3, 1, -1, 16;
  250.       angle: 'user', -90, 1;
  251.       wait: 20;
  252.     </sequence>   
  253.    
  254.     # called when the user revives
  255.     <sequence:revive>
  256.       pose: 'user', 0, 2, 1, -1, 16;
  257.       angle: 'user', 0, 20;   
  258.       wait: 20;
  259.     </sequence>   
  260.    
  261.     # called when the user wins
  262.     <sequence:victory>
  263.       move: 'user', 'origin', 0, 0, 20, 14;
  264.       pose: 'user', 0, 0, 0, 1;
  265.       wait: 2;
  266.       pose: 'user', 0, 1, 0, 1;
  267.       wait: 2;
  268.       pose: 'user', 0, 2, 0, 1;
  269.       wait: 2;
  270.       pose: 'user', 0, 3, 0, 1;
  271.       wait: 2;
  272.       pose: 'user', 0, 0, 0, 1;
  273.       wait: 2;
  274.       pose: 'user', 0, 1, 0, 1;
  275.       wait: 2;
  276.       pose: 'user', 0, 2, 0, 1;
  277.       wait: 2;
  278.       move: 'user', 'origin', Graphics.width, 0, 0, 120;
  279.       wait: 120;
  280.     </sequence>

  281.     # called when the user runs to protect someone
  282.     #(the target is the person to protect, and the user is the substitute)
  283.     <sequence:substitute>
  284.       balloon: 'user', 1;
  285.       wait: 60;   
  286.       opacity: 'user', 0, 20;
  287.       opacity: 'target', 0, 20;
  288.       wait: 20;
  289.       move: 'user', 'target', 0, 0, 8, 1;
  290.       move: 'target', 'user',  0, 0, 8, 1;
  291.       wait: 20;
  292.       opacity: 'user', 255, 20;
  293.       opacity: 'target', 255, 20;  
  294.       wait: 20;
  295.     </sequence>

  296.     # called when a magic is reflected
  297.     <sequence:reflect>
  298.       animation: 'user', 94, false;
  299.       wait: 20;
  300.     </sequence>

  301.     # called when the item does not have an attack animation
  302.     <sequence:item>
  303.       pose: 'user', 0, 2, -2, -1, 9;  
  304.       move: 'user', 'origin', 32, 0, 0, 20;
  305.       wait: 20;
  306.       pose: 'user', 0, 0, 1, -1, 12;     
  307.       show pic: 1, 0, 1, 0, 0, 0, 0, 0, 0;
  308.       move pic ex: 1, 'user', 0, 0, 1;
  309.       wait: 1;
  310.       move pic ex: 1, 'user', 0, -16, 20;
  311.       zoom pic: 1, 100, 100, 20;
  312.       opacity pic: 1, 255, 20;
  313.       wait: 20;
  314.       animation: 'target', 0;
  315.       damage;
  316.       wait: 20;
  317.       zoom pic: 1, 0, 0, 20;
  318.       opacity pic: 1, 0, 20;
  319.       wait: 20;
  320.       delete pic: 1;
  321.       pose: 'user', 0, 1, -2, -1, 9;
  322.       move: 'user', 'origin', 0, 0, 0, 20;
  323.       wait: 20;
  324.       pose: 'user', 0, 2, -2, -1, 12;
  325.       wait: 20;        
  326.      
  327.     </sequence>

  328.     # called when the skill does not have an attack animation
  329.     <sequence:skill>
  330.       pose: 'user', 0, 2, -2, -1, 9;  
  331.       move: 'user', 'origin', 32, 0, 0, 20;
  332.       wait: 20;
  333.       weapon: 'user', -2, -12, -45, 45, 11, false, false;
  334.       animation: 'user', 81;
  335.       wait: 10;
  336.       weapon: 'user', 2, -12, 45, 45, 50, false, false;
  337.       wait: 50;
  338.       check reflect;
  339.       animation: 'target', 0;
  340.       damage;
  341.       wait: 20;   
  342.       pose: 'user', 0, 1, -2, -1, 9;
  343.       move: 'user', 'origin', 0, 0, 0, 20;
  344.       wait: 20;   
  345.       pose: 'user', 0, 2, -2, -1, 12;
  346.       wait: 20;         
  347.     </sequence>

  348.     # called when the user is standig you can get it with states too.
  349.     <sequence:stand>
  350.     </sequence>

  351.     # called when the user is standig you can get it with states too.
  352.     <sequence:return position>
  353.       opacity: 'user', 0, 20;
  354.       wait: 20;
  355.       move: 'user', 'origin', 0, 0, 0, 1;
  356.       opacity: 'user', 255, 20;
  357.       wait: 20;      
  358.     </sequence>   
  359.    
  360.     # called when the user evades an attack
  361.     <sequence:evade>
  362.     </sequence>

  363.     # called when the target misses
  364.     <sequence:miss>
  365.     </sequence>  
  366.    
  367.     # called when the actor is selecting something.
  368.     <sequence:action selection>
  369.     </sequence>
  370.   "
  371.   
  372. end

  373. #==============================================================================
  374. # ?Vocab
  375. #------------------------------------------------------------------------------
  376. #  ?????????????????????????????????????
  377. # ??????????? $data_system ??????????????
  378. #==============================================================================

  379. module Vocab  
  380.   
  381.   Error_CommandNotRecognized = 'The command %s is not recognized by the system'
  382.   Error_TagSintaxError = 'There is an error in your syntax'
  383.   Error_ScreenNotValid = 'The screen cannot be targeted in this way'
  384.   Error_OriginNotValid = 'The origin cannot be targeted in this way'
  385. end

  386. $imported = {} if $imported.nil?
  387. $imported['Ramiro-RBS'] = true
  388. #===============================================================================
  389. # ** RBS - Ramiro's Battle System (PART II - Classes And Modules)
  390. # Version 2.0
  391. # Difficulty Very Hard.
  392. #-------------------------------------------------------------------------------
  393. # If you don't know what to do... DO NOT EDIT THIS FILE.
  394. #-------------------------------------------------------------------------------
  395. # YANFLY SCRIPTS COMPATIBILITY:
  396. #
  397. # Common ways to test if an YF script works:
  398. #
  399. # First of all, put the Unlisted YEA script BEFORE the RBS, why before? because
  400. # YEA is 'older' (in terms of published date) and the compatibility patches are
  401. # made with the RBS (that supports a way to mix both battle systems altogether)
  402. #
  403. # If the script does not work properly, you may put it AFTER RBS and TRY AGAIN.
  404. #
  405. # If even with that change the script does not work, you may then call it a
  406. # "compatibility issue" and I will, eventually, make a patch for it.
  407. #
  408. # Why are you making compatibility patches?
  409. #
  410. # It's quite simple, YF scripts sometimes overrite some methods that I had to
  411. # alias or vice-versa. in that cases, Yanfly or I should need to make a Patch.
  412. # To run the scripts toguether.
  413. #
  414. # The next section will show HOW TO APPLY each script, knowkn in wich order
  415. # and if it needs or not this patch.
  416. #
  417. #
  418. #
  419. # List of Compatible YEA scripts:
  420. # BATTLE SCRIPTS:
  421. #  - Ace Battle Engine (Insert BEFORE RBS)
  422. #           Known Issues: Disable one of the popup systems or YEA popup or
  423. #                         RBS popup.
  424. #  - Lunatic Objects (Doesn't infleunce the place)
  425. #           Known Issues: None.
  426. #  - TargetManager (Doesn't infleunce the place)
  427. #           Known Issues: None.
  428. #  - CastAnimations (Doesn't infleunce the place)
  429. #           Known Issues: None.
  430. #
  431. # OTHER YF SCRIPTS:
  432. # Because other YF scripts won't collide with this battle system.
  433. # They should be compatible. If there is an incompatibility issue, just
  434. # ask and I'll do as much as I can to repair it.
  435. #-------------------------------------------------------------------------------
  436. # License:
  437. #Copyright (c) 2012, Ramiro Rojo
  438. #All rights reserved.
  439. #
  440. #Redistribution and use in source and binary forms, with or without
  441. #modification, are permitted provided that the following conditions are met:
  442. #
  443. #1. Redistributions of source code must retain the above copyright notice, this
  444. #   list of conditions and the following disclaimer.
  445. #2. Redistributions in binary form must reproduce the above copyright notice,
  446. #   this list of conditions and the following disclaimer in the documentation
  447. #   and/or other materials provided with the distribution.
  448. #
  449. #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  450. #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  451. #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  452. #DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  453. #ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  454. #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  455. #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  456. #ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  457. #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  458. #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  459. #
  460. #The views and conclusions contained in the software and documentation are those
  461. #of the authors and should not be interpreted as representing official policies,
  462. #either expressed or implied, of the FreeBSD Project.
  463. #===============================================================================

  464. #===============================================================================
  465. # BEGIN MODULE SECTION
  466. #===============================================================================

  467. module Cache
  468.   
  469.   #-----------------------------------------------------------------------------
  470.   # Constants
  471.   #-----------------------------------------------------------------------------  
  472.   @@icon_bitmaps = {}
  473.   
  474.   def self.get_icon_bitmap(icon_index)
  475.     if !@@icon_bitmaps[icon_index] || @@icon_bitmaps[icon_index].disposed?
  476.       bmp = Bitmap.new(24,24)
  477.       bitmap = Cache.system("Iconset")
  478.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  479.       bmp.blt(0, 0, bitmap, rect)   
  480.       @@icon_bitmaps[icon_index] = bmp
  481.     end
  482.     @@icon_bitmaps[icon_index]
  483.   end
  484.   
  485.   class << self
  486.     alias rbs_cache_clear clear
  487.    
  488.     def clear
  489.       @@icon_bitmaps ||= {}
  490.       @@icon_bitmaps.clear
  491.       rbs_cache_clear
  492.     end
  493.   end
  494.   
  495. end

  496. #===============================================================================
  497. # * BattleCamera module
  498. #-------------------------------------------------------------------------------
  499. # Controls the camera`s position on the battlefield.
  500. # It can be zoomed in and out.
  501. #===============================================================================
  502. module BattleCamera
  503.   
  504.   #-----------------------------------------------------------------------------
  505.   # Starts the camera
  506.   #-----------------------------------------------------------------------------
  507.   def self.start
  508.     self.reset
  509.   end
  510.   
  511.   #-----------------------------------------------------------------------------
  512.   # Resets the camera
  513.   #-----------------------------------------------------------------------------  
  514.   def self.reset
  515.     @center_x = Graphics.width  / 2
  516.     @center_y = Graphics.height / 2
  517.     @current_x = @desired_x = @center_x
  518.     @current_y = @desired_y = @center_y
  519.     @current_zoom = @desired_zoom = 1.0
  520.     @zoom_time = 0
  521.     @movement_time = 0
  522.     @target = :screen
  523.   end
  524.   
  525.   #-----------------------------------------------------------------------------
  526.   # Corrects a position
  527.   #-----------------------------------------------------------------------------  
  528.   def self.correct_position(pos, current, current_zoom, center)
  529.     return ((pos - current) * (current_zoom - 1.0) + pos - (current - center))
  530.   end
  531.   
  532.   #-----------------------------------------------------------------------------
  533.   # Corrects the x position given
  534.   #-----------------------------------------------------------------------------  
  535.   def self.correct_x(x)
  536.     return correct_position(x, @current_x, @current_zoom, @center_x)
  537.   end
  538.   
  539.   #-----------------------------------------------------------------------------
  540.   # Corrects the y position given
  541.   #-----------------------------------------------------------------------------  
  542.   def self.correct_y(y)
  543.     return correct_position(y, @current_y, @current_zoom, @center_y)
  544.   end
  545.   
  546.   #-----------------------------------------------------------------------------
  547.   # Corrects the zoom given
  548.   #-----------------------------------------------------------------------------  
  549.   def self.correct_zoom(zoom, x=nil, y=nil, zoom_effective=true)
  550.     if BattleConfig::BattleCamera_UsePanoramicCamera
  551.       if !x || !y || !zoom_effective
  552.         return zoom * @current_zoom
  553.       else
  554.         return ((y - @center_y * 130 / 100) * 0.005 + 1.0) * @current_zoom
  555.       end  
  556.     else
  557.       return zoom * @current_zoom
  558.     end  
  559.   end
  560.   
  561.   #-----------------------------------------------------------------------------
  562.   # Corrects the angle given
  563.   #-----------------------------------------------------------------------------  
  564.   def self.correct_angle(angle)
  565.     return angle
  566.   end
  567.   
  568.   #-----------------------------------------------------------------------------
  569.   # Corrects the mirror value given
  570.   #-----------------------------------------------------------------------------  
  571.   def self.correct_mirror(mirror)
  572.     return mirror
  573.   end
  574.   
  575.   #-----------------------------------------------------------------------------
  576.   # Calculates the difference of movement in the frame
  577.   #-----------------------------------------------------------------------------  
  578.   def self.calculate_display_change(current, desired, count)
  579.     ((current * (count - 1) + desired) / count)
  580.   end  
  581.   
  582.   #-----------------------------------------------------------------------------
  583.   # Updates the camera.
  584.   #-----------------------------------------------------------------------------  
  585.   def self.update
  586.     @center_x = Graphics.width  / 2
  587.     @center_y = Graphics.height / 2
  588.     if @zoom_time > 0
  589.       @current_zoom = self.calculate_display_change(@current_zoom, @desired_zoom, @zoom_time)
  590.       @zoom_time -= 1
  591.     end
  592.    
  593.     if @movement_time > 0
  594.       @current_x = self.calculate_display_change(@current_x, @desired_x, @movement_time)
  595.       @current_y = self.calculate_display_change(@current_y, @desired_y, @movement_time)
  596.       @movement_time -= 1
  597.     end
  598.    
  599.     if @target != :screen && !moving?
  600.       cx = 0
  601.       cy = 0
  602.       @target.each do |i|
  603.         cx += i.current_x
  604.         cy += i.current_y
  605.       end
  606.       if @target.size > 0
  607.         cx /= @target.size
  608.         cy /= @target.size
  609.       end
  610.       @current_x = cx
  611.       @current_y = cy
  612.     end  

  613.   end
  614.   
  615.   #-----------------------------------------------------------------------------
  616.   # Sets the movement of the Camera.
  617.   #-----------------------------------------------------------------------------  
  618.   def self.set_movement(x, y, time)
  619.     @desired_x = x
  620.     @desired_y = y
  621.     @movement_time = time
  622.   end
  623.   
  624.   #-----------------------------------------------------------------------------
  625.   # Sets the zoom of the Camera.
  626.   #-----------------------------------------------------------------------------   
  627.   def self.set_zoom(zoom, time)
  628.     @desired_zoom = zoom
  629.     @zoom_time = time
  630.   end  
  631.   
  632.   #-----------------------------------------------------------------------------
  633.   # Sets the target of the Camera.
  634.   #-----------------------------------------------------------------------------   
  635.   def self.set_target(target)
  636.     @target = target
  637.   end   
  638.   
  639.   #-----------------------------------------------------------------------------
  640.   # Checks if the camera is moving.
  641.   #-----------------------------------------------------------------------------   
  642.   def self.moving?
  643.     return ( @movement_time > 0 || @zoom_time > 0 )
  644.   end
  645.   
  646. end

  647. #===============================================================================
  648. # * BattleInterpreter module
  649. #-------------------------------------------------------------------------------
  650. # This module manages the battle's actions and keeps track of all of them.
  651. # it can read commands for using in battle animations.
  652. #===============================================================================
  653. module BattleInterpreter
  654.   
  655.   #-----------------------------------------------------------------------------
  656.   # CONSTANTS
  657.   #-----------------------------------------------------------------------------  
  658.   Commands = {}
  659.   
  660.   #=============================================================================
  661.   # * BattleInterpreter::Action
  662.   #-----------------------------------------------------------------------------
  663.   # An action used by the battle interpreter module.
  664.   # It stores information of the action used and process part of them.
  665.   #=============================================================================
  666.   class Action
  667.    
  668.     #---------------------------------------------------------------------------
  669.     # Class properties
  670.     #---------------------------------------------------------------------------  
  671.     attr_reader   :original_user
  672.     attr_reader   :original_target
  673.     attr_accessor :user
  674.     attr_accessor :targets
  675.     attr_accessor :item
  676.     attr_accessor :loop_depth
  677.     attr_accessor :linked_actions
  678.     attr_accessor :paused
  679.    
  680.     #---------------------------------------------------------------------------
  681.     # Starts an action
  682.     #---------------------------------------------------------------------------      
  683.     def initialize(spriteset, user, targets, sequence, item, can_counter=true)
  684.       @extra_affected_battlers = []
  685.       @sequence = sequence
  686.       [url=home.php?mod=space&uid=103426]@User[/url] = user
  687.       @targets = targets
  688.       @item = item
  689.       @loop_depth = 0
  690.       @wait_count = 0
  691.       @original_user = user
  692.       @original_targets = targets
  693.       @spriteset = spriteset
  694.       @counter_check = can_counter
  695.       @linked_actions = []
  696.       @paused = false
  697.       compile_data
  698.     end  
  699.    
  700.     #---------------------------------------------------------------------------
  701.     # Checks if a counter can be realized
  702.     #---------------------------------------------------------------------------   
  703.     def counter_active?
  704.       return @counter_check
  705.     end
  706.    
  707.     #---------------------------------------------------------------------------
  708.     # Evaluates parameters
  709.     #---------------------------------------------------------------------------   
  710.     def eval_data(data)
  711.       make_parameters(data)[0]
  712.     end
  713.    
  714.     #---------------------------------------------------------------------------
  715.     # Sets the wait time of the action
  716.     #---------------------------------------------------------------------------   
  717.     def wait(wait)
  718.       @wait_count = wait
  719.     end
  720.    
  721.     #---------------------------------------------------------------------------
  722.     # Makes the parameters for an action
  723.     #---------------------------------------------------------------------------   
  724.     def make_parameters(parameters)
  725.       return [] if !parameters
  726.       a = @user
  727.       b = @targets[0]
  728.       t = @targets
  729.       s = $game_siwtches
  730.       v = $game_variables
  731.       result = []
  732.       parameters.split(',').each do |i|
  733.         r = Kernel.eval(i) rescue nil
  734.         result.push(r)
  735.       end  
  736.       return result
  737.     end
  738.    
  739.     #---------------------------------------------------------------------------
  740.     # Compiles the data for the action
  741.     #---------------------------------------------------------------------------   
  742.     def compile_data
  743.       @commands = []
  744.       @sequence.split(';').each do |line|
  745.         next if (line.gsub(/\s/mi) {''}) == ''
  746.         line += ';'
  747.         if line[/((\s+)?)(.*?)(:(.*?))?;/mi]
  748.           @commands.push([$3.upcase, make_parameters($5)])
  749.         end  
  750.       end
  751.     end
  752.    
  753.     #---------------------------------------------------------------------------
  754.     # Updates the action
  755.     #---------------------------------------------------------------------------   
  756.     def update
  757.       return if @paused
  758.       if (@wait_count && @wait_count > 0)
  759.         @wait_count -= 1
  760.         return
  761.       end
  762.       call_next_command
  763.     end
  764.    
  765.     #---------------------------------------------------------------------------
  766.     # Calls next command
  767.     #---------------------------------------------------------------------------   
  768.     def call_next_command
  769.       return if @commands.size == 0 || (@wait_count && @wait_count > 0)
  770.       initial_depth = current_depth = @loop_depth
  771.       command, params = next_command
  772.       raise sprintf(Vocab::Error_CommandNotRecognized, command) if !Commands[command]
  773.       has_depth, link_method = Commands[command]
  774.       current_depth += 1
  775.       result = []
  776.       if has_depth
  777.         while initial_depth != current_depth && @commands.size > 0
  778.           i = next_command
  779.           nested_command, nested_params = i
  780.           if Commands[nested_command] && Commands[nested_command][0]
  781.             current_depth += 1
  782.           elsif nested_command[/END/mi]  
  783.             current_depth -= 1
  784.           end
  785.           result.push(i)
  786.         end
  787.         if initial_depth == current_depth
  788.           params.push(result)
  789.           @loop_depth += 1
  790.         else
  791.           raise Vocab::Error_TagSintaxError
  792.         end        
  793.       end
  794.       link_method.call(self, params)
  795.       call_next_command
  796.     end
  797.    
  798.     #---------------------------------------------------------------------------
  799.     # Gets the next command
  800.     #---------------------------------------------------------------------------   
  801.     def next_command
  802.       @commands.shift
  803.     end
  804.    
  805.     #---------------------------------------------------------------------------
  806.     # Insert commands as next
  807.     #---------------------------------------------------------------------------   
  808.     def insert_commands_as_next(commands)
  809.       @commands = commands + @commands
  810.     end
  811.    
  812.     #---------------------------------------------------------------------------
  813.     # Checks if the action is running
  814.     #---------------------------------------------------------------------------   
  815.     def running?
  816.       return (@commands.size > 0 || @wait_count > 0)
  817.     end
  818.    
  819.     #---------------------------------------------------------------------------
  820.     # Pauses the action
  821.     #---------------------------------------------------------------------------   
  822.     def pause
  823.       @paused = true
  824.     end
  825.    
  826.     #---------------------------------------------------------------------------
  827.     # Checks if the action is paused
  828.     #---------------------------------------------------------------------------   
  829.     def paused?
  830.       @paused
  831.     end
  832.    
  833.     #---------------------------------------------------------------------------
  834.     # Resumes the action
  835.     #---------------------------------------------------------------------------   
  836.     def resume
  837.       @paused = false
  838.       call_next_command
  839.     end
  840.    
  841.     #---------------------------------------------------------------------------
  842.     # Stops the action
  843.     #---------------------------------------------------------------------------   
  844.     def abort
  845.       @commands.clear
  846.       @wait_count = 0
  847.     end
  848.    
  849.     #---------------------------------------------------------------------------
  850.     # Analizes targets by a string
  851.     #---------------------------------------------------------------------------   
  852.     def analize_target_string(string, origin_valid = true, screen_valid = false)
  853.       case string
  854.       when /(.*?) except (.*)/im
  855.         t1 = analize_target_string($1, origin_valid, screen_valid)
  856.         t2 = analize_target_string($2, origin_valid, screen_valid)
  857.         return t1 - t2
  858.       when /(.*?) but (.*)/im
  859.         t1 = analize_target_string($1, origin_valid, screen_valid)
  860.         t2 = analize_target_string($2, origin_valid, screen_valid)
  861.         return t1 - t2        
  862.       when /(\d+) random ([\w\s]+)/im
  863.         num = $1.to_i
  864.         targets = analize_target_string($2, false, false)
  865.         result = []
  866.         num.times do |i|
  867.           result.push(targets[rand(targets.size)])
  868.         end  
  869.         return result
  870.       when /original (\w+)/im
  871.         case $1
  872.         when /user/im
  873.           return [@original_user]
  874.         when /target(s?)/im
  875.           return @original_targets
  876.         end  
  877.       when /dead battler(s?)/im
  878.           return $game_troop.dead_members + $game_party.dead_members         
  879.       when /dead all(y||es)/im
  880.         case @user.confusion_level
  881.         when 0
  882.           return @user.friend_unit.dead_members
  883.         when 1
  884.           return @[email protected]_unit.dead_members
  885.         when 2
  886.           return @user.enemy_unit.dead_members
  887.         end
  888.       when /dead enem(y||ies)/im
  889.         case @user.confusion_level
  890.         when 0
  891.           return @user.enemy_unit.dead_members
  892.         when 1
  893.           return @[email protected]_unit.dead_members
  894.         when 2
  895.           return @user.friend_unit.dead_members
  896.         end         
  897.       when /battler(s?)/im
  898.           return $game_troop.alive_members + $game_party.alive_members
  899.       when /all(y||es)/im
  900.         case @user.confusion_level
  901.         when 0
  902.           return @user.friend_unit.alive_members
  903.         when 1
  904.           return @[email protected]_unit.alive_members
  905.         when 2
  906.           return @user.enemy_unit.alive_members
  907.         end  
  908.       when /friend(s?)/im
  909.         case @user.confusion_level
  910.         when 0
  911.           group = @user.friend_unit.alive_members
  912.         when 1
  913.           group = @[email protected]_unit.alive_members
  914.         when 2
  915.           group = @user.enemy_unit.alive_members
  916.         end   
  917.         return group - [@user]
  918.       when /enem(y||ies)/im
  919.         case @user.confusion_level
  920.         when 0
  921.           return @user.enemy_unit.alive_members
  922.         when 1
  923.           return @[email protected]_unit.alive_members
  924.         when 2
  925.           return @user.friend_unit.alive_members
  926.         end         
  927.       when /target(s?)/im  
  928.         return @targets
  929.       when /user/im
  930.         return [@user]
  931.       when /screen/im
  932.         if screen_valid
  933.           return :screen
  934.         else
  935.           raise Vocab::Error_ScreenNotValid
  936.         end  
  937.       when /origin/im
  938.         if origin_valid
  939.           return :origin
  940.         else
  941.           raise Vocab::Error_OriginNotValid
  942.         end         
  943.       end
  944.       return nil
  945.       
  946.     end
  947.    
  948.     #---------------------------------------------------------------------------
  949.     # Get the sprites of battlers.
  950.     #---------------------------------------------------------------------------   
  951.     def get_battler_sprites(battlers)
  952.       result = []
  953.       @spriteset.battler_sprites.each do |i|
  954.         result.push(i) if battlers.any? {|j| i.battler == j }
  955.       end
  956.       return result
  957.     end
  958.    
  959.     #---------------------------------------------------------------------------
  960.     # gets the battler sprites of a determined target string
  961.     #---------------------------------------------------------------------------   
  962.     def analize_battler_sprites_string(string, origin_valid = true, screen_valid = false)
  963.       battlers = analize_target_string(string, origin_valid, screen_valid)
  964.       return battlers if battlers.is_a?(Symbol)
  965.       return battlers ? get_battler_sprites(battlers) : []
  966.     end
  967.    
  968.     def affected_battlers   
  969.       targets + [user] + @extra_affected_battlers   
  970.     end
  971.    
  972.   end
  973.   
  974.   class LoopingAction < BattleInterpreter::Action
  975.       
  976.     def next_command
  977.       new_command = @commands.shift
  978.       @commands.push(new_command)
  979.       return new_command
  980.     end
  981.       
  982.   end  
  983.   
  984.   #-----------------------------------------------------------------------------
  985.   # Starts the interpreter
  986.   #-----------------------------------------------------------------------------
  987.   def self.start(spriteset)
  988.     self.reset
  989.     @spriteset = spriteset
  990.   end

  991.   #-----------------------------------------------------------------------------
  992.   # Resets the interpreter
  993.   #-----------------------------------------------------------------------------   
  994.   def self.reset
  995.     Commands.clear
  996.     @looping_actions = {}
  997.     @actions = []
  998.   end  
  999.   
  1000.   #-----------------------------------------------------------------------------
  1001.   # Adds an action
  1002.   #-----------------------------------------------------------------------------   
  1003.   def self.add_action(user, targets, sequence, item, can_counter = true)
  1004.     action = BattleInterpreter::Action.new(@spriteset, user, targets, sequence, item, can_counter)
  1005.     @actions.push(action)
  1006.     action
  1007.   end
  1008.   
  1009.   #-----------------------------------------------------------------------------
  1010.   # Updates the interpreter
  1011.   #-----------------------------------------------------------------------------   
  1012.   def self.update
  1013.     current_battlers = []
  1014.     @actions.each do |i|
  1015.       i.update
  1016.       if i.running?
  1017.         i.affected_battlers.each do |j|
  1018.           current_battlers.push(j)
  1019.         end
  1020.       else  
  1021.         @actions.delete(i)
  1022.       end  
  1023.     end  
  1024.     @looping_actions.each_pair do |battler, action|
  1025.       action.update if !current_battlers.include?(battler)
  1026.     end  
  1027.   end
  1028.   
  1029.   #-----------------------------------------------------------------------------
  1030.   # Checks if the interpreter is running
  1031.   #-----------------------------------------------------------------------------   
  1032.   def self.running?
  1033.     return true if @actions.any? {|i| i.running? && !i.paused?}
  1034.     return true if BattleCamera.moving?
  1035.     return true if @spriteset.animation?
  1036.     return false
  1037.   end
  1038.   
  1039.   #-----------------------------------------------------------------------------
  1040.   # Adds a looping action to an user
  1041.   #-----------------------------------------------------------------------------   
  1042.   def self.add_looping_action(user, sequence)
  1043.     action = BattleInterpreter::LoopingAction.new(@spriteset, user, [user], sequence, nil)
  1044.     @looping_actions[user] = action
  1045.     action   
  1046.   end
  1047.   
  1048.   def self.pause_looping_action(user)
  1049.     @looping_actions[user].pause if @looping_actions[user]
  1050.   end
  1051.   
  1052.   def self.resume_looping_action(user)
  1053.     @looping_actions[user].resume if @looping_actions[user]
  1054.   end
  1055.   
  1056. end

  1057. #==============================================================================
  1058. # ?BattleManager
  1059. #==============================================================================

  1060. module BattleManager
  1061.   
  1062.   #-----------------------------------------------------------------------------
  1063.   # Checks if the battle is a surprise battle
  1064.   #-----------------------------------------------------------------------------   
  1065.   def self.surprise?
  1066.     return @surprise
  1067.   end
  1068.   
  1069.   #-----------------------------------------------------------------------------
  1070.   # Checks if the battle is a preemptive battle
  1071.   #-----------------------------------------------------------------------------   
  1072.   def self.preemptive?
  1073.     return @preemptive
  1074.   end
  1075.   
  1076.   class << self
  1077.    
  1078.     #---------------------------------------------------------------------------
  1079.     # Alias methods
  1080.     #---------------------------------------------------------------------------
  1081.     alias rbs_battle_manager_process_victory process_victory
  1082.    
  1083.     #-----------------------------------------------------------------------------
  1084.     # Process victory
  1085.     #-----------------------------------------------------------------------------     
  1086.     def process_victory
  1087.       for member in $game_party.alive_members
  1088.         sequence = member.get_victory_sequence
  1089.         BattleInterpreter.add_action(member, [member], sequence, nil, false)
  1090.       end
  1091.       rbs_battle_manager_process_victory
  1092.     end  
  1093.   end
  1094.   
  1095. end
  1096. #===============================================================================
  1097. # END MODULE SECTION
  1098. #===============================================================================
  1099. #===============================================================================
  1100. # BEGIN SPRITE SECTION
  1101. #===============================================================================

  1102. #===============================================================================
  1103. # ?Sprite_Battler
  1104. #===============================================================================
  1105. class Sprite_Battler < Sprite_Base
  1106.   
  1107.   #-----------------------------------------------------------------------------
  1108.   # Alias methods
  1109.   #-----------------------------------------------------------------------------   
  1110.   alias rbs_sprite_battler_initialize initialize
  1111.   alias rbs_sprite_battler_update update
  1112.   alias rbs_sprite_battler_animation? animation?
  1113.   alias rbs_sprite_battler_dispose dispose
  1114.   
  1115.   #-----------------------------------------------------------------------------
  1116.   # Class Properties
  1117.   #-----------------------------------------------------------------------------   
  1118.   attr_reader :current_x
  1119.   attr_reader :current_y
  1120.   attr_reader :original_x
  1121.   attr_reader :original_y
  1122.   
  1123.   #-----------------------------------------------------------------------------
  1124.   # Resets the position.
  1125.   #-----------------------------------------------------------------------------
  1126.   def reset_position
  1127.     @character_started = true
  1128.     @original_battler = @battler
  1129.     @original_x = @battler.screen_x
  1130.     @original_y = @battler.screen_y
  1131.     @current_x = @desired_x = @original_x
  1132.     @current_y = @desired_y = @original_y   
  1133.     @jump_count = 0
  1134.     @jump_axis  = 0
  1135.     @jump_value = 0
  1136.     @movement_count = 0
  1137.     @frame_count = 0
  1138.     @frame_delay = 16
  1139.     @last_battler = battler
  1140.     @battler_index = @battler.default_battler_index
  1141.     @frame = 0
  1142.     @pose  = 0
  1143.     @poses = 1
  1144.     @frames = 1
  1145.     @frame_style = :rmvx
  1146.     @loops = 0
  1147.     @last_battle_index = 0
  1148.     @desired_zoom_x = @current_zoom_x = 1
  1149.     @desired_zoom_y = @current_zoom_y = 1
  1150.     @current_angle = @desired_angle = 0
  1151.     @angle_time = 0   
  1152.     @zoom_time = 0   
  1153.     @current_opacity = @desired_opacity = 0
  1154.     @opacity_time = 0   
  1155.     @battler_name_result = @battler.battler_name
  1156.     @mirrored_sprite = false
  1157.     @effect_opacity = 255
  1158.     @effect_ox  = 0
  1159.     @effect_height = 0   
  1160.     @balloon_id = 0
  1161.     @need_refresh = true
  1162.     @last_battler = nil
  1163.     @last_battler_name = ''
  1164.     @last_battler_hue = 0
  1165.   end
  1166.   
  1167.   def make_return_sequence
  1168.     return if !@battler
  1169.     seq = ''
  1170.     if (@original_x != @current_x) || (@original_y != @current_y)
  1171.       seq = @battler.get_return_sequence
  1172.     end  
  1173.     BattleInterpreter.add_action(@battler, [@battler], seq, nil, false)
  1174.     if @battler.alive?
  1175.       BattleInterpreter.add_looping_action(@battler, @battler.get_stand_sequence)
  1176.     end
  1177.   end
  1178.   
  1179.   #-----------------------------------------------------------------------------
  1180.   # Sets the mirror value
  1181.   #-----------------------------------------------------------------------------
  1182.   def set_mirror_value(value)
  1183.     @mirrored_sprite = value
  1184.   end

  1185.   #-----------------------------------------------------------------------------
  1186.   # Creates the sprite
  1187.   #-----------------------------------------------------------------------------   
  1188.   def initialize(viewport, battler=nil)
  1189.     @weapon_sprites = []
  1190.     @character_started = false
  1191.     @afterimages = []
  1192.     @afterimages_visible = false
  1193.     @afterimage_separation = 8
  1194.     @animation_reg = []   
  1195.     rbs_sprite_battler_initialize(viewport, battler)
  1196.   end
  1197.    
  1198.   #-----------------------------------------------------------------------------
  1199.   # Dispose
  1200.   #-----------------------------------------------------------------------------   
  1201.   def dispose
  1202.     #dispose_damage_sprites
  1203.     dispose_afterimages
  1204.     dispose_weapon_sprites
  1205.     dispose_balloon
  1206.     rbs_sprite_battler_dispose
  1207.   end
  1208.   
  1209.   #-----------------------------------------------------------------------------
  1210.   # Dispose afterimages
  1211.   #-----------------------------------------------------------------------------   
  1212.   def dispose_afterimages
  1213.     @afterimages.each do |i|
  1214.       i.dispose
  1215.     end  
  1216.     @afterimages.clear
  1217.   end
  1218.   
  1219.   #-----------------------------------------------------------------------------
  1220.   # Dispose weapon sprites
  1221.   #-----------------------------------------------------------------------------   
  1222.   def dispose_weapon_sprites
  1223.     @weapon_sprites.each do |i|
  1224.       i.dispose
  1225.     end  
  1226.   end
  1227.   
  1228.   #-----------------------------------------------------------------------------
  1229.   # Checks if the sprite is moving?
  1230.   #-----------------------------------------------------------------------------   
  1231.   def moving?
  1232.     return false if !@battler
  1233.     return (@movement_count > 0 || @angle_time > 0 || @zoom_time > 0 || @opacity_time > 0 )
  1234.   end
  1235.   
  1236.   #--------------------------------------------------------------------------
  1237.   # ? Update blink effect
  1238.   #--------------------------------------------------------------------------
  1239.   def update_blink
  1240.     @effect_opacity = (@effect_duration % 10 < 5) ? 255 : 0
  1241.   end
  1242.   #--------------------------------------------------------------------------
  1243.   # ? Opdates appear effect
  1244.   #--------------------------------------------------------------------------
  1245.   def update_appear
  1246.     @effect_opacity = (16 - @effect_duration) * 16
  1247.   end
  1248.   #--------------------------------------------------------------------------
  1249.   # ? Opdates disappear effect
  1250.   #--------------------------------------------------------------------------
  1251.   def update_disappear
  1252.     @effect_opacity = 256 - (32 - @effect_duration) * 10
  1253.   end
  1254.   #--------------------------------------------------------------------------
  1255.   # ? Update collapse effect
  1256.   #--------------------------------------------------------------------------
  1257.   def update_collapse
  1258.     self.blend_type = 1
  1259.     self.color.set(255, 128, 128, 128)
  1260.     @effect_opacity = 256 - (48 - @effect_duration) * 6
  1261.   end  
  1262.   
  1263.   #--------------------------------------------------------------------------
  1264.   # ? Reverts the sprite to normal
  1265.   #--------------------------------------------------------------------------
  1266.   def revert_to_normal
  1267.     self.blend_type = 0
  1268.     self.color.set(0, 0, 0, 0)
  1269.     @effect_opacity = 255
  1270.     @effect_ox = @battler_width / 2 if bitmap
  1271.     @effect_height = 0
  1272.   end  
  1273.   
  1274.   #--------------------------------------------------------------------------
  1275.   # ? Updates boss collpase
  1276.   #--------------------------------------------------------------------------
  1277.   def update_boss_collapse
  1278.     alpha = @effect_duration * 120 / bitmap.height
  1279.     @effect_ox = @battler_width / 2 + @effect_duration % 2 * 4 - 2
  1280.     self.blend_type = 1
  1281.     self.color.set(255, 255, 255, 255 - alpha)
  1282.     @effect_opacity = alpha
  1283.     @effect_height -= 1
  1284.     Sound.play_boss_collapse2 if @effect_duration % 20 == 19
  1285.   end
  1286.   #--------------------------------------------------------------------------
  1287.   # ?  updates instant collapse
  1288.   #--------------------------------------------------------------------------
  1289.   def update_instant_collapse
  1290.     @effect_opacity = 0
  1291.   end  
  1292.   
  1293.   #-----------------------------------------------------------------------------
  1294.   # Frame update
  1295.   #-----------------------------------------------------------------------------   
  1296.   def update
  1297.     if [url=home.php?mod=space&uid=133701]@battler[/url] && (!@character_started || @battler != @original_battler)
  1298.       reset_position
  1299.     end   
  1300.     set_animation_origin if @animation
  1301.     rbs_sprite_battler_update   
  1302.     if @battler
  1303.       update_battler_position
  1304.       update_battler_pose  
  1305.       update_afterimages
  1306.       update_weapon_sprites
  1307.       update_balloon
  1308.     end  

  1309.   end
  1310.   
  1311.   #-----------------------------------------------------------------------------
  1312.   # Update positions.
  1313.   #-----------------------------------------------------------------------------   
  1314.   def update_battler_position
  1315.     if @movement_count > 0
  1316.       @current_x = BattleCamera.calculate_display_change(@current_x, @desired_x, @movement_count)
  1317.       @current_y = BattleCamera.calculate_display_change(@current_y, @desired_y, @movement_count)
  1318.       if @jump_count > 0
  1319.         @jump_value = BattleCamera.calculate_display_change(@jump_value, @jump_axis, @jump_count)
  1320.         @jump_count -= 1
  1321.       elsif @jump_value != 0
  1322.         @jump_axis = 0
  1323.         @jump_count = @movement_count - 1
  1324.       end  
  1325.       @movement_count -= 1
  1326.     end
  1327.    
  1328.     if @zoom_time > 0
  1329.       @current_zoom_x = BattleCamera.calculate_display_change(@current_zoom_x, @desired_zoom_x, @zoom_time)
  1330.       @current_zoom_y = BattleCamera.calculate_display_change(@current_zoom_y, @desired_zoom_y, @zoom_time)
  1331.       @zoom_time -= 1
  1332.     end
  1333.    
  1334.     if @angle_time > 0  
  1335.       @current_angle = BattleCamera.calculate_display_change(@current_angle, @desired_angle, @angle_time)
  1336.       @angle_time -= 1
  1337.     end

  1338.     if @opacity_time > 0  
  1339.        @current_opacity = BattleCamera.calculate_display_change(@current_opacity, @desired_opacity, @opacity_time)
  1340.        @opacity_time -= 1      
  1341.     end
  1342.    
  1343.     self.x = BattleCamera.correct_x( @current_x )
  1344.     self.y = BattleCamera.correct_y( @current_y - @jump_value - @effect_height / 2)   
  1345.     self.z = @current_y + 100     
  1346.     self.zoom_x = BattleCamera.correct_zoom(@current_zoom_x, @current_x, @current_y, @battler.zoom_effective?)
  1347.     self.zoom_y = BattleCamera.correct_zoom(@current_zoom_y, @current_x, @current_y, @battler.zoom_effective?)
  1348.     self.angle =  BattleCamera.correct_angle(@current_angle)
  1349.     self.mirror = BattleCamera.correct_mirror(@battler.enemy? ? @mirrored_sprite : !@mirrored_sprite)
  1350.     self.opacity = @current_opacity * @effect_opacity / 255
  1351.   end
  1352.   
  1353.   #-----------------------------------------------------------------------------
  1354.   # Get the max frame number
  1355.   #-----------------------------------------------------------------------------   
  1356.   def max_frames
  1357.     return @frame_style == -2 ? @frames * 2 : @frames
  1358.   end
  1359.   
  1360.   #-----------------------------------------------------------------------------
  1361.   # Gets the real frame number
  1362.   #-----------------------------------------------------------------------------
  1363.   def real_frame
  1364.     return @frame < @frames ? @frame : (max_frames - @frame - 1)
  1365.   end
  1366.   
  1367.   #-----------------------------------------------------------------------------
  1368.   # Updates the current pose
  1369.   #-----------------------------------------------------------------------------   
  1370.   def update_battler_pose
  1371.    
  1372.     if @loops != 0
  1373.       if @frame_style < 0
  1374.         @frame_count = (@frame_count + 1) % @frame_delay
  1375.         if @frame_count == 0
  1376.           @frame = (@frame + 1) % max_frames
  1377.           @loops -= 1 if  @frame == 0 && @loops > 0
  1378.         end
  1379.       else
  1380.         @frame = @frame_style
  1381.       end
  1382.     end  
  1383.     o_x = @battler_width  * real_frame
  1384.     o_y = @battler_height * @pose + @effect_height
  1385.     bh  = [@battler_height + @effect_height, 1].max
  1386.     self.src_rect.set(o_x, o_y, @battler_width, bh)
  1387.   end

  1388.   #-----------------------------------------------------------------------------
  1389.   # Makes the new battler name
  1390.   #-----------------------------------------------------------------------------   
  1391.   def make_battler_name
  1392.     if @need_refresh || @last_battler != self.battler ||
  1393.           @last_battler_name != battler.battler_name ||
  1394.           @last_battler_hue != battler.battler_hue
  1395.       @last_battler_name = battler.battler_name
  1396.       @last_battler_hue = battler.battler_hue         
  1397.       @need_refresh = false
  1398.       @last_battler = self.battler
  1399.       battler_name = @battler.battler_name.sub(/\[(\d+),(\d+)\]/i) { '' }   
  1400.       battler_name = @battler_index == 0 ? @battler.battler_name : "#{@battler.battler_name}_#{@battler_index}"
  1401.       files = Dir.glob("Graphics/Battlers/#{battler_name}*")
  1402.       @battler_name_result = (files.size > 0) ? files[0] : battler_name
  1403.       @battler_name_result.gsub! (/Graphics\/Battlers\//mi) {''}
  1404.     end  
  1405.     return @battler_name_result
  1406.   end
  1407.   
  1408.   #-----------------------------------------------------------------------------
  1409.   # Updates the bitmap
  1410.   #-----------------------------------------------------------------------------   
  1411.   def update_bitmap
  1412.     battler_name = make_battler_name
  1413.     new_bitmap = Cache.battler(battler_name, @battler.battler_hue)
  1414.     if bitmap != new_bitmap
  1415.       data = []
  1416.       if battler_name[/\[(.*?),(.*?)\]/i]
  1417.         @frames = eval($1)
  1418.         @poses  = eval($2)
  1419.       else
  1420.         @poses = BattleConfig::DefaultPoses
  1421.         @frames = BattleConfig::DefaultFrames
  1422.       end  
  1423.       @frame_delay = 16
  1424.       @frame_style = -2
  1425.       @loops = -1
  1426.       self.bitmap = new_bitmap
  1427.       @battler_width  = self.bitmap.width  / @frames
  1428.       @battler_height = self.bitmap.height / @poses
  1429.       @effect_ox = @battler_width / 2 if bitmap
  1430.       init_visibility
  1431.     end
  1432.   end

  1433.   #-----------------------------------------------------------------------------
  1434.   # Updates the weapon sprites
  1435.   #-----------------------------------------------------------------------------
  1436.   def update_weapon_sprites
  1437.     @weapon_sprites.each do |i|
  1438.       if i.animation?
  1439.         i.update
  1440.       else
  1441.         i.dispose
  1442.         @weapon_sprites.delete(i)
  1443.       end
  1444.     end  
  1445.   end   

  1446.   #-----------------------------------------------------------------------------
  1447.   # Updates original position.
  1448.   #-----------------------------------------------------------------------------
  1449.   def update_origin
  1450.     if bitmap
  1451.       self.ox = @effect_ox
  1452.       self.oy = @battler_height + @effect_height
  1453.     end
  1454.   end   
  1455.   #-----------------------------------------------------------------------------
  1456.   # Sets the movememnt
  1457.   #-----------------------------------------------------------------------------
  1458.   def set_movement(x, y, jump, time)
  1459.     @desired_x = x
  1460.     @desired_y = y
  1461.     @jump_count = time / 2
  1462.     @jump_axis  = jump
  1463.     @jump_value = 0
  1464.     @movement_count = time   
  1465.   end
  1466.   #-----------------------------------------------------------------------------
  1467.   # Sets the pose
  1468.   #-----------------------------------------------------------------------------
  1469.   def set_pose(character_index, pose, style, loops, interval)
  1470.     @battler_index = character_index
  1471.     @frame = 0
  1472.     @frame_delay = interval
  1473.     @pose  = pose if pose < @poses
  1474.     @frame_style = style
  1475.     @loops = loops
  1476.     @need_refresh = true
  1477.   end
  1478.   #-----------------------------------------------------------------------------
  1479.   # Sets the zoom
  1480.   #-----------------------------------------------------------------------------
  1481.   def set_zoom(x, y, time)
  1482.     @desired_zoom_x = x
  1483.     @desired_zoom_y = y
  1484.     @zoom_time = time
  1485.   end
  1486.   
  1487.   #-----------------------------------------------------------------------------
  1488.   # Sets the angle
  1489.   #-----------------------------------------------------------------------------   
  1490.   def set_angle(angle, time)
  1491.     @desired_angle = angle
  1492.     @angle_time = time
  1493.   end
  1494.   
  1495.   #-----------------------------------------------------------------------------
  1496.   # Sets the opacity
  1497.   #-----------------------------------------------------------------------------   
  1498.   def set_opacity(opacity, time)
  1499.     @desired_opacity = opacity
  1500.     @opacity_time = time   
  1501.   end
  1502.   
  1503.   #-----------------------------------------------------------------------------
  1504.   # Checks if the sprite is on animation
  1505.   #-----------------------------------------------------------------------------   
  1506.   def animation?
  1507.     return rbs_sprite_battler_animation? || moving? || (@effect_duration > 0)
  1508.   end
  1509.   
  1510.   #--------------------------------------------------------------------------
  1511.   # ? Starts new effect
  1512.   #--------------------------------------------------------------------------
  1513.   def start_effect(effect_type)
  1514.     @effect_type = effect_type
  1515.     case @effect_type
  1516.     when :appear
  1517.       @effect_duration = 16
  1518.       @battler_visible = true
  1519.     when :disappear
  1520.       @effect_duration = 32
  1521.       @battler_visible = false
  1522.     when :whiten
  1523.       @effect_duration = 16
  1524.       @battler_visible = true
  1525.     when :blink
  1526.       @effect_duration = 20
  1527.       @battler_visible = true
  1528.     when :collapse
  1529.       @effect_duration = 48
  1530.       @battler_visible = false
  1531.     when :boss_collapse
  1532.       @effect_duration = @battler_height
  1533.       @battler_visible = false
  1534.     when :instant_collapse
  1535.       @effect_duration = 16
  1536.       @battler_visible = false
  1537.     end
  1538.     revert_to_normal
  1539.   end  
  1540.   
  1541.   #-----------------------------------------------------------------------------
  1542.   # Sets the sprites of the animation
  1543.   #-----------------------------------------------------------------------------
  1544.   def animation_set_sprites(frame)
  1545.     cell_data = frame.cell_data
  1546.     @ani_sprites.each_with_index do |sprite, i|
  1547.       next unless sprite
  1548.       pattern = cell_data[i, 0]
  1549.       if !pattern || pattern < 0
  1550.         sprite.visible = false
  1551.         next
  1552.       end
  1553.       sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  1554.       sprite.visible = true
  1555.       sprite.src_rect.set(pattern % 5 * 192,
  1556.         pattern % 100 / 5 * 192, 192, 192)
  1557.       if @ani_mirror
  1558.         sprite.x = @ani_ox - cell_data[i, 1]
  1559.         sprite.y = @ani_oy + cell_data[i, 2]
  1560.         sprite.angle = BattleCamera.correct_angle(360 - cell_data[i, 4])
  1561.         sprite.mirror =  BattleCamera.correct_mirror(cell_data[i, 5] == 0)
  1562.       else
  1563.         sprite.x = @ani_ox + cell_data[i, 1]
  1564.         sprite.y = @ani_oy + cell_data[i, 2]
  1565.         sprite.angle = BattleCamera.correct_angle(cell_data[i, 4])
  1566.         sprite.mirror = BattleCamera.correct_mirror(cell_data[i, 5] == 1)
  1567.       end
  1568.       sprite.z = self.z + 300 + i
  1569.       sprite.ox = 96
  1570.       sprite.oy = 96
  1571.       sprite.zoom_x = BattleCamera.correct_zoom(cell_data[i, 3] / 100.0, @current_x, @current_y, @battler.zoom_effective?)
  1572.       sprite.zoom_y = BattleCamera.correct_zoom(cell_data[i, 3] / 100.0, @current_x, @current_y, @battler.zoom_effective?)
  1573.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  1574.       sprite.blend_type = cell_data[i, 7]
  1575.     end
  1576.   end  
  1577.   
  1578.   #-----------------------------------------------------------------------------
  1579.   # Updates the animation
  1580.   #-----------------------------------------------------------------------------   
  1581.   def update_animation
  1582.     return unless @animation
  1583.     @ani_duration -= 1
  1584.     if @ani_duration % @ani_rate == 0
  1585.       if @ani_duration > 0
  1586.         frame_index = @animation.frame_max
  1587.         frame_index -= (@ani_duration + @ani_rate - 1) / @ani_rate
  1588.         animation_set_sprites(@animation.frames[frame_index])
  1589.         @animation.timings.each do |timing|
  1590.           animation_process_timing(timing) if timing.frame == frame_index
  1591.         end
  1592.       else
  1593.         end_animation
  1594.       end
  1595.     end
  1596.   end  
  1597.   #-----------------------------------------------------------------------------
  1598.   # Updates afterimages
  1599.   #-----------------------------------------------------------------------------
  1600.   def update_afterimages
  1601.     @animation_reg.push([self.bitmap, @current_x, @current_y - @jump_value,
  1602.                          self.z,
  1603.                          @current_zoom_x, @current_zoom_y,
  1604.                          self.src_rect.clone, self.ox, self.oy,
  1605.                          @current_angle, self.mirror])        
  1606.     @afterimages.each_with_index do |afterimage, i|
  1607.       j = @animation_reg.size - ((i + 1) * @afterimage_separation)
  1608.       reg = @animation_reg[j]
  1609.       next if !reg
  1610.       afterimage.update(i, @afterimages.size, reg, self)
  1611.     end  
  1612.   end
  1613.   
  1614.   #-----------------------------------------------------------------------------
  1615.   # Sets the afterimages
  1616.   #-----------------------------------------------------------------------------
  1617.   def set_aftermages(value, count, separation)
  1618.     @afterimages_visible = value
  1619.     dispose_afterimages
  1620.     @afterimages.clear
  1621.     if @afterimages_visible
  1622.       count.times do |i|
  1623.         @afterimages.push(Sprite_Afterimage.new(viewport))
  1624.       end  
  1625.     end  
  1626.     @afterimage_separation = separation
  1627.   end
  1628.   
  1629.   #-----------------------------------------------------------------------------
  1630.   # Sets a weapon sprite by icons
  1631.   #-----------------------------------------------------------------------------  
  1632.   def set_weapon_icon(x_corr, y_corr, start_angle, end_angle, time, left_hand=false, over=false)
  1633.     if left_hand
  1634.       if @battler.weapons[1]
  1635.         bitmap = get_equip_sprite_icon(@battler.weapons[1])
  1636.       else
  1637.         return
  1638.       end  
  1639.     else
  1640.       if @battler.weapons[0]
  1641.         bitmap = get_equip_sprite_icon(@battler.weapons[0])
  1642.       else
  1643.         return
  1644.       end  
  1645.     end
  1646.     sprite = Sprite_Weapon.new(self, bitmap, time, 1, 1, over, true)
  1647.     sprite.set_angles(start_angle, end_angle)
  1648.     sprite.setup_correction(x_corr, y_corr)
  1649.     @weapon_sprites.push(sprite)
  1650.   end
  1651.   
  1652.   def get_equip_sprite_icon(equip)
  1653.     Cache.get_icon_bitmap(equip.icon_index)
  1654.   end
  1655.   
  1656.   def set_weapon_sprite(bitmap_name, x_corr, y_corr, frames, interval, over)
  1657.     time = frames * interval + 1
  1658.     bitmap = get_weapon_bitmap_anime(bitmap_name)
  1659.     sprite = Sprite_Weapon.new(self, bitmap, time, frames, interval, over, false)
  1660.     sprite.setup_correction(x_corr, y_corr)
  1661.     @weapon_sprites.push(sprite)
  1662.   end
  1663.   
  1664.   def get_weapon_bitmap_anime(bitmap, hue=0)
  1665.     name = @battler.battler_name.sub(/\[(\d+),(\d+)\]/i) { '' }
  1666.     bitmap_name = "#{name}_#{bitmap}"
  1667.     if FileTest.exists?("Graphics/Battlers/#{bitmap_name}")
  1668.       return Cache.battler(bitmap_name, hue)
  1669.     else
  1670.       return Cache.battler(bitmap, hue)
  1671.     end
  1672.   end
  1673.   
  1674.   #--------------------------------------------------------------------------
  1675.   # ? ?????????????
  1676.   #--------------------------------------------------------------------------
  1677.   def start_balloon(balloon_id)
  1678.     dispose_balloon
  1679.     @balloon_id = balloon_id
  1680.     @balloon_duration = 8 * balloon_speed + balloon_wait
  1681.     @balloon_sprite = ::Sprite.new(viewport)
  1682.     @balloon_sprite.bitmap = Cache.system("Balloon")
  1683.     @balloon_sprite.ox = 16
  1684.     @balloon_sprite.oy = 32
  1685.     update_balloon
  1686.   end
  1687.   #--------------------------------------------------------------------------
  1688.   # ? ???????????
  1689.   #--------------------------------------------------------------------------
  1690.   def dispose_balloon
  1691.     if @balloon_sprite
  1692.       @balloon_sprite.dispose
  1693.       @balloon_sprite = nil
  1694.     end
  1695.     @balloon_id = 0
  1696.   end
  1697.   #--------------------------------------------------------------------------
  1698.   # ? ???????????
  1699.   #--------------------------------------------------------------------------
  1700.   def update_balloon
  1701.     return if @balloon_id == 0
  1702.     if @balloon_duration > 0
  1703.       @balloon_duration -= 1
  1704.       if @balloon_duration > 0
  1705.         @balloon_sprite.x = BattleCamera.correct_x(@current_x)
  1706.         @balloon_sprite.y = BattleCamera.correct_y(@current_y - @battler_height)
  1707.         @balloon_sprite.z = self.z + 200
  1708.         sx = balloon_frame_index * 32
  1709.         sy = (@balloon_id - 1) * 32
  1710.         @balloon_sprite.src_rect.set(sx, sy, 32, 32)
  1711.       else
  1712.         end_balloon
  1713.       end
  1714.     end
  1715.   end
  1716.   #--------------------------------------------------------------------------
  1717.   # ? ???????????
  1718.   #--------------------------------------------------------------------------
  1719.   def end_balloon
  1720.     dispose_balloon
  1721.     @balloon_id = 0
  1722.   end
  1723.   #--------------------------------------------------------------------------
  1724.   # ? ?????????????
  1725.   #--------------------------------------------------------------------------
  1726.   def balloon_speed
  1727.     return 8
  1728.   end
  1729.   #--------------------------------------------------------------------------
  1730.   # ? ?????????????????
  1731.   #--------------------------------------------------------------------------
  1732.   def balloon_wait
  1733.     return 12
  1734.   end
  1735.   #--------------------------------------------------------------------------
  1736.   # ? ???????????????
  1737.   #--------------------------------------------------------------------------
  1738.   def balloon_frame_index
  1739.     return 7 - [(@balloon_duration - balloon_wait) / balloon_speed, 0].max
  1740.   end  
  1741.   
  1742. end

  1743. #===============================================================================
  1744. # ?Sprite_Weapon
  1745. #-------------------------------------------------------------------------------
  1746. # The class that controls weapon animations.
  1747. #===============================================================================
  1748. class Sprite_Weapon < Sprite
  1749.   
  1750.   attr_reader :anime_count
  1751.   
  1752.   def initialize(sprite, bitmap, anime_count, frames=1, frame_interval=1, over=false, icon=false)
  1753.     super(sprite.viewport)
  1754.     @sprite = sprite
  1755.     @anime_count = anime_count
  1756.     @current_angle = 0
  1757.     @end_angle = 0
  1758.     @frames = frames
  1759.     @frame_interval = frame_interval
  1760.     @frame_count = 0
  1761.     @frame = 0
  1762.     @over = over
  1763.     @x_correction = @y_correction = 0
  1764.     self.bitmap = bitmap
  1765.     @bw = self.bitmap.width / @frames
  1766.     @bh = self.bitmap.height
  1767.     self.mirror = sprite.battler.enemy?
  1768.     self.ox = icon ? @bw : @bw / 2
  1769.     self.oy = @bh
  1770.     update_rect
  1771.   end
  1772.   
  1773.   def update
  1774.     super
  1775.     return if @anime_count < 1
  1776.     update_animation
  1777.     @anime_count -= 1
  1778.   end
  1779.   
  1780.   def update_animation
  1781.     update_angle
  1782.     update_frame
  1783.     update_rect
  1784.     update_coordinates
  1785.   end
  1786.   
  1787.   def update_angle
  1788.     @current_angle = (@current_angle * (@anime_count - 1) + @end_angle) / @anime_count
  1789.     self.angle = @sprite.angle + @current_angle
  1790.   end
  1791.   
  1792.   def update_frame
  1793.     @frame_count = (@frame_count + 1) % @frame_interval
  1794.     @frame = (@frame + 1) % @frames if @frame_count == 0  
  1795.   end
  1796.   
  1797.   def update_rect  
  1798.     self.src_rect.set(@bw * @frame, 0, @bw, @bh)
  1799.   end
  1800.   
  1801.   def animation?
  1802.     return (@anime_count > 0)
  1803.   end
  1804.   
  1805.   def update_coordinates
  1806.     self.x = BattleCamera.correct_x(@sprite.current_x + @x_correction)
  1807.     self.y = BattleCamera.correct_y(@sprite.current_y + @y_correction)
  1808.     self.z = @over ? @sprite.z + 1 : @sprite.z - 1
  1809.     self.zoom_x = @sprite.zoom_x
  1810.     self.zoom_y = @sprite.zoom_y
  1811.    
  1812.   end
  1813.   
  1814.   def set_angles(start_angle, end_angle)
  1815.     @current_angle = start_angle
  1816.     @end_angle = end_angle
  1817.   end
  1818.   
  1819.   def setup_correction(x, y)
  1820.     @x_correction = x
  1821.     @y_correction = y
  1822.   end
  1823.   
  1824. end

  1825. #===============================================================================
  1826. # ?Sprite_Afterimage
  1827. #-------------------------------------------------------------------------------
  1828. # The class that controls afterimage processing.
  1829. #===============================================================================

  1830. class Sprite_Afterimage < Sprite
  1831.   
  1832.   #-----------------------------------------------------------------------------
  1833.   # Updates the afterimage
  1834.   #-----------------------------------------------------------------------------   
  1835.   def update(index, size, data, sprite)
  1836.     super()
  1837.     self.bitmap = data[0]
  1838.     self.x = BattleCamera.correct_x(data[1])
  1839.     self.y = BattleCamera.correct_y(data[2])
  1840.     self.z = data[3]
  1841.     self.zoom_x = BattleCamera.correct_zoom(data[4], data[1], data[2], sprite.battler.zoom_effective?)
  1842.     self.zoom_y = BattleCamera.correct_zoom(data[5], data[1], data[2], sprite.battler.zoom_effective?)
  1843.     self.src_rect = data[6]
  1844.     self.ox = data[7]
  1845.     self.oy = data[8]
  1846.     self.angle = BattleCamera.correct_angle(data[9])
  1847.     self.mirror = data[10]
  1848.     self.opacity = 255 - (index * 255 / size)
  1849.   end
  1850.   
  1851. end

  1852. #===============================================================================
  1853. # ?Sprite_TargetCursor
  1854. #-------------------------------------------------------------------------------
  1855. # This class controls Target selection and animation of the cursor.
  1856. #===============================================================================
  1857. class Sprite_TargetCursor < Sprite
  1858.   
  1859.   #--------------------------------------------------------------------------
  1860.   # ? Class Properties
  1861.   #--------------------------------------------------------------------------  
  1862.   attr_accessor :screen_x
  1863.   attr_accessor :screen_y
  1864.   
  1865.   #--------------------------------------------------------------------------
  1866.   # ? Creates a new cursor.
  1867.   #--------------------------------------------------------------------------  
  1868.   def initialize
  1869.     super()
  1870.     self.z = 999999
  1871.     self.bitmap = Cache.system(BattleConfig::CursorBitmap)
  1872.     @frames = BattleConfig::CursorFrames
  1873.     @delay  = BattleConfig::CursorDelay
  1874.     @frame_width = self.bitmap.width / @frames
  1875.     @frame_count = 0
  1876.     @frame = 0
  1877.     @screen_x = 0
  1878.     @screen_y = 0   
  1879.     self.src_rect.width = @frame_width
  1880.     self.ox = @frame_width / 2
  1881.     self.oy = self.bitmap.width / 2
  1882.     update
  1883.   end  
  1884.   
  1885.   #--------------------------------------------------------------------------
  1886.   # ? Dispose
  1887.   #--------------------------------------------------------------------------  
  1888.   def dispose
  1889.     super
  1890.     self.bitmap.dispose if self.bitmap
  1891.   end
  1892.   
  1893.   #--------------------------------------------------------------------------
  1894.   # ? Frame Update
  1895.   #--------------------------------------------------------------------------  
  1896.   def update
  1897.     super
  1898.     @frame_count = (@frame_count + 1) % @delay
  1899.     @frame = (@frame + 1) % @frames if @frame_count == 0
  1900.     self.src_rect.x = @frame * @frame_width
  1901.     self.x = BattleCamera.correct_x(@screen_x)
  1902.     self.y = BattleCamera.correct_y(@screen_y)
  1903.     self.zoom_x = self.zoom_y = BattleCamera.correct_zoom(1.0, @screen_x, @screen_y)   
  1904.   end
  1905.   
  1906. end

  1907. #==============================================================================
  1908. # ?Sprite_BattlePicture
  1909. #==============================================================================

  1910. class Sprite_BattlePicture < Sprite_Base
  1911.   #--------------------------------------------------------------------------
  1912.   # ? ?????????
  1913.   #     picture : Game_Picture
  1914.   #--------------------------------------------------------------------------
  1915.   def initialize(viewport, picture)
  1916.     super(viewport)
  1917.     @picture = picture
  1918.     update
  1919.   end
  1920.   #--------------------------------------------------------------------------
  1921.   # ? ??
  1922.   #--------------------------------------------------------------------------
  1923.   def dispose
  1924.     bitmap.dispose if bitmap
  1925.     super
  1926.   end
  1927.   #--------------------------------------------------------------------------
  1928.   # ? ??????
  1929.   #--------------------------------------------------------------------------
  1930.   def update
  1931.     super
  1932.     update_bitmap
  1933.     update_origin
  1934.     update_position
  1935.     update_zoom
  1936.     update_other
  1937.   end
  1938.   #-----------------------------------------------------------------------------
  1939.   # Updates the bitmap
  1940.   #-----------------------------------------------------------------------------  
  1941.   def update_bitmap
  1942.     if @picture.name.is_a?(Integer)
  1943.       self.bitmap = Cache.get_icon_bitmap(@picture.name)
  1944.     else  
  1945.       self.bitmap = Cache.picture(@picture.name)
  1946.     end  
  1947.   end
  1948.   
  1949.   #--------------------------------------------------------------------------
  1950.   # ? ?????
  1951.   #--------------------------------------------------------------------------
  1952.   def update_origin
  1953.     if @picture.origin == 0
  1954.       self.ox = 0
  1955.       self.oy = 0
  1956.     else
  1957.       self.ox = bitmap.width / 2
  1958.       self.oy = bitmap.height / 2
  1959.     end
  1960.   end
  1961.   #--------------------------------------------------------------------------
  1962.   # ? ?????
  1963.   #--------------------------------------------------------------------------
  1964.   def update_position
  1965.     self.x = BattleCamera.correct_x(@picture.x)
  1966.     self.y = BattleCamera.correct_y(@picture.y)
  1967.     self.z = @picture.number
  1968.   end
  1969.   #--------------------------------------------------------------------------
  1970.   # ? ??????
  1971.   #--------------------------------------------------------------------------
  1972.   def update_zoom
  1973.     self.zoom_x = BattleCamera.correct_zoom(@picture.zoom_x / 100.0)
  1974.     self.zoom_y = BattleCamera.correct_zoom(@picture.zoom_y / 100.0)
  1975.   end
  1976.   #--------------------------------------------------------------------------
  1977.   # ? ??????
  1978.   #--------------------------------------------------------------------------
  1979.   def update_other
  1980.     self.opacity = @picture.opacity
  1981.     self.blend_type = @picture.blend_type
  1982.     self.angle = @picture.angle
  1983.     self.tone.set(@picture.tone)
  1984.   end
  1985.   
  1986.   def start_animation_ex(animation, mirror = false)
  1987.     start_animation(animation, mirror)
  1988.   end  
  1989.   
  1990.      
  1991.   
  1992. end

  1993. #===============================================================================
  1994. # ?Spriteset_Battle
  1995. #===============================================================================

  1996. class Spriteset_Battle
  1997.   
  1998.   #--------------------------------------------------------------------------
  1999.   # ? Class variables
  2000.   #--------------------------------------------------------------------------  
  2001.   @@inverted_x_cache    = {}
  2002.   @@inverted_y_cache    = {}
  2003.   @@inverted_both_cache = {}
  2004.   
  2005.   #--------------------------------------------------------------------------
  2006.   # ? Alias methods
  2007.   #--------------------------------------------------------------------------  
  2008.   alias rbs_spriteset_battle_initialize initialize
  2009.   alias rbs_spriteset_battle_battleback1_bitmap battleback1_bitmap
  2010.   alias rbs_spriteset_battle_battleback2_bitmap battleback2_bitmap
  2011.   
  2012.   #--------------------------------------------------------------------------
  2013.   # ? Creates the spriteset
  2014.   #--------------------------------------------------------------------------
  2015.   def initialize
  2016.     rbs_spriteset_battle_initialize
  2017.     @battler_sprites = @enemy_sprites + @actor_sprites  
  2018.     @icon_sprites = {}
  2019.   end

  2020.   #--------------------------------------------------------------------------
  2021.   # ? checks if animating
  2022.   #--------------------------------------------------------------------------
  2023.   def animation?
  2024.     battler_sprites.any? {|sprite| sprite.animation? || sprite.moving? || BattleCamera.moving? }
  2025.   end  
  2026.   
  2027.   #--------------------------------------------------------------------------
  2028.   # ? gets the battler sprites
  2029.   #--------------------------------------------------------------------------  
  2030.   def battler_sprites
  2031.     @battler_sprites
  2032.   end
  2033.   
  2034.   #--------------------------------------------------------------------------
  2035.   # ? Get the battler sprite of a target
  2036.   #--------------------------------------------------------------------------  
  2037.   def battler_sprite(battler)
  2038.     @battler_sprites.each do |i|
  2039.       return i if i.battler == battler
  2040.     end
  2041.   end
  2042.   
  2043.   #--------------------------------------------------------------------------
  2044.   # ? Creates the lower battleback
  2045.   #--------------------------------------------------------------------------
  2046.   def create_battleback1
  2047.     @back1_sprite = Plane.new(@viewport1)
  2048.     @back1_sprite.bitmap = battleback1_bitmap
  2049.     @back1_sprite.z = 0
  2050.   end
  2051.   #--------------------------------------------------------------------------
  2052.   # ? Creats the upper battleback
  2053.   #--------------------------------------------------------------------------
  2054.   def create_battleback2
  2055.     @back2_sprite = Plane.new(@viewport1)
  2056.     @back2_sprite.bitmap = battleback2_bitmap
  2057.     @back2_sprite.z = 1
  2058.   end  
  2059.   
  2060.   #--------------------------------------------------------------------------
  2061.   # ? Updates lower battleback
  2062.   #--------------------------------------------------------------------------
  2063.   def update_battleback1
  2064.     z = BattleConfig::Battleback_NormalZoom
  2065.     ox = @back1_sprite.bitmap.width * 3 / 4
  2066.     oy = @back1_sprite.bitmap.height * 3 / 4   
  2067.     @back1_sprite.ox = -BattleCamera.correct_x(ox)
  2068.     @back1_sprite.oy = -BattleCamera.correct_y(oy)
  2069.     zoom = BattleCamera.correct_zoom(BattleConfig::Battleback_NormalZoom)
  2070.     @back1_sprite.zoom_x = @back1_sprite.zoom_y = zoom
  2071.   end
  2072.   #--------------------------------------------------------------------------
  2073.   # ? Updates upper battleback
  2074.   #--------------------------------------------------------------------------
  2075.   def update_battleback2
  2076.     z = BattleConfig::Battleback_NormalZoom
  2077.     ox = @back2_sprite.bitmap.width * 3 / 4
  2078.     oy = @back2_sprite.bitmap.height * 3 / 4
  2079.     @back2_sprite.ox = -BattleCamera.correct_x(ox)
  2080.     @back2_sprite.oy = -BattleCamera.correct_y(oy)
  2081.     zoom = BattleCamera.correct_zoom(BattleConfig::Battleback_NormalZoom)
  2082.     @back2_sprite.zoom_x = @back2_sprite.zoom_y = zoom
  2083.   end  
  2084.   
  2085.   #--------------------------------------------------------------------------
  2086.   # ? Gets the bitmap of lower battleback
  2087.   #--------------------------------------------------------------------------  
  2088.   def battleback1_bitmap
  2089.     if BattleConfig::UsingDefaultBattlebacks
  2090.       return create_mirrored_battleback(rbs_spriteset_battle_battleback1_bitmap)
  2091.     else
  2092.       return rbs_spriteset_battle_battleback1_bitmap
  2093.     end  
  2094.   end
  2095.   
  2096.   #--------------------------------------------------------------------------
  2097.   # ? Gets the bitmap of upper battleback
  2098.   #--------------------------------------------------------------------------   
  2099.   def battleback2_bitmap
  2100.     if BattleConfig::UsingDefaultBattlebacks
  2101.       return create_mirrored_battleback(rbs_spriteset_battle_battleback2_bitmap)
  2102.     else
  2103.       return rbs_spriteset_battle_battleback2_bitmap
  2104.     end     
  2105.   end
  2106.   
  2107.   #--------------------------------------------------------------------------
  2108.   # ? Creates the sprite of the battleback for compatibility
  2109.   #--------------------------------------------------------------------------   
  2110.   def create_mirrored_battleback(battleback)
  2111.     org_w = battleback.width
  2112.     org_h = battleback.height
  2113.     bw = battleback.width << 1
  2114.     bh = battleback.height << 1
  2115.     bmp = Bitmap.new(bw, bh)
  2116.     bmp.blt(org_w >> 1, org_h >> 1, battleback, battleback.rect)
  2117.     battleback.dispose
  2118.     return bmp
  2119.   end

  2120.   def make_return_sequence
  2121.     battler_sprites.each do |i|
  2122.       i.make_return_sequence
  2123.     end  
  2124.   end
  2125.   
  2126.   #--------------------------------------------------------------------------
  2127.   # ? ????????????
  2128.   #--------------------------------------------------------------------------
  2129.   def update_pictures
  2130.     $game_troop.screen.pictures.each do |pic|
  2131.       @picture_sprites[pic.number] ||= Sprite_BattlePicture.new(@viewport2, pic)
  2132.       @picture_sprites[pic.number].update
  2133.     end
  2134.   end  
  2135.   
  2136. end

  2137. #===============================================================================
  2138. # END SPRITE SECTION
  2139. #===============================================================================

  2140. #===============================================================================
  2141. # BEGIN GAME DATA SECTION
  2142. #===============================================================================

  2143. #===============================================================================
  2144. # * RPG::BaseItem
  2145. #===============================================================================
  2146. module RPG
  2147.   class BaseItem
  2148.    
  2149.     #---------------------------------------------------------------------------
  2150.     # Gets attack skill id
  2151.     #---------------------------------------------------------------------------
  2152.     def get_atk_skill_id
  2153.       return self.note[/<atk skill id:(.*?)>/mi] ? eval($1) : nil
  2154.     end
  2155.    
  2156.     #---------------------------------------------------------------------------
  2157.     # Gets guard skill id
  2158.     #---------------------------------------------------------------------------   
  2159.     def get_guard_skill_id
  2160.       return self.note[/<guard skill id:(.*?)>/mi] ? eval($1) : nil
  2161.     end
  2162.    
  2163.     #---------------------------------------------------------------------------
  2164.     # Gets a sequence
  2165.     #---------------------------------------------------------------------------     
  2166.     def get_sequence(key)
  2167.       ex = BattleConfig::Default_SequenceNotes
  2168.       reg = /<sequence:#{key}>(.*?)<\/sequence>/mi
  2169.       ex_r = ''
  2170.       if self.is_a?(RPG::Actor) || self.is_a?(RPG::Enemy)
  2171.         ex_r = (ex[reg] ? $1 : '')  
  2172.       end  
  2173.       return self.note[reg] ? $1 : ex_r
  2174.     end
  2175.    
  2176.     #---------------------------------------------------------------------------
  2177.     # Gets a sequence
  2178.     #---------------------------------------------------------------------------   
  2179.     def get_turn_start_sequence
  2180.       get_sequence('turn start')
  2181.     end     
  2182.    
  2183.     #---------------------------------------------------------------------------
  2184.     # Gets a sequence
  2185.     #---------------------------------------------------------------------------   
  2186.     def get_turn_end_sequence
  2187.       get_sequence('turn end')     
  2188.     end        
  2189.    
  2190.     #---------------------------------------------------------------------------
  2191.     # Gets a sequence
  2192.     #---------------------------------------------------------------------------   
  2193.     def get_presentation_sequence
  2194.       get_sequence('presentation')   
  2195.     end
  2196.    
  2197.     #---------------------------------------------------------------------------
  2198.     # Gets a sequence
  2199.     #---------------------------------------------------------------------------   
  2200.     def get_surprised_sequence
  2201.       get_sequence('surprised')     
  2202.     end
  2203.    
  2204.     #---------------------------------------------------------------------------
  2205.     # Gets a sequence
  2206.     #---------------------------------------------------------------------------   
  2207.     def get_preemptive_sequence
  2208.       get_sequence('preemptive')   
  2209.     end
  2210.    
  2211.     #---------------------------------------------------------------------------
  2212.     # Gets a sequence
  2213.     #---------------------------------------------------------------------------   
  2214.     def get_attack_sequence
  2215.       get_sequence('attack')   
  2216.     end   
  2217.    
  2218.     #---------------------------------------------------------------------------
  2219.     # Gets a sequence
  2220.     #---------------------------------------------------------------------------   
  2221.     def get_guard_sequence
  2222.       get_sequence('guard')   
  2223.     end      
  2224.    
  2225.     #---------------------------------------------------------------------------
  2226.     # Gets a sequence
  2227.     #---------------------------------------------------------------------------   
  2228.     def get_counter_sequence
  2229.       get_sequence('counter')   
  2230.     end
  2231.   
  2232.     #---------------------------------------------------------------------------
  2233.     # Gets a sequence
  2234.     #---------------------------------------------------------------------------   
  2235.     def get_die_sequence
  2236.       get_sequence('die')   
  2237.     end

  2238.     #---------------------------------------------------------------------------
  2239.     # Gets a sequence
  2240.     #---------------------------------------------------------------------------   
  2241.     def get_dead_sequence
  2242.       get_sequence('dead')   
  2243.     end   
  2244.    
  2245.     #---------------------------------------------------------------------------
  2246.     # Gets a sequence
  2247.     #---------------------------------------------------------------------------   
  2248.     def get_revive_sequence
  2249.       get_sequence('revive')   
  2250.     end   
  2251.    
  2252.     #---------------------------------------------------------------------------
  2253.     # Gets a sequence
  2254.     #---------------------------------------------------------------------------   
  2255.     def get_victory_sequence
  2256.       get_sequence('victory')   
  2257.     end
  2258.   
  2259.     #---------------------------------------------------------------------------
  2260.     # Gets a sequence
  2261.     #---------------------------------------------------------------------------   
  2262.     def get_substitute_sequence
  2263.       get_sequence('substitute')   
  2264.     end
  2265.   
  2266.     #---------------------------------------------------------------------------
  2267.     # Gets a sequence
  2268.     #---------------------------------------------------------------------------   
  2269.     def get_reflect_sequence
  2270.       get_sequence('reflect')
  2271.     end   
  2272.    
  2273.     #---------------------------------------------------------------------------
  2274.     # Gets a sequence
  2275.     #---------------------------------------------------------------------------   
  2276.     def get_item_use_sequence
  2277.       get_sequence('item')
  2278.     end  
  2279.   
  2280.     #---------------------------------------------------------------------------
  2281.     # Gets a sequence
  2282.     #---------------------------------------------------------------------------   
  2283.     def get_skill_use_sequence
  2284.       get_sequence('skill')
  2285.     end   

  2286.     #---------------------------------------------------------------------------
  2287.     # Gets a sequence
  2288.     #---------------------------------------------------------------------------   
  2289.     def get_stand_sequence
  2290.       get_sequence('stand')
  2291.     end
  2292.    
  2293.     #---------------------------------------------------------------------------
  2294.     # Gets a sequence
  2295.     #---------------------------------------------------------------------------   
  2296.     def get_evade_sequence
  2297.       get_sequence('evade')
  2298.     end
  2299.    
  2300.     #---------------------------------------------------------------------------
  2301.     # Gets a sequence
  2302.     #---------------------------------------------------------------------------   
  2303.     def get_miss_sequence
  2304.       get_sequence('miss')
  2305.     end

  2306.     #---------------------------------------------------------------------------
  2307.     # Gets a sequence
  2308.     #---------------------------------------------------------------------------     
  2309.     def get_return_sequence
  2310.       get_sequence('return position')
  2311.     end   
  2312.    
  2313.     #---------------------------------------------------------------------------
  2314.     # Gets the sequence used when actor is processing an input
  2315.     #---------------------------------------------------------------------------     
  2316.     def get_action_selection_sequence
  2317.       get_sequence('action selection')
  2318.     end
  2319.    
  2320.     #---------------------------------------------------------------------------
  2321.     # Gets the default battler index
  2322.     #---------------------------------------------------------------------------   
  2323.     def get_default_battler_index
  2324.       return self.note[/<default battler index:(.*?)>/mi] ? eval($1) : nil
  2325.     end   
  2326.    
  2327.   end
  2328. end

  2329. class RPG::Skill < RPG::UsableItem
  2330.   
  2331.     #---------------------------------------------------------------------------
  2332.     # Gets a sequence
  2333.     #---------------------------------------------------------------------------   
  2334.     def get_attack_sequence
  2335.       get_sequence('skill') == '' ? get_sequence('attack') : get_sequence('skill')
  2336.     end   
  2337.   
  2338. end

  2339. class RPG::Item < RPG::UsableItem
  2340.   
  2341.     #---------------------------------------------------------------------------
  2342.     # Gets a sequence
  2343.     #---------------------------------------------------------------------------   
  2344.     def get_attack_sequence
  2345.       get_sequence('item') == '' ? get_sequence('attack') : get_sequence('skill')
  2346.     end   
  2347.   
  2348. end


  2349. #===============================================================================
  2350. # END GAME DATA SECTION
  2351. #===============================================================================

  2352. #===============================================================================
  2353. # BEGIN GAME OBJECTS SECTION
  2354. #===============================================================================

  2355. #===============================================================================
  2356. # ?Game_Battler
  2357. #===============================================================================
  2358. class Game_Battler
  2359.   
  2360.   def friend_unit
  2361.     return []
  2362.   end
  2363.   
  2364.   def enemy_unit
  2365.     return []
  2366.   end
  2367.   
  2368.   def counter_skill_id
  2369.     return attack_skill_id
  2370.   end

  2371.   def zoom_effective?
  2372.     return true
  2373.   end

  2374. end

  2375. #==============================================================================
  2376. # ?Game_Enemy
  2377. #==============================================================================
  2378. class Game_Enemy < Game_Battler
  2379.   
  2380.   #-----------------------------------------------------------------------------
  2381.   # Class atributes
  2382.   #-----------------------------------------------------------------------------
  2383.   attr_reader :atk_animation_id1
  2384.   attr_reader :atk_animation_id2
  2385.   
  2386.   #-----------------------------------------------------------------------------
  2387.   # Alias methods
  2388.   #-----------------------------------------------------------------------------  
  2389.   alias rbs_game_enemy_initialize initialize
  2390.   
  2391.   #-----------------------------------------------------------------------------
  2392.   # Object Creation
  2393.   #-----------------------------------------------------------------------------   
  2394.   def initialize(index, enemy_id)
  2395.     rbs_game_enemy_initialize(index, enemy_id)
  2396.     @atk_animation_id1 = enemy.note[/<atk ani1:(.*?)>/im] ? eval($1) : BattleConfig::DefaultEnemey_Ani1ID
  2397.     @atk_animation_id2 = enemy.note[/<atk ani2:(.*?)>/im] ? eval($1) : BattleConfig::DefaultEnemey_Ani2ID
  2398.     @counter_skill_id  = enemy.note[/<counter skill id:(.*?)>/im] ? eval($1) : attack_skill_id
  2399.     @weapon_1_id       = enemy.note[/<weapon 1 id:(.*?)>/im] ? eval($1) : 0
  2400.     @weapon_2_id       = enemy.note[/<weapon 2 id:(.*?)>/im] ? eval($1) : 0
  2401.   end
  2402.   
  2403.   #--------------------------------------------------------------------------
  2404.   # ? Get the attack skll id
  2405.   #--------------------------------------------------------------------------
  2406.   def attack_skill_id
  2407.     id = enemy.get_atk_skill_id
  2408.     return id ? id : super
  2409.   end
  2410.   #--------------------------------------------------------------------------
  2411.   # ? Get the guard skill id
  2412.   #--------------------------------------------------------------------------
  2413.   def guard_skill_id
  2414.     id = enemy.get_guard_skill_id
  2415.     return id ? id : super
  2416.   end   
  2417.   
  2418.   #--------------------------------------------------------------------------
  2419.   # ? Get sequence
  2420.   #--------------------------------------------------------------------------  
  2421.   def get_turn_start_sequence
  2422.     return enemy.presentation_sequence
  2423.   end     
  2424.    
  2425.   #--------------------------------------------------------------------------
  2426.   # ? Get sequence
  2427.   #--------------------------------------------------------------------------   
  2428.   def get_turn_end_sequence
  2429.     return enemy.presentation_sequence
  2430.   end     
  2431.   
  2432.   #--------------------------------------------------------------------------
  2433.   # ? Get sequence
  2434.   #--------------------------------------------------------------------------   
  2435.   def get_presentation_sequence
  2436.     return enemy.get_presentation_sequence
  2437.   end
  2438.    
  2439.   #--------------------------------------------------------------------------
  2440.   # ? Get sequence
  2441.   #--------------------------------------------------------------------------   
  2442.   def get_surprised_sequence
  2443.     return enemy.get_surprised_sequence
  2444.   end
  2445.    
  2446.   #--------------------------------------------------------------------------
  2447.   # ? Get sequence
  2448.   #--------------------------------------------------------------------------   
  2449.   def get_preemptive_sequence
  2450.     return enemy.get_preemptive_sequence
  2451.   end
  2452.    
  2453.   #--------------------------------------------------------------------------
  2454.   # ? Get sequence
  2455.   #--------------------------------------------------------------------------
  2456.   def get_attack_sequence
  2457.     return enemy.get_attack_sequence
  2458.   end
  2459.   
  2460.   #--------------------------------------------------------------------------
  2461.   # ? Get sequence
  2462.   #--------------------------------------------------------------------------
  2463.   def get_guard_sequence
  2464.     return enemy.get_guard_sequence
  2465.   end  
  2466.   
  2467.   #--------------------------------------------------------------------------
  2468.   # ? Get sequence
  2469.   #--------------------------------------------------------------------------
  2470.   def get_counter_sequence
  2471.     return enemy.get_counter_sequence
  2472.   end
  2473.   
  2474.   #--------------------------------------------------------------------------
  2475.   # ? Get sequence
  2476.   #--------------------------------------------------------------------------
  2477.   def get_die_sequence
  2478.     return enemy.get_die_sequence
  2479.   end

  2480.   #--------------------------------------------------------------------------
  2481.   # ? Get sequence
  2482.   #--------------------------------------------------------------------------
  2483.   def get_dead_sequence
  2484.     return enemy.get_dead_sequence
  2485.   end  
  2486.   
  2487.   #--------------------------------------------------------------------------
  2488.   # ? Get sequence
  2489.   #--------------------------------------------------------------------------
  2490.   def get_revive_sequence
  2491.     return enemy.get_revive_sequence
  2492.   end
  2493.   
  2494.   #--------------------------------------------------------------------------
  2495.   # ? Get sequence
  2496.   #--------------------------------------------------------------------------
  2497.   def get_victory_sequence
  2498.     return enemy.get_victory_sequence
  2499.   end

  2500.   #--------------------------------------------------------------------------
  2501.   # ? Get sequence
  2502.   #--------------------------------------------------------------------------
  2503.   def get_substitute_sequence
  2504.     return enemy.get_substitute_sequence
  2505.   end
  2506.   
  2507.   #--------------------------------------------------------------------------
  2508.   # ? Get sequence
  2509.   #--------------------------------------------------------------------------
  2510.   def get_reflect_sequence
  2511.     return enemy.get_substitute_sequence
  2512.   end
  2513.   
  2514.   #--------------------------------------------------------------------------
  2515.   # ? Get sequence
  2516.   #--------------------------------------------------------------------------
  2517.   def get_item_use_sequence
  2518.     return enemy.get_item_use_sequence
  2519.   end  
  2520.   
  2521.   #--------------------------------------------------------------------------
  2522.   # ? Get sequence
  2523.   #--------------------------------------------------------------------------
  2524.   def get_skill_use_sequence
  2525.     return enemy.get_skill_use_sequence
  2526.   end   
  2527.   
  2528.   #--------------------------------------------------------------------------
  2529.   # ? Get sequence
  2530.   #--------------------------------------------------------------------------
  2531.   def get_stand_sequence
  2532.     seq = ''
  2533.     states.each do |i|
  2534.       next if !i
  2535.       seq += i.get_stand_sequence
  2536.     end     
  2537.     return seq == '' ? enemy.get_stand_sequence : seq
  2538.   end
  2539.    
  2540.   #--------------------------------------------------------------------------
  2541.   # ? Get sequence
  2542.   #--------------------------------------------------------------------------
  2543.   def get_evade_sequence
  2544.     return enemy.get_evade_sequence
  2545.   end
  2546.    
  2547.   #--------------------------------------------------------------------------
  2548.   # ? Get sequence
  2549.   #--------------------------------------------------------------------------
  2550.   def get_miss_sequence
  2551.     return enemy.get_miss_sequence
  2552.   end   
  2553.   
  2554.   #--------------------------------------------------------------------------
  2555.   # ? Get sequence
  2556.   #--------------------------------------------------------------------------
  2557.   def get_return_sequence
  2558.     return enemy.get_return_sequence
  2559.   end  
  2560.   
  2561.   #-----------------------------------------------------------------------------
  2562.   # Gets friend unit
  2563.   #-----------------------------------------------------------------------------   
  2564.   def friend_unit
  2565.     return $game_troop
  2566.   end

  2567.   #-----------------------------------------------------------------------------
  2568.   # Gets enemy unit
  2569.   #-----------------------------------------------------------------------------  
  2570.   def enemy_unit
  2571.     return $game_party
  2572.   end  
  2573.   
  2574.   #-----------------------------------------------------------------------------
  2575.   # Gets default battler index
  2576.   #-----------------------------------------------------------------------------   
  2577.   def default_battler_index
  2578.     a = enemy.get_default_battler_index
  2579.     return a ? a : BattleConfig::DefaultEnemyIndex
  2580.   end
  2581.   
  2582.   #-----------------------------------------------------------------------------
  2583.   # Gets the real presentation action according to situation
  2584.   #-----------------------------------------------------------------------------  
  2585.   def get_real_presentation_action
  2586.     return get_dead_sequence if dead?
  2587.     BattleManager.surprise? ? get_preemptive_sequence : (BattleManager.preemptive? ? get_surprised_sequence : get_presentation_sequence )
  2588.   end
  2589.   
  2590.   #-----------------------------------------------------------------------------
  2591.   # Gets the counter skill id
  2592.   #-----------------------------------------------------------------------------  
  2593.   def counter_skill_id
  2594.     return @counter_skill_id
  2595.   end  
  2596.   
  2597.   #-----------------------------------------------------------------------------
  2598.   # has dia sequence?
  2599.   #-----------------------------------------------------------------------------  
  2600.   def die_sequence?
  2601.     return enemy.note[/<die sequence on>/mi] ? true : false
  2602.   end  
  2603.   
  2604.   #-----------------------------------------------------------------------------
  2605.   # Get weapons
  2606.   #-----------------------------------------------------------------------------  
  2607.   def weapons
  2608.     result = []
  2609.     result.push($data_weapons[@weapon_1_id]) if @weapon_1_id > 0
  2610.     result.push($data_weapons[@weapon_2_id]) if @weapon_2_id > 0
  2611.     return result
  2612.   end
  2613.   
  2614. end

  2615. #==============================================================================
  2616. # ?Game_Actor
  2617. #==============================================================================
  2618. class Game_Actor < Game_Battler
  2619.   
  2620.   #-----------------------------------------------------------------------------
  2621.   # Class atributes
  2622.   #-----------------------------------------------------------------------------   
  2623.   attr_accessor :battler_name
  2624.   attr_accessor :battler_hue  
  2625.   attr_accessor :counter_skill_id
  2626.   
  2627.   #-----------------------------------------------------------------------------
  2628.   # Alias methods
  2629.   #-----------------------------------------------------------------------------  
  2630.   alias rbs_game_actor_setup setup
  2631.   alias rbs_game_actor_make_actions make_actions
  2632.   
  2633.   #--------------------------------------------------------------------------
  2634.   # ? Setups an actor by ID
  2635.   #--------------------------------------------------------------------------   
  2636.   def setup(actor_id)
  2637.     rbs_game_actor_setup(actor_id)
  2638.     @battler_name = actor.note[/<battler name:(.*?)>/im] ? $1 : @character_name
  2639.     @battler_hue  = actor.note[/<battler hue:(.*?)>/im] ? $1.to_i : 0
  2640.     @custom_screen_x = actor.note[/<screen x:(.*?)>/im] ? $1.to_i : nil
  2641.     @custom_screen_y = actor.note[/<screen y:(.*?)>/im] ? $1.to_i : nil
  2642.     id1 = actor.note[/<atk ani1:(.*?)>/im] ? Kernel.eval($1) : ($data_classes[@class_id].note[/<atk ani1:(.*?)>/im] ? Kernel.eval($1) : BattleConfig::DefaultEnemey_Ani1ID)
  2643.     id2 = actor.note[/<atk ani2:(.*?)>/im] ? Kernel.eval($1) : ($data_classes[@class_id].note[/<atk ani2:(.*?)>/im] ? Kernel.eval($1) : BattleConfig::DefaultEnemey_Ani2ID)
  2644.     @default_atk_animation_id1 = id1
  2645.     @default_atk_animation_id2 = id2
  2646.     c_s_id = $data_classes[@class_id].note[/<counter skill id:(.*?)>/im] ? Kernel.eval($1) : attack_skill_id
  2647.     @counter_skill_id  = actor.note[/<counter skill id:(.*?)>/im]  ? Kernel.eval($1) : c_s_id
  2648.   end
  2649.   
  2650.   #--------------------------------------------------------------------------
  2651.   # ? Use sprite?
  2652.   #--------------------------------------------------------------------------   
  2653.   def use_sprite?
  2654.     return true
  2655.   end
  2656.   
  2657.   #--------------------------------------------------------------------------
  2658.   # ? Get battle screen x position
  2659.   #--------------------------------------------------------------------------   
  2660.   def screen_x
  2661.     return @custom_screen_x ? @custom_screen_x : BattleConfig::ActorPos[self.index][0]
  2662.   end
  2663.   
  2664.   #--------------------------------------------------------------------------
  2665.   # ? Get battle screen y position
  2666.   #--------------------------------------------------------------------------   
  2667.   def screen_y
  2668.     return @custom_screen_y ? @custom_screen_y : BattleConfig::ActorPos[self.index][1]
  2669.   end
  2670.   
  2671.   #--------------------------------------------------------------------------
  2672.   # ? Get battle screen z position
  2673.   #--------------------------------------------------------------------------   
  2674.   def screen_z
  2675.     return 100
  2676.   end
  2677.   
  2678.   #--------------------------------------------------------------------------
  2679.   # ? Get sequence
  2680.   #--------------------------------------------------------------------------   
  2681.   def get_turn_start_sequence
  2682.     seq = ''
  2683.     equips.each do |i|
  2684.       next if !i
  2685.       seq += i.get_turn_start_sequence
  2686.     end  
  2687.     return seq != '' ? seq : actor.get_turn_start_sequence
  2688.   end     
  2689.    
  2690.   #--------------------------------------------------------------------------
  2691.   # ? Get sequence
  2692.   #--------------------------------------------------------------------------   
  2693.   def get_turn_end_sequence
  2694.     seq = ''
  2695.     equips.each do |i|
  2696.       next if !i
  2697.       seq += i.get_turn_end_sequence
  2698.     end  
  2699.     return seq != '' ? seq : actor.get_turn_end_sequence
  2700.   end   
  2701.   
  2702.   #--------------------------------------------------------------------------
  2703.   # ? Get sequence
  2704.   #--------------------------------------------------------------------------   
  2705.   def get_presentation_sequence
  2706.     seq = ''
  2707.     equips.each do |i|
  2708.       next if !i
  2709.       seq += i.get_presentation_sequence
  2710.     end  
  2711.     return seq != '' ? seq : actor.get_presentation_sequence
  2712.   end
  2713.    
  2714.   #--------------------------------------------------------------------------
  2715.   # ? Get sequence
  2716.   #--------------------------------------------------------------------------   
  2717.   def get_surprised_sequence
  2718.     seq = ''
  2719.     equips.each do |i|
  2720.       next if !i
  2721.       seq += i.get_surprised_sequence
  2722.     end  
  2723.     return seq != '' ? seq : actor.get_surprised_sequence
  2724.   end
  2725.    
  2726.   #--------------------------------------------------------------------------
  2727.   # ? Get sequence
  2728.   #--------------------------------------------------------------------------   
  2729.   def get_preemptive_sequence
  2730.     seq = ''
  2731.     equips.each do |i|
  2732.       next if !i
  2733.       seq += i.get_preemptive_sequence
  2734.     end  
  2735.     return seq != '' ? seq : actor.get_preemptive_sequence
  2736.   end
  2737.    
  2738.   #--------------------------------------------------------------------------
  2739.   # ? Get sequence
  2740.   #--------------------------------------------------------------------------   
  2741.   def get_attack_sequence
  2742.     seq = ''
  2743.     equips.each do |i|
  2744.       next if !i
  2745.       seq += i.get_attack_sequence
  2746.     end  
  2747.     return seq != '' ? seq : actor.get_attack_sequence
  2748.   end
  2749.   
  2750.   #--------------------------------------------------------------------------
  2751.   # ? Get sequence
  2752.   #--------------------------------------------------------------------------   
  2753.   def get_guard_sequence
  2754.     seq = ''
  2755.     equips.each do |i|
  2756.       next if !i
  2757.       seq += i.get_guard_sequence
  2758.     end  
  2759.     return seq != '' ? seq : actor.get_guard_sequence
  2760.   end  
  2761.   
  2762.   #--------------------------------------------------------------------------
  2763.   # ? Get sequence
  2764.   #--------------------------------------------------------------------------   
  2765.   def get_counter_sequence
  2766.     seq = ''
  2767.     equips.each do |i|
  2768.       next if !i
  2769.       seq += i.get_counter_sequence
  2770.     end  
  2771.     return seq != '' ? seq : actor.get_counter_sequence
  2772.   end  
  2773.   
  2774.   #--------------------------------------------------------------------------
  2775.   # ? Get sequence
  2776.   #--------------------------------------------------------------------------   
  2777.   def get_die_sequence
  2778.     seq = ''
  2779.     equips.each do |i|
  2780.       next if !i
  2781.       seq += i.get_die_sequence
  2782.     end  
  2783.     return seq != '' ? seq : actor.get_die_sequence
  2784.   end

  2785.   #--------------------------------------------------------------------------
  2786.   # ? Get sequence
  2787.   #--------------------------------------------------------------------------   
  2788.   def get_dead_sequence
  2789.     seq = ''
  2790.     equips.each do |i|
  2791.       next if !i
  2792.       seq += i.get_dead_sequence
  2793.     end  
  2794.     return seq != '' ? seq : actor.get_dead_sequence
  2795.   end  
  2796.   
  2797.   #--------------------------------------------------------------------------
  2798.   # ? Get sequence
  2799.   #--------------------------------------------------------------------------   
  2800.   def get_revive_sequence
  2801.     seq = ''
  2802.     equips.each do |i|
  2803.       next if !i
  2804.       seq += i.get_revive_sequence
  2805.     end  
  2806.     return seq != '' ? seq : actor.get_revive_sequence
  2807.   end  
  2808.   
  2809.   #--------------------------------------------------------------------------
  2810.   # ? Get sequence
  2811.   #--------------------------------------------------------------------------   
  2812.   def get_victory_sequence
  2813.     seq = ''
  2814.     equips.each do |i|
  2815.       next if !i
  2816.       seq += i.get_victory_sequence
  2817.     end  
  2818.     return seq != '' ? seq : actor.get_victory_sequence
  2819.   end
  2820.   
  2821.   #--------------------------------------------------------------------------
  2822.   # ? Get sequence
  2823.   #--------------------------------------------------------------------------   
  2824.   def get_substitute_sequence
  2825.     seq = ''
  2826.     equips.each do |i|
  2827.       next if !i
  2828.       seq += i.get_substitute_sequence
  2829.     end  
  2830.     return seq != '' ? seq : actor.get_substitute_sequence
  2831.   end
  2832.   
  2833.   #--------------------------------------------------------------------------
  2834.   # ? Get sequence
  2835.   #--------------------------------------------------------------------------   
  2836.   def get_reflect_sequence
  2837.     seq = ''
  2838.     equips.each do |i|
  2839.       next if !i
  2840.       seq += i.get_reflect_sequence
  2841.     end  
  2842.     return seq != '' ? seq : actor.get_reflect_sequence
  2843.   end  
  2844.   
  2845.   #--------------------------------------------------------------------------
  2846.   # ? Get sequence
  2847.   #--------------------------------------------------------------------------
  2848.   def get_item_use_sequence
  2849.     seq = ''
  2850.     equips.each do |i|
  2851.       next if !i
  2852.       seq += i.get_item_use_sequence
  2853.     end  
  2854.     return seq != '' ? seq : actor.get_item_use_sequence
  2855.   end  
  2856.   
  2857.   #--------------------------------------------------------------------------
  2858.   # ? Get sequence
  2859.   #--------------------------------------------------------------------------
  2860.   def get_skill_use_sequence
  2861.     seq = ''
  2862.     equips.each do |i|
  2863.       next if !i
  2864.       seq += i.get_skill_use_sequence
  2865.     end  
  2866.     return seq != '' ? seq : actor.get_skill_use_sequence
  2867.   end   
  2868.   
  2869.   #--------------------------------------------------------------------------
  2870.   # ? Get sequence
  2871.   #--------------------------------------------------------------------------
  2872.   def get_stand_sequence
  2873.     seq = ''
  2874.     equips.each do |i|
  2875.       next if !i
  2876.       seq += i.get_stand_sequence if seq == ''
  2877.     end  
  2878.     states.each do |i|
  2879.       next if !i
  2880.       seq += i.get_stand_sequence if seq == ''
  2881.     end      
  2882.     return seq != '' ? seq : actor.get_stand_sequence
  2883.   end

  2884.   #--------------------------------------------------------------------------
  2885.   # ? Get sequence
  2886.   #--------------------------------------------------------------------------
  2887.   def get_evade_sequence
  2888.     seq = ''
  2889.     equips.each do |i|
  2890.       next if !i
  2891.       seq += i.get_evade_sequence
  2892.     end  
  2893.     return seq != '' ? seq : actor.get_evade_sequence
  2894.   end   
  2895.   
  2896.   #--------------------------------------------------------------------------
  2897.   # ? Get sequence
  2898.   #--------------------------------------------------------------------------
  2899.   def get_miss_sequence
  2900.     seq = ''
  2901.     equips.each do |i|
  2902.       next if !i
  2903.       seq += i.get_miss_sequence if seq == ''
  2904.     end  
  2905.     return seq != '' ? seq : actor.get_miss_sequence
  2906.   end      
  2907.   
  2908.   #--------------------------------------------------------------------------
  2909.   # ? Get sequence
  2910.   #--------------------------------------------------------------------------
  2911.   def get_return_sequence
  2912.     seq = ''
  2913.     equips.each do |i|
  2914.       next if !i
  2915.       seq += i.get_return_sequence if seq == ''
  2916.     end  
  2917.     states.each do |i|
  2918.       next if !i
  2919.       seq += i.get_return_sequence if seq == ''
  2920.     end  
  2921.     return seq != '' ? seq : actor.get_return_sequence
  2922.   end   
  2923.   
  2924.   #---------------------------------------------------------------------------
  2925.   # Gets the sequence used when actor is processing an input
  2926.   #---------------------------------------------------------------------------     
  2927.   def get_action_selection_sequence  
  2928.     seq = ''
  2929.     equips.each do |i|
  2930.       next if !i
  2931.       seq += i.get_action_selection_sequence  if seq == ''
  2932.     end  
  2933.     states.each do |i|
  2934.       next if !i
  2935.       seq += i.get_action_selection_sequence  if seq == ''
  2936.     end  
  2937.     return seq != '' ? seq : actor.get_action_selection_sequence   
  2938.   end
  2939.   
  2940.   #-----------------------------------------------------------------------------
  2941.   # Gets the real presentation action according to situation
  2942.   #-----------------------------------------------------------------------------  
  2943.   def get_real_presentation_action
  2944.     return get_dead_sequence if dead?
  2945.     BattleManager.surprise? ? get_surprised_sequence : (BattleManager.preemptive? ? get_preemptive_sequence : get_presentation_sequence )
  2946.   end  
  2947.   
  2948.   #-----------------------------------------------------------------------------
  2949.   # Performs collapse effect
  2950.   #-----------------------------------------------------------------------------  
  2951.   def perform_collapse_effect
  2952.     case collapse_type
  2953.     when 0
  2954.       @sprite_effect_type = :collapse
  2955.       Sound.play_enemy_collapse
  2956.     when 1
  2957.       @sprite_effect_type = :boss_collapse
  2958.       Sound.play_boss_collapse1
  2959.     when 2
  2960.       @sprite_effect_type = :instant_collapse
  2961.     end
  2962.   end  
  2963.   
  2964.   #-----------------------------------------------------------------------------
  2965.   # Has die sequence
  2966.   #-----------------------------------------------------------------------------  
  2967.   def die_sequence?
  2968.     return actor.note[/<die sequence on>/mi] ? true : false
  2969.   end
  2970.   
  2971.   #--------------------------------------------------------------------------
  2972.   # ? Get the attack skill id
  2973.   #--------------------------------------------------------------------------
  2974.   def attack_skill_id
  2975.     id = actor.get_atk_skill_id
  2976.     wpns = weapons.compact
  2977.     if wpns.size > 0
  2978.       w = wpns[rand(wpns.size)]   
  2979.       id2 = w.get_atk_skill_id
  2980.       id  = id2 if id2
  2981.     end  
  2982.     return id ? id : super
  2983.   end
  2984.   #--------------------------------------------------------------------------
  2985.   # ? Get the guard skill id
  2986.   #--------------------------------------------------------------------------
  2987.   def guard_skill_id
  2988.     id = actor.get_guard_skill_id
  2989.     armrs = armors.compact
  2990.     if armrs.size > 0
  2991.       a = armrs[rand(armrs.size)]   
  2992.       id2 = a.get_guard_skill_id
  2993.       id  = id2 if id2
  2994.     end  
  2995.     return id ? id : super
  2996.   end   
  2997.   
  2998.   #-----------------------------------------------------------------------------
  2999.   # Get friend unit
  3000.   #-----------------------------------------------------------------------------
  3001.   def friend_unit
  3002.     return $game_party
  3003.   end
  3004.   
  3005.   #-----------------------------------------------------------------------------
  3006.   # Get enemy unit
  3007.   #-----------------------------------------------------------------------------  
  3008.   def enemy_unit
  3009.     return $game_troop
  3010.   end   
  3011.   
  3012.   #-----------------------------------------------------------------------------
  3013.   # Get default battler index
  3014.   #-----------------------------------------------------------------------------  
  3015.   def default_battler_index
  3016.     a = actor.get_default_battler_index
  3017.     return a ? a : BattleConfig::DefaultActorIndex
  3018.   end

  3019.   #-----------------------------------------------------------------------------
  3020.   # Get attack animation 1
  3021.   #-----------------------------------------------------------------------------  
  3022.   def atk_animation_id1
  3023.     if dual_wield?
  3024.       return weapons[0].animation_id if weapons[0]
  3025.       return weapons[1] ? 0 : @default_atk_animation_id1
  3026.     else
  3027.       return weapons[0] ? weapons[0].animation_id : 1
  3028.     end
  3029.   end

  3030.   #-----------------------------------------------------------------------------
  3031.   # Get attack animation 2
  3032.   #-----------------------------------------------------------------------------   
  3033.   def atk_animation_id2
  3034.     if dual_wield?
  3035.       return weapons[1] ? weapons[1].animation_id : @default_atk_animation_id2
  3036.     else
  3037.       return 0
  3038.     end
  3039.   end  
  3040.   
  3041.   #-----------------------------------------------------------------------------
  3042.   # Get counter attack skill id
  3043.   #-----------------------------------------------------------------------------   
  3044.   def counter_skill_id
  3045.     id = @counter_skill_id
  3046.     equips.each do |i|
  3047.       next if !i
  3048.       id = i.note[/<counter skill id:(.*?)>/im] ? Kernel.eval($1) : id
  3049.     end      
  3050.     return id
  3051.   end   
  3052.   
  3053. end

  3054. #==============================================================================
  3055. # ?Game_Picture
  3056. #------------------------------------------------------------------------------
  3057. #  ??????????????????? Game_Pictures ??????????
  3058. # ??????????????????????????
  3059. #==============================================================================

  3060. class Game_Picture
  3061.   
  3062.   #-----------------------------------------------------------------------------
  3063.   # Class atributes
  3064.   #-----------------------------------------------------------------------------
  3065.   attr_accessor :animation_id
  3066.   attr_accessor :animation_flip
  3067.   
  3068.   #-----------------------------------------------------------------------------
  3069.   # Alias methods
  3070.   #-----------------------------------------------------------------------------  
  3071.   alias rbs_game_picture_init_basic init_basic
  3072.   
  3073.   #-----------------------------------------------------------------------------
  3074.   # Start basic information
  3075.   #-----------------------------------------------------------------------------   
  3076.   def init_basic
  3077.     @animation_id = 0
  3078.     @animation_flip = false   
  3079.     rbs_game_picture_init_basic
  3080.   end
  3081.   
  3082.   #-----------------------------------------------------------------------------
  3083.   #  Move ex
  3084.   #-----------------------------------------------------------------------------   
  3085.   def move_ex(x, y, duration)
  3086.     @target_x = x.to_f
  3087.     @target_y = y.to_f
  3088.     @duration = duration   
  3089.   end
  3090.   
  3091.   #-----------------------------------------------------------------------------
  3092.   # Set zoom
  3093.   #-----------------------------------------------------------------------------   
  3094.   def set_zoom(zoom_x, zoom_y, duration)
  3095.     @target_zoom_x = zoom_x.to_f
  3096.     @target_zoom_y = zoom_y.to_f
  3097.     @duration = duration      
  3098.   end
  3099.   
  3100.   #-----------------------------------------------------------------------------
  3101.   # Set opacity
  3102.   #-----------------------------------------------------------------------------   
  3103.   def set_opacity(opacity, duration)
  3104.     @target_opacity = opacity.to_f
  3105.     @duration = duration      
  3106.   end  
  3107.   
  3108.   #-----------------------------------------------------------------------------
  3109.   # Set animation
  3110.   #-----------------------------------------------------------------------------   
  3111.   def set_animation(animation_id, flip=false)
  3112.     @animation_id = animation_id
  3113.     @animation_flip = flip
  3114.   end
  3115.   
  3116. end

  3117. #===============================================================================
  3118. # END GAME OBJECTS SECTION
  3119. #===============================================================================

  3120. #===============================================================================
  3121. # BEGIN WINDOW SECTION
  3122. #===============================================================================

  3123. if !$imported["YEA-BattleEngine"] # If you use YEA please configure it from YEA.

  3124. #==============================================================================
  3125. # ?Window_BattleLog
  3126. #==============================================================================
  3127. class Window_BattleLog < Window_Selectable
  3128.   #--------------------------------------------------------------------------
  3129.   # ? Display the use item
  3130.   #--------------------------------------------------------------------------
  3131.   def display_use_item(subject, item)
  3132.     if item.is_a?(RPG::Skill)
  3133.       if BattleConfig::Log_DisplaySkillName
  3134.         add_text("\\I[#{item.icon_index}]#{item.name}")
  3135.       end
  3136.       if BattleConfig::Log_DisplaySkillMsg1
  3137.         add_text(subject.name + item.message1)
  3138.       end  
  3139.       if BattleConfig::Log_DisplaySkillMsg2 && !item.message2.empty?
  3140.         wait
  3141.         add_text(item.message2)
  3142.       end
  3143.     elsif
  3144.       if BattleConfig::Log_DisplayItemName
  3145.         add_text("\\I[#{item.icon_index}]#{item.name}")
  3146.       end  
  3147.       if BattleConfig::Log_DisplayItemUsage
  3148.         add_text(sprintf(Vocab::UseItem, subject.name, item.name))
  3149.       end  
  3150.     end
  3151.   end  
  3152.   
  3153.   #--------------------------------------------------------------------------
  3154.   # ? Display action results
  3155.   #--------------------------------------------------------------------------
  3156.   def display_action_results(target, item)
  3157.     if target.result.used
  3158.       last_line_number = line_number
  3159.       display_critical(target, item) if BattleConfig::Log_DisplayCritical
  3160.       display_damage(target, item)
  3161.       display_affected_status(target, item)
  3162.       display_failure(target, item) if BattleConfig::Log_DisplayFailure
  3163.       wait if line_number > last_line_number
  3164.       back_to(last_line_number)
  3165.     end
  3166.   end  
  3167.   
  3168.   #--------------------------------------------------------------------------
  3169.   # ? Display damage
  3170.   #--------------------------------------------------------------------------
  3171.   def display_damage(target, item)
  3172.     if target.result.missed
  3173.       display_miss(target, item) if BattleConfig::Log_DisplayMiss
  3174.     elsif target.result.evaded
  3175.       display_evasion(target, item) if BattleConfig::Log_DisplayEvasion
  3176.     else
  3177.       display_hp_damage(target, item) if BattleConfig::Log_DisplayHpDamage
  3178.       display_mp_damage(target, item) if BattleConfig::Log_DisplayMpDamage
  3179.       display_tp_damage(target, item) if BattleConfig::Log_DisplayTpDamage
  3180.     end
  3181.   end  
  3182.   
  3183.   #--------------------------------------------------------------------------
  3184.   # ? Display changed states
  3185.   #--------------------------------------------------------------------------
  3186.   def display_changed_states(target)
  3187.     display_added_states(target) if BattleConfig::Log_DisplayAddedStates
  3188.     display_removed_states(target) if BattleConfig::Log_DisplayRemovedStates
  3189.   end  
  3190.   
  3191.   #--------------------------------------------------------------------------
  3192.   # ? Display added states
  3193.   #--------------------------------------------------------------------------
  3194.   def display_added_states(target)
  3195.     target.result.added_state_objects.each do |state|
  3196.       state_msg = target.actor? ? state.message1 : state.message2
  3197.       next if state_msg.empty?
  3198.       replace_text(target.name + state_msg)
  3199.       wait
  3200.       wait_for_effect
  3201.     end
  3202.   end  

  3203.   #--------------------------------------------------------------------------
  3204.   # ? Display changed buffs
  3205.   #--------------------------------------------------------------------------
  3206.   def display_changed_buffs(target)
  3207.     display_buffs(target, target.result.added_buffs, Vocab::BuffAdd) if BattleConfig::Log_DisplayBuffs
  3208.     display_buffs(target, target.result.added_debuffs, Vocab::DebuffAdd) if BattleConfig::Log_DisplayDebuffs
  3209.     display_buffs(target, target.result.removed_buffs, Vocab::BuffRemove) if BattleConfig::Log_DisplayRemovedBuffs
  3210.   end  
  3211.   
  3212. end

  3213. end # if $imported["YEA-BattleEngine"]

  3214. #==============================================================================
  3215. # ?Window_BattleItem
  3216. #==============================================================================
  3217. class Window_BattleItem < Window_ItemList
  3218.   
  3219.   #--------------------------------------------------------------------------
  3220.   # ? Object creation
  3221.   #--------------------------------------------------------------------------
  3222.   def initialize(help_window, info_viewport)
  3223.     y = Graphics.height - window_height
  3224.     super(0, y, window_width, window_height)
  3225.     self.visible = false
  3226.     @help_window = help_window
  3227.     @info_viewport = info_viewport
  3228.   end
  3229.   
  3230.   #--------------------------------------------------------------------------
  3231.   # ? Get window width
  3232.   #--------------------------------------------------------------------------
  3233.   def window_width
  3234.     Graphics.width
  3235.   end
  3236.   
  3237.   #--------------------------------------------------------------------------
  3238.   # ? Get window height
  3239.   #--------------------------------------------------------------------------
  3240.   def window_height
  3241.     fitting_height(visible_line_number)
  3242.   end

  3243.   #--------------------------------------------------------------------------
  3244.   # ? Get visible line muber
  3245.   #--------------------------------------------------------------------------  
  3246.   def visible_line_number
  3247.     return 4
  3248.   end  
  3249.   
  3250.   
  3251. end

  3252. #==============================================================================
  3253. # ?Window_BattleSkill
  3254. #------------------------------------------------------------------------------
  3255. #  ???????????????????????????
  3256. #==============================================================================

  3257. class Window_BattleSkill < Window_SkillList
  3258.   
  3259.   #--------------------------------------------------------------------------
  3260.   # ? Object Creation
  3261.   #--------------------------------------------------------------------------
  3262.   def initialize(help_window, info_viewport)
  3263.     y = Graphics.height - window_height
  3264.     super(0, y, window_width, window_height)
  3265.     self.visible = false
  3266.     @help_window = help_window
  3267.     @info_viewport = info_viewport
  3268.   end
  3269.   #--------------------------------------------------------------------------
  3270.   # ? Gets window width
  3271.   #--------------------------------------------------------------------------
  3272.   def window_width
  3273.     Graphics.width
  3274.   end
  3275.   #--------------------------------------------------------------------------
  3276.   # ? Gets window height
  3277.   #--------------------------------------------------------------------------
  3278.   def window_height
  3279.     fitting_height(visible_line_number)
  3280.   end
  3281.   
  3282.   #--------------------------------------------------------------------------
  3283.   # ? Get visible line muber
  3284.   #--------------------------------------------------------------------------   
  3285.   def visible_line_number
  3286.     return 4
  3287.   end  

  3288. end

  3289. #===============================================================================
  3290. # END WINDOW SECTION
  3291. #===============================================================================

  3292. #===============================================================================
  3293. # BEGIN SCENE SECTION
  3294. #===============================================================================

  3295. #==============================================================================
  3296. # ?Scene_Battle
  3297. #==============================================================================
  3298. class Scene_Battle < Scene_Base
  3299.   #--------------------------------------------------------------------------
  3300.   # ? Alias methods
  3301.   #--------------------------------------------------------------------------
  3302.   alias rbs_scene_battle_start start
  3303.   alias rbs_scene_battle_post_start post_start
  3304.   alias rbs_scene_battle_battle_start battle_start
  3305.   alias rbs_scene_battle_use_item use_item
  3306.   alias rbs_scene_battle_update_basic update_basic
  3307.   alias rbs_scene_battle_start_actor_command_selection start_actor_command_selection
  3308.   alias rbs_scene_battle_next_command next_command
  3309.   alias rbs_scene_battle_prior_command prior_command
  3310.   
  3311.   #--------------------------------------------------------------------------
  3312.   # ? Start scene
  3313.   #--------------------------------------------------------------------------
  3314.   def start
  3315.     BattleCamera.start
  3316.     rbs_scene_battle_start
  3317.     BattleInterpreter.start(@spriteset)
  3318.     setup_battle_commands
  3319.   end
  3320.   
  3321.   #--------------------------------------------------------------------------
  3322.   # ? Post star scene
  3323.   #--------------------------------------------------------------------------   
  3324.   def post_start
  3325.     rbs_scene_battle_post_start
  3326.     show_presentation_animation
  3327.   end
  3328.   
  3329.   #--------------------------------------------------------------------------
  3330.   # ? Start battle
  3331.   #--------------------------------------------------------------------------   
  3332.   def battle_start   
  3333.     rbs_scene_battle_battle_start
  3334.   end
  3335.    
  3336.   #--------------------------------------------------------------------------
  3337.   # ? Get next command
  3338.   #--------------------------------------------------------------------------   
  3339.   def next_command
  3340.     if BattleManager.actor
  3341.       actor = BattleManager.actor
  3342.       BattleInterpreter.add_looping_action(actor, actor.get_stand_sequence)
  3343.       BattleInterpreter.add_action(actor, [actor], actor.get_turn_end_sequence, $data_skills[1])
  3344.       wait_for_battle_interpreter      
  3345.     end  
  3346.     rbs_scene_battle_next_command  
  3347.   end
  3348.   
  3349.   #--------------------------------------------------------------------------
  3350.   # ? Get Prior command
  3351.   #--------------------------------------------------------------------------   
  3352.   def prior_command
  3353.     if BattleManager.actor
  3354.       actor = BattleManager.actor
  3355.       BattleInterpreter.add_looping_action(actor, actor.get_stand_sequence)   
  3356.       BattleInterpreter.add_action(actor, [actor], actor.get_turn_end_sequence, $data_skills[1])
  3357.       wait_for_battle_interpreter      
  3358.     end  
  3359.     rbs_scene_battle_prior_command  
  3360.   end  
  3361.   
  3362.   #--------------------------------------------------------------------------
  3363.   # ? Show presentation animation
  3364.   #--------------------------------------------------------------------------   
  3365.   def show_presentation_animation
  3366.     @spriteset.update
  3367.     act = @party_command_window.active
  3368.     @party_command_window.deactivate
  3369.     @party_command_window.hide
  3370.     for member in $game_party.members+$game_troop.members
  3371.       sequence = member.get_real_presentation_action
  3372.       BattleInterpreter.add_action(member, [member], sequence, $data_skills[1])
  3373.     end  
  3374.     wait_for_battle_interpreter
  3375.     wait(20)
  3376.     @spriteset.make_return_sequence
  3377.     wait_for_battle_interpreter
  3378.     if $imported["YEA-BattleEngine"]
  3379.       @party_command_window.show
  3380.       @party_command_window.active = act
  3381.     else  
  3382.       @party_command_window.activate
  3383.       @party_command_window.show
  3384.     end  
  3385.   end
  3386.   
  3387.   #--------------------------------------------------------------------------
  3388.   # ? Start actor command selection
  3389.   #--------------------------------------------------------------------------   
  3390.   def start_actor_command_selection
  3391.     if BattleManager.actor
  3392.       actor = BattleManager.actor
  3393.       BattleInterpreter.add_looping_action(actor, actor.get_action_selection_sequence)  
  3394.       BattleInterpreter.add_action(actor, [actor], actor.get_turn_start_sequence, $data_skills[1])
  3395.       wait_for_battle_interpreter      
  3396.     end     
  3397.     rbs_scene_battle_start_actor_command_selection
  3398.   end

  3399.   #--------------------------------------------------------------------------
  3400.   # ? Show attack animation
  3401.   #--------------------------------------------------------------------------   
  3402.   def show_attack_animation(targets)
  3403.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  3404.     wait_for_animation
  3405.     show_normal_animation(targets, @subject.atk_animation_id2, true)
  3406.   end  

  3407.   #--------------------------------------------------------------------------
  3408.   # ? Use item
  3409.   #--------------------------------------------------------------------------
  3410.   def use_item
  3411.     setup_dead_battlers
  3412.     item = @subject.current_action.item
  3413.     sequence = get_sequence(@subject, item)
  3414.     @log_window.display_use_item(@subject, item)
  3415.     @subject.use_item(item)   
  3416.     if $imported["YEA-LunaticObjects"]
  3417.       lunatic_object_effect(:before, item, @subject, @subject)
  3418.     end   
  3419.     if sequence == ''
  3420.       refresh_status
  3421.       targets = @subject.current_action.make_targets.compact
  3422.       show_animation(targets, item.animation_id)
  3423.       targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  3424.     else
  3425.       targets = @subject.current_action.make_targets.compact
  3426.       if $imported["YEA-TargetManager"]
  3427.         targets = [alive_random_target(target, item)] if item.for_random?
  3428.       end
  3429.       process_casting_animation if $imported["YEA-CastAnimations"]
  3430.       BattleInterpreter.add_action(@subject, targets, sequence, item)
  3431.       wait_for_battle_interpreter
  3432.     end   
  3433.     if $imported["YEA-LunaticObjects"]
  3434.       lunatic_object_effect(:after, item, @subject, @subject)
  3435.     end     
  3436.     finish_item_use
  3437.   end
  3438.   
  3439.   def setup_dead_battlers
  3440.     @dead_battlers = []
  3441.     for battler in $game_troop.dead_members+$game_party.dead_members
  3442.       @dead_battlers.push(battler) if battler.dead?
  3443.     end      
  3444.   end
  3445.   
  3446.   def finish_item_use
  3447.     @spriteset.make_return_sequence
  3448.     wait_for_battle_interpreter
  3449.     for battler in $game_troop.members+$game_party.members
  3450.       if battler.dead? && !@dead_battlers.include?(battler)
  3451.         @dead_battlers.delete(battler)
  3452.         if battler.die_sequence?
  3453.           sequence = battler.get_die_sequence
  3454.           BattleInterpreter.add_action(battler, [battler], sequence, nil, false)
  3455.         else
  3456.           battler.perform_collapse_effect
  3457.         end  
  3458.       elsif battler.alive? &&  @dead_battlers.include?(battler)
  3459.         sequence = battler.get_revive_sequence
  3460.         BattleInterpreter.add_action(battler, [battler], sequence, nil, false)
  3461.       end        
  3462.     end
  3463.     wait_for_battle_interpreter   
  3464.   end
  3465.   
  3466.   #--------------------------------------------------------------------------
  3467.   # ? Gets the sequence for an item
  3468.   #--------------------------------------------------------------------------   
  3469.   def get_sequence(subject, item)
  3470.     sequence = item.get_attack_sequence
  3471.     if item.is_a?(RPG::Skill) and item.id == subject.attack_skill_id
  3472.       seq = subject.get_attack_sequence
  3473.       if seq != ''
  3474.         sequence = seq
  3475.       end
  3476.     elsif item.is_a?(RPG::Skill) and item.id == subject.guard_skill_id
  3477.       seq = subject.get_guard_sequence
  3478.       if seq != ''
  3479.         sequence = seq
  3480.       end
  3481.     end  
  3482.     if sequence == ''  
  3483.       if item.is_a?(RPG::Skill)
  3484.         seq = subject.get_skill_use_sequence
  3485.         if seq != ''
  3486.           sequence = seq
  3487.         end        
  3488.       elsif item.is_a?(RPG::Item)
  3489.         seq = subject.get_item_use_sequence
  3490.         if seq != ''
  3491.           sequence = seq
  3492.         end
  3493.       end
  3494.     end   
  3495.     return sequence
  3496.   end
  3497.   
  3498.   #--------------------------------------------------------------------------
  3499.   # ? Wait for battle interpreter
  3500.   #--------------------------------------------------------------------------   
  3501.   def wait_for_battle_interpreter
  3502.     update_for_wait while BattleInterpreter.running?
  3503.     wait_for_animation
  3504.   end
  3505.   
  3506.   #--------------------------------------------------------------------------
  3507.   # ? Basic update
  3508.   #--------------------------------------------------------------------------   
  3509.   def update_basic
  3510.     rbs_scene_battle_update_basic
  3511.     BattleCamera.update
  3512.     BattleInterpreter.update
  3513.   end

  3514.   #--------------------------------------------------------------------------
  3515.   # ? Show animation ex
  3516.   #--------------------------------------------------------------------------  
  3517.   def show_animation_ex(targets, animation_id, mirror = false)
  3518.     return if !targets || targets.empty?
  3519.     animation = $data_animations[animation_id]
  3520.     if animation
  3521.       if animation.to_screen?
  3522.         target = targets[0]
  3523.         target.start_animation(animation, mirror)      
  3524.       else  
  3525.         targets.each do |target|
  3526.           target.start_animation(animation, mirror)     
  3527.         end
  3528.       end  
  3529.     end
  3530.   end  
  3531.   
  3532.   #--------------------------------------------------------------------------
  3533.   # ? Apply item efects
  3534.   #--------------------------------------------------------------------------
  3535.   def apply_item_effects_ex(user, target, item)
  3536.     if $imported["YEA-LunaticObjects"]
  3537.       lunatic_object_effect(:prepare, item, @subject, target)
  3538.     end   
  3539.     target.item_apply(user, item)
  3540.     if $imported["YEA-LunaticObjects"]
  3541.       lunatic_object_effect(:during, item, @subject, target)
  3542.     end     
  3543.     refresh_status
  3544.     @log_window.display_action_results(target, item)
  3545.   end
  3546.   
  3547.   #--------------------------------------------------------------------------
  3548.   # ? Invoke counter attack
  3549.   #--------------------------------------------------------------------------
  3550.   def invoke_counter_attack_ex(user, target, item)
  3551.     if BattleConfig::Log_DisplayCounterattack
  3552.       @log_window.display_counter(target, item)
  3553.     end  
  3554.     attack_skill = $data_skills[target.counter_skill_id]
  3555.     sequence = attack_skill.get_counter_sequence
  3556.     sequence = target.get_counter_sequence if sequence == ''
  3557.     BattleInterpreter.add_action(target, [user], sequence, attack_skill, false)
  3558.     @log_window.display_action_results(target, attack_skill)
  3559.   end
  3560.   
  3561.   #--------------------------------------------------------------------------
  3562.   # ? Invoke magic reflection
  3563.   #--------------------------------------------------------------------------
  3564.   def invoke_magic_reflection_ex(action, target)
  3565.     item = action.item
  3566.     user = action.user
  3567.     if BattleConfig::Log_DisplayReflection
  3568.       @log_window.display_reflection(target, item)
  3569.     end  
  3570.     action.targets.delete(target)
  3571.     action.targets.push(user)
  3572.     sequence = target.get_reflect_sequence
  3573.     BattleInterpreter.add_action(target, [user], sequence, item, false)
  3574.   end
  3575.   
  3576.   #--------------------------------------------------------------------------
  3577.   # ? Apply substitute
  3578.   #--------------------------------------------------------------------------
  3579.   def apply_substitute_ex(action, target, item)
  3580.     if check_substitute(target, item)
  3581.       substitute = target.friends_unit.substitute_battler
  3582.       if substitute && target != substitute && [email protected]?(substitute)
  3583.         if BattleConfig::Log_DisplaySubstitute
  3584.           @log_window.display_substitute(substitute, target)
  3585.         end
  3586.         sequence = substitute.get_substitute_sequence
  3587.         action.targets.delete(target)
  3588.         action.targets.push(substitute)
  3589.         @substitutes.push(substitute)
  3590.         BattleInterpreter.add_action(substitute, [target], sequence, item)
  3591.       end
  3592.     end
  3593.   end  
  3594.   
  3595. if !$imported["YEA-BattleEngine"]  # If YEA is imported, please consider using
  3596.                                    # the YEA target selection
  3597.   #--------------------------------------------------------------------------
  3598.   # ? Selects an enemy
  3599.   #--------------------------------------------------------------------------   
  3600.   def select_enemy_selection
  3601.     @actor_input = false
  3602.     @skill_window.hide
  3603.     @item_window.hide   
  3604.     @target_index = 0
  3605.     @target_sprites = get_sprites($game_troop.members).compact
  3606.     @target_size = $game_troop.members.size
  3607.     @cursor_sprite = Sprite_TargetCursor.new
  3608.     while !@actor_input && $game_troop.members[@target_index].dead?
  3609.       @target_index = (@target_index + 1) % @target_size
  3610.     end     
  3611.     loop do
  3612.       update_for_wait
  3613.       if Input.trigger?(:C)
  3614.         Sound.play_ok
  3615.         @cursor_sprite.dispose
  3616.         on_enemy_ok
  3617.         return
  3618.       elsif Input.trigger?(:B)
  3619.         Sound.play_cancel
  3620.         @cursor_sprite.dispose
  3621.         on_enemy_cancel
  3622.         return
  3623.       end  
  3624.       update_target_selection
  3625.     end
  3626.   end
  3627.   
  3628.   #--------------------------------------------------------------------------
  3629.   # ? Selects an actor
  3630.   #--------------------------------------------------------------------------   
  3631.   def select_actor_selection
  3632.     @actor_input = true
  3633.     @skill_window.hide
  3634.     @item_window.hide
  3635.     @target_index = 0
  3636.     @target_sprites = get_sprites($game_party.members).compact
  3637.     @target_size = $game_party.members.size
  3638.     @cursor_sprite = Sprite_TargetCursor.new
  3639.     loop do
  3640.       update_for_wait
  3641.       if Input.trigger?(:C)
  3642.         Sound.play_ok
  3643.         @cursor_sprite.dispose
  3644.         on_actor_ok
  3645.         break
  3646.       elsif Input.trigger?(:B)
  3647.         Sound.play_cancel
  3648.         @cursor_sprite.dispose
  3649.         on_actor_cancel
  3650.         break
  3651.       end  
  3652.       update_target_selection
  3653.     end   
  3654.    
  3655.   end
  3656.   
  3657.   #--------------------------------------------------------------------------
  3658.   # ? Update target selction
  3659.   #--------------------------------------------------------------------------   
  3660.   def update_target_selection
  3661.     if Input.repeat?(:UP) || Input.repeat?(:RIGHT)
  3662.       Sound.play_cursor
  3663.       @target_index = (@target_index + 1) % @target_size
  3664.       while !@actor_input && $game_troop.members[@target_index].dead?
  3665.         @target_index = (@target_index + 1) % @target_size
  3666.       end  
  3667.     elsif Input.repeat?(:DOWN) || Input.repeat?(:LEFT)
  3668.       Sound.play_cursor
  3669.       @target_index = (@target_index - 1) % @target_size
  3670.       while !@actor_input && $game_troop.members[@target_index].dead?
  3671.         @target_index = (@target_index - 1) % @target_size
  3672.       end      
  3673.     end
  3674.     sprite = @target_sprites[@target_index]
  3675.     @cursor_sprite.screen_x = sprite.current_x
  3676.     @cursor_sprite.screen_y = sprite.current_y
  3677.     @cursor_sprite.update
  3678.   end
  3679.   
  3680.   #--------------------------------------------------------------------------
  3681.   # ? On actor ok
  3682.   #--------------------------------------------------------------------------   
  3683.   def on_actor_ok
  3684.     BattleManager.actor.input.target_index = @target_index
  3685.     @actor_window.hide
  3686.     @skill_window.hide
  3687.     @item_window.hide   
  3688.     next_command
  3689.   end  
  3690.   
  3691.   #--------------------------------------------------------------------------
  3692.   # ? On enemy ok
  3693.   #--------------------------------------------------------------------------   
  3694.   def on_enemy_ok
  3695.     BattleManager.actor.input.target_index = @target_index
  3696.     @enemy_window.hide
  3697.     @skill_window.hide
  3698.     @item_window.hide   
  3699.     next_command
  3700.   end  
  3701.   
  3702.   #--------------------------------------------------------------------------
  3703.   # ? On actor cancel
  3704.   #--------------------------------------------------------------------------
  3705.   def on_actor_cancel
  3706.     @actor_window.hide
  3707.     case @actor_command_window.current_symbol
  3708.     when :skill
  3709.       @skill_window.show
  3710.       @skill_window.activate
  3711.     when :item
  3712.       @item_window.show
  3713.       @item_window.activate
  3714.     end
  3715.   end  
  3716.   
  3717.   #--------------------------------------------------------------------------
  3718.   # ? On enemy cancel
  3719.   #--------------------------------------------------------------------------
  3720.   def on_enemy_cancel
  3721.     @enemy_window.hide
  3722.     case @actor_command_window.current_symbol
  3723.     when :attack
  3724.       @actor_command_window.activate
  3725.     when :skill
  3726.       @skill_window.show
  3727.       @skill_window.activate
  3728.     when :item
  3729.       @item_window.show
  3730.       @item_window.activate
  3731.     end
  3732.   end   
  3733.   
  3734. end # if !$imported["YEA-BattleEngine"]   
  3735.   
  3736.   #--------------------------------------------------------------------------
  3737.   # ? Get battler sprites
  3738.   #--------------------------------------------------------------------------   
  3739.   def get_sprites(battlers)
  3740.     result = []
  3741.     battlers.each do |battler|
  3742.       result.push(@spriteset.battler_sprite(battler))
  3743.     end
  3744.     return result
  3745.   end
  3746.   
  3747. end  

  3748. #===============================================================================
  3749. # END SCENE SECTION
  3750. #===============================================================================

  3751. #===============================================================================
  3752. # START YEA COMPATIBILITY
  3753. #===============================================================================

  3754. if $imported["YEA-BattleEngine"]
  3755.   
  3756. #==============================================================================
  3757. # ?Sprite_Popup
  3758. #==============================================================================

  3759. class Scene_Battle < Scene_Base
  3760.   attr_accessor :spriteset
  3761. end

  3762. class Sprite_Popup < Sprite_Base  
  3763.   
  3764.   attr_accessor :current_x
  3765.   attr_accessor :current_y
  3766.   
  3767.   alias rbs_yea_sprite_popup_create_popup_bitmap create_popup_bitmap  
  3768.   
  3769.   #--------------------------------------------------------------------------
  3770.   # create_popup_bitmap
  3771.   #--------------------------------------------------------------------------
  3772.   def create_popup_bitmap
  3773.     rbs_yea_sprite_popup_create_popup_bitmap
  3774.     @current_x = @battler.sprite.current_x
  3775.     @current_y = @battler.sprite.current_y
  3776.     @current_x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
  3777.     @current_x -= SceneManager.scene.spriteset.viewport1.ox
  3778.     @current_y  = @battler.sprite.current_y - @battler.sprite.oy/2
  3779.     @current_y -= @battler.sprite.oy/2 if @battler.actor?
  3780.     @current_y -= SceneManager.scene.spriteset.viewport1.oy
  3781.     update
  3782.   end
  3783.   
  3784.   #--------------------------------------------------------------------------
  3785.   # update
  3786.   #--------------------------------------------------------------------------
  3787.   def update
  3788.     super
  3789.     @current_zoom_x = 0 if !@current_zoom_x
  3790.     @current_zoom_y = 0 if !@current_zoom_y
  3791.     @current_x = self.x if !@current_x
  3792.     @current_y = self.y if !@current_y   
  3793.     #---
  3794.     if @flags.include?("critical") && YEA::BATTLE::FLASH_CRITICAL
  3795.       @hue_duration = 2 if @hue_duration == nil || @hue_duration == 0
  3796.       @hue_duration -= 1
  3797.       self.bitmap.hue_change(15) if @hue_duration <= 0
  3798.     end
  3799.     #---
  3800.     if @zoom_direction == "up"
  3801.       @current_zoom_x = [@current_zoom_x + 0.075, @target_zoom].min
  3802.       @current_zoom_y = [@current_zoom_y + 0.075, @target_zoom].min
  3803.     else
  3804.       @current_zoom_x = [@current_zoom_x - 0.075, @target_zoom].max
  3805.       @current_zoom_y = [@current_zoom_y - 0.075, @target_zoom].max
  3806.     end
  3807.     self.zoom_x = BattleCamera.correct_zoom(@current_zoom_x)
  3808.     self.zoom_y = BattleCamera.correct_zoom(@current_zoom_y)
  3809.    
  3810.     self.x = BattleCamera.correct_x(@current_x)
  3811.     self.y = BattleCamera.correct_y(@current_y)
  3812.    
  3813.     #---
  3814.     @full -= 1
  3815.     return if @full > 0
  3816.     @current_y -= 1
  3817.     self.opacity -= @fade
  3818.     self.y = BattleCamera.correct_y(@current_y)
  3819.   end  
  3820.   
  3821. end  
  3822.   
  3823. class Sprite_Battler < Sprite_Base

  3824.   alias rbs_yea_create_new_popup create_new_popup
  3825.   
  3826.   #--------------------------------------------------------------------------
  3827.   # new method: create_new_popup
  3828.   #--------------------------------------------------------------------------
  3829.   def create_new_popup(value, rules, flags)
  3830.     return if @battler == nil
  3831.     return if flags & @popup_flags != []
  3832.     for popup in @popups
  3833.       popup.current_y -= 24
  3834.     end
  3835.     rbs_yea_create_new_popup(value, rules, flags)
  3836.   end
  3837.   
  3838. end

  3839. end

  3840. #===============================================================================
  3841. # END YEA COMPATIBILITY
  3842. #===============================================================================

  3843. #===============================================================================
  3844. # END OF FILE!!!
  3845. #===============================================================================
  3846. #===============================================================================
  3847. # ** RBS - Ramiro's Battle System (PART II - Classes And Modules)
  3848. # Version 2.0
  3849. # Difficulty Very Hard.
  3850. #-------------------------------------------------------------------------------
  3851. # If you don't know what to do... DO NOT EDIT THIS FILE.
  3852. #-------------------------------------------------------------------------------
  3853. # License:
  3854. #Copyright (c) 2012, Ramiro Rojo
  3855. #All rights reserved.
  3856. #
  3857. #Redistribution and use in source and binary forms, with or without
  3858. #modification, are permitted provided that the following conditions are met:
  3859. #
  3860. #1. Redistributions of source code must retain the above copyright notice, this
  3861. #   list of conditions and the following disclaimer.
  3862. #2. Redistributions in binary form must reproduce the above copyright notice,
  3863. #   this list of conditions and the following disclaimer in the documentation
  3864. #   and/or other materials provided with the distribution.
  3865. #
  3866. #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  3867. #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  3868. #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  3869. #DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  3870. #ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  3871. #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  3872. #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  3873. #ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  3874. #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  3875. #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3876. #
  3877. #The views and conclusions contained in the software and documentation are those
  3878. #of the authors and should not be interpreted as representing official policies,
  3879. #either expressed or implied, of the FreeBSD Project.
  3880. #===============================================================================

  3881. #==============================================================================
  3882. # ?Scene_Battle
  3883. #==============================================================================

  3884. class Scene_Battle < Scene_Base
  3885.   
  3886.   def setup_battle_commands
  3887.    
  3888.     # ADDING A COMMAND:
  3889.     # BattleInterpreter::Commands['command in upercase'] = [needs close, linked method]
  3890.    
  3891.     # <pose: target, character_index, pose_id, style, loops, interval> (WORKS!)
  3892.     BattleInterpreter::Commands['POSE'] = [false, method(:on_pose_command)]
  3893.     # <wait: time> (WORKS!)
  3894.     BattleInterpreter::Commands['WAIT'] = [false, method(:on_wait_command)]
  3895.     # <move: mover, target, x_correction, y_correction, jump, time> (WORKS!)
  3896.     BattleInterpreter::Commands['MOVE'] = [false, method(:on_move_command)]
  3897.     # <zoom: target, zoom_x, zoom_y, time> (WORKS!)
  3898.     BattleInterpreter::Commands['ZOOM'] = [false, method(:on_zoom_command)]
  3899.     # <angle: target, angle, time> (WORKS!)
  3900.     BattleInterpreter::Commands['ANGLE'] = [false, method(:on_angle_command)]
  3901.     # <opacity: target, opacity, time> (WORKS!)
  3902.     BattleInterpreter::Commands['OPACITY'] = [false, method(:on_opacity_command)]   
  3903.     # <animation: target, animation_id, flip> (WORKS!)
  3904.     BattleInterpreter::Commands['ANIMATION'] = [false, method(:on_animation_command)]
  3905.     # <effects>
  3906.     BattleInterpreter::Commands['EFFECTS'] = [false, method(:on_effects_command)]
  3907.     # <if: 'evaluating condition'> (WORKS!)
  3908.     BattleInterpreter::Commands['IF'] = [true, method(:on_if_command)]
  3909.     # <repeat: 'times'> (WORKS!)
  3910.     BattleInterpreter::Commands['REPEAT'] = [true, method(:on_repeat_command)]  
  3911.     # <while: 'evaluating condition'> (WORKS!)
  3912.     BattleInterpreter::Commands['WHILE'] = [true, method(:on_while_command)]      
  3913.     # <afterimage: target, count, separation> (WORKS!)
  3914.     BattleInterpreter::Commands['AFTERIMAGE'] = [false, method(:on_afterimage_command)]
  3915.     # <mirror: target, value> (WORKS!)
  3916.     BattleInterpreter::Commands['MIRROR'] = [false, method(:on_mirror_command)]
  3917.     # <show pic: id, name, origin, x, y, zoom_x, zoom_y, opacity, blend_type> (WORKS!)
  3918.     BattleInterpreter::Commands['SHOW PIC']  = [false, method(:on_show_picture_command)]
  3919.     # <move pic: id, origin, x, y, zoom_x, zoom_y, opacity, blend_type, duration> (WORKS!)
  3920.     BattleInterpreter::Commands['MOVE PIC'] = [false, method(:on_move_picture_command)]
  3921.     # <move pic ex: id, target, x_correction, y_correction, time> (WORKS!)
  3922.     BattleInterpreter::Commands['MOVE PIC EX'] = [false, method(:on_move_picture_ex_command)]
  3923.     # <zoom pic ex: id, zoom_x, zoom_y, time> (WORKS!)
  3924.     BattleInterpreter::Commands['ZOOM PIC'] = [false, method(:on_zoom_picture_command)]
  3925.     # <opacity pic ex: id, opacity, time> (WORKS!)
  3926.     BattleInterpreter::Commands['OPACITY PIC'] = [false, method(:on_opacity_picture_command)]   
  3927.     # <anime pic: id, animation_id, flip> (WORKS!)
  3928.     BattleInterpreter::Commands['ANIME PIC'] = [false, method(:on_anime_picture_command)]
  3929.     # <rotate pic: id, speed> (WORKS!)
  3930.     BattleInterpreter::Commands['ROTATE PIC'] = [false, method(:on_rotate_picture_command)]
  3931.     # <tone pic: id, red, green, blue, gray>, time (WORKS!)
  3932.     BattleInterpreter::Commands['TONE PIC'] = [false, method(:on_tone_picture_command)]
  3933.     # <delete pic: id> (WORKS!)
  3934.     BattleInterpreter::Commands['DELETE PIC']  = [false, method(:on_delete_picture_command)]
  3935.     # <ruby: script> (WORKS!)
  3936.     BattleInterpreter::Commands['RUBY']  = [false, method(:on_ruby_script_command)]
  3937.     # <each process: target> (WORKS!)
  3938.     BattleInterpreter::Commands['EACH PROCESS'] = [true, method(:on_each_process_command)]
  3939.     # <change target: target> (WORKS!)
  3940.     BattleInterpreter::Commands['CHANGE TARGET'] = [false, method(:on_target_change_command)]
  3941.     # <target change: battler_array> (used by some Commands) (WORKS!)
  3942.     BattleInterpreter::Commands['TARGET CHANGE EX'] =  [false, method(:on_target_change_special_command)]
  3943.     # <end> (WORKS!)
  3944.     BattleInterpreter::Commands['END'] = [false, method(:on_end_command)]
  3945.     # <check counter> (READY!)
  3946.     BattleInterpreter::Commands['CHECK COUNTER'] = [false, method(:on_counter_check_command)]
  3947.     # <check reflect> (READY!)
  3948.     BattleInterpreter::Commands['CHECK REFLECT'] = [false, method(:on_reflect_check_command)]
  3949.     # <check substitute> (READY!)
  3950.     BattleInterpreter::Commands['CHECK SUBSTITUTE'] = [false, method(:on_substitute_check_command)]
  3951.     # <link skill: skill_id, chance> (READY!)
  3952.     BattleInterpreter::Commands['LINK SKILL'] = [false, method(:on_link_skill_command)]
  3953.     # <link item: item_id, chance> (READY!)
  3954.     BattleInterpreter::Commands['LINK ITEM'] = [false, method(:on_link_item_command)]   
  3955.     # <damage>
  3956.     BattleInterpreter::Commands['DAMAGE'] = [false, method(:on_damage_command)]  
  3957.     # <move camera: target, x, y, time>
  3958.     BattleInterpreter::Commands['MOVE CAMERA'] = [false, method(:on_move_camera_command)]
  3959.     # <zoom camera: zoom, time>
  3960.     BattleInterpreter::Commands['ZOOM CAMERA'] = [false, method(:on_zoom_camera_command)]
  3961.     # <target camera: target>
  3962.     BattleInterpreter::Commands['TARGET CAMERA'] = [false, method(:on_target_camera_command)]   
  3963.     # <perform collapse>
  3964.     BattleInterpreter::Commands['PERFORM COLLAPSE'] = [false, method(:on_perform_collapse_command)]
  3965.     # <abort>
  3966.     BattleInterpreter::Commands['ABORT'] = [false, method(:on_abort_command)]
  3967. # 1.1 and bigger ===============================================================================   
  3968.     # <weapon: target, x_corr, y_corr, start_angle, end_angle, time, left_hand, over>
  3969.     BattleInterpreter::Commands['WEAPON'] = [false, method(:on_weapon_command)]
  3970.     # <weapon ex: target, bitmap, x _corr, y_corr, frames, interval, over> (WORKS!)
  3971.     BattleInterpreter::Commands['WEAPON EX'] = [false, method(:on_weapon_ex_command)]   
  3972.     # <log text: text> (WORKS!)
  3973.     BattleInterpreter::Commands['LOG TEXT'] = [false, method(:on_log_text_command)]
  3974.     # <balloon: target, balloon_id> (WORKS!)
  3975.     BattleInterpreter::Commands['BALLOON'] = [false, method(:on_balloon_command)]
  3976. # 1.2 and bigger ===============================================================================   
  3977.     # <fps: frames> (WORKS!)
  3978.     BattleInterpreter::Commands['FPS'] = [false, method(:on_fps_command)]
  3979.     # <switch: id, value> (WORKS!)
  3980.     BattleInterpreter::Commands['SWITCH'] = [false, method(:on_switch_command)]
  3981.     # <variable: id, value> (WORKS!)
  3982.     BattleInterpreter::Commands['VARIABLE'] = [false, method(:on_variable_command)]
  3983.     # <movie: name> (WORKS!)
  3984.     BattleInterpreter::Commands['MOVIE'] = [false, method(:on_movie_command)]
  3985.     # <save bgm> (WORKS!)
  3986.     BattleInterpreter::Commands['SAVE BGM'] = [false, method(:on_save_bgm_command)]
  3987.     # <replay bgm> (WORKS!)
  3988.     BattleInterpreter::Commands['REPLAY BGM'] = [false, method(:on_replay_bgm_command)]
  3989.     # <save bgs> (WORKS!)
  3990.     BattleInterpreter::Commands['SAVE BGS'] = [false, method(:on_save_bgs_command)]
  3991.     # <replay bgs> (WORKS!)
  3992.     BattleInterpreter::Commands['REPLAY BGS'] = [false, method(:on_replay_bgs_command)]
  3993.     # <play bgm: name, volume, pitch, pos> (WORKS!)
  3994.     BattleInterpreter::Commands['PLAY BGM'] = [false, method(:on_play_bgm_command)]
  3995.     # <play bgs: name, volume, pitch, pos> (WORKS!)
  3996.     BattleInterpreter::Commands['PLAY BGS'] = [false, method(:on_play_bgs_command)]
  3997.     # <play me: name, volume, pitch> (WORKS!)
  3998.     BattleInterpreter::Commands['PLAY ME'] = [false, method(:on_play_me_command)]
  3999.     # <play se: name, volume, pitch> (WORKS!)
  4000.     BattleInterpreter::Commands['PLAY SE'] = [false, method(:on_play_se_command)]
  4001.     # <stop bgm> (WORKS!)
  4002.     BattleInterpreter::Commands['STOP BGM'] = [false, method(:on_stop_bgm_command)]
  4003.     # <stop bgs> (WORKS!)
  4004.     BattleInterpreter::Commands['STOP BGS'] = [false, method(:on_stop_bgs_command)]
  4005.     # <stop me> (WORKS!)
  4006.     BattleInterpreter::Commands['STOP ME'] = [false, method(:on_stop_me_command)]
  4007.     # <stop se> (WORKS!)
  4008.     BattleInterpreter::Commands['STOP SE'] = [false, method(:on_stop_se_command)]
  4009.     # <fade bgm: time> (WORKS!)
  4010.     BattleInterpreter::Commands['FADE BGM'] = [false, method(:on_fade_bgm_command)]
  4011.     # <fade bgs: time> (WORKS!)
  4012.     BattleInterpreter::Commands['FADE BGS'] = [false, method(:on_fade_bgs_command)]
  4013.     # <fade me: time> (WORKS!)
  4014.     BattleInterpreter::Commands['FADE ME'] = [false, method(:on_fade_me_command)]
  4015.   end
  4016.   
  4017.   def on_pose_command(action, params)
  4018.     action.analize_battler_sprites_string(params[0], false, false).each do |i|
  4019.       i.set_pose(params[1], params[2], params[3], params[4], params[5])
  4020.     end   
  4021.   end   
  4022.   
  4023.   def on_wait_command(action, params)
  4024.     if params[0].is_a?(String) && params[0][/animation/mi]
  4025.       wait_for_battle_interpreter
  4026.     elsif params[0].is_a?(String)  
  4027.       action.wait(action.eval_data(params[0]))
  4028.     else  
  4029.       action.wait(params[0])
  4030.     end  
  4031.   end
  4032.   
  4033.   def on_move_command(action, params)
  4034.     users = action.analize_battler_sprites_string(params[0], false, false)
  4035.     targets = action.analize_battler_sprites_string(params[1], true, true)
  4036.     if targets == :screen
  4037.       users.each do |i|
  4038.         i.set_movement(params[2], params[3], params[4], params[5])
  4039.       end  
  4040.     elsif targets == :origin
  4041.       users.each do |i|
  4042.         corr_x = params[2]
  4043.         corr_y = params[3]
  4044.         corr_x *= -1 if i.battler.actor? && BattleConfig::InvertXCorrection
  4045.         corr_y *= -1 if i.battler.actor? && BattleConfig::InvertYCorrection
  4046.         i.set_movement(corr_x+i.original_x, corr_y+i.original_y, params[4], params[5])
  4047.       end     
  4048.     else
  4049.       pos_x = 0
  4050.       pos_y = 0
  4051.       targets.each do |i|
  4052.         pos_x += i.current_x
  4053.         pos_y += i.current_y
  4054.       end
  4055.       if targets.size > 0
  4056.         pos_x /= targets.size
  4057.         pos_y /= targets.size
  4058.       else
  4059.         return        
  4060.       end
  4061.       users.each do |i|
  4062.         x = pos_x
  4063.         y = pos_y
  4064.         x += i.battler.actor? && BattleConfig::InvertXCorrection ? -params[2] : params[2]
  4065.         y += i.battler.actor? && BattleConfig::InvertYCorrection ? -params[3] : params[3]
  4066.         i.set_movement(x, y, params[4], params[5])
  4067.       end
  4068.     end  
  4069.   end
  4070.   
  4071.   def on_zoom_command(action, params)
  4072.      action.analize_battler_sprites_string(params[0], false, false).each do |i|
  4073.        i.set_zoom(params[1] / 100.0, params[2] / 100.0, params[3])
  4074.      end  
  4075.   end
  4076.   
  4077.   def on_angle_command(action, params)
  4078.      action.analize_battler_sprites_string(params[0], false, false).each do |i|
  4079.        i.set_angle(params[1], params[2])
  4080.      end      
  4081.   end
  4082.   
  4083.   def on_opacity_command(action, params)
  4084.      action.analize_battler_sprites_string(params[0], false, false).each do |i|
  4085.        i.set_opacity(params[1], params[2])
  4086.      end      
  4087.   end
  4088.   def on_animation_command(action, params)
  4089.     animations = []
  4090.     if params[1] < 0
  4091.       if params[1] == -1
  4092.         animations.push(action.user.atk_animation_id1)
  4093.       else  
  4094.         animations.push(action.user.atk_animation_id2)
  4095.       end  
  4096.     elsif params[1] == 0
  4097.       id = action.item.animation_id
  4098.       if id < 1
  4099.         animations.push(action.user.atk_animation_id1)
  4100.         animations.push(action.user.atk_animation_id2)
  4101.       else
  4102.         animations.push(id)
  4103.       end        
  4104.     else
  4105.       animations.push(params[1])
  4106.     end   
  4107.     targets = action.analize_battler_sprites_string(params[0], false, false)
  4108.     show_animation_ex(targets, animations[0], params[2])
  4109.     if animations[1]
  4110.       wait_for_animation
  4111.       show_animation_ex(targets, animations[1], !params[2])
  4112.     end  
  4113.   end
  4114.   
  4115.   def on_effects_command(action, params)
  4116.   end
  4117.   
  4118.   def on_if_command(action, params)
  4119.     check = params[0].is_a?(String) ? action.eval_data(params[0]) : params[0]
  4120.     if check
  4121.       action.insert_commands_as_next(params[1])
  4122.     end  
  4123.   end
  4124.   
  4125.   def on_repeat_command(action, params)
  4126.     t = params[0].is_a?(String) ? action.eval_data(params[0]) : params[0]
  4127.     t.times do |i|
  4128.       action.insert_commands_as_next(params[1])
  4129.     end      
  4130.   end
  4131.   
  4132.   def on_while_command(action, params)
  4133.     check = params[0].is_a?(String) ? action.eval_data(params[0]) : params[0]
  4134.     if check
  4135.       action.insert_commands_as_next([['END', [] ]])
  4136.       action.insert_commands_as_next(params[1])
  4137.       action.insert_commands_as_next([ ['WHILE', [ params[0] ] ] ])
  4138.       action.insert_commands_as_next(params[1])
  4139.     end      
  4140.   end  
  4141.   
  4142.   def on_afterimage_command(action, params)
  4143.     action.analize_battler_sprites_string(params[0], false, false).each do |i|
  4144.       visible = params[1] <= 0 ? false : true
  4145.       i.set_aftermages(visible, params[1], params[2])
  4146.     end      
  4147.   end
  4148.   
  4149.   def on_mirror_command(action, params)
  4150.     targets = action.analize_battler_sprites_string(params[0], false, false)
  4151.     targets.each do |target|
  4152.       target.set_mirror_value(params[1])
  4153.     end  
  4154.   end  
  4155.   
  4156.   def on_show_picture_command(action, params)
  4157.     picture = $game_troop.screen.pictures[params[0]]
  4158.     i = params[1]
  4159.     wpns = action.user.weapons
  4160.     wpn = wpns[-i - 1] ? wpns[-i - 1] : (wpns[0] ? wpns[0] : nil)
  4161.     index = wpn ? wpn.icon_index : 0
  4162.     index = i == 0 ? action.item.icon_index : index
  4163.     bmp = i.is_a?(String) ? i : (i > 0 ? i : index)
  4164.     picture.show(bmp, params[2], params[3], params[4], params[5],
  4165.                  params[6], params[7], params[8])
  4166.   end
  4167.   
  4168.   def on_move_picture_command(action, params)
  4169.     picture = $game_troop.screen.pictures[params[0]]
  4170.     picture.move(params[1], params[2], params[3], params[4], params[5],
  4171.                  params[6], params[7], params[8])
  4172.   end  
  4173.   
  4174.   def on_move_picture_ex_command(action, params)
  4175.     picture = $game_troop.screen.pictures[params[0]]
  4176.     targets = action.analize_battler_sprites_string(params[1], false, true)
  4177.     pos_x = 0
  4178.     pos_y = 0   
  4179.     if targets != :screen
  4180.       targets.each do |i|
  4181.         pos_x += i.current_x
  4182.         pos_y += i.current_y
  4183.       end
  4184.       if targets.size > 0
  4185.         pos_x /= targets.size
  4186.         pos_y /= targets.size
  4187.       else
  4188.         return
  4189.       end
  4190.     end  
  4191.     pos_x += params[2]
  4192.     pos_y += params[3]
  4193.    
  4194.     picture.move_ex(pos_x, pos_y, params[4])
  4195.   end
  4196.   
  4197.   def on_zoom_picture_command(action, params)
  4198.     picture = $game_troop.screen.pictures[params[0]]
  4199.     picture.set_zoom(params[1], params[2], params[3])
  4200.   end
  4201.   
  4202.   def on_opacity_picture_command(action, params)
  4203.     picture = $game_troop.screen.pictures[params[0]]
  4204.     picture.set_opacity(params[1], params[2])   
  4205.   end
  4206.   
  4207.   def on_anime_picture_command(action, params)
  4208.     picture = $game_troop.screen.pictures[params[0]]
  4209.     if params[1] < 0
  4210.       if params[1] == -1
  4211.         animation_id = action.user.atk_animation_id1
  4212.       else  
  4213.         animation_id = action.user.atk_animation_id2
  4214.       end  
  4215.     else
  4216.       animation_id = params[1]
  4217.     end  
  4218.     picture.set_animation(animation_id, params[2])
  4219.   end

  4220.   def on_rotate_picture_command(action, params)
  4221.     picture = $game_troop.screen.pictures[params[0]]
  4222.     picture.rotate(params[1])
  4223.   end
  4224.   
  4225.   def on_delete_picture_command(action, params)
  4226.     picture = $game_troop.screen.pictures[params[0]]
  4227.     picture.erase  
  4228.   end  
  4229.   
  4230.   def on_tone_picture_command(action, params)
  4231.     picture = $game_troop.screen.pictures[params[0]]
  4232.     picture.start_tone_change(Tone.new(params[1], params[2], params[3],
  4233.                               params[4]), params[5])
  4234.   end   
  4235.   
  4236.   def on_ruby_script_command(action, params)
  4237.     action.eval_data(params[0])
  4238.   end
  4239.   
  4240.   def on_each_process_command(action, params)
  4241.     @new_targets = action.analize_target_string(params[0])
  4242.     return if @new_targets.size == 0
  4243.     @for_alive_targets = @new_targets[0] && @new_targets[0].alive?
  4244.     @for_friend_target = @new_targets[0] && @new_targets[0].actor? == action.user.actor?
  4245.     @target_size = 1
  4246.     @last_targets = action.targets
  4247.     @remove_targets = []
  4248.     comm = []
  4249.     @new_targets.each do |i|
  4250.       comm += [['TARGET CHANGE EX', [i] ]] + params[1]
  4251.     end  
  4252.     action.insert_commands_as_next(comm + [['TARGET CHANGE EX', @last_targets]])
  4253.   end
  4254.   
  4255.   def on_target_change_special_command(action, params)
  4256.     if @collapse_checked
  4257.       params.each do |battler|
  4258.         if battler.alive? != @for_alive_targets
  4259.           params.delete(battler)
  4260.         end  
  4261.       end  
  4262.       if params.size <= 0
  4263.         unit = @for_friend_target ? acion.user.friend_unit : action.user.enemy_unit
  4264.         params = @for_alive_targets ? unit.alive_members : unit.dead_members
  4265.         params = params[0...@target_size].compact
  4266.       end  
  4267.       @collapse_checked = false
  4268.     end  
  4269.     action.targets = params
  4270.     action.linked_actions.each do |a|
  4271.       a.targets = action.targets
  4272.     end     
  4273.   end
  4274.   
  4275.   def on_target_change_command(action, params)
  4276.     action.targets = action.analize_target_string(params[0])
  4277.     action.linked_actions.each do |a|
  4278.       a.targets = action.targets
  4279.     end  
  4280.   end
  4281.   
  4282.   def on_end_command(action, params)
  4283.     action.loop_depth -= 1
  4284.   end  
  4285.   
  4286.   def on_counter_check_command(action, params)
  4287.     action.pause
  4288.     action.targets.each do |target|
  4289.       if rand < target.item_cnt(action.user, action.item) && action.counter_active?
  4290.         action.abort
  4291.         invoke_counter_attack_ex(action.user, target, action.item)
  4292.       end  
  4293.     end  
  4294.     wait_for_battle_interpreter
  4295.     action.resume     
  4296.   end
  4297.   
  4298.   def on_reflect_check_command(action, params)
  4299.     action.pause   
  4300.     action.targets.each do |target|
  4301.       if rand < target.item_mrf(action.user, action.item)
  4302.         invoke_magic_reflection_ex(action, target)
  4303.       end
  4304.     end
  4305.     wait_for_battle_interpreter
  4306.     action.resume   
  4307.   end
  4308.   
  4309.   def on_substitute_check_command(action, params)
  4310.     @substitutes = []
  4311.     action.pause
  4312.     action.targets.each do |target|
  4313.       apply_substitute_ex(action, target, action.item)
  4314.     end  
  4315.     wait_for_battle_interpreter
  4316.     action.resume
  4317.     @substitutes.clear
  4318.   end
  4319.   
  4320.   def on_link_skill_command(action, params)
  4321.     result = params[1].is_a?(String) ? action.eval_data(params[1]) : params[1]
  4322.     if rand(100) < result
  4323.       if params[0] < 1
  4324.         id = action.user.attack_skill_id
  4325.       else
  4326.         id = params[0]
  4327.       end
  4328.       action.abort
  4329.       action.user.current_action.set_skill(id)
  4330.       @subject = action.user
  4331.       use_item      
  4332.     end
  4333.   end
  4334.   
  4335.   def on_link_item_command(action, params)
  4336.     result = params[1].is_a?(String) ? action.eval_data(params[1]) : params[1]
  4337.     if rand(100) < result
  4338.       action.abort
  4339.       user.current_action.set_item(id)
  4340.       @subject = action.user
  4341.       use_item
  4342.     end
  4343.   end
  4344.   
  4345.   def on_damage_command(action, params)
  4346.     action.targets.each do |target|
  4347.       apply_item_effects_ex(action.user, target, action.item)
  4348.     end
  4349.   end
  4350.   
  4351.   def on_move_camera_command(action, params)
  4352.     target = action.analize_battler_sprites_string(params[0], false, true)
  4353.     if target == :screen
  4354.       BattleCamera.set_movement(params[1], params[2], params[3])
  4355.     else
  4356.       cx = 0
  4357.       cy = 0
  4358.       target.each do |i|
  4359.         cx += i.current_x
  4360.         cy += i.current_y
  4361.       end
  4362.       if target.size > 0
  4363.         cx /= target.size
  4364.         cy /= target.size
  4365.       end
  4366.       BattleCamera.set_movement(cx+params[1], cy+params[2], params[3])
  4367.     end  
  4368.   end
  4369.   
  4370.   def on_zoom_camera_command(action, params)
  4371.     BattleCamera.set_zoom(params[0] / 100.0, params[1])
  4372.   end  
  4373.   
  4374.   def on_target_camera_command(action, params)
  4375.     target = action.analize_battler_sprites_string(params[0], false, true)
  4376.     BattleCamera.set_target(target)
  4377.   end
  4378.   
  4379.   def on_perform_collapse_command(action, params)
  4380.     @collapse_checked = true
  4381.     action.targets.each do |target|
  4382.       if target.dead?
  4383.         if target.die_sequence?
  4384.           sequence = target.get_die_sequence
  4385.           BattleInterpreter.add_action(target, [target], sequence, nil, false)
  4386.         else
  4387.           target.perform_collapse_effect
  4388.         end  
  4389.         action.targets.delete(target)
  4390.         @dead_battlers.push(target)
  4391.         @last_targets.delete(target) if @last_targets
  4392.         @remove_targets.push(target) if @remove_targets
  4393.       end  
  4394.     end  
  4395.   end
  4396.   
  4397.   def on_abort_command(action, params)
  4398.     action.abort
  4399.   end
  4400.   
  4401.   def on_weapon_command(action, params)
  4402.     targets = action.analize_battler_sprites_string(params[0], false, false)
  4403.     targets.each do |target|
  4404.       x = target.battler.actor? && BattleConfig::InvertXCorrection ? -params[1] : params[1]
  4405.       y = target.battler.actor? && BattleConfig::InvertYCorrection ? -params[2] : params[2]
  4406.       sa = target.battler.actor? ? 360 - params[3] : params[3]
  4407.       ea = target.battler.actor? ? 360 - params[4] : params[4]
  4408.       target.set_weapon_icon(x, y, sa, ea, params[5], params[6], params[7])
  4409.     end  
  4410.   end
  4411.   
  4412.   def on_weapon_ex_command(action, params)
  4413.     targets = action.analize_battler_sprites_string(params[0], false, false)
  4414.     targets.each do |target|
  4415.       x = target.battler.actor? && BattleConfig::InvertXCorrection ? -params[2] : params[2]
  4416.       y = target.battler.actor? && BattleConfig::InvertYCorrection ? -params[3] : params[3]   
  4417.       target.set_weapon_sprite(params[1], x, y, params[4], params[5], params[6])
  4418.     end     
  4419.   end
  4420.   
  4421.   def on_log_text_command(action, params)
  4422.     @log_window.add_text(params[0])
  4423.   end
  4424.   
  4425.   def on_balloon_command(action, params)
  4426.     targets = action.analize_battler_sprites_string(params[0], false, false)
  4427.     targets.each do |target|
  4428.       target.start_balloon(params[1])
  4429.     end  
  4430.   end
  4431.   
  4432.   def on_fps_command(action, params)
  4433.     Graphics.frame_rate = params[0]
  4434.   end
  4435.   
  4436.   def on_switch_command(action, params)
  4437.     $game_switches[params[0]] = params[1]
  4438.   end
  4439.   
  4440.   def on_variable_command(action, params)
  4441.     $game_variables[params[0]] = params[1]
  4442.   end
  4443.   
  4444.   def on_movie_command(action, params)
  4445.     Graphics.play_movie(params[0])
  4446.   end
  4447.   
  4448.   def on_save_bgm_command(action, params)
  4449.     @last_bgm_played = RPG::BGM.last
  4450.   end
  4451.   
  4452.   def on_replay_bgm_command(action, params)
  4453.     @last_bgm_played.replay if @last_bgm_played
  4454.     @last_bgm_played = nil
  4455.   end
  4456.   
  4457.   def on_save_bgs_command(action, params)
  4458.     @last_bgs_played = RPG::BGS.last
  4459.   end
  4460.   
  4461.   def on_replay_bgs_command(action, params)
  4462.     @last_bgs_played.replay if @last_bgs_played
  4463.     @last_bgs_played = nil
  4464.   end
  4465.   
  4466.   def on_play_bgm_command(action, params)
  4467.     RPG::BGM.new(params[0], params[1], params[2], params[3]).play
  4468.   end
  4469.   
  4470.   def on_play_bgs_command(action, params)
  4471.     RPG::BGS.new(params[0], params[1], params[2], params[3]).play
  4472.   end
  4473.   
  4474.   def on_play_me_command(action, params)
  4475.     RPG::ME.new(params[0], params[1], params[2]).play
  4476.   end
  4477.   
  4478.   def on_play_se_command(action, params)
  4479.     RPG::SE.new(params[0], params[1], params[2]).play
  4480.   end
  4481.   
  4482.   def on_stop_bgm_command(action, params)
  4483.     Audio.bgm_stop
  4484.   end
  4485.   
  4486.   def on_stop_bgs_command(action, params)
  4487.     Audio.bgs_stop
  4488.   end
  4489.   
  4490.   def on_stop_me_command(action, params)
  4491.     Audio.me_stop
  4492.   end
  4493.   
  4494.   def on_stop_se_command(action, params)
  4495.     Audio.se_stop
  4496.   end
  4497.   
  4498.   def on_fade_bgm_command(action, params)
  4499.     Audio.bgm_fade(params[0])
  4500.   end
  4501.   
  4502.   def on_fade_bgs_command(action, params)
  4503.     Audio.bgs_fade(params[0])
  4504.   end
  4505.   
  4506.   def on_fade_me_command(action, params)  
  4507.     Audio.me_fade(params[0])
  4508.   end
  4509.   
  4510. end
复制代码
新手,来学习的。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
89
在线时间
76 小时
注册时间
2009-8-5
帖子
29
5
 楼主| 发表于 2014-2-9 04:28:32 | 只看该作者
额 可以删了 已经解决了。。

点评

解决了也没必要删的0.0  发表于 2014-2-9 12:45
新手,来学习的。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
4 小时
注册时间
2008-7-12
帖子
19
6
发表于 2014-2-10 12:36:59 | 只看该作者
话说我很想知道你是怎么解决的
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
89
在线时间
76 小时
注册时间
2009-8-5
帖子
29
7
 楼主| 发表于 2014-2-10 23:59:28 | 只看该作者
liloya 发表于 2014-2-10 12:36
话说我很想知道你是怎么解决的

我换成sideview的那个横版了。。。
新手,来学习的。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-16 12:01

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表