SHARE
TWEET

Kread-Ex Animated Battlers V1.09

Syren Jun 3rd, 2014 3,117 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. #  ▼ Animated Battlers
  3. #  Author: Kread-EX
  4. #          Yami
  5. #          Archeia_Nessiah
  6. #  Version 1.09
  7. #  Release date: 28/11/2012
  8. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  9.  
  10. #------------------------------------------------------------------------------
  11. #  ▼ UPDATES
  12. #------------------------------------------------------------------------------
  13. # # 03/06/2014  Added and fixed the following:
  14. # #             Anti-Lag Implemented, Locked an animation,
  15. # #             enemies attacking too fast, jump back to a pose after
  16. # #             the previous pose's animation, jump to target, and damage at
  17. # #             x frame.
  18. # # 07/04/2013. Added option for linking animations during skill use.
  19. # # 04/04/2013. Fixed a bug with guarding.
  20. # # 18/02/2013. Fixed another bug with Dual Wielding.
  21. # # 16/02/2013. Fixed a bug with Dual Wielding.
  22. # # 15/02/2013. Compatibility with Symphony.
  23. # # 15/02/2013. Added state animations and a few other options.
  24. # # 15/02/2013. Compatibility with modern algebra's Flash Enemy.
  25. # # 05/01/2013. Compatibility with Banish Skills.
  26. #------------------------------------------------------------------------------
  27. #  ▼ INTRODUCTION
  28. #------------------------------------------------------------------------------
  29. # # This script will allow you to use battle animations as animation battlers.
  30. # # It sounds simple enough but please read the instructions.
  31. # #
  32. # # DON'T ASK ME FOR A DEMO. PLEASE.
  33. #------------------------------------------------------------------------------
  34. #  ▼ INSTRUCTIONS
  35. #------------------------------------------------------------------------------
  36. # # I direct you to this page: http://wp.me/P22oyp-ca
  37. #------------------------------------------------------------------------------
  38. #  ▼ TERMS OF USAGE
  39. #------------------------------------------------------------------------------
  40. # #  You are free to adapt this work to suit your needs.
  41. # #  You can use this work for commercial purposes if you like it.
  42. # #  Credit is appreciated.
  43. # #
  44. # # For support:
  45. # # grimoirecastle.wordpress.com
  46. # # rpgmakerweb.com
  47. #------------------------------------------------------------------------------
  48. #  ▼ COMPATIBILITY
  49. #------------------------------------------------------------------------------
  50. # # Works with the DBS and Ace Battle Engine.
  51. # # List of aliases and overwrites:
  52. # #
  53. # # DataManager
  54. # # load_database (alias)
  55. # # load_aniB_notetags (new method)
  56. # #
  57. # # BattleManager
  58. # # process_victory (alias)
  59. # #
  60. # # RPG::Actor, RPG::Class, RPG::Enemy
  61. # # load_aniB_notetags (new method)
  62. # # animation_data (new method)
  63. # #
  64. # # RPG::UsableItem
  65. # # load_aniB_notetags (new method)
  66. # # battler_anim_id (new attr method)
  67. # # move_to_target (new attr method)
  68. # #
  69. # # Game_Battler
  70. # # skill_pose_active (new attr method)
  71. # # item_pose_active (new attr method)
  72. # # x_destination (new attr method)
  73. # # y_destination (new attr method)
  74. # # movement_type (new attr method)
  75. # # animation_data (new method)
  76. # # skill_battler_anim (new method)
  77. # # item_battler_anim (new method)
  78. # # on_action_end (alias)
  79. # # is_moving? (new method)
  80. # #
  81. # # Game_Actor
  82. # # victory_pose (new attr method)
  83. # # perform_collapse_effect (alias)
  84. # # screen_x (overwrite)
  85. # # screen_y (overwrite)
  86. # # screen_z (overwrite)
  87. # # use_sprite? (overwrite)
  88. # #
  89. # # Sprite_Battler
  90. # # screen_x (new attr method)
  91. # # screen_y (new attr method)
  92. # # initialize (alias)
  93. # # update (alias)
  94. # # update_bitmap (overwrite)
  95. # # update_position (overwrite)
  96. # # update_movement (new method)
  97. # # update_battler_poses (new method)
  98. # # animation? (overwrite)
  99. # # battler_animation? (new method)
  100. # # start_battler_animation (new method)
  101. # # load_battler_animation_bitmap (new method)
  102. # # make_battler_animation_sprites (new method)
  103. # # set_battler_animation_origin (new method)
  104. # # move_battler_animation (new method)
  105. # # dispose_battler_animation (new method)
  106. # # update_battler_animation (new method)
  107. # # battler_animation_set_sprites (new method)
  108. # # battler_animation_process_timing (new method)
  109. # # get_current_pose (new method)
  110. # # update_collapse (alias)
  111. # # update_boss_collapse (overwrite)
  112. # #
  113. # # Window_BattleActor
  114. # # update (alias)
  115. # #
  116. # # Scene_Battle
  117. # # execute_action (alias)
  118. # # move_to_target (new method)
  119. # # move_back_to_pos (new method)
  120. #------------------------------------------------------------------------------
  121. ($imported ||= {})['KRX-AnimatedBattlers'] = true
  122.  
  123. #puts 'Load: Animated Battlers v1.08 by Kread-EX'
  124.  
  125. module KRX
  126. #===========================================================================
  127. # ■ CONFIGURATION
  128. #===========================================================================
  129.  
  130.   ACTOR_POSITIONS = [[430, 250], [487, 274], [550, 300], [540, 300]]
  131.   VICTORY_DELAY = 30
  132.   MAX_SPRITES = 16
  133.   MOVEMENT_Y_OFFSET = 70
  134.   # Set this to true to make the attack anim play twice for dual wielders.
  135.   DUAL_WIELDING = false
  136.  
  137. #===========================================================================
  138. # ■ CONFIGURATION ENDS HERE
  139. #===========================================================================
  140.   module REGEXP
  141.     ANIM_TAG_START = /<animation_block>/i
  142.     ANIM_TAG_END = /<\/animation_block>/i
  143.     ANIM_STANDING = /standing:[ ]*(\d+)/i
  144.     ANIM_DANGER = /danger:[ ]*(\d+)/i
  145.     ANIM_HIT = /hit:[ ]*(\d+)/i
  146.     ANIM_DEAD = /dead:[ ]*(\d+)/i
  147.     ANIM_VICTORY = /victory:[ ]*(\d+)/i
  148.     ANIM_ITEM_DEFAULT = /item_default:[ ]*(\d+)/i
  149.     ANIM_SKILL_DEFAULT = /skill_default:[ ]*(\d+)/i
  150.     ANIM_ITEM = /item:[ ]*(\d+(?:\s*,\s*\d+*)*)/i
  151.     ANIM_SKILL = /skill:[ ]*(\d+(?:\s*,\s*\d+*)*)/i
  152.     ANIM_STATE = /state:[ ]*(\d+(?:\s*,\s*\d+*)*)/i
  153.     ANIM_MOV_F = /move_f:[ ]*(\d+)/
  154.     ANIM_MOV_B = /move_b:[ ]*(\d+)/
  155.     ANIM_MIRROR = /mirror/i
  156.     ANIM_GUARD = /guard:[ ]*(\d+)/i
  157.     ANIM_ON_ITEM = /<anim_id:[ ]*(\d+)>/i
  158.     ANIM_TO_TARGET = /<move_to_target:*[ ]*(-?\d+)*>/i
  159.   end
  160.  
  161. end
  162.  
  163. #===========================================================================
  164. # ■ DataManager
  165. #===========================================================================
  166.  
  167. module DataManager  
  168.   #--------------------------------------------------------------------------
  169.   # ● Loads the database
  170.   #--------------------------------------------------------------------------
  171.   class << self; alias_method(:krx_aniB_dm_ld, :load_database); end
  172.   def self.load_database
  173.     krx_aniB_dm_ld
  174.     load_aniB_notetags
  175.   end  
  176.   #--------------------------------------------------------------------------
  177.   # ● Loads the note tags
  178.   #--------------------------------------------------------------------------
  179.   def self.load_aniB_notetags
  180.     groups = [$data_skills, $data_items, $data_actors, $data_classes,
  181.     $data_enemies]
  182.     for group in groups
  183.       for obj in group
  184.         next if obj.nil?
  185.         obj.load_aniB_notetags
  186.       end
  187.     end
  188.     #puts "Read: Animated Battlers Notetags"
  189.   end
  190. end
  191.  
  192. #===========================================================================
  193. # ■ BattleManager
  194. #===========================================================================
  195.  
  196. module BattleManager
  197.   #--------------------------------------------------------------------------
  198.   # ● Process the battle victory
  199.   #--------------------------------------------------------------------------
  200.   class << self; alias_method(:krx_aniB_bm_pv, :process_victory); end
  201.   def self.process_victory
  202.     $game_party.members.each {|m| m.victory_pose = true}
  203.     KRX::VICTORY_DELAY.times {SceneManager.scene.update_basic}
  204.     krx_aniB_bm_pv
  205.     $game_party.members.each {|m| m.victory_pose = false}
  206.   end
  207. end
  208.  
  209.  
  210. #===========================================================================
  211. # ■ RPG::Actor, RPG::Class, RPG::Enemy
  212. #===========================================================================
  213.  
  214. module KRX
  215.   module ANIMATED_BATTLERS
  216.     #--------------------------------------------------------------------------
  217.     # ● Loads the note tags
  218.     #--------------------------------------------------------------------------
  219.     def load_aniB_notetags
  220.       @animation_data = {}
  221.       @note.split(/[\r\n]+/).each do |line|
  222.         case line
  223.         when KRX::REGEXP::ANIM_TAG_START
  224.           @enable_aniB_tags = true
  225.         when KRX::REGEXP::ANIM_TAG_END
  226.           @enable_aniB_tags = false
  227.         when KRX::REGEXP::ANIM_STANDING
  228.           @animation_data[:stand] = $1.to_i if @enable_aniB_tags
  229.         when KRX::REGEXP::ANIM_DANGER
  230.           @animation_data[:danger] = $1.to_i if @enable_aniB_tags
  231.         when KRX::REGEXP::ANIM_HIT
  232.           @animation_data[:hit] = $1.to_i if @enable_aniB_tags
  233.         when KRX::REGEXP::ANIM_DEAD
  234.           @animation_data[:dead] = $1.to_i if @enable_aniB_tags
  235.         when KRX::REGEXP::ANIM_VICTORY
  236.           @animation_data[:victory] = $1.to_i if @enable_aniB_tags
  237.         when KRX::REGEXP::ANIM_ITEM_DEFAULT
  238.           @animation_data[:dflt_item] = $1.to_i if @enable_aniB_tags
  239.         when KRX::REGEXP::ANIM_SKILL_DEFAULT
  240.           @animation_data[:dflt_skill] = $1.to_i if @enable_aniB_tags
  241.         when KRX::REGEXP::ANIM_MIRROR
  242.           @animation_data[:mirror] = true if @enable_aniB_tags
  243.         when KRX::REGEXP::ANIM_GUARD
  244.           @animation_data[:guard] = $1.to_i if @enable_aniB_tags
  245.         when KRX::REGEXP::ANIM_MOV_F
  246.           @animation_data[:move_f] = $1.to_i if @enable_aniB_tags
  247.         when KRX::REGEXP::ANIM_MOV_B
  248.           @animation_data[:move_b] = $1.to_i if @enable_aniB_tags
  249.         when KRX::REGEXP::ANIM_ITEM
  250.           if @enable_aniB_tags
  251.             @animation_data[:item] ||= []
  252.             $1.scan(/\d+/).each {|i| @animation_data[:item].push(i.to_i)}
  253.           end
  254.         when KRX::REGEXP::ANIM_SKILL
  255.           if @enable_aniB_tags
  256.             @animation_data[:skill] ||= []
  257.             $1.scan(/\d+/).each {|i| @animation_data[:skill].push(i.to_i)}
  258.           end
  259.         when KRX::REGEXP::ANIM_STATE
  260.           if @enable_aniB_tags
  261.             @animation_data[:states] ||= []
  262.             $1.scan(/\d+/).each {|i| @animation_data[:states].push(i.to_i)}
  263.           end
  264.         end
  265.       end
  266.     end
  267.     #--------------------------------------------------------------------------
  268.     # ● Returns the animation settings
  269.     #--------------------------------------------------------------------------
  270.     def animation_data(key)
  271.       @animation_data[key]
  272.     end
  273.   end
  274. end
  275.  
  276. class RPG::Actor < RPG::BaseItem
  277.   include KRX::ANIMATED_BATTLERS
  278. end
  279.  
  280. class RPG::Class < RPG::BaseItem
  281.   include KRX::ANIMATED_BATTLERS
  282. end
  283.  
  284. class RPG::Enemy < RPG::BaseItem
  285.   include KRX::ANIMATED_BATTLERS
  286. end
  287.  
  288. #===========================================================================
  289. # ■ RPG::UsableItem
  290. #===========================================================================
  291.  
  292. class RPG::UsableItem < RPG::BaseItem
  293.   #--------------------------------------------------------------------------
  294.   # ● Public instance variables
  295.   #--------------------------------------------------------------------------
  296.   attr_reader     :battler_anim_id
  297.   attr_reader     :move_to_target
  298.   attr_reader     :move_direction
  299.   attr_reader     :jump_to_target
  300.   attr_reader     :damage_time
  301.   #--------------------------------------------------------------------------
  302.   # ● Loads the note tags
  303.   #--------------------------------------------------------------------------
  304.   def load_aniB_notetags
  305.     @damage_time = []
  306.     @note.split(/[\r\n]+/).each do |line|
  307.       case line
  308.       when KRX::REGEXP::ANIM_ON_ITEM
  309.         @battler_anim_id = $1.to_i
  310.       when KRX::REGEXP::ANIM_TO_TARGET
  311.         @move_to_target = true
  312.         @move_direction = $1.to_i
  313.         @move_direction ||= 0
  314.       when /<jump to target>/i
  315.         @jump_to_target = true
  316.       when /<damage at:[ ]*(\d+)>/i
  317.         @damage_time.push($1.to_i)
  318.       end
  319.     end
  320.   end
  321.   #--------------------------------------------------------------------------
  322.   # ● Check damage frame
  323.   #--------------------------------------------------------------------------
  324.   def damage_time?
  325.     @damage_time.size > 0
  326.   end
  327. end
  328.  
  329. #===========================================================================
  330. # ■ Game_Battler
  331. #===========================================================================
  332.  
  333. class Game_BattlerBase
  334.  
  335.   #--------------------------------------------------------------------------
  336.   # set_disappear
  337.   #--------------------------------------------------------------------------
  338.   def set_disappear(flag = true)
  339.     @disappear = flag
  340.   end
  341.  
  342.   #--------------------------------------------------------------------------
  343.   # disappear?
  344.   #--------------------------------------------------------------------------
  345.   def disappear?
  346.     @disappear
  347.   end
  348.  
  349.   #--------------------------------------------------------------------------
  350.   # set_invoke
  351.   #--------------------------------------------------------------------------
  352.   def set_invoke(item)
  353.     @invoke_backup = item
  354.   end
  355.  
  356.   #--------------------------------------------------------------------------
  357.   # get_invoke
  358.   #--------------------------------------------------------------------------
  359.   def get_invoke
  360.     @invoke_backup
  361.   end
  362.  
  363.   #--------------------------------------------------------------------------
  364.   # set_no_damage
  365.   #--------------------------------------------------------------------------
  366.   def set_no_damage(flag)
  367.     @invoke_no_dam = flag
  368.   end
  369.  
  370.   #--------------------------------------------------------------------------
  371.   # get_no_damage
  372.   #--------------------------------------------------------------------------
  373.   def get_no_damage
  374.     @invoke_no_dam
  375.   end
  376.  
  377. end # Game_BattlerBase
  378.  
  379. #===========================================================================
  380. # ■ Game_Battler
  381. #===========================================================================
  382.  
  383. class Game_Battler < Game_BattlerBase
  384.   #--------------------------------------------------------------------------
  385.   # ● Public instance variables
  386.   #--------------------------------------------------------------------------
  387.   attr_accessor   :skill_pose_active
  388.   attr_accessor   :item_pose_active
  389.   attr_accessor   :x_destination
  390.   attr_accessor   :y_destination
  391.   attr_accessor   :movement_type
  392.   attr_accessor   :lock_banim
  393.   #--------------------------------------------------------------------------
  394.   # ● Returns the battler animation data
  395.   #--------------------------------------------------------------------------
  396.   def animation_data(key)
  397.     if actor?
  398.       if actor.animation_data(key).nil?
  399.         self.class.animation_data(key)
  400.       else
  401.         actor.animation_data(key)
  402.       end
  403.     else
  404.       enemy.animation_data(key)
  405.     end
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● Returns the battler animation ID for a specific skill
  409.   #--------------------------------------------------------------------------
  410.   def skill_battler_anim(id)
  411.     data = animation_data(:skill) || []
  412.     data.each_index do |i|
  413.       next if i % 2 != 0
  414.       return data[i+1] if data[i] == id
  415.     end
  416.     $data_skills[id].battler_anim_id ? $data_skills[id].battler_anim_id :
  417.     animation_data(:dflt_skill)
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ● Returns the battler animation ID for a specific item
  421.   #--------------------------------------------------------------------------
  422.   def item_battler_anim(id)
  423.     data = animation_data(:item) || []
  424.     data.each_index do |i|
  425.       next if i % 2 != 0
  426.       return data[i+1] if data[i] == id
  427.     end
  428.     $data_items[id].battler_anim_id ? $data_items[id].battler_anim_id :
  429.     animation_data(:dflt_item)
  430.   end
  431.   #--------------------------------------------------------------------------
  432.   # ● Returns the battler animation ID for a specific state
  433.   #--------------------------------------------------------------------------
  434.   def state_battler_anim(id)
  435.     data = animation_data(:states) || []
  436.     data.each_index do |i|
  437.       next if i % 2 != 0
  438.       return data[i+1] if data[i] == id
  439.     end
  440.     nil
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ● Clears the action data
  444.   #--------------------------------------------------------------------------
  445.   alias_method(:krx_aniB_gb_oae, :on_action_end)
  446.   def on_action_end
  447.     krx_aniB_gb_oae
  448.     @skill_pose_active = false
  449.     @item_pose_active = false
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ● Determine if the battler is moving on the battle screen
  453.   #--------------------------------------------------------------------------
  454.   unless $imported["YES-BattleSymphony"]
  455.   def is_moving?
  456.     ((@x_destination || 0) > 0) || ((@y_destination || 0) > 0)
  457.   end
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # ● Update movement (Symphony)
  461.   #--------------------------------------------------------------------------
  462.   if $imported["YES-BattleSymphony"]
  463.   def update_movement
  464.     return unless self.is_moving?
  465.     @move_x_rate = 0 if @screen_x == @destination_x || @move_x_rate.nil?
  466.     @move_y_rate = 0 if @screen_y == @destination_y || @move_y_rate.nil?
  467.     value = [(@screen_x - @destination_x).abs, @move_x_rate].min
  468.     ofx = (@destination_x > @screen_x) ? value : -value
  469.     @screen_x += (@destination_x > @screen_x) ? value : -value
  470.     value = [(@screen_y - @destination_y).abs, @move_y_rate].min
  471.     ofy = (@destination_y > @screen_y) ? value : -value
  472.     @screen_y += (@destination_y > @screen_y) ? value : -value
  473.     sprite.move_battler_animation(ofx, ofy)
  474.   end
  475.   #--------------------------------------------------------------------------
  476.   # ● Update jump (Symphony)
  477.   #--------------------------------------------------------------------------
  478.   def update_jump
  479.     return unless self.is_moving?
  480.     #---
  481.     value = [(@screen_x - @destination_x).abs, @move_x_rate].min
  482.     @screen_x += (@destination_x > @screen_x) ? value : -value
  483.     ofx = (@destination_x > @screen_x) ? value : -value
  484.     @parabola[:x] += value
  485.     @screen_y -= @arc_y
  486.     #---
  487.     if @destination_x == @screen_x
  488.       @screen_y = @destination_y
  489.       @arc_y = 0
  490.       @arc = 0
  491.     else
  492.       a = (2.0*(@parabola[:y0]+@parabola[:y1])-4*@parabola[:h])/(@parabola[:d]**2)
  493.       b = (@parabola[:y1]-@parabola[:y0]-a*(@parabola[:d]**2))/@parabola[:d]
  494.       @arc_y = a * @parabola[:x] * @parabola[:x] + b * @parabola[:x] + @parabola[:y0]
  495.     end
  496.     #---
  497.     @screen_y += @arc_y
  498.     @move_x_rate = 0 if @screen_x == @destination_x
  499.     @move_y_rate = 0 if @screen_y == @destination_y
  500.     sprite.move_battler_animation(ofx, @arc_y)
  501.   end
  502.   end
  503. end
  504.  
  505. #===========================================================================
  506. # ■ Game_Actor
  507. #===========================================================================
  508.  
  509. class Game_Actor < Game_Battler
  510.   #--------------------------------------------------------------------------
  511.   # ● Public instance variables
  512.   #--------------------------------------------------------------------------
  513.   attr_accessor   :victory_pose
  514.   #--------------------------------------------------------------------------
  515.   # ● Perform the collapse effect if dead
  516.   #--------------------------------------------------------------------------
  517.   alias_method(:krx_aniB_ga_pce, :perform_collapse_effect)
  518.   def perform_collapse_effect
  519.     return if animation_data(:dead) != nil
  520.     krx_aniB_ga_pce
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # ● Return x coordinates on battle screen
  524.   #--------------------------------------------------------------------------
  525.   unless $imported["YES-BattleSymphony"]
  526.   def screen_x
  527.     KRX::ACTOR_POSITIONS[index][0]
  528.   end
  529.   #--------------------------------------------------------------------------
  530.   # ● Return y coordinates on battle screen
  531.   #--------------------------------------------------------------------------
  532.   def screen_y
  533.     KRX::ACTOR_POSITIONS[index][1]
  534.   end
  535.   end
  536.   #--------------------------------------------------------------------------
  537.   # ● Return z coordinates on battle screen
  538.   #--------------------------------------------------------------------------
  539.   def screen_z
  540.     return 100
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # ● The actors will use a sprite
  544.   #--------------------------------------------------------------------------
  545.   def use_sprite?
  546.     return true
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # ● Disable blink and shake when damaged
  550.   #--------------------------------------------------------------------------
  551.   def perform_damage_effect
  552.     Sound.play_actor_damage
  553.   end
  554. end
  555.  
  556. #==============================================================================
  557. # ■ Game_Enemy
  558. #==============================================================================
  559.  
  560. class Game_Enemy < Game_Battler
  561.   #--------------------------------------------------------------------------
  562.   # ● Disable blink and shake when damaged
  563.   #--------------------------------------------------------------------------
  564.   def perform_damage_effect
  565.     Sound.play_enemy_damage
  566.   end
  567. end # Game_Enemy
  568.  
  569. #==============================================================================
  570. # ■ Sprite_Battler
  571. #==============================================================================
  572.  
  573. class Sprite_Battler < Sprite_Base
  574.   #--------------------------------------------------------------------------
  575.   # ● Public instance variables
  576.   #--------------------------------------------------------------------------
  577.   attr_reader   :screen_x
  578.   attr_reader   :screen_y
  579.   #--------------------------------------------------------------------------
  580.   # ● Object Initialize
  581.   #--------------------------------------------------------------------------
  582.   alias_method(:krx_aniB_sb_init, :initialize)
  583.   def initialize(viewport, battler = nil)
  584.     krx_aniB_sb_init(viewport, battler)
  585.     @battler_ani_duration = 0
  586.     @blank_bitmap = Bitmap.new(48, 48)
  587.   end
  588.   #--------------------------------------------------------------------------
  589.   # ● Frame Update
  590.   #--------------------------------------------------------------------------
  591.   alias_method(:krx_abiB_sb_update, :update)
  592.   def update
  593.     dispose_battler_animation unless @battler || !battler_animation?
  594.     krx_abiB_sb_update
  595.     update_movement
  596.     @charset_shadow.visible = false if $imported["YES-BattleSymphony"]
  597.     if @battler && self.opacity < 255 && @battler_ani_sprites
  598.       @battler_ani_sprites.each {|sprite| sprite.opacity = self.opacity}
  599.     end
  600.   end
  601.   #--------------------------------------------------------------------------
  602.   # ● Update animation
  603.   #--------------------------------------------------------------------------
  604.   def update_animation
  605.     return unless animation?
  606.     @ani_duration -= 1
  607.     if @ani_duration % @ani_rate == 0
  608.       if @ani_duration > 0
  609.         frame_index = @animation.frame_max
  610.         frame_index -= (@ani_duration + @ani_rate - 1) / @ani_rate
  611.         if @battler
  612.           if $game_party.in_battle
  613.             if @battler.get_invoke && @battler.get_invoke.damage_time.include?(frame_index + 1)
  614.               SceneManager.scene.invoke_item(@battler, @battler.get_invoke)
  615.             end
  616.           end
  617.         end
  618.         animation_set_sprites(@animation.frames[frame_index])
  619.         @animation.timings.each do |timing|
  620.           animation_process_timing(timing) if timing.frame == frame_index
  621.           if timing.frame == frame_index
  622.             color = timing.flash_color
  623.             if @battler && $game_party.in_battle && @battler.get_invoke
  624.               if [color.red, color.green, color.blue, color.alpha] == [19, 28, 5, 0]
  625.                 SceneManager.scene.invoke_item(@battler, @battler.get_invoke)
  626.                 @battler.set_no_damage(true)
  627.               end
  628.             end
  629.           end
  630.         end
  631.       else
  632.         end_animation
  633.       end
  634.     end
  635.   end
  636.   #--------------------------------------------------------------------------
  637.   # ● Updates the initial bitmap
  638.   #--------------------------------------------------------------------------
  639.   def update_bitmap
  640.     self.bitmap = @blank_bitmap if self.bitmap != @blank_bitmap
  641.     update_battler_poses
  642.     update_flash_and_whiten
  643.   end
  644.   #--------------------------------------------------------------------------
  645.   # ● Updates the coordinates
  646.   #--------------------------------------------------------------------------
  647.   unless $imported["YES-BattleSymphony"]
  648.   def update_position
  649.     self.x = @screen_x || @battler.screen_x
  650.     self.y = @screen_y || @battler.screen_y
  651.     self.z = @battler.screen_z
  652.     self.opacity = @battler.disappear? ? 0 : 255
  653.   end
  654.   end
  655.   #--------------------------------------------------------------------------
  656.   # ● Updates the movement positions
  657.   #--------------------------------------------------------------------------
  658.   def update_movement
  659.     return unless @battler
  660.     return if $imported["YES-BattleSymphony"]
  661.     @battler.x_destination ||= 0
  662.     @battler.y_destination ||= 0
  663.     @screen_x ||= @battler.screen_x
  664.     @screen_y ||= @battler.screen_y
  665.     if @battler.x_destination != 0
  666.       sx, dx = @screen_x, @battler.x_destination
  667.       @screen_x = sx > dx ? [sx-16, dx].max : [sx+16, dx].min
  668.       mx = @screen_x - sx
  669.       move_battler_animation(mx, 0)
  670.       if @screen_x == dx
  671.         @battler.x_destination = 0
  672.         update_position
  673.       end
  674.     end
  675.     if @battler.y_destination != 0
  676.       sy, dy = @screen_y, @battler.y_destination
  677.       @screen_y = sy > dy ? [sy-8, dy].max : [sy+8, dy].min
  678.       my = @screen_y - sy
  679.       move_battler_animation(0, my)
  680.       if @screen_y == dy
  681.         @battler.y_destination = 0
  682.         update_position
  683.       end
  684.     end
  685.   end
  686.   #--------------------------------------------------------------------------
  687.   # ● Updates the battler poses
  688.   #--------------------------------------------------------------------------
  689.   def update_battler_poses
  690.     return if @battler && @battler.dead? && @battler.lock_banim
  691.     update_battler_animation
  692.     return if @battler.nil? || !@battler_visible
  693.     battler_anim_id = get_current_pose
  694.     return if battler_animation? || @no_loop
  695.     return if battler_anim_id.nil?
  696.     animation = $data_animations[battler_anim_id]
  697.     mirror = @battler.animation_data(:mirror)
  698.     if @battler.dual_wield? && @start_dual_wielding
  699.       @dual_wielding_done = true
  700.       @start_dual_wielding = false
  701.     end
  702.     start_battler_animation(animation, mirror)
  703.   end
  704.   #--------------------------------------------------------------------------
  705.   # ● Updates the flash and whiten effects
  706.   #--------------------------------------------------------------------------
  707.   def update_flash_and_whiten
  708.     unless @battler_ani_sprites.nil?
  709.       if @flash_color && @flash_duration > 0
  710.         d = @flash_duration
  711.         r, g, b = @flash_color.red, @flash_color.green, @flash_color.blue
  712.         @flash_color.alpha = @flash_color.alpha * (d - 1) / d
  713.       end
  714.       @battler_ani_sprites.each do |sprite|
  715.         if @flash_color && @flash_duration > 0
  716.           sprite.color.set(r, g, b, @flash_color.alpha)
  717.         end
  718.         if @effect_type == :whiten
  719.           sprite.color.set(255, 255, 255, 0)
  720.           sprite.color.alpha = 128 - (16 - @effect_duration) * 10
  721.         end
  722.       end
  723.       @flash_duration -= 1 if @flash_duration
  724.     end
  725.   end
  726.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  727.   # * Update Flash (modern algebra Flash Selected Enemy)
  728.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  729.   def update_fse_flash
  730.     unless @battler_ani_sprites.nil?
  731.       @battler_ani_sprites.each do |sprite|
  732.         sprite.color.set(*FSE_FLASH_COLOUR)
  733.         if @effect_duration > (FSE_FLASH_DURATION / 2)
  734.           sprite.color.alpha =
  735.           (FSE_FLASH_DURATION - @effect_duration) * @fse_flash_mod
  736.         else
  737.           sprite.color.alpha = @effect_duration * @fse_flash_mod
  738.         end
  739.       end
  740.     end
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # ● Determine if an anim is playing
  744.   #--------------------------------------------------------------------------
  745.   def animation?
  746.     @animation != nil || @banim_wait
  747.   end
  748.   #--------------------------------------------------------------------------
  749.   # ● Determine if a battler anim is playing
  750.   #--------------------------------------------------------------------------
  751.   def battler_animation?
  752.     @battler_animation != nil
  753.   end
  754.   #--------------------------------------------------------------------------
  755.   # ● Start the battler animation
  756.   #--------------------------------------------------------------------------
  757.   def start_battler_animation(animation, mirror)
  758.     dispose_battler_animation
  759.     @battler_animation = animation
  760.     @battler_mirror = mirror
  761.     if @battler_animation
  762.       set_animation_rate
  763.       @battler_ani_duration = @battler_animation.frame_max * @ani_rate + 1
  764.       load_battler_animation_bitmap
  765.       make_battler_animation_sprites
  766.       set_battler_animation_origin
  767.       update_battler_animation
  768.     end
  769.    
  770.   end
  771.   #--------------------------------------------------------------------------
  772.   # ● Construct the animation bitmaps
  773.   #--------------------------------------------------------------------------
  774.   def load_battler_animation_bitmap
  775.     animation1_name = @battler_animation.animation1_name
  776.     animation1_hue = @battler_animation.animation1_hue
  777.     animation2_name = @battler_animation.animation2_name
  778.     animation2_hue = @battler_animation.animation2_hue
  779.     @battler_ani_bitmap1 = Cache.animation(animation1_name, animation1_hue)
  780.     @battler_ani_bitmap2 = Cache.animation(animation2_name, animation2_hue)
  781.     if @@_reference_count.include?(@battler_ani_bitmap1)
  782.       @@_reference_count[@battler_ani_bitmap1] += 1
  783.     else
  784.       @@_reference_count[@battler_ani_bitmap1] = 1
  785.     end
  786.     if @@_reference_count.include?(@battler_ani_bitmap2)
  787.       @@_reference_count[@battler_ani_bitmap2] += 1
  788.     else
  789.       @@_reference_count[@battler_ani_bitmap2] = 1
  790.     end
  791.     Graphics.frame_reset
  792.   end
  793.   #--------------------------------------------------------------------------
  794.   # ● Construct the animation sprites to hold the bitmaps
  795.   #--------------------------------------------------------------------------
  796.   def make_battler_animation_sprites
  797.     @battler_ani_sprites = []
  798.     if @use_sprite && !@@ani_spr_checker.include?(@battler_animation)
  799.       KRX::MAX_SPRITES.times do
  800.         sprite = ::Sprite.new(viewport)
  801.         sprite.visible = false
  802.         @battler_ani_sprites.push(sprite)
  803.       end
  804.     end
  805.     @battler_ani_duplicated = @@ani_checker.include?(@battler_animation)
  806.   end
  807.   #--------------------------------------------------------------------------
  808.   # ● Pinpoint the animation origin values
  809.   #--------------------------------------------------------------------------
  810.   def set_battler_animation_origin
  811.     @battler_ani_ox = x - ox + width / 2
  812.     @battler_ani_oy = y - oy + height / 2
  813.     if @battler_animation.position == 0
  814.       @battler_ani_oy -= height / 2
  815.     elsif @battler_animation.position == 2 || @battler_animation.position == 3
  816.       @battler_ani_oy += height / 2
  817.     end
  818.   end
  819.   #--------------------------------------------------------------------------
  820.   # ● Move the animation
  821.   #--------------------------------------------------------------------------
  822.   def move_battler_animation(dx, dy)
  823.     if @battler_ani_sprites
  824.       @battler_ani_ox += dx
  825.       @battler_ani_oy += dy
  826.       @battler_ani_sprites.each do |sprite|
  827.         sprite.x += dx
  828.         sprite.y += dy
  829.       end
  830.     end
  831.   end
  832.   #--------------------------------------------------------------------------
  833.   # ● Free the animation
  834.   #--------------------------------------------------------------------------
  835.   def dispose_battler_animation
  836.    
  837. #    p @@_reference_count
  838.     if @battler_ani_bitmap1
  839.       @@_reference_count[@battler_ani_bitmap1] -= 1
  840.       if @@_reference_count[@battler_ani_bitmap1] == 0
  841. #        @battler_ani_bitmap1.dispose
  842.       end
  843.     end
  844.    
  845.    
  846.     if @battler_ani_bitmap2
  847.       @@_reference_count[@battler_ani_bitmap2] -= 1
  848.       if @@_reference_count[@battler_ani_bitmap2] == 0
  849.         @battler_ani_bitmap2.dispose
  850.       end
  851.     end
  852.     if @battler_ani_sprites
  853.       @battler_ani_sprites.each {|sprite| sprite.dispose }
  854.       @battler_ani_sprites = nil
  855.       @battler_animation = nil
  856.     end
  857.     @battler_ani_bitmap1 = nil
  858.     @battler_ani_bitmap2 = nil
  859.     @flash_color = @flash_duration = nil
  860.   end
  861.   #--------------------------------------------------------------------------
  862.   # ● Update the animation
  863.   #--------------------------------------------------------------------------
  864.   def update_battler_animation
  865.     return unless battler_animation?
  866.     @battler_ani_duration -= 1
  867.     if @battler_ani_duration % @ani_rate == 0
  868.       if @battler_ani_duration > 0
  869.         frame_index = @battler_animation.frame_max
  870.         frame_index -= (@battler_ani_duration + @ani_rate - 1) / @ani_rate
  871.         @last_frame = frame_index
  872.         battler_animation_set_sprites(@battler_animation.frames[frame_index])
  873.         @battler_animation.timings.each do |timing|
  874.           battler_animation_process_timing(timing) if timing.frame == frame_index
  875.         end
  876.       else
  877.         @battler_animation = nil
  878.       end
  879.     end
  880.   end
  881.   #--------------------------------------------------------------------------
  882.   # ● Set the animation sprites' coordinates
  883.   #--------------------------------------------------------------------------
  884.   def battler_animation_set_sprites(frame)
  885.     cell_data = frame.cell_data
  886.     @battler_ani_sprites.each_with_index do |sprite, i|
  887.       next unless sprite
  888.       pattern = cell_data[i, 0]
  889.       if !pattern || pattern < 0
  890.         sprite.visible = false
  891.         next
  892.       end
  893.       sprite.bitmap = pattern < 100 ? @battler_ani_bitmap1 :
  894.       @battler_ani_bitmap2
  895.       sprite.visible = true
  896.       sprite.src_rect.set(pattern % 5 * 192,
  897.       pattern % 100 / 5 * 192, 192, 192)
  898.       if @battler_mirror
  899.         sprite.x = @battler_ani_ox - cell_data[i, 1]
  900.         sprite.y = @battler_ani_oy + cell_data[i, 2]
  901.         sprite.angle = (360 - cell_data[i, 4])
  902.         sprite.mirror = (cell_data[i, 5] == 0)
  903.       else
  904.         sprite.x = @battler_ani_ox + cell_data[i, 1]
  905.         sprite.y = @battler_ani_oy + cell_data[i, 2]
  906.         sprite.angle = cell_data[i, 4]
  907.         sprite.mirror = (cell_data[i, 5] == 1)
  908.       end
  909.       sprite.z = @battler.is_moving? ? self.z + 60 : self.z + i
  910.       sprite.ox = 96
  911.       sprite.oy = 96
  912.       sprite.zoom_x = cell_data[i, 3] / 100.0
  913.       sprite.zoom_y = cell_data[i, 3] / 100.0
  914.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  915.       sprite.blend_type = cell_data[i, 7]
  916.     end
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # ● Plays sounds and flash effects
  920.   #--------------------------------------------------------------------------
  921.   def battler_animation_process_timing(timing)
  922.     timing.se.play unless @battler_ani_duplicated
  923.     case timing.flash_scope
  924.     when 1
  925.       self.flash(timing.flash_color, timing.flash_duration * @ani_rate)
  926.     when 2
  927.       if viewport && !@battler_ani_duplicated
  928.         viewport.flash(timing.flash_color, timing.flash_duration * @ani_rate)
  929.       end
  930.     when 3
  931.       self.flash(nil, timing.flash_duration * @ani_rate)
  932.     end
  933.   end
  934.   #--------------------------------------------------------------------------
  935.   # ● Determine which pose should be used right now
  936.   #--------------------------------------------------------------------------
  937.   def get_current_pose
  938.     return unless @battler
  939.     # Standing
  940.     new_pose = @battler.animation_data(:stand)
  941.     # Dead
  942.     if @battler.dead?
  943.       new_pose = @battler.animation_data(:dead)
  944.     # Victory
  945.     elsif @battler.is_a?(Game_Actor) && @battler.victory_pose
  946.       new_pose = @battler.animation_data(:victory)
  947.     # Moving toward target
  948.     elsif @battler.is_moving? && @battler.movement_type == 0
  949.       new_pose = @battler.animation_data(:move_f)
  950.     # Moving back to initial position
  951.     elsif @battler.is_moving? && @battler.movement_type == 1
  952.       new_pose = @battler.animation_data(:move_b)
  953.     # Guarding
  954.     elsif @battler.guard?
  955.       new_pose = @battler.animation_data(:guard)
  956.     # Skill
  957.     elsif @battler.skill_pose_active
  958.       new_pose = @battler.skill_battler_anim(@battler.current_action.item.id)
  959.     # Item
  960.     elsif @battler.item_pose_active
  961.       new_pose = @battler.item_battler_anim(@battler.current_action.item.id)
  962.     # Being hit
  963.     elsif @battler.result.hp_damage > 0 && @battler.result.added_states.size == 0
  964.       new_pose = @battler.animation_data(:hit)
  965.     elsif @battler.states.size > 0 || @battler.result.added_states.size > 0
  966.       new_pose = @battler.animation_data(:stand)
  967.       @battler.sort_states.each do |state|
  968.         if @battler.state_battler_anim(state)
  969.           new_pose = @battler.state_battler_anim(state)
  970.           break
  971.         end
  972.       end
  973.     elsif @battler.hp_rate < 0.5
  974.       new_pose = @battler.animation_data(:danger)
  975.     end
  976.     # Saved pose
  977.     @next_pose = nil unless @battler.skill_pose_active
  978.     new_pose = @next_pose if @next_pose
  979.     # Failsafe: use hit animation if no other one is found
  980.     new_pose = @battler.animation_data(:hit) if new_pose.nil?
  981.     # Failsafe: and in last resort, use standing anim
  982.     new_pose = @battler.animation_data(:stand) if new_pose.nil?
  983.     # Animation loops unless specified otherwise
  984.     if @last_pose == new_pose
  985.       @no_loop = !($data_animations[new_pose].name =~ /no[_|\s]loop/i).nil?
  986.     end
  987.     # Forces 1 loop for dual wielding animation
  988.     if KRX::DUAL_WIELDING
  989.     if @battler.dual_wield? && @battler.weapons.size == 2
  990.       if @battler.current_action && @battler.current_action.item
  991.         if @battler.current_action.item.id == @battler.attack_skill_id
  992.           @start_dual_wielding = true unless @dual_wielding_done
  993.           @no_loop = false unless @dual_wielding_done
  994.         end
  995.       end
  996.     end; end
  997.     # Manage wait flag
  998.     fmax = $data_animations[new_pose].frame_max
  999.     @banim_wait = !($data_animations[new_pose].name =~ /wait/i).nil?
  1000.     @banim_wait = false if @last_frame == fmax - 1 if @banim_wait
  1001.     if @last_frame == fmax - 1
  1002.       switch_to = $data_animations[new_pose].name.match(/To(\d+)/i)
  1003.       id = switch_to[1] if switch_to
  1004.       @next_pose = id.to_i if id
  1005.     end
  1006.     # Update animation
  1007.     if new_pose != @last_pose
  1008.       @last_pose = new_pose
  1009.       @battler_animation = nil
  1010.       @no_loop = false
  1011.       @start_dual_wielding = false
  1012.       @dual_wielding_done = false
  1013.     end
  1014.     new_pose
  1015.   end
  1016.   #--------------------------------------------------------------------------
  1017.   # ● Performs the collapse effect
  1018.   #--------------------------------------------------------------------------
  1019.   alias_method(:krx_aniB_sb_uc, :update_collapse)
  1020.   def update_collapse
  1021.     krx_aniB_sb_uc
  1022.     @battler_ani_sprites.each do |spr|
  1023.       spr.blend_type = 1
  1024.       spr.color.set(255, 128, 128, 128)
  1025.       spr.opacity = 256 - (48 - @effect_duration) * 6
  1026.     end
  1027.   end
  1028.   #--------------------------------------------------------------------------
  1029.   # ● Performs the boss collapse effect
  1030.   #--------------------------------------------------------------------------
  1031.   def update_boss_collapse
  1032.     @effect_duration = @battler_ani_duration
  1033.   end
  1034.   #--------------------------------------------------------------------------
  1035.   # ● Mimics the flash effect
  1036.   #--------------------------------------------------------------------------
  1037.   def flash(color, duration)
  1038.     @flash_color = color.dup
  1039.     @flash_duration = duration
  1040.   end
  1041. end
  1042.  
  1043. # Ignore in YEA Battle Engine
  1044.  
  1045. unless $imported["YEA-BattleEngine"]
  1046. #==============================================================================
  1047. # ■ Window_BattleEnemy
  1048. #==============================================================================
  1049.  
  1050. class Window_BattleEnemy < Window_Selectable
  1051.   #--------------------------------------------------------------------------
  1052.   # ● Frame Update
  1053.   #--------------------------------------------------------------------------
  1054.   alias_method(:krx_aniB_wbe_update, :update)
  1055.   def update
  1056.     enemy.sprite_effect_type = :whiten if active
  1057.     krx_aniB_wbe_update
  1058.   end
  1059. end
  1060.  
  1061. end
  1062.  
  1063. # End of YEA Battle Engine check
  1064.  
  1065. # Flash Selected Enemy compat.
  1066.  
  1067. if $imported[:"FlashSelectedEnemy 1.0.0"]
  1068. #==============================================================================
  1069. # ■ Window_BattleEnemy
  1070. #==============================================================================
  1071.  
  1072. class Window_BattleEnemy < Window_Selectable
  1073.   #--------------------------------------------------------------------------
  1074.   # ● Frame Update
  1075.   #--------------------------------------------------------------------------
  1076.   def update
  1077.     super
  1078.   end
  1079. end
  1080.  
  1081. end
  1082.  
  1083. # End of Flash Selected Enemy check
  1084.  
  1085. #==============================================================================
  1086. # ■ Window_BattleActor
  1087. #==============================================================================
  1088.  
  1089. class Window_BattleActor < Window_BattleStatus
  1090.   #--------------------------------------------------------------------------
  1091.   # ● Frame Update
  1092.   #--------------------------------------------------------------------------
  1093.   alias_method(:krx_aniB_wba_update, :update)
  1094.   def update
  1095.     $game_party.battle_members[index].sprite_effect_type = :whiten if active
  1096.     krx_aniB_wba_update
  1097.   end
  1098. end
  1099.  
  1100. #==============================================================================
  1101. # ■ Scene_Battle
  1102. #==============================================================================
  1103.  
  1104. class Scene_Battle < Scene_Base
  1105.   #--------------------------------------------------------------------------
  1106.   # ● Execute the action previously selected
  1107.   #--------------------------------------------------------------------------
  1108.   alias_method(:krx_aniB_sb_ea, :execute_action)
  1109.   def execute_action
  1110.     move_to_target
  1111.     if @subject.current_action.item.is_a?(RPG::Skill)
  1112.       @subject.skill_pose_active = true
  1113.       wait_for_animation
  1114.     elsif @subject.current_action.item.is_a?(RPG::Item)
  1115.       @subject.item_pose_active = true
  1116.     end
  1117.     krx_aniB_sb_ea
  1118.     move_back_to_pos
  1119.   end
  1120.   #--------------------------------------------------------------------------
  1121.   # ● Moves the battler towards the target
  1122.   #--------------------------------------------------------------------------
  1123.   def move_to_target
  1124.     if @subject.current_action.item.jump_to_target
  1125.       @subject.set_disappear(true)
  1126.     else
  1127.       @subject.movement_type = 2
  1128.       return unless @subject.current_action.item.move_to_target
  1129.       target = @subject.current_action.make_targets.compact[0]
  1130.       ctx =  @subject.screen_x > target.screen_x ? 96 : -96
  1131.       cty = KRX::MOVEMENT_Y_OFFSET * @subject.current_action.item.move_direction
  1132.       @subject.x_destination = target.screen_x + ctx
  1133.       @subject.y_destination = target.screen_y + cty
  1134.       @subject.movement_type = 0
  1135.       update_basic while @subject.is_moving?
  1136.     end
  1137.   end
  1138.   #--------------------------------------------------------------------------
  1139.   # ● Moves the battler back to where they started
  1140.   #--------------------------------------------------------------------------
  1141.   def move_back_to_pos
  1142.     if @subject.disappear?
  1143.       @subject.set_disappear(false)
  1144.     end
  1145.     #---
  1146.     return unless @subject.movement_type == 0
  1147.     @subject.x_destination = @subject.screen_x
  1148.     @subject.y_destination = @subject.screen_y
  1149.     @subject.movement_type = 1
  1150.     update_basic while @subject.is_moving?
  1151.   end
  1152.   #--------------------------------------------------------------------------
  1153.   # ● Use a Banish skill
  1154.   #--------------------------------------------------------------------------
  1155.   if $imported['KRX-BanishSkills']
  1156.   def use_banish_skill(target, orig_item, skill_id)
  1157.     @log_window.display_use_item(@subject, orig_item)
  1158.     @subject.use_item(orig_item)
  1159.     @log_window.display_banish(orig_item, target)
  1160.     item = $data_skills[skill_id]
  1161.     @log_window.display_use_item(target, item)
  1162.     target.actions << Game_Action.new(self)
  1163.     target.current_action.set_skill(item.id)
  1164.     target.skill_pose_active = true
  1165.     wait_for_animation
  1166.     target.use_item(item)
  1167.     target.remove_banish_state
  1168.     refresh_status
  1169.     show_animation([@subject], item.animation_id)
  1170.     item.repeats.times do
  1171.       @subject.item_apply(target, item)
  1172.       refresh_status
  1173.       @log_window.display_action_results(@subject, item)
  1174.     end
  1175.     target.skill_pose_active = false
  1176.     target.actions.clear
  1177.   end; end
  1178. end
  1179.  
  1180. if $imported["YES-BattleSymphony"]
  1181. #===========================================================================
  1182. # ■ Spriteset_Battle
  1183. #===========================================================================
  1184. class Spriteset_Battle  
  1185.   #--------------------------------------------------------------------------
  1186.   def update_actors
  1187.     @actor_sprites.each_with_index do |sprite, i|
  1188.       party_member = $game_party.battle_members[i]
  1189.       if party_member != sprite.battler
  1190.         sprite.battler = $game_party.battle_members[i]
  1191.         #---
  1192.         if party_member
  1193.           party_member.reset_position
  1194.           party_member.correct_origin_position
  1195.           party_member.break_pose if party_member.dead?
  1196.         end
  1197.       end
  1198.       sprite.update
  1199.     end
  1200.   end
  1201. end
  1202. #===========================================================================
  1203. # ■ Game_Actor
  1204. #===========================================================================
  1205. class Game_Actor
  1206.   #--------------------------------------------------------------------------
  1207.   def use_charset?
  1208.     return false
  1209.   end
  1210. end
  1211. end
  1212.  
  1213. # Antilag section
  1214. module Cache
  1215.  
  1216.   def self.storage_aab(bitmap, name)
  1217.     @aab_cache ||= {}
  1218.     @aab_cache[name] = bitmap unless @aab_cache.has_key?(name)
  1219.     @aab_cache[name]
  1220.   end
  1221.  
  1222.   def self.restore_aab(name)
  1223.     return false if @aab_cache.nil? || !@aab_cache.has_key?(name)
  1224.     @aab_cache[name]
  1225.   end
  1226.  
  1227.   def self.clear_aab
  1228.     @aab_cache ||= {}
  1229.     @aab_cache.each_value { |b| b.dispose unless b.disposed? }
  1230.     @aab_cache.clear
  1231.   end
  1232.  
  1233. end # Cache
  1234.  
  1235. module DataManager
  1236.  
  1237.   class <<self; alias yami_aab_init init; end
  1238.   def self.init
  1239.     Cache.clear_aab
  1240.     yami_aab_init
  1241.   end
  1242.  
  1243. end # DataManager
  1244.  
  1245. class Sprite_Battler < Sprite_Base
  1246.  
  1247.   alias yami_aab_initialize initialize
  1248.   def initialize(viewport, battler = nil)
  1249.     yami_aab_initialize(viewport, battler)
  1250.     @framereset_done = false
  1251.   end
  1252.  
  1253.   def load_battler_animation_bitmap
  1254.     animation1_name = @battler_animation.animation1_name
  1255.     animation1_hue = @battler_animation.animation1_hue
  1256.     animation2_name = @battler_animation.animation2_name
  1257.     animation2_hue = @battler_animation.animation2_hue
  1258.     #---
  1259.     name = animation1_name + animation1_hue.to_s
  1260.     cache = Cache.restore_aab(name)
  1261.     if !cache
  1262.       cache = Cache.animation(animation1_name, animation1_hue)
  1263.       Cache.storage_aab(cache.clone, name)
  1264.       cache.dispose
  1265.     end
  1266.     @battler_ani_bitmap1 = Cache.restore_aab(name)
  1267.     #---
  1268.     name = animation2_name + animation2_hue.to_s
  1269.     cache = Cache.restore_aab(name)
  1270.     if !cache
  1271.       cache = Cache.animation(animation2_name, animation2_hue)
  1272.       Cache.storage_aab(cache.clone, name)
  1273.       cache.dispose
  1274.     end
  1275.     @battler_ani_bitmap2 = Cache.restore_aab(name)
  1276.     #---
  1277.     if !@framereset_done
  1278.       Graphics.frame_reset
  1279.       @framereset_done = true
  1280.     end
  1281.   end
  1282.  
  1283.   def dispose_battler_animation
  1284.     if @battler_ani_sprites
  1285.       @battler_ani_sprites.each {|sprite| sprite.dispose }
  1286.       @battler_ani_sprites = nil
  1287.       @battler_animation = nil
  1288.     end
  1289.     @flash_color = @flash_duration = nil
  1290.   end
  1291.  
  1292. end
RAW Paste Data
Top