estriole

Old Victor Anim battle

Apr 14th, 2013
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 217.50 KB | None | 0 0
  1. #==============================================================================
  2. # ** Victor Engine - Animated Battle
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Version History:
  7. #  v beta - 2012.01.28 > Beta relase
  8. #  v 1.00 - 2012.03.08 > Full relase
  9. #  v 1.01 - 2012.03.11 > Better automatic facing direction handling
  10. #                      > Added tags to control intro and victory poses
  11. #                      > Added tags to assign equipment icons for enemies
  12. #  v 1.02 - 2012.03.15 > Fixed enemies turing back when unmovable
  13. #                      > Better active battler handling
  14. #  v 1.03 - 2012.03.19 > Fixed last text error on fast damage skill
  15. #                      > Fixed bug if number of members exceeds battle members
  16. #  v 1.04 - 2012.03.21 > Fixed pose freeze error
  17. #  v 1.05 - 2012.05.20 > Compatibility with Map Turn Battle
  18. #  v 1.06 - 2012.05.22 > Compatibility with Passive States
  19. #  v 1.07 - 2012.05.24 > Compatibility with State Auto Apply
  20. #                      > Added note tags for cast poses
  21. #  v 1.08 - 2012.05.25 > Fixed Counter and Reflect endless loop
  22. #                      > Fixed freeze at the battle end
  23. #  v 1.09 - 2012.06.17 > Fixed throw wait and effect animation
  24. #                      > Fixed icons placement (Thanks to Fomar0153)
  25. #                      > Fixed directions of actions
  26. #                      > Fixed battle log showing too fast
  27. #                      > Fixed freeze when escaping
  28. #                      > Improved Dual Wielding options
  29. #------------------------------------------------------------------------------
  30. #  This script provides a totally customized animated battle system.
  31. # This script allows a full customization of actions sequences, spritesheet
  32. # and many things related to in battle display.
  33. # This script ins't newbie friendly, be *VERY CAREFUL* with the settings.
  34. #------------------------------------------------------------------------------
  35. # Compatibility
  36. #   Requires the script 'Victor Engine - Basic Module' v 1.24 or higher
  37. #
  38. # * Overwrite methods
  39. #   class Game_BattlerBase
  40. #     def refresh
  41. #
  42. #   class Game_Battler < Game_BattlerBase
  43. #     def dead?
  44. #
  45. #   class Game_Actor < Game_Battler
  46. #     def perform_collapse_effect
  47. #     def perform_damage_effect
  48. #
  49. #   class Game_Enemy < Game_Battler
  50. #     def perform_damage_effect
  51. #
  52. #   class Sprite_Battler < Sprite_Base
  53. #     def update_bitmap
  54. #     def init_visibility
  55. #     def update_origin
  56. #
  57. #   class Spriteset_Battle
  58. #     def create_actors
  59. #
  60. #   class Window_BattleLog < Window_Selectable
  61. #     def wait_and_clear
  62. #     def wait
  63. #     def back_to(line_number)
  64. #     def display_added_states(target)
  65. #
  66. #   class Scene_Battle < Scene_Base
  67. #     def abs_wait_short
  68. #     def process_action
  69. #     def apply_item_effects(target, item)
  70. #     def execute_action
  71. #     def use_item
  72. #     def show_animation(targets, animation_id)
  73. #     def invoke_counter_attack(target, item)
  74. #     def invoke_magic_reflection(target, item)
  75. #     def apply_substitute(target, item)
  76. #
  77. # * Alias methods
  78. #   class << BattleManager
  79. #     def init_members
  80. #     def battle_end(result)
  81. #     def process_victory
  82. #     def process_escape
  83. #     def process_abort
  84. #
  85. #   class Game_Screen
  86. #     def clear_tone
  87. #     def update
  88. #
  89. #   class Game_Battler < Game_BattlerBase
  90. #     def initialize
  91. #     def item_apply(user, item)
  92. #     def make_damage_value(user, item)
  93. #     def regenerate_hp
  94. #     def die
  95. #     def revive
  96. #
  97. #   class Game_Actor < Game_Battler
  98. #     def param_plus(param_id)
  99. #
  100. #   class Game_Enemy < Game_Battler
  101. #     def perform_collapse_effect
  102. #
  103. #   class Sprite_Battler < Sprite_Base
  104. #     def initialize(viewport, battler = nil)
  105. #     def update_effect
  106. #     def revert_to_normal
  107. #     def setup_new_effect
  108. #
  109. #   class Spriteset_Battle
  110. #     def initialize
  111. #     def update
  112. #     def dispose
  113. #     def create_pictures
  114. #     def create_viewports
  115. #     def update_viewports
  116. #
  117. #   class Window_BattleLog < Window_Selectable
  118. #     def add_text(text)
  119. #
  120. #   class Scene_Battle < Scene_Base
  121. #     def create_spriteset
  122. #     def update_basic
  123. #     def turn_end
  124. #     def next_command
  125. #     def prior_command
  126. #
  127. #------------------------------------------------------------------------------
  128. # Instructions:
  129. #  To instal the script, open you script editor and paste this script on
  130. #  a new section bellow the Materials section. This script must also
  131. #  be bellow the script 'Victor Engine - Basic'
  132. #------------------------------------------------------------------------------
  133. # Weapons note tags:
  134. #   Tags to be used on Weapons note boxes.
  135. #
  136. #  <attack pose: action>
  137. #   Changes the normal attack pose when using a weapon with this tag
  138. #     action : action name
  139. #
  140. #  <dual pose: action>
  141. #   Changes the double attack pose when using a weapon with this tag
  142. #     action : action name
  143. #
  144. #  <skill pose: action>
  145. #   Changes the physical skill pose when using a weapon with this tag
  146. #     action : action name
  147. #
  148. #  <magic pose: action>
  149. #   Changes the magical skill pose when using a weapon with this tag
  150. #     action : action name
  151. #
  152. #  <item pose: action>
  153. #   Changes the item pose when using a weapon with this tag
  154. #     action : action name
  155. #
  156. #  <advance pose: action>
  157. #   Changes the movement for actions when using a weapon with this tag
  158. #   this change the movement of all actions that have movement (by default
  159. #   only normal attacks and physical skills)
  160. #     action : movement type name
  161. #
  162. #------------------------------------------------------------------------------
  163. # Skills and Items note tags:
  164. #   Tags to be used on Skills and Items note boxes.
  165. #
  166. #  <action pose: action>
  167. #   Changes the pose of the skill or item with this tag
  168. #     action : action name
  169. #
  170. #  <action movement>
  171. #   By default, only physical skills have movement. So, if you want to add
  172. #   movement to non-physical skills and items, add this tag.
  173. #
  174. #  <allow dual attack>
  175. #   By default, skills and items do a single hit even if the character is
  176. #   dual wielding, adding this tag to the skill will allow the actor to
  177. #   attack twice when dual wielding. This only if the action don't use a
  178. #   custom pose.
  179. #
  180. #------------------------------------------------------------------------------
  181. # Actors note tags:
  182. #   Tags to be used on Actors note boxes.
  183. #
  184. #  <no intro>
  185. #   This tag will make the actor display no intro pose at the battle start.
  186. #   By default, all actor display intro pose
  187. #
  188. #  <no victory>
  189. #   This tag will make the actor display no victory pose at the battle start.
  190. #   By default, all actors display victory pose
  191. #
  192. #------------------------------------------------------------------------------
  193. # Enemies note tags:
  194. #   Tags to be used on Enemies note boxes.
  195. #
  196. #  <intro pose>
  197. #   This tag will make the enemy display intro pose at the battle start.
  198. #   By default, no enemy display intro pose
  199. #
  200. #  <victory pose>
  201. #   This tag will make the enemy display victory pose at the battle start.
  202. #   By default, no enemy display victory pose
  203. #
  204. #  <weapon x: y>
  205. #   This allows to display weapons for enemies when using the pose value
  206. #   'icon: weapon *'.
  207. #     x : the slot index of the weapon (1: right hand, 2: left hand)
  208. #     y : the incon index
  209. #
  210. #  <armor x: y>
  211. #   This allows to display armors for enemies when using the pose value
  212. #   'icon: armor *'.
  213. #     x : the slot index of the armor (1: shield, 2: helm, 3: armor, 4: acc)
  214. #     y : the incon index
  215. #
  216. #------------------------------------------------------------------------------
  217. # Actors, Enemies, Classes, States, Weapons and Armors note tags:
  218. #   Tags to be used on Actors, Enemies, Classes, States, Weapons and Armors
  219. #   note boxes.
  220. #
  221. #  <unmovable>
  222. #   This tag allows to make a totally unmovable battler. The battler will not
  223. #   move to attack, neither be can forced to move by any action.
  224. #  
  225. #  <use dual attack>
  226. #   By default, the attack when dual wielding calls the action sequence from
  227. #   the equiped weapons. Adding this tag will make the actor use the custom
  228. #   dual attack sequence <action: dual attack, reset>
  229. #
  230. #------------------------------------------------------------------------------
  231. # Comment calls note tags:
  232. #  Tags to be used in events comment box, works like a script call.
  233. #
  234. #  <no intro>
  235. #   When called, the next battle will have no intro pose.
  236. #
  237. #  <no victory>
  238. #   When called, the next battle will have no victory pose.
  239. #
  240. #------------------------------------------------------------------------------
  241. # Additional instructions:
  242. #
  243. #  More detailed info about the settings can be found at:
  244. #   http://victorscripts.wordpress.com/
  245. #
  246. #  From version 1.09 and later the dual attack pose is opitional, if not set
  247. #  the actor will use the default attack for each weapon instead (wich
  248. #  allows to use weapons with totally different poses), also it's possible
  249. #  to setup skills to inherit the double attack effect. So you can make
  250. #  you physical single hit skills to deal 2 strikes if dual wielding.
  251. #
  252. #==============================================================================
  253.  
  254. #==============================================================================
  255. # ** Victor Engine
  256. #------------------------------------------------------------------------------
  257. #   Setting module for the Victor Engine
  258. #==============================================================================
  259.  
  260. module Victor_Engine
  261.   #--------------------------------------------------------------------------
  262.   # * Initialize Variables
  263.   #--------------------------------------------------------------------------
  264.   VE_ACTION_SETTINGS = {} # Don't remove or change
  265.   #--------------------------------------------------------------------------
  266.   # * Animated battler sufix
  267.   #   When using sprites, add this to the animated sprite sheet of the battler,
  268.   #   that way you can keep the original battler a single sprite and make
  269.   #   easier to setup their position on the troop
  270.   #--------------------------------------------------------------------------
  271.   VE_SPRITE_SUFIX = "[anim]"
  272.   #--------------------------------------------------------------------------
  273.   # * Intro fade
  274.   #   When true, there will be a small fade effect on the battlers during
  275.   #   the battle start (like RMXP default battle)
  276.   #--------------------------------------------------------------------------
  277.   VE_BATTLE_INTRO_FADE = true
  278.   #--------------------------------------------------------------------------
  279.   # * Default sprite settings
  280.   #   This is the settings for all battler graphics that doesn't have
  281.   #   their own custom setting
  282.   #--------------------------------------------------------------------------
  283.   VE_DEFAULT_SPRITE = {
  284.   # Basic Settings
  285.   # name:   value,
  286.     frames: 4,        # Number of frames
  287.     rows:   14,       # Number of rows
  288.     mirror: false,    # Mirror battler when facing right
  289.     invert: false,    # Invert the battler graphic
  290.     mode:   :sprite,  # Graphic style (:sprite or :chasert)
  291.     action: nil,      # Action settings
  292.  
  293.   # Main Poses
  294.   # name:       row,
  295.     idle:      1,   # Idle pose
  296.     guard:     2,   # Guard pose
  297.     evade:     2,   # Evade pose
  298.     danger:    3,   # Low HP pose
  299.     hurt:      4,   # Damage pose
  300.     attack:    5,   # Physical attack pose
  301.     use:       6,   # No type use pose
  302.     item:      6,   # Item use pose
  303.     skill:     7,   # Skill use pose
  304.     magic:     8,   # Magic use pose
  305.     advance:   9,   # Advance pose
  306.     retreat:   10,  # Retreat pose
  307.     escape:    10,  # Escape pose
  308.     victory:   11,  # Victory pose
  309.     intro:     12,  # Battle start pose
  310.     dead:      13,  # Incapacited pose
  311.     ready:     nil, # Ready pose
  312.     itemcast:  nil, # Item cast pose
  313.     skillcast: nil, # Skill cast pose
  314.     magiccast: nil, # Magic cast pose
  315.     command:   nil, # Command pose
  316.     input:     nil, # Input pose
  317.     cancel:    nil, # Cancel pose
  318.     # You can add other pose names and call them within the action settings
  319.     # use only lowcase letters
  320.   } # Don't remove
  321.   #--------------------------------------------------------------------------
  322.   # * Custom sprite settings
  323.   #   Theses settings are set individually based on the battler graphic
  324.   #   filename (even if using the charset mode, the setting will be based
  325.   #   on the battler name, so it's suggested to use the same name for
  326.   #   the battler and charset graphic when using charset mode)
  327.   #   Any value from the default setting can be used, if a value is not set
  328.   #   it's automatically uses the value from basic setting
  329.   #--------------------------------------------------------------------------
  330.   VE_SPRITE_SETTINGS = {
  331.   # 'Filename' => {settings},
  332.   #
  333.   # 'Sample 1' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  334.   #                action: nil},
  335.   # 'Sample 2' => {frames: 3, rows: 4, mirror: true, invert: false,
  336.   #                mode: :charset, action: :charset},
  337.   # 'Sample 3' => {frames: 3, rows: 4, mirror: false, invert: false,
  338.   #                mode: :charset, action: :kaduki},
  339.     'Scorpion'  => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  340.                     action: nil},
  341.     'Warrior_m' => {frames: 4, rows: 14, mirror: false, mode: :sprite,
  342.                     action: :default},
  343.     'Actor1'    => {frames: 3, rows: 4, mirror: false, invert: false,
  344.                     mode: :charset, action: :charset},
  345.     '$Actor4'   => {frames: 3, rows: 4, mirror: true, invert: false,
  346.                     mode: :charset, action: :kaduki},
  347.     '$Slime'    => {frames: 3, rows: 4, mirror: false, invert: false,
  348.                     mode: :charset, action: :charset},
  349.     '$Imp'      => {frames: 3, rows: 4, mirror: false, invert: false,
  350.                     mode: :charset, action: :charset},                    
  351.     'Wizard_f'  => {frames: 3, rows: 4, mirror: false, invert: false,
  352.                     mode: :charset, action: :charset},
  353.     'Hero_m'    => {frames: 4, rows: 14, mirror: false, mode: :sprite,
  354.                     action: :default},
  355.     'Thief_m'   => {frames: 3, rows: 4, mirror: true, invert: false,
  356.                     mode: :charset, action: :kaduki},
  357.   } # Don't remove
  358.   #--------------------------------------------------------------------------
  359.   # * Settings Used For all battlers that doesn't have specific settings
  360.   #--------------------------------------------------------------------------
  361.   VE_DEFAULT_ACTION = "
  362.  
  363.    # Pose displayed when idle
  364.    <action: idle, loop>
  365.    pose: self, row idle, all frames, wait 8;
  366.    wait: 32;
  367.    </action>
  368.  
  369.    # Pose displayed when incapacited
  370.    <action: dead, loop>
  371.    pose: self, row dead, all frames, wait 8;
  372.    wait: 32;
  373.    </action>
  374.  
  375.    # Pose displayed when hp is low
  376.    <action: danger, loop>
  377.    pose: self, row danger, all frames, wait 8;
  378.    wait: 32;
  379.    </action>
  380.  
  381.    # Pose displayed when guarding
  382.    <action: guard, loop>
  383.    pose: self, row guard, all frames, wait 12;
  384.    wait: 48;
  385.    </action>
  386.  
  387.    # Pose displayed during the battle start
  388.    <action: intro, reset>
  389.    pose: self, row intro, all frames, wait 16;
  390.    wait: 64;
  391.    </action>
  392.  
  393.    # Pose displayed during battle victory
  394.    <action: victory, wait>
  395.    pose: self, row victory, all frames, wait 16;
  396.    wait: 64;
  397.    </action>
  398.  
  399.    # Pose displayed while waiting to perfom actions
  400.    <action: ready, loop>
  401.    pose: self, row ready, frame 1;
  402.    wait: 32;
  403.    </action>
  404.    
  405.    # Pose displayed while waiting to perfom item actions
  406.    <action: item cast, loop>
  407.    pose: self, row itemcast, frame 1;
  408.    wait: 32;
  409.    </action>
  410.    
  411.    # Pose displayed while waiting to perfom skill actions
  412.    <action: skill cast, loop>
  413.    pose: self, row skillcast, frame 1;
  414.    wait: 32;
  415.    </action>
  416.    
  417.    # Pose displayed while waiting to perfom magic actions
  418.    <action: magic cast, loop>
  419.    pose: self, row magiccast, frame 1;
  420.    wait: 32;
  421.    </action>
  422.    
  423.    # Pose displayed before inputing commands
  424.    <action: command, reset>
  425.    </action>
  426.    
  427.    # Pose displayed after inputing commands
  428.    <action: input, reset>
  429.    </action>
  430.    
  431.    # Pose displayed when cancel inputing commands
  432.    <action: cancel, reset>
  433.    </action>
  434.    
  435.    # Pose displayed when recive damage
  436.    <action: hurt, reset>
  437.    pose: self, row hurt, all frames, wait 4;
  438.    wait: 16
  439.    </action>
  440.  
  441.    # Pose displayed when evading attacks
  442.    <action: evade, reset>
  443.    pose: self, row evade, all frames, wait 4;
  444.    wait: 16;
  445.    </action>
  446.  
  447.    # Pose displayed when a attack miss
  448.    <action: miss, reset>
  449.    </action>
  450.  
  451.    # Pose displayed when reviving
  452.    <action: revive, reset>
  453.    </action>
  454.  
  455.    # Pose displayed when dying
  456.    <action: die, reset>
  457.    </action>
  458.  
  459.    # Make the target inactive (important, avoid change)
  460.    <action: inactive>
  461.    inactive;
  462.    </action>
  463.  
  464.    # Finish offensive action (important, avoid change)
  465.    <action: finish>
  466.    finish;
  467.    </action>
  468.  
  469.    # Set action advance
  470.    <action: advance, reset>
  471.    action: self, move to target;
  472.    wait: action;
  473.    </action>
  474.    
  475.    # Movement to target
  476.    <action: move to target, reset>
  477.    wait: targets, movement;
  478.    wait: animation;
  479.    move: self, move to;
  480.    direction: targets;
  481.    jump: self, move, height 7;
  482.    pose: self, row advance, all frames, wait 4;
  483.    wait: movement;
  484.    </action>
  485.    
  486.    # Step foward movement
  487.    <action: step foward, reset>
  488.    wait: targets, movement;
  489.    wait: animation;
  490.    move: self, step foward, speed 6;
  491.    pose: self, row advance, all frames, wait 4;
  492.    wait: movement;
  493.    </action>
  494.    
  495.    # Step backward movement
  496.    <action: step backward, reset>
  497.    wait: animation;
  498.    move: self, step backward, speed 6;
  499.    pose: self, row retreat, all frames, wait 4, invert;
  500.    wait: movement;
  501.    </action>
  502.  
  503.    # Return to original spot
  504.    <action: retreat, reset>
  505.    move: self, retreat;
  506.    pose: self, row retreat, all frames, wait 4, invert;
  507.    jump: self, move, height 7;
  508.    wait: movement;
  509.    direction: default;
  510.    </action>
  511.    
  512.    # Move outside of the screen
  513.    <action: escape, reset>
  514.    move: self, escape;
  515.    pose: self, row retreat, all frames, wait 4, invert;
  516.    wait: movement;
  517.    </action>
  518.    
  519.    # Pose used for Defend command
  520.    <action: defend, reset>
  521.    pose: self, row guard, all frames, wait 8;
  522.    wait: 4;
  523.    anim: targets, effect;
  524.    wait: 4;
  525.    effect: 100%;
  526.    wait: 20;
  527.    </action>
  528.    
  529.    # Pose for physical attacks
  530.    <action: attack, reset>
  531.    wait: targets, movement;
  532.    pose: self, row attack, all frames, wait 4;
  533.    wait: 4;
  534.    anim: targets, weapon;
  535.    wait: 8;
  536.    effect: 100%;
  537.    wait: 20;
  538.    </action>
  539.    
  540.    # Pose for physical attack with two weapons
  541.    <action: dual attack, reset>
  542.    wait: targets, movement;
  543.    pose: self, row attack, all frames, wait 4;
  544.    wait: 4;
  545.    anim: targets, weapon 1;
  546.    wait: 8;
  547.    effect: 75%, weapon 1;
  548.    wait: 4;
  549.    wait: animation;
  550.    pose: self, row skill, all frames, wait 4;
  551.    wait: 8;
  552.    anim: targets, weapon 2;
  553.    wait: 4;
  554.    effect: 75%, weapon 2;
  555.    wait: 20;
  556.    </action>
  557.        
  558.    # Pose for using actions without type
  559.    <action: use, reset>
  560.    wait: targets, movement;
  561.    wait: animation;
  562.    pose: self, row item, all frames, wait 4;
  563.    wait: 4;
  564.    anim: targets, effect;
  565.    wait: 4;
  566.    effect: 100%;
  567.    wait: 20;
  568.    </action>
  569.    
  570.    # Pose for item use
  571.    <action: item, reset>
  572.    wait: targets, movement;
  573.    wait: animation;
  574.    pose: self, row direction, all frames, wait 4;
  575.    wait: 4;
  576.    anim: targets, effect;
  577.    wait: 4;
  578.    effect: 100%;
  579.    wait: 20;
  580.    </action>
  581.    
  582.    # Pose for magical skill use
  583.    <action: magic, reset>
  584.    wait: targets, movement;
  585.    wait: animation;
  586.    pose: self, row magic, all frames, wait 4;
  587.    wait: 4;
  588.    anim: targets, effect;
  589.    wait: 8;
  590.    effect: 100%;
  591.    wait: 20;
  592.    </action>
  593.    
  594.    # Pose for physical skill use
  595.    <action: skill, reset>
  596.    wait: targets, movement;
  597.    pose: self, row attack, all frames, wait 4;
  598.    wait: 4;
  599.    anim: targets, effect;
  600.    wait: 8;
  601.    effect: 100%;
  602.    wait: 20;
  603.    </action>
  604.    
  605.    # Pose for counter attack activation (important, avoid change)
  606.    <action: counter on, reset>
  607.    counter: self, on;
  608.    wait: counter;
  609.    </action>
  610.    
  611.    # Pose for counter attack deactivation (important, avoid change)
  612.    <action: counter off, reset>
  613.    counter: targets, off;
  614.    </action>
  615.    
  616.    # Pose for magic reflection
  617.    <action: reflection, reset>
  618.    wait: animation;
  619.    wait: 4;
  620.    anim: self, effect;
  621.    wait: 8;
  622.    effect: 100%;
  623.    wait: animation;
  624.    </action>
  625.    
  626.    # Pose for substitution activation (important, avoid change)
  627.    <action: substitution on, reset>
  628.    move: self, substitution, teleport;
  629.    wait: movement;
  630.    </action>
  631.    
  632.    # Pose for substitution deactivation
  633.    <action: substitution off, reset>
  634.    move: self, retreat, speed 15;
  635.    </action>
  636.    
  637.    # Pose for the skill 'Dual Attack'
  638.    <action: double attack, reset>
  639.    wait: targets, movement;
  640.    pose: self, row attack, all frames, wait 4;
  641.    wait: 4;
  642.    anim: targets, weapon;
  643.    wait: 8;
  644.    effect: 75%;
  645.    wait: 4;
  646.    wait: animation;
  647.    pose: self, row skill, all frames, wait 4;
  648.    wait: 8;
  649.    anim: targets, weapon;
  650.    wait: 4;
  651.    effect: 75%;
  652.    wait: 20;
  653.    </action>
  654.    
  655.    # Pose for the skills 'Life Drain' and 'Manda Drain'
  656.    <action: drain, reset>
  657.    wait: targets, movement;
  658.    wait: animation;
  659.    pose: self, row magic, all frames, wait 4;
  660.    wait: 4;
  661.    anim: targets, effect;
  662.    wait: 8;
  663.    effect: 100%;
  664.    wait: 20;
  665.    action: targets, user drain;
  666.    wait: action;
  667.    </action>
  668.  
  669.    # Pose for the targets of the skills 'Life Drain' and 'Manda Drain'
  670.    <action: user drain, reset>
  671.    throw: self, icon 187, return, revert, init y -12, end y -12;
  672.    wait: self, throw;
  673.    drain: self;
  674.    wait: animation;
  675.    </action>    
  676.    
  677.    # Pose for the sample skill 'Throw Weapon'
  678.    <action: throw weapon, reset>
  679.    wait: targets, movement;
  680.    pose: self, row attack, all frames, wait 4;
  681.    action: targets, target throw;
  682.    wait: action;
  683.    </action>
  684.    
  685.    # Pose for the targets of the sample skill 'Throw Weapon'
  686.    <action: target throw, reset>
  687.    throw: self, weapon, arc 12, spin +45, init y -12, end y -12;
  688.    wait: self, throw;
  689.    throw: self, weapon, arc 12, spin +45, return, revert, init y -12, end y -12;
  690.    anim: self, weapon;
  691.    effect: self, 100%;
  692.    wait: self, throw;
  693.    wait: animation;
  694.    </action>
  695.    
  696.    # Pose for the sample skill 'Lightning Strike'
  697.    <action: lightning strike, 5 times>
  698.    wait: targets, movement;
  699.    direction: targets;
  700.    pose: self, row attack, frame 1, all frames, wait 2;
  701.    move: self, x -48, speed 50;
  702.    anim: targets, effect;
  703.    effect: 20%;
  704.    </action>
  705.    
  706.    # Pose for the sample skill 'Tempest'
  707.    <action: tempest, reset>
  708.    wait: targets, movement;
  709.    wait: animation;
  710.    pose: self, row magic, all frames, wait 4;
  711.    wait: 4;
  712.    tone: black, high priority, duration 20;
  713.    wait: tone;
  714.    movie: name 'Tempest', white, high priority;
  715.    tone: clear, high priority, duration 20;
  716.    wait: 15;
  717.    anim: targets, effect;
  718.    flash: screen, duration 10;
  719.    effect: 100%;
  720.    wait: 20;
  721.    </action>
  722.    
  723.    # Pose for the sample skill 'Meteor'
  724.    <action: meteor, reset>
  725.    wait: targets, movement;
  726.    wait: animation;
  727.    pose: self, row magic, all frames, wait 4;
  728.    wait: 4;
  729.    tone: black, high priority, duration 20;
  730.    wait: tone;
  731.    movie: name 'Meteor';
  732.    tone: clear, high priority, duration 20;
  733.    anim: targets, effect;
  734.    wait: 20;
  735.    effect: 100%;
  736.    wait: 20;
  737.    </action>
  738.    
  739.    # Pose for 'Bow' type weapons
  740.    <action: bow, reset>
  741.    wait: targets, movement;
  742.    direction: targets;
  743.    pose: self, row attack, all frames, wait 4;
  744.    action: targets, arrow;
  745.    wait: action;
  746.    </action>
  747.    
  748.    # Pose for the targets of 'Bow' attack
  749.    <action: arrow, reset>
  750.    throw: self, image 'Arrow', arc 10, angle 45, init x -6, init y -12;
  751.    wait: self, throw;
  752.    anim: self, weapon;
  753.    effect: self, 100%;
  754.    wait: animation;
  755.    </action>
  756.    
  757.    # Movement to target for the skill 'Aura Blade'
  758.    <action: aura blade move to, reset>
  759.    wait: targets, movement;
  760.    pose: self, row magic, all frames, wait 2;
  761.    anim: id 81;
  762.    wait: animation;
  763.    </action>
  764.    
  765.    # Pose for the skill 'Aura Blade'
  766.    <action: aura blade, reset>
  767.    wait: targets, movement;
  768.    pose: self, row magic, all frames, wait 2;
  769.    anim: id 81;
  770.    wait: animation;
  771.    pose: self, row advance, all frames, wait 2;
  772.    move: move to;
  773.    wait: movement;
  774.    jump: height 16;
  775.    wait: 12;
  776.    pose: self, row attack, frame 1;
  777.    freeze: duration 40;
  778.    anim: self, id 66;
  779.    wait: self, freeze;
  780.    wait: 4;
  781.    pose: self, row attack, all frames, wait 2;
  782.    wait: 4;
  783.    anim: targets, effect;
  784.    flash: screen, duration 8;
  785.    wait: 8;
  786.    effect: 75%, weapon;
  787.    flash: screen, duration 8;
  788.    wait: 4;
  789.    </action>
  790.    
  791.    "
  792.   #--------------------------------------------------------------------------
  793.   # * Sample settings used for battlers tagged as 'charset'
  794.   #--------------------------------------------------------------------------
  795.   VE_ACTION_SETTINGS[:charset] = "
  796.    # Pose displayed when idle
  797.    <action: idle, loop>
  798.    pose: self, row direction, frame 2;
  799.    wait: 16;
  800.    </action>
  801.  
  802.    # Pose displayed when incapacited
  803.    <action: dead, loop>
  804.    pose: self, row 4, frame 2, angle -90, x -16, y -12;
  805.    wait: 32;
  806.    </action>
  807.  
  808.    # Pose displayed when hp is low
  809.    <action: danger, loop>
  810.    pose: self, row direction, frame 2;
  811.    wait: 16;
  812.    </action>
  813.  
  814.    # Pose displayed when guarding
  815.    <action: guard, loop>
  816.    icon: self, shield, y +8, above;
  817.    pose: self, row direction, frame 1;
  818.    wait: 16;
  819.    </action>
  820.  
  821.    # Pose displayed during the battle start
  822.    <action: intro, reset>
  823.    pose: self, row direction, frame 2;
  824.    wait: 64;
  825.    </action>
  826.  
  827.    # Pose displayed during battle victory
  828.    <action: victory, wait>
  829.    pose: self, row 2, frame 2;
  830.    wait: 2;
  831.    pose: self, row 4, frame 2;
  832.    wait: 2;
  833.    pose: self, row 3, frame 2;
  834.    wait: 2;
  835.    pose: self, row 1, frame 2;
  836.    wait: 2;
  837.    pose: self, row 2, frame 2;
  838.    wait: 2;
  839.    pose: self, row 4, frame 2;
  840.    wait: 2;
  841.    pose: self, row 3, frame 2;
  842.    wait: 2;
  843.    pose: self, row 1, frame 2;
  844.    wait: 2;
  845.    jump: self, height 8, speed 8;
  846.    wait: 10
  847.    </action>
  848.  
  849.    # Pose displayed while waiting to perfom actions
  850.    <action: ready, loop>
  851.    pose: self, row direction, all frames, return, wait 8;
  852.    wait: 32;
  853.    </action>
  854.    
  855.    # Pose displayed while waiting to perfom item actions
  856.    <action: item cast, loop>
  857.    pose: self, row direction, all frames, return, wait 8;
  858.    wait: 32;
  859.    </action>
  860.    
  861.    # Pose displayed while waiting to perfom skill actions
  862.    <action: skill cast, loop>
  863.    pose: self, row direction, all frames, return, wait 8;
  864.    wait: 32;
  865.    </action>
  866.    
  867.    # Pose displayed while waiting to perfom magic actions
  868.    <action: magic cast, loop>
  869.    pose: self, row direction, all frames, return, wait 8;
  870.    wait: 32;
  871.    </action>
  872.    
  873.    # Pose displayed before inputing commands
  874.    <action: command, reset>
  875.    action: self, step foward;
  876.    wait: action;
  877.    </action>
  878.    
  879.    # Pose displayed after inputing commands
  880.    <action: input, reset>
  881.    action: self, step backward;
  882.    wait: action;
  883.    </action>
  884.    
  885.    # Pose displayed when cancel inputing commands
  886.    <action: cancel, reset>
  887.    action: self, step backward;
  888.    wait: action;
  889.    </action>
  890.    
  891.    # Pose displayed when recive damage
  892.    <action: hurt, reset>
  893.    move: self, retreat, teleport;
  894.    direction: active;
  895.    pose: self, row direction, all frames, wait 4, return;
  896.    move: self, step backward, speed 4;
  897.    wait: movement;
  898.    pose: self, row direction, frame 2;
  899.    wait: 4;
  900.    pose: self, row direction, all frames, wait 4, return;
  901.    move: self, step foward, speed 5;
  902.    wait: movement;
  903.    direction: default;
  904.    </action>
  905.  
  906.    # Pose displayed when evading attacks
  907.    <action: evade, reset>
  908.    move: self, retreat, teleport;
  909.    direction: active;
  910.    pose: self, row 1, frame 2;
  911.    move: self, step backward, speed 4;
  912.    jump: self, move;
  913.    wait: movement;
  914.    pose: self, row direction, frame 2;
  915.    wait: 4;
  916.    pose: self, row direction, all frames, wait 4, return;
  917.    move: self, step foward, speed 5;
  918.    wait: movement;
  919.    direction: default;
  920.    </action>
  921.  
  922.    # Pose displayed when a attack miss
  923.    <action: miss, reset>
  924.    </action>
  925.  
  926.    # Pose displayed when reviving
  927.    <action: revive, reset>
  928.    </action>
  929.  
  930.    # Pose displayed when dying
  931.    <action: die, reset>
  932.    </action>
  933.  
  934.    # Make the target inactive (important, avoid change)
  935.    <action: inactive>
  936.    inactive;
  937.    </action>
  938.  
  939.    # Finish offensive action (important, avoid change)
  940.    <action: finish>
  941.    finish;
  942.    </action>
  943.  
  944.    # Set action advance
  945.    <action: advance, reset>
  946.    action: self, move to target;
  947.    wait: action;
  948.    </action>
  949.    
  950.    # Movement to target
  951.    <action: move to target, reset>
  952.    wait: targets, movement;
  953.    wait: animation;
  954.    move: self, move to;
  955.    direction: targets;
  956.    pose: self, row direction, all frames, return, wait 4;
  957.    wait: movement;
  958.    </action>
  959.    
  960.    # Step foward movement
  961.    <action: step foward, reset>
  962.    wait: targets, movement;
  963.    wait: animation;
  964.    move: self, step foward, speed 6;
  965.    pose: self, row direction, all frames, return, wait 4;
  966.    wait: movement;
  967.    </action>
  968.  
  969.    # Step backward movement
  970.    <action: step backward, reset>
  971.    wait: animation;
  972.    move: self, step backward, speed 6;
  973.    pose: self, row direction, all frames, return, wait 4;
  974.    wait: movement;
  975.    </action>
  976.  
  977.    # Return to original spot
  978.    <action: retreat, reset>
  979.    direction: return;
  980.    move: self, retreat;
  981.    pose: self, row direction, all frames, return, wait 4;
  982.    wait: movement;
  983.    direction: default;
  984.    </action>
  985.    
  986.    # Move outside of the screen
  987.    <action: escape, reset>
  988.    move: self, escape;
  989.    pose: self, row direction, all frames, return, wait 4;
  990.    wait: movement;
  991.    </action>
  992.    
  993.    # Pose used for Defend command
  994.    <action: defend, reset>
  995.    pose: self, row direction, all frames, wait 8;
  996.    wait: 4;
  997.    anim: targets, effect;
  998.    wait: 4;
  999.    effect: 100%;
  1000.    wait: 20;
  1001.    </action>
  1002.    
  1003.    # Pose for physical attacks
  1004.    <action: attack, reset>
  1005.    wait: targets, movement;
  1006.    direction: targets;
  1007.    pose: self, row direction, all frames, wait 2, y +1;
  1008.    icon: weapon, angle -90, x +12, y -16;
  1009.    icon: weapon, angle -45, x +6, y -16;
  1010.    icon: weapon, angle 0, x -6;
  1011.    anim: targets, weapon;
  1012.    icon: weapon, angle 45, x -10, y +8;
  1013.    effect: 100%;
  1014.    wait: 20;
  1015.    icon: delete;
  1016.    </action>
  1017.    
  1018.    # Pose for physical attack with two weapons
  1019.    <action: dual attack, reset>
  1020.    wait: targets, movement;
  1021.    direction: targets;
  1022.    pose: self, row direction, all frames, wait 2, y +1;
  1023.    icon: weapon, angle -90, x +12, y -16;
  1024.    icon: weapon, angle -45, x +6, y -16;
  1025.    icon: weapon, angle 0, x -6;
  1026.    anim: targets, weapon;
  1027.    icon: weapon, angle 45, x -10, y +8;
  1028.    effect: 75%, weapon;
  1029.    wait: animation;
  1030.    icon: delete;
  1031.    direction: targets;
  1032.    pose: self, row direction, all frames, wait 2, revert, y +1;
  1033.    icon: weapon 2, angle -90, x +12, y -16;
  1034.    icon: weapon 2, angle -45, x +6, y -16;
  1035.    icon: weapon 2, angle 0;
  1036.    anim: targets, weapon;
  1037.    icon: weapon 2, angle 45, x -6, y +8;
  1038.    effect: 75%, weapon 2;
  1039.    wait: 20;
  1040.    icon: delete;
  1041.    </action>
  1042.    
  1043.    # Pose for using actions without type
  1044.    <action: use, reset>
  1045.    wait: targets, movement;
  1046.    action: self, step foward;
  1047.    pose: self, row direction, all frames, wait 4;
  1048.    wait: 4;
  1049.    anim: targets, effect;
  1050.    wait: 4;
  1051.    effect: 100%;
  1052.    wait: 20;
  1053.    action: self, step backward;
  1054.    </action>
  1055.    
  1056.    # Pose for item use
  1057.    <action: item, reset>
  1058.    wait: targets, movement;
  1059.    action: self, step foward;
  1060.    wait: 10;
  1061.    pose: self, row direction, frame 1;
  1062.    icon: action, x -8, above;
  1063.    wait: 4;
  1064.    pose: self, row direction, frame 2;
  1065.    icon: action, x -4, y -4, above;
  1066.    wait: 4;
  1067.    pose: self, row direction, frame 3;
  1068.    icon: action, y -8, above;
  1069.    wait: 4;
  1070.    pose: self, row direction, frame 2;
  1071.    icon: action, y -8, x +4, above;
  1072.    wait: 12;
  1073.    icon: delete;
  1074.    pose: self, row direction, frame 1;
  1075.    throw: targets, action, arc 10, init y -8;
  1076.    wait: targets, throw;
  1077.    anim: targets, effect;
  1078.    wait: 4;
  1079.    effect: 100%;
  1080.    wait: 20;
  1081.    action: self, step backward;
  1082.    </action>
  1083.    
  1084.    # Pose for magical skill use
  1085.    <action: magic, reset>
  1086.    wait: targets, movement;
  1087.    action: self, step foward;
  1088.    direction: targets;
  1089.    pose: self, row direction, all frames, wait 4;
  1090.    wait: 4;
  1091.    anim: targets, effect;
  1092.    wait: 8;
  1093.    effect: 100%;
  1094.    wait: 20;
  1095.    action: self, step backward;
  1096.    </action>
  1097.    
  1098.    # Pose for physical skill use
  1099.    <action: skill, reset>
  1100.    wait: targets, movement;
  1101.    direction: targets;
  1102.    pose: self, row direction, all frames, wait 2;
  1103.    icon: weapon, angle -90, x +12, y -16;
  1104.    icon: weapon, angle -45, x +6, y -16;
  1105.    icon: weapon, angle 0, x -6;
  1106.    anim: targets, effect;
  1107.    icon: weapon, angle 45, x -10, y +8;
  1108.    effect: 100%;
  1109.    wait: 20;
  1110.    icon: delete;
  1111.    </action>
  1112.    
  1113.    # Pose for counter attack activation (important, avoid change)
  1114.    <action: counter off, reset>
  1115.    counter: targets, off;
  1116.    </action>
  1117.  
  1118.    # Pose for counter attack deactivation (important, avoid change)
  1119.    <action: counter on, reset>
  1120.    counter: self, on;
  1121.    wait: counter;
  1122.    </action>
  1123.    
  1124.    # Pose for magic reflection
  1125.    <action: reflection, reset>
  1126.    wait: animation;
  1127.    wait: 4;
  1128.    anim: self, effect;
  1129.    wait: 8;
  1130.    effect: 100%;
  1131.    wait: animation;
  1132.    </action>
  1133.    
  1134.    # Pose for substitution activation (important, avoid change)
  1135.    <action: substitution on, reset>
  1136.    move: self, substitution, teleport;
  1137.    wait: movement;
  1138.    </action>
  1139.    
  1140.    # Pose for substitution deactivation (important, avoid change)
  1141.    <action: substitution off, reset>
  1142.    move: self, retreat, teleport;
  1143.    </action>
  1144.    
  1145.    # Pose for the skill 'Dual Attack'
  1146.    <action: dual attack, reset>
  1147.    wait: targets, movement;
  1148.    direction: targets;
  1149.    pose: self, row direction, all frames, wait 2, y +1;
  1150.    icon: weapon, angle -90, x +12, y -16;
  1151.    icon: weapon, angle -45, x +6, y -16;
  1152.    icon: weapon, angle 0, x -6;
  1153.    anim: targets, effect;
  1154.    icon: weapon, angle 45, x -10, y +8;
  1155.    effect: 100%;
  1156.    wait: animation;
  1157.    icon: delete;
  1158.    direction: targets;
  1159.    pose: self, row direction, all frames, wait 2, revert, y +1;
  1160.    icon: weapon, angle -90, x +12, y -16;
  1161.    icon: weapon, angle -45, x +6, y -16;
  1162.    icon: weapon, angle 0;
  1163.    anim: targets, effect;
  1164.    icon: weapon, angle 45, x -6, y +8;
  1165.    effect: 100%;
  1166.    wait: 20;
  1167.    icon: delete;
  1168.    </action>
  1169.    
  1170.    # Pose for the skills 'Life Drain' and 'Mana Drain'
  1171.    <action: drain, reset>
  1172.    wait: targets, movement;
  1173.    wait: animation;
  1174.    direction: targets;
  1175.    pose: self, row direction, all frames, wait 4;
  1176.    wait: 4;
  1177.    anim: targets, effect;
  1178.    wait: 8;
  1179.    effect: 100%;
  1180.    wait: 20;
  1181.    action: targets, user drain;
  1182.    wait: action;
  1183.    </action>
  1184.  
  1185.    # Pose for the targets of the skills 'Life Drain' and 'Mana Drain
  1186.    <action: user drain, reset>
  1187.    throw: self, icon 187, return, revert, init y -12, end y -12;
  1188.    wait: self, throw;
  1189.    drain: self;
  1190.    wait: animation;
  1191.    </action>    
  1192.    
  1193.    # Pose for the sample skill 'Throw Weapon'
  1194.    <action: throw weapon, reset>
  1195.    wait: targets, movement;
  1196.    direction: targets;
  1197.    pose: self, row direction, frame 1;
  1198.    pose: self, row direction, frame 2;
  1199.    action: targets, target throw;
  1200.    pose: self, row direction, frame 3;
  1201.    wait: action;
  1202.    </action>
  1203.    
  1204.    # Pose for the targets of the sample skill 'Throw Weapon'
  1205.    <action: target throw, reset>
  1206.    throw: self, weapon, arc 12, spin +45, init y -12, end y -12;
  1207.    wait: self, throw;
  1208.    throw: self, weapon, arc 12, spin +45, return, revert, init y -12, end y -12;
  1209.    anim: self, weapon;
  1210.    effect: self, 100%;
  1211.    wait: self, throw;
  1212.    wait: animation;
  1213.    </action>
  1214.    
  1215.    # Pose for the sample skill 'Lightning Strike'
  1216.    <action: lightning strike, 5 times>
  1217.    wait: targets, movement;
  1218.    direction: targets;
  1219.    pose: self, row direction, frame 3, y +1;
  1220.    move: self, x -48, speed 50;
  1221.    icon: weapon, angle 45, x -12, y +8;
  1222.    anim: targets, effect;
  1223.    effect: 20%;
  1224.    icon: delete;
  1225.    </action>
  1226.    
  1227.    # Pose for the sample skill 'Tempest'
  1228.    <action: tempest, reset>
  1229.    wait: targets, movement;
  1230.    wait: animation;
  1231.    pose: self, row direction, all frames, wait 4;
  1232.    wait: 4;
  1233.    tone: black, high priority, duration 20;
  1234.    wait: tone;
  1235.    movie: name 'Tempest', white, high priority;
  1236.    tone: clear, high priority, duration 20;
  1237.    wait: 15;
  1238.    anim: targets, effect;
  1239.    flash: screen, duration 10;
  1240.    effect: 100%;
  1241.    wait: 20;
  1242.    </action>
  1243.    
  1244.    # Pose for the sample skill 'Meteor'
  1245.    <action: meteor, reset>
  1246.    wait: targets, movement;
  1247.    wait: animation;
  1248.    pose: self, row direction, all frames, wait 4;
  1249.    wait: 4;
  1250.    tone: black, high priority, duration 20;
  1251.    wait: tone;
  1252.    movie: name 'Meteor';
  1253.    tone: clear, high priority, duration 20;
  1254.    anim: targets, effect;
  1255.    wait: 20;
  1256.    effect: 100%;
  1257.    wait: 20;
  1258.    </action>
  1259.    
  1260.    # Pose for 'Claw' type weapons
  1261.    <action: claw, reset>
  1262.    wait: targets, movement;
  1263.    direction: targets;
  1264.    pose: self, row direction, all frames, wait 3, y +1;
  1265.    icon: weapon, angle -45, x +16, y -16;
  1266.    icon: weapon, angle -30, x +10, y -16;
  1267.    icon: weapon, angle -15, x -2;
  1268.    anim: targets, weapon;
  1269.    icon: weapon, angle 0, x -6, y +8;
  1270.    effect: 100%;
  1271.    wait: 20;
  1272.    icon: delete;
  1273.    </action>
  1274.    
  1275.    # Pose for 'Spear' type weapons
  1276.    <action: spear, reset>
  1277.    wait: targets, movement;
  1278.    direction: targets;
  1279.    pose: self, row direction, all frames, wait 3, y +1;
  1280.    icon: weapon, angle 45, x +12, y +8;
  1281.    icon: weapon, angle 45, x +12, y +8;
  1282.    icon: weapon, angle 45, x 0, y +8;
  1283.    anim: targets, weapon;
  1284.    icon: weapon, angle 45, x -12, y +8;
  1285.    effect: 100%;
  1286.    wait: 20;
  1287.    icon: delete;
  1288.    </action>
  1289.    
  1290.    # Pose for 'Gun' type weapons
  1291.    <action: gun, reset>
  1292.    wait: targets, movement;
  1293.    direction: targets;
  1294.    pose: self, row direction, all frames, wait 3;
  1295.    icon: weapon, angle -135, x +12, y -16;
  1296.    icon: weapon, angle -105, x +6, y -10;
  1297.    icon: weapon, angle -75, x 0, y -2;
  1298.    icon: weapon, angle -45, x -6, y +4;
  1299.    wait: 30;
  1300.    sound: name 'Gun1';
  1301.    pose: self, row direction, frame 3;
  1302.    icon: weapon, angle -75, x 0, y -2;
  1303.    pose: self, row direction, frame 2;
  1304.    icon: weapon, angle -105, x +6, y -10;
  1305.    pose: self, row direction, frame 1;
  1306.    anim: targets, weapon;
  1307.    icon: weapon, angle -135, x +12, y -16;
  1308.    effect: 100%;
  1309.    wait: 20;
  1310.    icon: delete;
  1311.    </action>
  1312.    
  1313.    # Pose for 'Bow' type weapons
  1314.    <action: bow, reset>
  1315.    wait: targets, movement;
  1316.    direction: targets;
  1317.    pose: self, row 2, all frames, sufix _3, wait 4;
  1318.    icon: image 'Bow1', x +6, above;
  1319.    icon: image 'Bow2', x +6, above;
  1320.    icon: image 'Bow3', x +6, above;
  1321.    wait: 10;
  1322.    icon: image 'Bow2', x +6, above;
  1323.    icon: image 'Bow1', x +6, above;
  1324.    action: targets, arrow;
  1325.    wait: action;
  1326.    </action>
  1327.  
  1328.    # Pose for the targets of 'Bow' attack
  1329.    <action: arrow, reset>
  1330.    throw: self, image 'Arrow', arc 10, angle 45, init x -6, init y -12;
  1331.    wait: self, throw;
  1332.    anim: self, weapon;
  1333.    effect: self, 100%;
  1334.    wait: animation;
  1335.    </action>
  1336.        
  1337.    "
  1338.   #--------------------------------------------------------------------------
  1339.   # * Sample settings used for battlers tagged as 'kaduki' style
  1340.   #--------------------------------------------------------------------------
  1341.   VE_ACTION_SETTINGS[:kaduki] = "
  1342.  
  1343.    # Pose displayed when idle
  1344.    <action: idle, loop>
  1345.    pose: self, row 1, all frames, sufix _1, return, loop, wait 16;
  1346.    wait: pose;
  1347.    </action>
  1348.  
  1349.    # Pose displayed when incapacited
  1350.    <action: dead, loop>
  1351.    pose: self, row 4, all frames, sufix _2, return, loop, wait 8;
  1352.    wait: pose;
  1353.    </action>
  1354.  
  1355.    # Pose displayed when hp is low
  1356.    <action: danger, loop>
  1357.    pose: self, row 3, all frames, sufix _1, return, loop, wait 16;
  1358.    wait: pose;
  1359.    </action>
  1360.  
  1361.    # Pose displayed when guarding
  1362.    <action: guard, loop>
  1363.    icon: self, shield, y +8, above;
  1364.    pose: self, row 4, frame 3, sufix _1;
  1365.    wait: 16;
  1366.    </action>
  1367.  
  1368.    # Pose displayed during the battle start
  1369.    <action: intro, reset>
  1370.    pose: self, row 1, frame 2, sufix _1;
  1371.    wait: 12;
  1372.    </action>
  1373.  
  1374.    # Pose displayed during battle victory
  1375.    <action: victory, wait>
  1376.    pose: self, row 1, all frames, sufix _2, wait 8;
  1377.    wait: pose;
  1378.    </action>
  1379.  
  1380.    # Pose displayed while waiting to perfom actions
  1381.    <action: ready, loop>
  1382.    pose: self, row 1, frame 2, sufix _1;
  1383.    wait: 24;
  1384.    </action>
  1385.    
  1386.    # Pose displayed while waiting to perfom item actions
  1387.    <action: item cast, loop>
  1388.    pose: self, row 1, frame 2, sufix _1;
  1389.    wait: 24;
  1390.    </action>
  1391.    
  1392.    # Pose displayed while waiting to perfom skill actions
  1393.    <action: skill cast, loop>
  1394.    pose: self, row 1, frame 2, sufix _1;
  1395.    wait: 24;
  1396.    </action>
  1397.    
  1398.    # Pose displayed while waiting to perfom magic actions
  1399.    <action: magic cast, loop>
  1400.    pose: self, row 4, all frames, sufix _3, loop, wait 8;
  1401.    wait: pose;
  1402.    </action>
  1403.    
  1404.    # Pose displayed before inputing commands
  1405.    <action: command, reset>
  1406.    action: self, step foward;
  1407.    wait: action;
  1408.    </action>
  1409.    
  1410.    # Pose displayed after inputing commands
  1411.    <action: input, reset>
  1412.    action: self, step backward;
  1413.    wait: action;
  1414.    </action>
  1415.    
  1416.    # Pose displayed when cancel inputing commands
  1417.    <action: cancel, reset>
  1418.    action: self, step backward;
  1419.    wait: action;
  1420.    </action>
  1421.        
  1422.    # Pose displayed when recive damage
  1423.    <action: hurt, reset>
  1424.    move: self, retreat, teleport;
  1425.    pose: self, row 2, all frames, sufix _1, wait 4;
  1426.    move: self, step backward, speed 4;
  1427.    wait: movement;
  1428.    pose: self, row direction, frame 2;
  1429.    wait: 4;
  1430.    pose: self, row 4, all frames, wait 4, return, sufix _1;
  1431.    move: self, step foward, speed 5;
  1432.    wait: movement;
  1433.    </action>
  1434.  
  1435.    # Pose displayed when evading attacks
  1436.    <action: evade, reset>
  1437.    pose: self, row 2, sufix _2, all frames, wait 4,;
  1438.    move: self, step backward, speed 4;
  1439.    jump: self, move;
  1440.    wait: movement;
  1441.    pose: self, row 1, frame 2, sufix _2;
  1442.    wait: 4;
  1443.    pose: self, row 4, all frames, wait 4, return, sufix _1;
  1444.    move: self, step foward, speed 5;
  1445.    wait: movement;
  1446.    </action>
  1447.  
  1448.    # Pose displayed when a attack miss
  1449.    <action: miss, reset>
  1450.    </action>
  1451.  
  1452.    # Pose displayed when reviving
  1453.    <action: revive, reset>
  1454.    </action>
  1455.  
  1456.    # Pose displayed when dying
  1457.    <action: die, reset>
  1458.    </action>
  1459.    
  1460.    # Make the target inactive (important, avoid change)
  1461.    <action: inactive>
  1462.    inactive;
  1463.    </action>
  1464.  
  1465.    # Finish offensive action (important, avoid change)
  1466.    <action: finish>
  1467.    finish;
  1468.    </action>
  1469.    
  1470.    # Set action advance
  1471.    <action: advance, reset>
  1472.    action: self, move to target;
  1473.    wait: action;
  1474.    </action>
  1475.    
  1476.    # Movement to target
  1477.    <action: move to target, reset>
  1478.    wait: targets, movement;
  1479.    wait: animation;
  1480.    move: self, move to;
  1481.    direction: targets;
  1482.    pose: self, row 4, all frames, sufix _1, return, loop, wait 8;
  1483.    wait: movement;
  1484.    </action>
  1485.    
  1486.    # Step foward movement
  1487.    <action: step foward, reset>
  1488.    wait: targets, movement;
  1489.    wait: animation;
  1490.    move: self, step foward, speed 6;
  1491.    pose: self, row 4, all frames, sufix _1, return, wait 8;
  1492.    wait: movement;
  1493.    </action>
  1494.  
  1495.    # Step backward movement
  1496.    <action: step backward, reset>
  1497.    wait: animation;
  1498.    move: self, step backward, speed 6;
  1499.    pose: self, row 4, all frames, sufix _1, return, wait 8;
  1500.    </action>
  1501.    
  1502.    # Return to original spot
  1503.    <action: retreat, reset>
  1504.    direction: return;
  1505.    move: self, retreat;
  1506.    pose: self, row 4, all frames, sufix _1, return, loop, wait 8;
  1507.    wait: movement;
  1508.    direction: default;
  1509.    </action>
  1510.    
  1511.    # Move outside of the screen
  1512.    <action: escape, reset>
  1513.    move: self, escape;
  1514.    pose: self, row 4, all frames, sufix _1, return, wait 8;
  1515.    wait: movement;
  1516.    </action>
  1517.    
  1518.    # Pose used for Defend command
  1519.    <action: defend, reset>
  1520.    pose: self, row 4, frame 2, sufix _1;
  1521.    icon: self, shield, y +8, above;
  1522.    pose: self, row 4, frame 3, sufix _1;
  1523.    wait: 4;
  1524.    anim: targets, effect;
  1525.    wait: 4;
  1526.    effect: 100%;
  1527.    wait: 20;
  1528.    </action>
  1529.    
  1530.    # Pose for physical attacks
  1531.    <action: attack, reset>
  1532.    wait: targets, movement;
  1533.    direction: targets;
  1534.    pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1535.    icon: weapon, angle -90, x +12, y -16;
  1536.    icon: weapon, angle -45, x +6, y -16;
  1537.    icon: weapon, angle 0, x -6;
  1538.    anim: targets, weapon;
  1539.    icon: weapon, angle 45, x -10, y +8;
  1540.    effect: 100%;
  1541.    wait: 20;
  1542.    icon: delete;
  1543.    </action>
  1544.    
  1545.    # Pose for physical attack with two weapons
  1546.    <action: dual attack, reset>
  1547.    wait: targets, movement;
  1548.    direction: targets;
  1549.    pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1550.    icon: weapon, angle -180, x +12, y -16;
  1551.    icon: weapon, angle -135, x +12, y -16;
  1552.    icon: weapon, angle -90, x +12, y -16;
  1553.    icon: weapon, angle -45, x +6, y -16;
  1554.    icon: weapon, angle 0, x -6;
  1555.    anim: targets, weapon 1;
  1556.    icon: weapon, angle 45, x -10, y +8;
  1557.    effect: 75%, weapon 1;
  1558.    wait: animation;
  1559.    icon: delete;
  1560.    direction: targets;
  1561.    pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1562.    icon: weapon 2, angle -180, x +12, y -16;
  1563.    icon: weapon 2, angle -135, x +12, y -16;
  1564.    icon: weapon 2, angle -90, x +12, y -16;
  1565.    icon: weapon 2, angle -45, x +6, y -16;
  1566.    icon: weapon 2, angle 0;
  1567.    anim: targets, weapon 2;
  1568.    icon: weapon 2, angle 45, x -6, y +8;
  1569.    effect: 75%, weapon 2;
  1570.    wait: 20;
  1571.    icon: delete;
  1572.    </action>
  1573.    
  1574.    # Pose for using actions without type
  1575.    <action: use, reset>
  1576.    wait: targets, movement;
  1577.    wait: animation;
  1578.    action: self, step foward;
  1579.    pose: self, row 2, all frames, sufix _3, wait 3;
  1580.    wait: 4;
  1581.    anim: targets, effect;
  1582.    wait: 4;
  1583.    effect: 100%;
  1584.    wait: 20;
  1585.    action: self, step backward;
  1586.    </action>
  1587.    
  1588.    # Pose for item use
  1589.    <action: item, reset>
  1590.    wait: targets, movement;
  1591.    wait: animation;
  1592.    action: self, step foward;
  1593.    wait: 10;
  1594.    pose: self, row 2, all frames, sufix _3, wait 3;
  1595.    icon: action, x -8, above;
  1596.    wait: 4;
  1597.    icon: action, x -4, y -4, above;
  1598.    wait: 4;
  1599.    icon: action, y -8, above;
  1600.    wait: 4;
  1601.    icon: action, y -8, x +4, above;
  1602.    wait: 12;
  1603.    pose: self, row 1, all frames, sufix _3, wait 2;
  1604.    icon: delete;
  1605.    throw: targets, action, arc 10, init y -8;
  1606.    wait: targets, throw;
  1607.    anim: targets, effect;
  1608.    wait: 4;
  1609.    effect: 100%;
  1610.    wait: 20;
  1611.    action: self, step backward;
  1612.    </action>
  1613.    
  1614.    # Pose for magical skill use
  1615.    <action: magic, reset>
  1616.    wait: targets, movement;
  1617.    wait: animation;
  1618.    action: self, step foward;
  1619.    direction: targets;
  1620.    pose: self, row 3, all frames, sufix _3, wait 3;
  1621.    wait: 4;
  1622.    anim: targets, effect;
  1623.    wait: 8;
  1624.    effect: 100%;
  1625.    wait: 20;
  1626.    action: self, step backward;
  1627.    </action>
  1628.    
  1629.    # Pose for physical skill use
  1630.    <action: skill, reset>
  1631.    wait: targets, movement;
  1632.    direction: targets;
  1633.    pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1634.    icon: weapon, angle -90, x +12, y -16;
  1635.    icon: weapon, angle -45, x +6, y -16;
  1636.    icon: weapon, angle 0, x -6;
  1637.    anim: targets, weapon;
  1638.    icon: weapon, angle 45, x -10, y +8;
  1639.    effect: 100%;
  1640.    wait: 20;
  1641.    icon: delete;
  1642.    </action>
  1643.    
  1644.    # Pose for counter attack activation (important, avoid change)
  1645.    <action: counter on, reset>
  1646.    counter: self, on;
  1647.    wait: counter;
  1648.    </action>
  1649.  
  1650.    # Pose for counter attack deactivation (important, avoid change)
  1651.    <action: counter off, reset>
  1652.    counter: targets, off;
  1653.    </action>
  1654.    
  1655.    # Pose for magic reflection
  1656.    <action: reflection, reset>
  1657.    wait: animation;
  1658.    wait: 4;
  1659.    anim: self, effect;
  1660.    wait: 8;
  1661.    effect: 100%;
  1662.    wait: animation;
  1663.    </action>
  1664.    
  1665.    # Pose for substitution activation (important, avoid change)
  1666.    <action: substitution on, reset>
  1667.    move: self, substitution, teleport;
  1668.    wait: movement;
  1669.    </action>
  1670.    
  1671.    # Pose for substitution deactivation
  1672.    <action: substitution off, reset>
  1673.    move: self, retreat, speed 15;
  1674.    </action>
  1675.  
  1676.    # Pose for the skill 'Dual Attack'
  1677.    <action: dual attack, reset>
  1678.    wait: targets, movement;
  1679.    direction: targets;
  1680.    pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1681.    icon: weapon, angle -180, x +12, y -16;
  1682.    icon: weapon, angle -135, x +12, y -16;
  1683.    icon: weapon, angle -90, x +12, y -16;
  1684.    icon: weapon, angle -45, x +6, y -16;
  1685.    icon: weapon, angle 0, x -6;
  1686.    anim: targets, effect;
  1687.    icon: weapon, angle 45, x -10, y +8;
  1688.    effect: 100%;
  1689.    wait: animation;
  1690.    icon: delete;
  1691.    direction: targets;
  1692.    pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1693.    icon: weapon, angle -180, x +12, y -16;
  1694.    icon: weapon, angle -135, x +12, y -16;
  1695.    icon: weapon, angle -90, x +12, y -16;
  1696.    icon: weapon, angle -45, x +6, y -16;
  1697.    icon: weapon, angle 0;
  1698.    anim: targets, effect;
  1699.    icon: weapon, angle 45, x -6, y +8;
  1700.    effect: 100%;
  1701.    wait: 20;
  1702.    icon: delete;
  1703.    </action>
  1704.    
  1705.    # Pose for the skills 'Life Drain' and 'Manda Drain'
  1706.    <action: drain, reset>
  1707.    wait: targets, movement;
  1708.    wait: animation;
  1709.    direction: targets;
  1710.    pose: self, row 3, all frames, sufix _3, wait 3;
  1711.    wait: 4;
  1712.    anim: targets, effect;
  1713.    wait: 8;
  1714.    effect: 100%;
  1715.    wait: 20;
  1716.    action: targets, user drain;
  1717.    wait: action;
  1718.    </action>
  1719.  
  1720.    # Pose for the targets of the skills 'Life Drain' and 'Manda Drain'
  1721.    <action: user drain, reset>
  1722.    throw: self, icon 187, return, revert, init y -12, end y -12;
  1723.    wait: self, throw;
  1724.    drain: self;
  1725.    wait: animation;
  1726.    </action>    
  1727.    
  1728.    # Pose for the sample skill 'Throw Weapon'
  1729.    <action: throw weapon, reset>
  1730.    wait: targets, movement;
  1731.    direction: targets;
  1732.    pose: self, row 1, all frames, sufix _3, wait 3;
  1733.    wait: 3;
  1734.    action: targets, target throw;
  1735.    wait: action;
  1736.    </action>
  1737.    
  1738.    # Pose for the targets of the sample skill 'Throw Weapon'
  1739.    <action: target throw, reset>
  1740.    throw: self, weapon, arc 12, spin +45, init y -12, end y -12;
  1741.    wait: self, throw;
  1742.    throw: self, weapon, arc 12, spin +45, return, revert, init y -12, end y -12;
  1743.    anim: self, weapon;
  1744.    effect: self, 100%;
  1745.    wait: self, throw;
  1746.    wait: animation;
  1747.    </action>
  1748.    
  1749.    # Pose for the sample skill 'Lightning Strike'
  1750.    <action: lightning strike, 10 times>
  1751.    wait: targets, movement;
  1752.    direction: targets;
  1753.    pose: self, row 1, frame 3, sufix _3, y +1;
  1754.    move: self, x -48, speed 50;
  1755.    icon: weapon, angle 45, x -12, y +8;
  1756.    anim: targets, effect;
  1757.    effect: 20%;
  1758.    icon: delete;
  1759.    </action>
  1760.    
  1761.    # Pose for the sample skill 'Tempest'
  1762.    <action: tempest, reset>
  1763.    wait: targets, movement;
  1764.    wait: animation;
  1765.    pose: self, row 3, all frames, sufix _3, wait 3;
  1766.    wait: 4;
  1767.    tone: black, high priority, duration 20;
  1768.    wait: tone;
  1769.    movie: name 'Tempest', white, high priority;
  1770.    tone: clear, high priority, duration 20;
  1771.    wait: 15;
  1772.    anim: targets, effect;
  1773.    flash: screen, duration 10;
  1774.    effect: 100%;
  1775.    wait: 20;
  1776.    </action>
  1777.    
  1778.    # Pose for the sample skill 'Meteor'
  1779.    <action: meteor, reset>
  1780.    wait: targets, movement;
  1781.    wait: animation;
  1782.    pose: self, row 3, all frames, sufix _3, wait 3;
  1783.    wait: 4;
  1784.    tone: black, high priority, duration 20;
  1785.    wait: tone;
  1786.    movie: name 'Meteor';
  1787.    tone: clear, high priority, duration 20;
  1788.    anim: targets, effect;
  1789.    wait: 20;
  1790.    effect: 100%;
  1791.    wait: 20;
  1792.    </action>
  1793.    
  1794.    # Pose for 'Claw' type weapons
  1795.    <action: claw, reset>
  1796.    wait: targets, movement;
  1797.    direction: targets;
  1798.    pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1799.    icon: weapon, angle -45, x +16, y -16;
  1800.    icon: weapon, angle -30, x +10, y -16;
  1801.    icon: weapon, angle -15, x -2;
  1802.    anim: targets, weapon;
  1803.    icon: weapon, angle 0, x -6, y +8;
  1804.    effect: 100%;
  1805.    wait: 20;
  1806.    icon: delete;
  1807.    </action>
  1808.    
  1809.    # Pose for 'Spear' type weapons
  1810.    <action: spear, reset>
  1811.    wait: targets, movement;
  1812.    direction: targets;
  1813.    pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1814.    icon: weapon, angle 45, x +12, y +8;
  1815.    icon: weapon, angle 45, x +12, y +8;
  1816.    icon: weapon, angle 45, x 0, y +8;
  1817.    anim: targets, weapon;
  1818.    icon: weapon, angle 45, x -12, y +8;
  1819.    effect: 100%;
  1820.    wait: 20;
  1821.    icon: delete;
  1822.    </action>
  1823.    
  1824.    # Pose for 'Gun' type weapons
  1825.    <action: gun, reset>
  1826.    wait: targets, movement;
  1827.    direction: targets;
  1828.    pose: self, row 1, all frames, sufix _3, wait 3;
  1829.    icon: weapon, angle -135, x +12, y -16;
  1830.    icon: weapon, angle -105, x +6, y -10;
  1831.    icon: weapon, angle -75, x 0, y -2;
  1832.    icon: weapon, angle -45, x -6, y +4;
  1833.    wait: 30;
  1834.    sound: name 'Gun1';
  1835.    pose: self, row 1, frame 3, sufix _3;
  1836.    icon: weapon, angle -75, x -6, y -2;
  1837.    pose: self, row 1, frame 2, sufix _3;
  1838.    icon: weapon, angle -105, y -10;
  1839.    pose: self, row 1, frame 1, sufix _3;
  1840.    anim: targets, effect;
  1841.    effect: 100%;
  1842.    wait: 20;
  1843.    icon: delete;
  1844.    </action>
  1845.    
  1846.    # Pose for 'Bow' type weapons
  1847.    <action: bow, reset>
  1848.    wait: targets, movement;
  1849.    direction: targets;
  1850.    pose: self, row 2, all frames, sufix _3, wait 4;
  1851.    icon: image 'Bow1', x +6, above;
  1852.    icon: image 'Bow2', x +6, above;
  1853.    icon: image 'Bow3', x +6, above;
  1854.    wait: 10;
  1855.    icon: image 'Bow2', x +6, above;
  1856.    icon: image 'Bow1', x +6, above;
  1857.    action: targets, arrow;
  1858.    wait: action;
  1859.    </action>
  1860.    
  1861.    # Pose for the targets of 'Bow' attack
  1862.    <action: arrow, reset>
  1863.    throw: self, image 'Arrow', arc 10, angle 45, init x -6, init y -12;
  1864.    wait: self, throw;
  1865.    anim: self, weapon;
  1866.    effect: self, 100%;
  1867.    wait: animation;
  1868.    </action>
  1869.  
  1870.    # Movement to target for the skill 'Aura Blade'
  1871.    <action: aura blade move to, reset>
  1872.    wait: targets, movement;
  1873.    wait: animation;
  1874.    move: self, move to, x +52;
  1875.    direction: targets;
  1876.    pose: self, row 4, all frames, sufix _1, return, wait 8;
  1877.    wait: movement;
  1878.    </action>
  1879.    
  1880.    # Pose for the skill 'Aura Blade'
  1881.    <action: aura blade, reset>
  1882.    wait: targets, movement;
  1883.    pose: self, row 4, sufix _3, all frames, wait 8, loop;
  1884.    anim: id 81;
  1885.    wait: animation;
  1886.    pose: self, row 2, sufix _3, all frames, wait 3, y +1;
  1887.    icon: weapon, angle 45, x -6, y +6;
  1888.    icon: weapon, angle 30, x -10, y +0;
  1889.    icon: weapon, angle 15, x -14, y -6;
  1890.    icon: weapon, angle 0, x -10, y -10;
  1891.    wait: 30;
  1892.    anim: id 110;
  1893.    wait: animation;
  1894.    wait: 30;
  1895.    move: self, x -144, speed 15;
  1896.    pose: self, row 1, sufix _3, all frames, wait 3, y +1;
  1897.    icon: weapon, angle -90, x +12, y -16;
  1898.    icon: weapon, angle -45, x +6, y -16;
  1899.    icon: weapon, angle 0, x -6;
  1900.    icon: weapon, angle 45, x -10, y +8;
  1901.    anim: targets, effect;
  1902.    effect: 100%;
  1903.    wait: 20;
  1904.    </action>
  1905.  
  1906.    "
  1907.   #--------------------------------------------------------------------------
  1908.   # * required
  1909.   #   This method checks for the existance of the basic module and other
  1910.   #   VE scripts required for this script to work, don't edit this
  1911.   #--------------------------------------------------------------------------
  1912.   def self.required(name, req, version, type = nil)
  1913.     if !$imported[:ve_basic_module]
  1914.       msg = "The script '%s' requires the script\n"
  1915.       msg += "'VE - Basic Module' v%s or higher above it to work properly\n"
  1916.       msg += "Go to http://victorscripts.wordpress.com/ to download this script."
  1917.       msgbox(sprintf(msg, self.script_name(name), version))
  1918.       exit
  1919.     else
  1920.       self.required_script(name, req, version, type)
  1921.     end
  1922.   end
  1923.   #--------------------------------------------------------------------------
  1924.   # * script_name
  1925.   #   Get the script name base on the imported value, don't edit this
  1926.   #--------------------------------------------------------------------------
  1927.   def self.script_name(name, ext = "VE")
  1928.     name = name.to_s.gsub("_", " ").upcase.split
  1929.     name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  1930.     name.join(" ")
  1931.   end
  1932. end
  1933.  
  1934. $imported ||= {}
  1935. $imported[:ve_animated_battle] = 1.01
  1936. Victor_Engine.required(:ve_animated_battle, :ve_basic_module, 1.13, :above)
  1937. Victor_Engine.required(:ve_animated_battle, :ve_actor_battlers, 1.00, :bellow)
  1938. Victor_Engine.required(:ve_animated_battle, :ve_animations_settings, 1.00, :bellow)
  1939.  
  1940.  
  1941. # $imported ||= {}
  1942. # $imported[:ve_animated_battle] = 1.09
  1943. # Victor_Engine.required(:ve_animated_battle, :ve_basic_module, 1.24, :above)
  1944. # Victor_Engine.required(:ve_animated_battle, :ve_actor_battlers, 1.00, :bellow)
  1945. # Victor_Engine.required(:ve_animated_battle, :ve_animations_settings, 1.00, :bellow)
  1946. # Victor_Engine.required(:ve_animated_battle, :ve_passive_states, 1.00, :bellow)
  1947. # Victor_Engine.required(:ve_animated_battle, :ve_map_battle, 1.00, :bellow)
  1948. # Victor_Engine.required(:ve_animated_battle, :ve_state_cancel, 1.00, :bellow)
  1949. # Victor_Engine.required(:ve_animated_battle, :ve_tech_points, 1.00, :bellow)
  1950. # Victor_Engine.required(:ve_animated_battle, :ve_trait_control, 1.00, :bellow)
  1951. # Victor_Engine.required(:ve_animated_battle, :ve_mp_level, 1.00, :bellow)
  1952. # Victor_Engine.required(:ve_animated_battle, :ve_automatic_battlers, 1.00, :bellow)
  1953. # Victor_Engine.required(:ve_animated_battle, :ve_state_auto_apply, 1.00, :bellow)
  1954. # Victor_Engine.required(:ve_animated_battle, :ve_element_states, 1.00, :bellow)
  1955.  
  1956. #==============================================================================
  1957. # ** Object
  1958. #------------------------------------------------------------------------------
  1959. #  This class is the superclass of all other classes.
  1960. #==============================================================================
  1961.  
  1962. class Object
  1963.   #--------------------------------------------------------------------------
  1964.   # * New method: custom_pose
  1965.   #--------------------------------------------------------------------------
  1966.   def custom_pose(type)
  1967.     note =~ /<#{type.upcase} POSE: (\w[\w ]+)>/i ? make_symbol($1) : nil
  1968.   end
  1969. end
  1970.  
  1971. #==============================================================================
  1972. # ** BattleManager
  1973. #------------------------------------------------------------------------------
  1974. #  This module handles the battle processing
  1975. #==============================================================================
  1976.  
  1977. class << BattleManager
  1978.   #--------------------------------------------------------------------------
  1979.   # * Public Instance Variables
  1980.   #--------------------------------------------------------------------------
  1981.   attr_accessor :old_tone
  1982.   #--------------------------------------------------------------------------
  1983.   # * Alias method: init_members
  1984.   #--------------------------------------------------------------------------
  1985.   alias :init_members_ve_animated_battle :init_members
  1986.   def init_members
  1987.     $game_party.members.each {|member| member.clear_poses }
  1988.     init_members_ve_animated_battle
  1989.   end
  1990.   #--------------------------------------------------------------------------
  1991.   # * Alias method: battle_end
  1992.   #--------------------------------------------------------------------------
  1993.   alias :battle_end_ve_animated_battle :battle_end
  1994.   def battle_end(result)
  1995.     $game_party.members.each {|member| member.clear_poses }
  1996.     $game_system.no_intro   = false
  1997.     $game_system.no_victory = false
  1998.     battle_end_ve_animated_battle(result)
  1999.   end
  2000.   #--------------------------------------------------------------------------
  2001.   # * Alias method: process_victory
  2002.   #--------------------------------------------------------------------------
  2003.   alias :process_victory_ve_animated_battle :process_victory
  2004.   def process_victory
  2005.     process_battle_end_pose($game_party)
  2006.     process_victory_ve_animated_battle
  2007.   end
  2008.   #--------------------------------------------------------------------------
  2009.   # * Alias method: process_defeat
  2010.   #--------------------------------------------------------------------------
  2011.   alias :process_defeat_ve_animated_battle :process_defeat
  2012.   def process_defeat
  2013.     process_battle_end_pose($game_troop)
  2014.     process_defeat_ve_animated_battle
  2015.   end
  2016.   #--------------------------------------------------------------------------
  2017.   # * Alias method: process_escape
  2018.   #--------------------------------------------------------------------------
  2019.   alias :process_escape_ve_animated_battle :process_escape
  2020.   def process_escape
  2021.     @escaping = true
  2022.     success   = process_escape_ve_animated_battle
  2023.     @escaping = false
  2024.     return success
  2025.   end
  2026.   #--------------------------------------------------------------------------
  2027.   # * Alias method: process_abort
  2028.   #--------------------------------------------------------------------------
  2029.   alias :process_abort_ve_animated_battle :process_abort
  2030.   def process_abort
  2031.     process_escape_pose if @escaping
  2032.     process_abort_ve_animated_battle
  2033.   end
  2034.   #--------------------------------------------------------------------------
  2035.   # * New method: process_battle_end_pose
  2036.   #--------------------------------------------------------------------------
  2037.   def process_battle_end_pose(party)
  2038.     SceneManager.scene.log_window_clear
  2039.     SceneManager.scene.update_basic while party.not_in_position?
  2040.     SceneManager.scene.update_basic
  2041.     party.movable_members.each do |member|
  2042.       next if $game_system.no_victory || !member.victory_pose?
  2043.       member.clear_loop_poses
  2044.       member.call_pose(:victory)
  2045.     end
  2046.   end
  2047.   #--------------------------------------------------------------------------
  2048.   # * New method: process_escape_pose
  2049.   #--------------------------------------------------------------------------
  2050.   def process_escape_pose
  2051.     $game_party.movable_members.each do |member|
  2052.       member.clear_loop_poses
  2053.       member.call_pose(:escape)
  2054.     end
  2055.     SceneManager.scene.abs_wait(5)
  2056.     SceneManager.scene.update_basic while $game_party.moving?    
  2057.     SceneManager.scene.close_window
  2058.     Graphics.fadeout(30)
  2059.   end
  2060.   #--------------------------------------------------------------------------
  2061.   # * New method: set_active_pose
  2062.   #--------------------------------------------------------------------------
  2063.   def set_active_pose
  2064.     return unless actor
  2065.     actor.set_active_pose
  2066.     actor.reset_pose
  2067.   end
  2068.   #--------------------------------------------------------------------------
  2069.   # * New method: clear_active_pose
  2070.   #--------------------------------------------------------------------------
  2071.   def clear_active_pose
  2072.     return unless actor
  2073.     actor.active_pose = nil
  2074.     actor.reset_pose
  2075.   end
  2076.   #--------------------------------------------------------------------------
  2077.   # * New method: active
  2078.   #--------------------------------------------------------------------------
  2079.   def active
  2080.     SceneManager.scene_is?(Scene_Battle) ? SceneManager.scene.active : nil
  2081.   end
  2082.   #--------------------------------------------------------------------------
  2083.   # * New method: targets
  2084.   #--------------------------------------------------------------------------
  2085.   def targets
  2086.     return [] unless active
  2087.     active.action_targets
  2088.   end
  2089. end
  2090.  
  2091. #==============================================================================
  2092. # ** Game_System
  2093. #------------------------------------------------------------------------------
  2094. #  This class handles system-related data. Also manages vehicles and BGM, etc.
  2095. # The instance of this class is referenced by $game_system.
  2096. #==============================================================================
  2097.  
  2098. class Game_System
  2099.   #--------------------------------------------------------------------------
  2100.   # * Public Instance Variables
  2101.   #--------------------------------------------------------------------------
  2102.   attr_accessor :no_intro
  2103.   attr_accessor :no_victory
  2104.   attr_accessor :intro_fade
  2105.   #--------------------------------------------------------------------------
  2106.   # * Alias method: initialize
  2107.   #--------------------------------------------------------------------------
  2108.   alias :initialize_ve_animated_battle :initialize
  2109.   def initialize
  2110.     initialize_ve_animated_battle
  2111.     @intro_fade = VE_BATTLE_INTRO_FADE
  2112.   end
  2113. end
  2114.  
  2115. #==============================================================================
  2116. # ** Game_Screen
  2117. #------------------------------------------------------------------------------
  2118. #  This class handles screen maintenance data, such as change in color tone,
  2119. # flashes, etc. It's used within the Game_Map and Game_Troop classes.
  2120. #==============================================================================
  2121.  
  2122. class Game_Screen
  2123.   #--------------------------------------------------------------------------
  2124.   # * Public Instance Variables
  2125.   #--------------------------------------------------------------------------
  2126.   attr_reader   :low_tone
  2127.   attr_reader   :high_tone
  2128.   attr_accessor :old_tone
  2129.   attr_accessor :old_low_tone
  2130.   attr_accessor :old_high_tone
  2131.   #--------------------------------------------------------------------------
  2132.   # * Alias method: clear_tone
  2133.   #--------------------------------------------------------------------------
  2134.   alias :clear_tone_ve_animated_battle :clear_tone
  2135.   def clear_tone
  2136.     clear_tone_ve_animated_battle
  2137.     @low_tone  = Tone.new
  2138.     @high_tone = Tone.new
  2139.     @low_tone_target  = Tone.new
  2140.     @high_tone_target = Tone.new
  2141.     @low_tone_duration  = 0
  2142.     @high_tone_duration = 0
  2143.   end
  2144.   #--------------------------------------------------------------------------
  2145.   # * Alias method: update
  2146.   #--------------------------------------------------------------------------
  2147.   alias :update_ve_animated_battle :update
  2148.   def update
  2149.     update_ve_animated_battle
  2150.     low_update_tone
  2151.     high_update_tone
  2152.   end
  2153.   #--------------------------------------------------------------------------
  2154.   # * New method: start_low_tone_change
  2155.   #--------------------------------------------------------------------------
  2156.   def start_low_tone_change(tone, duration)
  2157.     @low_tone_target = tone.clone
  2158.     @low_tone_duration = duration
  2159.     @low_tone = @low_tone_target.clone if @low_tone_duration == 0
  2160.   end
  2161.   #--------------------------------------------------------------------------
  2162.   # * New method: start_high_tone_change
  2163.   #--------------------------------------------------------------------------
  2164.   def start_high_tone_change(tone, duration)
  2165.     @high_tone_target = tone.clone
  2166.     @high_tone_duration = duration
  2167.     @high_tone = @high_tone_target.clone if @high_tone_duration == 0
  2168.   end
  2169.   #--------------------------------------------------------------------------
  2170.   # * New method: low_update_tone
  2171.   #--------------------------------------------------------------------------
  2172.   def low_update_tone
  2173.     if @low_tone_duration > 0
  2174.       d    = @low_tone_duration
  2175.       tone = @low_tone_target
  2176.       @low_tone.red   = (@low_tone.red   * (d - 1) + tone.red)   / d
  2177.       @low_tone.green = (@low_tone.green * (d - 1) + tone.green) / d
  2178.       @low_tone.blue  = (@low_tone.blue  * (d - 1) + tone.blue)  / d
  2179.       @low_tone.gray  = (@low_tone.gray  * (d - 1) + tone.gray)  / d
  2180.       @low_tone_duration -= 1
  2181.     end
  2182.   end  
  2183.   #--------------------------------------------------------------------------
  2184.   # * New method: high_update_tone
  2185.   #--------------------------------------------------------------------------
  2186.   def high_update_tone
  2187.     if @high_tone_duration > 0
  2188.       d    = @high_tone_duration
  2189.       tone = @high_tone_target
  2190.       @high_tone.red   = (@high_tone.red   * (d - 1) + tone.red)   / d
  2191.       @high_tone.green = (@high_tone.green * (d - 1) + tone.green) / d
  2192.       @high_tone.blue  = (@high_tone.blue  * (d - 1) + tone.blue)  / d
  2193.       @high_tone.gray  = (@high_tone.gray  * (d - 1) + tone.gray)  / d
  2194.       @high_tone_duration -= 1
  2195.     end
  2196.   end
  2197.   #--------------------------------------------------------------------------
  2198.   # * New method: tone_change?
  2199.   #--------------------------------------------------------------------------
  2200.   def tone_change?
  2201.     @tone_duration > 0 || @low_tone_duration > 0 || @high_tone_duration > 0
  2202.   end
  2203. end
  2204.  
  2205. #==============================================================================
  2206. # ** Game_ActionResult
  2207. #------------------------------------------------------------------------------
  2208. #  This class handles the results of actions. This class is used within the
  2209. # Game_Battler class.
  2210. #==============================================================================
  2211.  
  2212. class Game_ActionResult
  2213.   #--------------------------------------------------------------------------
  2214.   # * New method: damage_value_adjust
  2215.   #--------------------------------------------------------------------------
  2216.   def damage_value_adjust(value, item)
  2217.     @hp_damage *= value
  2218.     @mp_damage *= value
  2219.     @hp_damage = @hp_damage.to_i
  2220.     @mp_damage = [@battler.mp, @mp_damage.to_i].min
  2221.     @hp_drain = @hp_damage if item.damage.drain?
  2222.     @mp_drain = @mp_damage if item.damage.drain?
  2223.     @hp_drain = [@battler.hp, @hp_drain].min
  2224.   end
  2225.   #--------------------------------------------------------------------------
  2226.   # * New method: setup_drain
  2227.   #--------------------------------------------------------------------------
  2228.   def setup_drain(user)
  2229.     user.hp_drain += @hp_drain
  2230.     user.mp_drain += @mp_drain
  2231.     @hp_drain = 0
  2232.     @mp_drain = 0
  2233.   end
  2234. end
  2235.  
  2236. #==============================================================================
  2237. # ** Game_BattlerBase
  2238. #------------------------------------------------------------------------------
  2239. #  This class handles battlers. It's used as a superclass of the Game_Battler
  2240. # classes.
  2241. #==============================================================================
  2242.  
  2243. class Game_BattlerBase
  2244.   #--------------------------------------------------------------------------
  2245.   # * Overwrite method: refresh
  2246.   #--------------------------------------------------------------------------
  2247.   def refresh
  2248.     state_resist_set.each {|state_id| erase_state(state_id) }
  2249.     @hp = [[@hp, mhp].min, 0].max
  2250.     @mp = [[@mp, mmp].min, 0].max
  2251.     die if @dying && !immortal?
  2252.     return if @dying
  2253.     valid = @hp == 0 && !immortal?
  2254.     valid ? add_state(death_state_id) : remove_state(death_state_id)
  2255.     reset_pose
  2256.   end
  2257. end
  2258.  
  2259. #==============================================================================
  2260. # ** Game_Battler
  2261. #------------------------------------------------------------------------------
  2262. #  This class deals with battlers. It's used as a superclass of the Game_Actor
  2263. # and Game_Enemy classes.
  2264. #==============================================================================
  2265.  
  2266. class Game_Battler < Game_BattlerBase
  2267.   #--------------------------------------------------------------------------
  2268.   # * Public Instance Variables
  2269.   #--------------------------------------------------------------------------
  2270.   attr_accessor :row
  2271.   attr_accessor :frame
  2272.   attr_accessor :timing
  2273.   attr_accessor :freeze
  2274.   attr_accessor :invisible
  2275.   attr_accessor :direction
  2276.   attr_accessor :move_speed
  2277.   attr_accessor :jumping
  2278.   attr_accessor :shake
  2279.   attr_accessor :pose_list
  2280.   attr_accessor :immortals
  2281.   attr_accessor :hp_drain
  2282.   attr_accessor :mp_drain
  2283.   attr_accessor :attack_flag
  2284.   attr_accessor :damage_flag
  2285.   attr_accessor :result_flag
  2286.   attr_accessor :target_list
  2287.   attr_accessor :dual_flag
  2288.   attr_accessor :spin
  2289.   attr_accessor :angle
  2290.   attr_accessor :sufix
  2291.   attr_accessor :active
  2292.   attr_accessor :targets
  2293.   attr_accessor :teleport
  2294.   attr_accessor :x_adj
  2295.   attr_accessor :y_adj
  2296.   attr_accessor :call_anim
  2297.   attr_accessor :call_effect
  2298.   attr_accessor :call_end
  2299.   attr_accessor :animation
  2300.   attr_accessor :countered
  2301.   attr_accessor :substitution
  2302.   attr_accessor :action_targets
  2303.   attr_accessor :active_pose
  2304.   attr_accessor :pose_loop_anim
  2305.   attr_accessor :previous_action
  2306.   attr_accessor :icon_list
  2307.   attr_accessor :throw_list
  2308.   attr_accessor :current_item
  2309.   attr_accessor :target_position
  2310.   attr_accessor :current_position
  2311.   attr_accessor :default_position
  2312.   #--------------------------------------------------------------------------
  2313.   # * Overwrite method: dead?
  2314.   #--------------------------------------------------------------------------
  2315.   def dead?
  2316.     super && !immortal?
  2317.   end
  2318.   #--------------------------------------------------------------------------
  2319.   # * Alias method: initialize
  2320.   #--------------------------------------------------------------------------
  2321.   alias :initialize_ve_animated_battle :initialize
  2322.   def initialize
  2323.     init_anim_battlers_variables
  2324.     initialize_ve_animated_battle
  2325.   end
  2326.   #--------------------------------------------------------------------------
  2327.   # * Alias method: item_apply
  2328.   #--------------------------------------------------------------------------
  2329.   alias :item_apply_ve_animated_battle :item_apply
  2330.   def item_apply(user, item)
  2331.     item_apply_ve_animated_battle(user, item)
  2332.     call_damage_pose(item, user) if movable?
  2333.     @substitution    = false
  2334.     user.result_flag = @result.hit? ? :hit : :miss
  2335.   end
  2336.   #--------------------------------------------------------------------------
  2337.   # * Alias method: make_damage_value
  2338.   #--------------------------------------------------------------------------
  2339.   alias :make_damage_value_ve_animated_battle :make_damage_value
  2340.   def make_damage_value(user, item)
  2341.     make_damage_value_ve_animated_battle(user, item)
  2342.     @result.damage_value_adjust(user.damage_flag, item) if user.damage_flag
  2343.     @result.setup_drain(user)
  2344.   end
  2345.   #--------------------------------------------------------------------------
  2346.   # * Alias method: regenerate_hp
  2347.   #--------------------------------------------------------------------------
  2348.   alias :regenerate_hp_ve_animated_battle :regenerate_hp
  2349.   def regenerate_hp
  2350.     regenerate_hp_ve_animated_battle
  2351.     call_pose(:hurt, :clear) if @result.hp_damage > 0 && movable?
  2352.   end
  2353.   #--------------------------------------------------------------------------
  2354.   # * Alias method: die
  2355.   #--------------------------------------------------------------------------
  2356.   alias :die_ve_animated_battle :die
  2357.   def die
  2358.     return @dying = true if immortal?
  2359.     call_pose(:die, :clear)
  2360.     @dying = false
  2361.     die_ve_animated_battle
  2362.   end
  2363.   #--------------------------------------------------------------------------
  2364.   # * Alias method: revive
  2365.   #--------------------------------------------------------------------------
  2366.   alias :revive_ve_animated_battle :revive
  2367.   def revive
  2368.     call_pose(:revive, :clear)
  2369.     revive_ve_animated_battle
  2370.   end
  2371.   #--------------------------------------------------------------------------
  2372.   # * New method: init_anim_battlers_variables
  2373.   #--------------------------------------------------------------------------
  2374.   def init_anim_battlers_variables
  2375.     clear_poses
  2376.   end
  2377.   #--------------------------------------------------------------------------
  2378.   # * New method: clear_poses
  2379.   #--------------------------------------------------------------------------
  2380.   def clear_poses
  2381.     @sufix = ""
  2382.     @row   = 0
  2383.     @frame = 0
  2384.     @angle = 0
  2385.     @spin  = 0
  2386.     @x_adj = 0
  2387.     @y_adj = 0
  2388.     @hp_drain = 0
  2389.     @mp_drain = 0
  2390.     @direction  = 2
  2391.     @move_speed = 1.0
  2392.     @pose_list  = []
  2393.     @targets    = []
  2394.     @immortals  = []
  2395.     @throw_list = []
  2396.     @icon_list  = {}
  2397.     @timing     = {}
  2398.     @action_targets = []
  2399.     clear_shake
  2400.     clear_position
  2401.   end
  2402.   #--------------------------------------------------------------------------
  2403.   # * New method: immortal?
  2404.   #--------------------------------------------------------------------------
  2405.   def immortal?
  2406.     return false unless $game_party.in_battle
  2407.     members = $game_troop.members + $game_party.battle_members
  2408.     members.any? {|member| member.immortals.include?(self) }
  2409.   end
  2410.   #--------------------------------------------------------------------------
  2411.   # * New method: clear_shake
  2412.   #--------------------------------------------------------------------------
  2413.   def clear_shake
  2414.     @shake_power = 0
  2415.     @shake_speed = 0
  2416.     @shake_duration = 0
  2417.     @shake_direction = 1
  2418.     @shake = 0
  2419.   end
  2420.   #--------------------------------------------------------------------------
  2421.   # * New method: clear_position
  2422.   #--------------------------------------------------------------------------
  2423.   def clear_position
  2424.     @target_position  = {x: 0, y: 0, h: 0, j: 0}
  2425.     @current_position = {x: 0, y: 0, h: 0, j: 0}
  2426.     @default_position = {x: 0, y: 0, h: 0, j: 0}
  2427.   end
  2428.   #--------------------------------------------------------------------------
  2429.   # * New method: call_pose
  2430.   #--------------------------------------------------------------------------
  2431.   def call_pose(symbol, insert = nil, item = nil, battler = nil)
  2432.     skip_pose if insert == :clear && pose_name_list.first == symbol
  2433.     pose  = make_string(symbol)
  2434.     note  = item ? item.note : ""
  2435.     notes = get_all_poses(note)
  2436.     code  = "ACTION: #{pose}((?: *, *[\\w ]+)+)?"
  2437.     setup_pose(symbol, notes, code, insert, battler)
  2438.   end
  2439.   #--------------------------------------------------------------------------
  2440.   # * New method: get_all_poses
  2441.   #--------------------------------------------------------------------------
  2442.   def get_all_poses(note = "")
  2443.     note + get_all_notes + battler_settings + default_settings
  2444.   end
  2445.   #--------------------------------------------------------------------------
  2446.   # * New method: default_settings
  2447.   #--------------------------------------------------------------------------
  2448.   def default_settings
  2449.     VE_DEFAULT_ACTION
  2450.   end
  2451.   #--------------------------------------------------------------------------
  2452.   # * New method: battler_settings
  2453.   #--------------------------------------------------------------------------
  2454.   def battler_settings
  2455.     VE_ACTION_SETTINGS[battler_mode] ? VE_ACTION_SETTINGS[battler_mode] : ""
  2456.   end
  2457.   #--------------------------------------------------------------------------
  2458.   # * New method: battler_mode
  2459.   #--------------------------------------------------------------------------
  2460.   def battler_mode
  2461.     sprite_value(:action)
  2462.   end
  2463.   #--------------------------------------------------------------------------
  2464.   # * New method: sprite_value
  2465.   #--------------------------------------------------------------------------
  2466.   def sprite_value(value)
  2467.     sprite_settings[value] ? sprite_settings[value] : VE_DEFAULT_SPRITE[value]
  2468.   end
  2469.   #--------------------------------------------------------------------------
  2470.   # * New method: sprite_settings
  2471.   #--------------------------------------------------------------------------
  2472.   def sprite_settings
  2473.     VE_SPRITE_SETTINGS[@battler_name] ? VE_SPRITE_SETTINGS[@battler_name] :
  2474.     VE_DEFAULT_SPRITE
  2475.   end
  2476.   #--------------------------------------------------------------------------
  2477.   # * New method: setup_pose
  2478.   #--------------------------------------------------------------------------
  2479.   def setup_pose(pose, notes, code, insert, battler)
  2480.     regexp = /<#{code}>((?:[^<]|<[^\/])*)<\/ACTION>/im
  2481.     if notes.gsub(/\r\n/i, "") =~ regexp
  2482.       time, last = get_values($1)
  2483.       value = setup_value($2, battler == :skip ? nil : battler)
  2484.       return if value.empty?
  2485.       time.times do
  2486.         list = {pose: pose, next: last, value: value.dup, battler: battler}
  2487.         insert ? @pose_list.unshift(list) : @pose_list.push(list)
  2488.       end
  2489.     end
  2490.   end
  2491.   #--------------------------------------------------------------------------
  2492.   # * New method: pose_name_list
  2493.   #--------------------------------------------------------------------------
  2494.   def pose_name_list
  2495.     @pose_list.collect {|pose| pose[:pose]}
  2496.   end
  2497.   #--------------------------------------------------------------------------
  2498.   # * New method: pose_name
  2499.   #--------------------------------------------------------------------------
  2500.   def pose_name
  2501.     pose_name_list.first
  2502.   end
  2503.   #--------------------------------------------------------------------------
  2504.   # * New method: skip_pose
  2505.   #--------------------------------------------------------------------------
  2506.   def skip_pose
  2507.     @current_pose = pose_name
  2508.     @pose_list.shift while @current_pose == pose_name && !@pose_list.empty?
  2509.   end
  2510.   #--------------------------------------------------------------------------
  2511.   # * New method: get_values
  2512.   #--------------------------------------------------------------------------
  2513.   def get_values(value)
  2514.     if value
  2515.       time = value =~ /([^,]+) TIMES/i ? [eval($1), 1].max : 1
  2516.       last = value =~ /(\w[\w ]+)/i    ? make_symbol($1)   : nil
  2517.       [time, last]
  2518.     else
  2519.       [1]
  2520.     end
  2521.   end
  2522.   #--------------------------------------------------------------------------
  2523.   # * New method: clear_loop_poses
  2524.   #--------------------------------------------------------------------------
  2525.   def clear_loop_poses
  2526.     @pose_list.delete_if {|pose| pose[:next] == :loop }
  2527.   end
  2528.   #--------------------------------------------------------------------------
  2529.   # * New method: battler
  2530.   #--------------------------------------------------------------------------
  2531.   def battler
  2532.     @pose[:battler] ? @pose[:battler] : self
  2533.   end
  2534.   #--------------------------------------------------------------------------
  2535.   # * New method: states_pose
  2536.   #--------------------------------------------------------------------------
  2537.   def states_pose
  2538.     $data_states.compact.collect {|state| state.custom_pose("STATE") }.compact
  2539.   end
  2540.   #--------------------------------------------------------------------------
  2541.   # * New method: setup_value
  2542.   #--------------------------------------------------------------------------
  2543.   def setup_value(settings, battler)
  2544.     values = []
  2545.     settings.scan(/(\w+)(?:: ([^;]+)[;\n\r])?/i) do |type, value|
  2546.       values.push(set_pose_value(type, value ? value : "", battler))
  2547.     end
  2548.     values
  2549.   end
  2550.   #--------------------------------------------------------------------------
  2551.   # * New method: set_pose_value
  2552.   #--------------------------------------------------------------------------
  2553.   def set_pose_value(type, value, battler)
  2554.     @pose = {}
  2555.     @pose[:battler] = battler
  2556.     @pose[:type]  = make_symbol(type)
  2557.     @pose[:hit]   = value =~ /HIT ONLY/i  ? true : false
  2558.     @pose[:miss]  = value =~ /MISS ONLY/i ? true : false
  2559.     @pose[:count] = setup_count($1) if value =~ /COUNT (\d+(?: *, *\d+)*)/i
  2560.     set_pose_setting("#{type} #{value}")
  2561.     @pose
  2562.   end
  2563.   #--------------------------------------------------------------------------
  2564.   # * New method: setup_count
  2565.   #--------------------------------------------------------------------------
  2566.   def setup_count(value)
  2567.     result = []
  2568.     value.scan(/(\d+)/i) { result.push($1.to_i) }
  2569.     result
  2570.   end
  2571.   #--------------------------------------------------------------------------
  2572.   # * New method: set_pose_setting
  2573.   #--------------------------------------------------------------------------
  2574.   def set_pose_setting(value)
  2575.     case value
  2576.     when /^POSE (.*)/i then set_pose($1)
  2577.     when /^WAIT (.*)/i then set_wait($1)
  2578.     when /^MOVE (.*)/i then set_move($1)
  2579.     when /^JUMP (.*)/i then set_jump($1)
  2580.     when /^ANIM (.*)/i then set_anim($1)
  2581.     when /^ICON (.*)/i then set_icon($1)
  2582.     when /^LOOP (.*)/i then set_loop($1)
  2583.     when /^TONE (.*)/i then set_tone($1)
  2584.     when /^HIDE (.*)/i then set_hide($1)
  2585.     when /^THROW (.*)/i then set_throw($1)
  2586.     when /^SOUND (.*)/i then set_sound($1)
  2587.     when /^PLANE (.*)/i then set_plane($1)
  2588.     when /^FLASH (.*)/i then set_flash($1)
  2589.     when /^SHAKE (.*)/i then set_shake($1)
  2590.     when /^MOVIE (.*)/i then set_movie($1)
  2591.     when /^COUNT (.*)/i then set_count($1)
  2592.     when /^ACTION (.*)/i then set_action($1)
  2593.     when /^FREEZE (.*)/i then set_freeze($1)
  2594.     when /^EFFECT (.*)/i then set_effect($1)
  2595.     when /^PICTURE (.*)/i then set_picture($1)
  2596.     when /^COUNTER (.*)/i then set_counter($1)
  2597.     when /^DIRECTION (.*)/i then set_direction($1)
  2598.     when /^TRANSITION (.*)/i then set_transition($1)
  2599.     end
  2600.   end
  2601.   #--------------------------------------------------------------------------
  2602.   # * New method: set_pose
  2603.   #--------------------------------------------------------------------------
  2604.   def set_pose(value)
  2605.     @pose[:target] = set_targets(value)
  2606.     @pose[:row]    = battler.set_row(value)
  2607.     @pose[:sufix]  = battler.set_sufix(value)
  2608.     @pose[:angle]  = value =~ /ANGLE ([+-]?\d+)/i  ? $1.to_i : 0
  2609.     @pose[:spin]   = value =~ /SPIN ([+-]?\d+)/i   ? $1.to_i : 0
  2610.     @pose[:frame]  = value =~ /FRAME (\d+)/i ? $1.to_i : 1
  2611.     @pose[:x] = value =~ /X ([+-]?\d+)/i   ? $1.to_i : 0
  2612.     @pose[:y] = value =~ /Y ([+-]?\d+)/i   ? $1.to_i : 0
  2613.     if value =~ /(\d+|ALL) FRAMES?/i
  2614.       w = [value =~ /WAIT (\d+)/i ? $1.to_i : 1, 1].max
  2615.       f = /(\d+) FRAMES/i ? $1.to_i : :all
  2616.       l = value =~ /LOOP/i   ? true : false
  2617.       r = value =~ /RETURN/i ? true : false
  2618.       v = value =~ /REVERT/i ? true : false
  2619.       i = value =~ /INVERT/i ? true : false
  2620.       result = {wait: w, time: w, frame: f, loop: l, return: r, revert: v,
  2621.                 invert: i}
  2622.     else
  2623.       result = {invert: value =~ /INVERT/i ? true : false}
  2624.     end
  2625.     @pose[:pose] = result
  2626.   end
  2627.   #--------------------------------------------------------------------------
  2628.   # * New method: set_wait(
  2629.   #--------------------------------------------------------------------------
  2630.   def set_wait(value)
  2631.     @pose[:target] = set_targets(value)
  2632.     value.scan(/(\w+)/i) do
  2633.       value = $1.downcase
  2634.       next if ["target","actor","friend","enemy", "user","self"].include?(value)
  2635.       case value
  2636.       when /(\d+)/i
  2637.         @pose[:time] = $1.to_i
  2638.         @pose[:wait] = $1.to_i
  2639.       when /(\w+)/i
  2640.         @pose[:time] = make_symbol($1)
  2641.         @pose[:wait] = make_symbol($1)
  2642.       end
  2643.     end
  2644.   end
  2645.   #--------------------------------------------------------------------------
  2646.   # * New method: set_move
  2647.   #--------------------------------------------------------------------------
  2648.   def set_move(value)
  2649.     regexp = /(MOVE TO|STEP FOWARD|STEP BACKWARD|RETREAT|ESCAPE|SUBSTITUTION)/i
  2650.     @pose[:value]  = make_symbol($1) if value =~ regexp
  2651.     @pose[:target] = battler.set_targets(value)
  2652.     @pose[:x]      = value =~ /X ([+-]?\d+)/i ? $1.to_i : 0
  2653.     @pose[:y]      = value =~ /Y ([+-]?\d+)/i ? $1.to_i : 0
  2654.     @pose[:h]      = value =~ /HEIGHT (\d+)/i ? $1.to_i : 0
  2655.     @pose[:speed]  = value =~ /SPEED (\d+)/i  ? $1.to_i / 10.0 : 1.0
  2656.     @pose[:targets]  = BattleManager.targets if @pose[:value] == :move_to
  2657.     @pose[:teleport] = value =~ /TELEPORT/i
  2658.   end
  2659.   #--------------------------------------------------------------------------
  2660.   # * New method: set_jump
  2661.   #--------------------------------------------------------------------------
  2662.   def set_jump(value)
  2663.     @pose[:target] = set_targets(value)
  2664.     @pose[:move]   = value =~ /MOVE/i
  2665.     @pose[:height] = value =~ /HEIGHT (\d+)/i ? [$1.to_i, 1].max : 5
  2666.     @pose[:speed]  = value =~ /SPEED (\d+)/i  ? [$1.to_i, 1].max : 10
  2667.   end
  2668.   #--------------------------------------------------------------------------
  2669.   # * New method: set_count
  2670.   #--------------------------------------------------------------------------
  2671.   def set_count(value)
  2672.     @pose[:add]  = value =~ /ADD (\d+)/i    ? $1.to_i : 0
  2673.     @pose[:rand] = value =~ /RANDOM (\d+)/i ? $1.to_i : 1
  2674.     @pose[:max]  = value =~ /MAX (\d+)/i    ? $1.to_i : 1
  2675.   end
  2676.   #--------------------------------------------------------------------------
  2677.   # * New method: set_action
  2678.   #--------------------------------------------------------------------------
  2679.   def set_action(value)
  2680.     @pose[:target] = set_targets(value)
  2681.     value.scan(/(\w[\w ]+)/) do
  2682.       not_action = ["target","actor","friend","enemy", "user","self"]
  2683.       next if not_action.include?($1.downcase)
  2684.       @pose[:action] = make_symbol($1)
  2685.     end
  2686.   end
  2687.   #--------------------------------------------------------------------------
  2688.   # * New method: set_freeze
  2689.   #--------------------------------------------------------------------------
  2690.   def set_freeze(value)
  2691.     @pose[:target]   = set_targets(value)
  2692.     @pose[:duration] = value =~ /DURATION (\d+)/i ? [$1.to_i, 1].max : 1
  2693.   end
  2694.   #--------------------------------------------------------------------------
  2695.   # * New method: set_sound
  2696.   #--------------------------------------------------------------------------
  2697.   def set_sound(value)
  2698.     @pose[:name]   = value =~ /NAME #{get_filename}/i ? $1 : ""
  2699.     @pose[:volume] = value =~ /VOLUME (\d+)/i ? $1.to_i : 100
  2700.     @pose[:pitch]  = value =~ /PITCH (\d+)/i  ? $1.to_i : 100
  2701.   end
  2702.   #--------------------------------------------------------------------------
  2703.   # * New method: set_hide
  2704.   #--------------------------------------------------------------------------
  2705.   def set_hide(value)
  2706.     @pose[:all_battler] = true if value =~ /ALL BATTLERS/i
  2707.     @pose[:all_enemies] = true if value =~ /ALL ENEMIES/i
  2708.     @pose[:all_friends] = true if value =~ /ALL FRIENDS/i
  2709.     @pose[:all_targets] = true if value =~ /ALL TARGETS/i
  2710.     @pose[:not_targets] = true if value =~ /NOT TARGETS/i
  2711.     @pose[:exc_user] = true if value =~ /EXCLUDE USER/i
  2712.     @pose[:inc_user] = true if value =~ /INCLUDE USER/i
  2713.     @pose[:unhide]   = true if value =~ /UNHIDE/i
  2714.   end
  2715.   #--------------------------------------------------------------------------
  2716.   # * New method: set_anim
  2717.   #--------------------------------------------------------------------------
  2718.   def set_anim(value)
  2719.     @pose[:target] = set_targets(value)
  2720.     item = battler.current_item ? battler.current_item : nil
  2721.     case value
  2722.     when /CAST/i
  2723.       cast = item && $imported[:ve_cast_animation]
  2724.       anim = cast ? battler.cast_animation_id(item) : 0
  2725.       @pose[:anim] = anim
  2726.     when /EFFECT/i
  2727.       @pose[:anim] = item ? item.animation_id : 0
  2728.     when /ID (\d+)/i
  2729.       @pose[:anim] = $1.to_i
  2730.     when /WEAPON(?: *(\d+)?)?/i
  2731.       dual = @dual_flag || ($1 && $1.to_i == 2)
  2732.       @pose[:anim] = battler.atk_animation_id1
  2733.       @pose[:anim] = battler.atk_animation_id2 if dual
  2734.     else
  2735.       @pose[:anim] = 0
  2736.     end
  2737.   end
  2738.   #--------------------------------------------------------------------------
  2739.   # * New method: set_icon
  2740.   #--------------------------------------------------------------------------
  2741.   def set_icon(value)
  2742.     @pose[:target] = set_targets(value)
  2743.     @pose[:index]  = value =~ /INDEX ([+-]?\d+)/i      ? $1.to_i : 0
  2744.     @pose[:image]  = value =~ /IMAGE #{get_filename}/i ? $1.to_s : nil
  2745.     @pose[:delete] = value =~ /DELETE/i ? true : false
  2746.     @pose[:above]  = value =~ /ABOVE/i  ? true : false
  2747.     return if @pose[:delete]
  2748.     set_action_icon(value)
  2749.     @pose[:x] = value =~ /X ([+-]?\d+)/i  ? $1.to_i : 0
  2750.     @pose[:y] = value =~ /Y ([+-]?\d+)/i  ? $1.to_i : 0
  2751.     @pose[:a] = value =~ /ANGLE ([+-]?\d+)/i   ? $1.to_i : 0
  2752.     @pose[:o] = value =~ /OPACITY (\d+)/i      ? $1.to_i : 255
  2753.     @pose[:spin] = value =~ /SPIN ([+-]\d+)/i  ? $1.to_i : 0
  2754.     @pose[:fin]  = value =~ /FADE IN (\d+)/i   ? $1.to_i : 0
  2755.     @pose[:fout] = value =~ /FADE OUT (\d+)/i  ? $1.to_i : 0
  2756.     @pose[:izm]  = value =~ /INIT ZOOM (\d+)/i ? $1.to_i / 100.0 : 1.0
  2757.     @pose[:ezm]  = value =~ /END ZOOM (\d+)/i  ? $1.to_i / 100.0 : 1.0
  2758.     @pose[:szm]  = value =~ /ZOOM SPD (\d+)/i  ? $1.to_i / 100.0 : 0.1
  2759.   end
  2760.   #--------------------------------------------------------------------------
  2761.   # * New method: set_picture
  2762.   #--------------------------------------------------------------------------
  2763.   def set_picture(value)
  2764.     @pose[:id] = value =~ /ID (\d+)/i ? [$1.to_i, 1].max : 1
  2765.     @pose[:delete] = value =~ /DELETE/i ? true : false
  2766.     return if @pose[:delete]
  2767.     name = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  2768.     orig = value =~ /CENTER/i ? 1 : 0
  2769.     x    = value =~ /POS X ([+-]?\d+)/i ? $1.to_i : 0
  2770.     y    = value =~ /POS Y ([+-]?\d+)/i ? $1.to_i : 0
  2771.     zoom_x  = value =~ /ZOOM X ([+-]?\d+)/i ? $1.to_i : 100.0
  2772.     zoom_y  = value =~ /ZOOM X ([+-]?\d+)/i ? $1.to_i : 100.0
  2773.     opacity = value =~ /OPACITY (\d+)/i     ? $1.to_i : 255
  2774.     blend   = value =~ /BLEND ([+-]\d+)/i   ? $1.to_i : 0
  2775.     duration = value =~ /DURATION (\d+)/i    ? $1.to_i : 0
  2776.     if value =~ /SHOW/i
  2777.       @pose[:show] = [name, orig, x, y, zoom_x, zoom_y, opacity, blend]
  2778.     elsif value =~ /MOVE/i
  2779.       @pose[:move] = [orig, x, y, zoom_x, zoom_y, opacity, blend, duration]
  2780.     end
  2781.   end
  2782.   #--------------------------------------------------------------------------
  2783.   # * New method: set_plane
  2784.   #--------------------------------------------------------------------------
  2785.   def set_plane(value)
  2786.     @pose[:delete]   = value =~ /DELETE/i ? true : false
  2787.     @pose[:duration] = value =~ /DURATION (\d+)/i ? $1.to_i : 0
  2788.     return if @pose[:delete]
  2789.     name = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  2790.     x    = value =~ /MOVE X ([+-]?\d+)/i ? $1.to_i : 0
  2791.     y    = value =~ /MOVE Y ([+-]?\d+)/i ? $1.to_i : 0
  2792.     z    = value =~ /Z ([+-]?\d+)/i      ? $1.to_i : 100
  2793.     zoom_x  = value =~ /ZOOM X (\d+)/i   ? $1.to_i : 100.0
  2794.     zoom_y  = value =~ /ZOOM Y (\d+)/i   ? $1.to_i : 100.0
  2795.     opacity = value =~ /OPACITY (\d+)/i  ? $1.to_i : 160
  2796.     blend   = value =~ /BLEND (\d+)/i    ? $1.to_i : 0
  2797.     duration = @pose[:duration]
  2798.     @pose[:list] = [name, x, y, z, zoom_x, zoom_y, opacity, blend, duration]
  2799.   end
  2800.   #--------------------------------------------------------------------------
  2801.   # * New method: set_throw
  2802.   #--------------------------------------------------------------------------
  2803.   def set_throw(value)
  2804.     @pose[:target] = set_targets(value)
  2805.     @pose[:image]  = value =~ /IMAGE #{get_filename}/i ? $1.to_s : nil
  2806.     set_action_icon(value)
  2807.     @pose[:revert] = value =~ /REVERT/i
  2808.     @pose[:return] = value =~ /RETURN/i
  2809.     @pose[:init_x] = value =~ /INIT X ([+-]?\d+)/i ? $1.to_i : 0
  2810.     @pose[:init_y] = value =~ /INIT Y ([+-]?\d+)/i ? $1.to_i : 0
  2811.     @pose[:end_x]  = value =~ /END X ([+-]?\d+)/i  ? $1.to_i : 0
  2812.     @pose[:end_y]  = value =~ /END Y ([+-]?\d+)/i  ? $1.to_i : 0
  2813.     @pose[:anim]   = value =~ /ANIM (\d+)/i    ? $1.to_i : nil
  2814.     @pose[:arc]    = value =~ /ARC (\d+)/i     ? $1.to_i : 0
  2815.     @pose[:speed]  = value =~ /SPEED (\d+)/i   ? $1.to_i / 10.0 : 1.0
  2816.     @pose[:spin] = value =~ /SPIN ([+-]\d+)/i  ? $1.to_i : 0
  2817.     @pose[:fin]  = value =~ /FADE IN (\d+)/i   ? $1.to_i : 0
  2818.     @pose[:fout] = value =~ /FADE OUT (\d+)/i  ? $1.to_i : 0
  2819.     @pose[:izm]  = value =~ /INIT ZOOM (\d+)/i ? $1.to_i / 100.0 : 1.0
  2820.     @pose[:ezm]  = value =~ /END ZOOM (\d+)/i  ? $1.to_i / 100.0 : 1.0
  2821.     @pose[:szm]  = value =~ /ZOOM SPD (\d+)/i  ? $1.to_i / 100.0 : 0.1
  2822.     @pose[:z] = value =~ /Z ([+-]?\d+)/i  ? $1.to_i : 0
  2823.     @pose[:o] = value =~ /OPACITY (\d+)/i ? $1.to_i : 255
  2824.     @pose[:a] = value =~ /ANGLE (\d+)/i   ? $1.to_i : 0
  2825.   end
  2826.   #--------------------------------------------------------------------------
  2827.   # * New method: set_action_icon
  2828.   #--------------------------------------------------------------------------
  2829.   def set_action_icon(value)
  2830.     id = @dual_flag ? 2 : 1
  2831.     icon = weapon_icon(id)      if value =~ /WEAPON/i
  2832.     icon = weapon_icon($1.to_i) if value =~ /WEAPON (\d+)/i
  2833.     icon = armor_icon($1.to_i)  if value =~ /ARMOR (\d+)/i
  2834.     icon = armor_icon(1)        if value =~ /SHIELD/i
  2835.     icon = action_icon if value =~ /ACTION/i
  2836.     icon = $1.to_i     if value =~ /ICON (\d+)/i
  2837.     @pose[:icon] = icon ? icon : 0
  2838.   end
  2839.   #--------------------------------------------------------------------------
  2840.   # * New method: set_shake
  2841.   #--------------------------------------------------------------------------
  2842.   def set_shake(value)
  2843.     @pose[:target] = set_targets(value)
  2844.     @pose[:screen] = value =~ /SCREEN/i ? true : false
  2845.     power = value =~ /POWER (\d+)/i ? [$1.to_i, 2].max : 5
  2846.     speed = value =~ /SPEED (\d+)/i ? [$1.to_i, 2].max : 5
  2847.     duration = value =~ /DURATION (\d+)/i ? [$1.to_i, 1].max : 10
  2848.     @pose[:shake] = [power / 2.0, speed / 2.0, duration]
  2849.   end
  2850.   #--------------------------------------------------------------------------
  2851.   # * New method: set_movie
  2852.   #--------------------------------------------------------------------------
  2853.   def set_movie(value)
  2854.     @pose[:name] = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  2855.     set_tone(value)
  2856.   end
  2857.   #--------------------------------------------------------------------------
  2858.   # * New method: set_tone
  2859.   #--------------------------------------------------------------------------
  2860.   def set_tone(value)
  2861.     r = value =~ /RED ([+-]?\d+)/i   ? $1.to_i : 0
  2862.     g = value =~ /GREEN ([+-]?\d+)/i ? $1.to_i : 0
  2863.     b = value =~ /BLUE ([+-]?\d+)/i  ? $1.to_i : 0
  2864.     a = value =~ /GRAY ([+-]?\d+)/i  ? $1.to_i : 0
  2865.     tone  = [r, g, b, a]
  2866.     tone  = [ 255,  255,  255, 0] if value =~ /WHITE/i
  2867.     tone  = [-255, -255, -255, 0] if value =~ /BLACK/i
  2868.     @pose[:tone]  = Tone.new(*tone)
  2869.     @pose[:clear] = true if value =~ /CLEAR/i
  2870.     @pose[:duration] = value =~ /DURATION (\d+)/i ? $1.to_i : 0
  2871.     @pose[:priority] = :normal
  2872.     @pose[:priority] = :high if value =~ /HIGH PRIORITY/i
  2873.     @pose[:priority] = :low  if value =~ /LOW PRIORITY/i
  2874.   end
  2875.   #--------------------------------------------------------------------------
  2876.   # * New method: set_flash
  2877.   #--------------------------------------------------------------------------
  2878.   def set_flash(value)
  2879.     @pose[:target] = set_targets(value)
  2880.     @pose[:screen] = value =~ /SCREEN/i ? true : false
  2881.     r = value =~ /RED (\d+)/i   ? $1.to_i : 255
  2882.     g = value =~ /GREEN (\d+)/i ? $1.to_i : 255
  2883.     b = value =~ /BLUE (\d+)/i  ? $1.to_i : 255
  2884.     a = value =~ /ALPHA (\d+)/i ? $1.to_i : 160
  2885.     duration = value =~ /DURATION (\d+)/i ? [$1.to_i, 1].max : 10
  2886.     @pose[:flash] = [Color.new(r, g, b, a), duration]
  2887.   end
  2888.   #--------------------------------------------------------------------------
  2889.   # * New method: set_loop
  2890.   #--------------------------------------------------------------------------
  2891.   def set_loop(value)
  2892.     @pose[:target]    = set_targets(value)
  2893.     @pose[:loop_anim] = value =~ /ANIM (\d+)/i ? $1.to_i : 0
  2894.   end
  2895.   #--------------------------------------------------------------------------
  2896.   # * New method: set_effect
  2897.   #--------------------------------------------------------------------------
  2898.   def set_effect(value)
  2899.     @pose[:target] = set_targets(value)
  2900.     @pose[:damage] = $1.to_i / 100.0  if value =~ /(\d+)%/i
  2901.     @pose[:weapon] = [$1.to_i, 1].max if value =~ /WEAPON (\d+)/i
  2902.   end
  2903.   #--------------------------------------------------------------------------
  2904.   # * New method: set_counter
  2905.   #--------------------------------------------------------------------------
  2906.   def set_counter(value)
  2907.     @pose[:target]  = set_targets(value)
  2908.     @pose[:counter] = true  if value =~ /ON/i
  2909.     @pose[:counter] = false if value =~ /OFF/i
  2910.   end
  2911.   #--------------------------------------------------------------------------
  2912.   # * New method: set_direction
  2913.   #--------------------------------------------------------------------------
  2914.   def set_direction(value)
  2915.     @pose[:active]    = true if value =~ /ACTIVE/i
  2916.     @pose[:targets]   = true if value =~ /TARGETS/i
  2917.     @pose[:return]    = true if value =~ /RETURN/i
  2918.     @pose[:default]   = true if value =~ /DEFAULT/i
  2919.     @pose[:direction] = 2 if value =~ /DOWN/i
  2920.     @pose[:direction] = 4 if value =~ /LEFT/i
  2921.     @pose[:direction] = 6 if value =~ /RIGHT/i
  2922.     @pose[:direction] = 8 if value =~ /UP/i
  2923.   end
  2924.   #--------------------------------------------------------------------------
  2925.   # * New method: set_direction
  2926.   #--------------------------------------------------------------------------
  2927.   def set_transition(value)
  2928.     @pose[:prepare]  = true if value =~ /PREPARE/i
  2929.     @pose[:execute]  = true if value =~ /EXECUTE/i
  2930.     @pose[:duration] = value =~ /DURATION (\d+)/i ? $1.to_i : 40
  2931.     @pose[:name]     = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  2932.   end
  2933.   #--------------------------------------------------------------------------
  2934.   # * New method: set_targets
  2935.   #--------------------------------------------------------------------------
  2936.   def set_targets(value)
  2937.     case value
  2938.     when /SELF/i
  2939.       [self]
  2940.     when /ACTOR ([^>,;]+)/i
  2941.       actor = $game_actors[eval($1)]
  2942.       $game_party.battle_members.include?(actor) ? [actor] : []
  2943.     when /FRIEND ([^>,;]+)/i
  2944.       [$game_party.battle_members[eval($1)]].compact
  2945.     when /ENEMY ([^>,;]+)/i
  2946.       [$game_troop.members[eval($1)]].compact
  2947.     when /RANDOM ENEMY/i
  2948.       battler.opponents_unit.members.random
  2949.     when /RANDOM FRIEND/i
  2950.       battler.friends_unit.members.random
  2951.     when /ALL ENEMIES/i
  2952.       battler.opponents_unit.members
  2953.     when /ALL FRIENDS/i
  2954.       battler.friends_unit.members
  2955.     when /TARGETS/i
  2956.       battler.action_targets.dup
  2957.     when /USER/i
  2958.       [battler]
  2959.     else
  2960.       nil
  2961.     end
  2962.   end
  2963.   #--------------------------------------------------------------------------
  2964.   # * New method: set_row
  2965.   #--------------------------------------------------------------------------
  2966.   def set_row(value)
  2967.     pose = battler.sprite_value(make_symbol($1)) if value =~ /ROW (\w+)/i
  2968.     pose = :direction if value =~ /ROW DIRECTION/i
  2969.     pose = $1.to_i    if value =~ /ROW (\d+)/i
  2970.     pose ? pose : 0
  2971.   end
  2972.   #--------------------------------------------------------------------------
  2973.   # * New method: set_sufix
  2974.   #--------------------------------------------------------------------------
  2975.   def set_sufix(value)
  2976.     pose = value =~ /SUFIX ([\[\]\w]+)/i ? $1.to_s : ""
  2977.     if pose.downcase == "[direction]"
  2978.       pose = case direction
  2979.       when 2 then "[down]"
  2980.       when 4 then "[left]"
  2981.       when 6 then "[right]"
  2982.       when 8 then "[up]"
  2983.       end
  2984.     end
  2985.     pose
  2986.   end
  2987.   #--------------------------------------------------------------------------
  2988.   # * New method: weapon_icon
  2989.   #--------------------------------------------------------------------------
  2990.   def weapon_icon(index)
  2991.     battler.actor? ? actor_weapon_icon(index) : enemy_weapon_icon(index)
  2992.   end
  2993.   #--------------------------------------------------------------------------
  2994.   # * New method: actor_weapon_icon
  2995.   #--------------------------------------------------------------------------
  2996.   def actor_weapon_icon(index)
  2997.     battler.weapons[index - 1] ? battler.weapons[index - 1].icon_index : nil
  2998.   end
  2999.   #--------------------------------------------------------------------------
  3000.   # * New method: enemy_weapon_icon
  3001.   #--------------------------------------------------------------------------
  3002.   def enemy_weapon_icon(index)
  3003.     note =~ /<WEAPON #{index}: (\d+)>/i ? $1.to_i : 0
  3004.   end
  3005.   #--------------------------------------------------------------------------
  3006.   # * New method: armor_icon
  3007.   #--------------------------------------------------------------------------
  3008.   def armor_icon(index)
  3009.     battler.actor? ? actor_armor_icon(index) : enemy_armor_icon(index)
  3010.   end
  3011.   #--------------------------------------------------------------------------
  3012.   # * New method: equip_list
  3013.   #--------------------------------------------------------------------------
  3014.   def actor_armor_icon(index)
  3015.     slot = battler.equip_slots[index]
  3016.     return nil unless slot && slot != 0 && battler.equip_list[slot]
  3017.     equip = battler.equip_list[slot]
  3018.     equip.object ? equip.object.icon_index : nil
  3019.   end
  3020.   #--------------------------------------------------------------------------
  3021.   # * New method: equip_list
  3022.   #--------------------------------------------------------------------------
  3023.   def enemy_armor_icon(index)
  3024.     note =~ /<ARMOR #{index}: (\d+)>/i ? $1.to_i : 0
  3025.   end
  3026.   #--------------------------------------------------------------------------
  3027.   # * New method: equip_list
  3028.   #--------------------------------------------------------------------------
  3029.   def equip_list
  3030.     @equips
  3031.   end
  3032.   #--------------------------------------------------------------------------
  3033.   # * New method: action_icon
  3034.   #--------------------------------------------------------------------------
  3035.   def action_icon
  3036.     current_item ? current_item.icon_index : 0
  3037.   end
  3038.   #--------------------------------------------------------------------------
  3039.   # * New method: active?
  3040.   #--------------------------------------------------------------------------
  3041.   def active?
  3042.     @active
  3043.   end
  3044.   #--------------------------------------------------------------------------
  3045.   # * New method: down?
  3046.   #--------------------------------------------------------------------------
  3047.   def down?
  3048.     @direction == 2
  3049.   end
  3050.   #--------------------------------------------------------------------------
  3051.   # * New method: left?
  3052.   #--------------------------------------------------------------------------
  3053.   def left?
  3054.     @direction == 4
  3055.   end
  3056.   #--------------------------------------------------------------------------
  3057.   # * New method: right?
  3058.   #--------------------------------------------------------------------------
  3059.   def right?
  3060.     @direction == 6
  3061.   end
  3062.   #--------------------------------------------------------------------------
  3063.   # * New method: up?
  3064.   #--------------------------------------------------------------------------
  3065.   def up?
  3066.     @direction == 8
  3067.   end
  3068.   #--------------------------------------------------------------------------
  3069.   # * New method: target_direction
  3070.   #--------------------------------------------------------------------------
  3071.   def target_direction(x, y, current = nil)
  3072.     position = current ? current : current_position
  3073.     relative_x = position[:x] - x
  3074.     relative_y = position[:y] - y
  3075.     if isometric?
  3076.       @direction = 2 if relative_x > 0 && relative_y < 0
  3077.       @direction = 4 if relative_x > 0 && relative_y > 0
  3078.       @direction = 6 if relative_x < 0 && relative_y < 0
  3079.       @direction = 8 if relative_x < 0 && relative_y > 0
  3080.     elsif relative_y.abs > relative_x.abs || frontview?
  3081.       @direction = relative_y < 0 ? 2 : 8
  3082.     elsif relative_x.abs >= relative_y.abs || sideview?
  3083.       @direction = relative_x < 0 ? 6 : 4
  3084.     end
  3085.   end
  3086.   #--------------------------------------------------------------------------
  3087.   # * New method: adjust_position
  3088.   #--------------------------------------------------------------------------
  3089.   def adjust_position(value)
  3090.     if isometric?
  3091.       x, y =  value, -value * 0.75 if down?
  3092.       x, y =  value,  value * 0.75 if left?
  3093.       x, y = -value, -value * 0.75 if right?
  3094.       x, y = -value,  value * 0.75 if up?
  3095.     else
  3096.       x, y = 0, -value if down?
  3097.       x, y =  value, 0 if left?
  3098.       x, y = -value, 0 if right?
  3099.       x, y = 0,  value if up?
  3100.     end
  3101.     @target_position[:x] += x.to_i
  3102.     @target_position[:y] += y.to_i
  3103.   end
  3104.   #--------------------------------------------------------------------------
  3105.   # * New method: position_fix
  3106.   #--------------------------------------------------------------------------
  3107.   def position_fix
  3108.     value =  16 if left?  || up?
  3109.     value = -16 if right? || down?
  3110.     target_position[rand(2) == 0 ? :x : :y] += value
  3111.   end
  3112.   #--------------------------------------------------------------------------
  3113.   # * New method: sharing_position?
  3114.   #--------------------------------------------------------------------------
  3115.   def sharing_position?
  3116.     units = $game_troop.members + $game_party.battle_members
  3117.     list  = units.select do |target|
  3118.       target != self && target.target_position == target_position
  3119.     end
  3120.     !list.empty?
  3121.   end
  3122.   #--------------------------------------------------------------------------
  3123.   # * New method: sideview?
  3124.   #--------------------------------------------------------------------------
  3125.   def sideview?
  3126.     $imported[:ve_actor_battlers] && VE_BATTLE_FORMATION == :side
  3127.   end
  3128.   #--------------------------------------------------------------------------
  3129.   # * New method: frontview?
  3130.   #--------------------------------------------------------------------------
  3131.   def frontview?
  3132.     $imported[:ve_actor_battlers] && VE_BATTLE_FORMATION == :front
  3133.   end
  3134.   #--------------------------------------------------------------------------
  3135.   # * New method: isometric
  3136.   #--------------------------------------------------------------------------
  3137.   def isometric?
  3138.     $imported[:ve_actor_battlers] && VE_BATTLE_FORMATION == :iso
  3139.   end
  3140.   #--------------------------------------------------------------------------
  3141.   # * New method: action_direction
  3142.   #--------------------------------------------------------------------------
  3143.   def action_direction
  3144.     units = BattleManager.targets
  3145.     target_x = units.collect {|member| member.current_position[:x] }.average
  3146.     target_y = units.collect {|member| member.current_position[:y] }.average
  3147.     target_direction(target_x, target_y)
  3148.   end
  3149.   #--------------------------------------------------------------------------
  3150.   # * New method: target_distance
  3151.   #--------------------------------------------------------------------------
  3152.   def target_distance(symbol)
  3153.     @target_position[symbol] - @current_position[symbol]
  3154.   end
  3155.   #--------------------------------------------------------------------------
  3156.   # * New method: moving?
  3157.   #--------------------------------------------------------------------------
  3158.   def moving?
  3159.     @current_position != @target_position
  3160.   end
  3161.   #--------------------------------------------------------------------------
  3162.   # * New method: damage_pose?
  3163.   #--------------------------------------------------------------------------
  3164.   def damage_pose?
  3165.     pose_name == :hurt || pose_name == :miss || pose_name == :evade ||
  3166.     pose_name == :critical
  3167.   end
  3168.   #--------------------------------------------------------------------------
  3169.   # * New method: origin?
  3170.   #--------------------------------------------------------------------------
  3171.   def origin?
  3172.     @current_position[:x] != screen_x || @current_position[:y] != screen_y
  3173.   end
  3174.   #--------------------------------------------------------------------------
  3175.   # * New method: activate
  3176.   #--------------------------------------------------------------------------
  3177.   def activate
  3178.     return unless current_action && current_action.item
  3179.     @active = true
  3180.     @active_pose = nil
  3181.     @action_targets = current_action.make_targets.compact.dup
  3182.     setup_immortals
  3183.   end
  3184.   #--------------------------------------------------------------------------
  3185.   # * New method: setup_immortals
  3186.   #--------------------------------------------------------------------------
  3187.   def setup_immortals
  3188.     @action_targets.each {|target| immortals.push(target) unless target.dead? }
  3189.     immortals.uniq!
  3190.   end
  3191.   #--------------------------------------------------------------------------
  3192.   # * New method: deactivate
  3193.   #--------------------------------------------------------------------------
  3194.   def deactivate
  3195.     @active = false
  3196.     @attack_flag = nil
  3197.     @result_flag = nil
  3198.     @call_end = true
  3199.     immortals = @immortals.dup
  3200.     @immortals.clear
  3201.     immortals.each {|member| member.refresh }
  3202.     @action_targets.clear
  3203.   end
  3204.   #--------------------------------------------------------------------------
  3205.   # * New method: action_pose
  3206.   #--------------------------------------------------------------------------
  3207.   def action_pose(item)
  3208.     activate
  3209.     @current_item = item
  3210.     call_action_poses
  3211.   end
  3212.   #--------------------------------------------------------------------------
  3213.   # * New method: call_action_poses
  3214.   #--------------------------------------------------------------------------
  3215.   def call_action_poses
  3216.     item = @current_item
  3217.     clear_loop_poses
  3218.     set_action_pose
  3219.     call_pose(:inactive)
  3220.     call_custom_pose("RETREAT", :retreat, item) if need_move?(item)
  3221.   end
  3222.   #--------------------------------------------------------------------------
  3223.   # * New method: set_action_pose
  3224.   #--------------------------------------------------------------------------
  3225.   def set_action_pose
  3226.     set_attack_pose(false)
  3227.     set_attack_pose(true) if double_attack? && !use_dual_attack?
  3228.     @attack_flag = (double_attack? && !use_dual_attack?) ? 1 : nil
  3229.   end
  3230.   #--------------------------------------------------------------------------
  3231.   # * New method: call_attack_pose
  3232.   #--------------------------------------------------------------------------
  3233.   def set_attack_pose(dual)
  3234.     item = @current_item
  3235.     @dual_flag = dual
  3236.     call_move_pose("ADVANCE", :advance, dual) if need_move?(item)
  3237.     call_pose(setup_pose_type(dual), false, item)
  3238.     call_pose(:finish, false)
  3239.   end
  3240.   #--------------------------------------------------------------------------
  3241.   # * New method: setup_pose_type
  3242.   #--------------------------------------------------------------------------
  3243.   def setup_pose_type(dual = false)
  3244.     item = @current_item
  3245.     pose = weapons_pose("USE"  , :use, dual)
  3246.     pose = weapons_pose("ITEM" , :item, dual)    if item.item?
  3247.     pose = weapons_pose("MAGIC", :magic, dual)   if item.magical?
  3248.     pose = weapons_pose("SKILL", :skill, dual)   if item.physical?
  3249.     pose = weapons_pose("ATTACK", :attack, dual) if item_attack?(item)
  3250.     pose = weapons_pose("DUAL"  , :dual_attack)  if use_dual_attack?
  3251.     pose = :defend if item_defend?(item)
  3252.     pose = custom_pose("ACTION", pose, item)
  3253.     pose = custom_pose("ITEM"  , pose, item) if item.item?
  3254.     pose = custom_pose("MAGIC" , pose, item) if item.magical?
  3255.     pose = custom_pose("SKILL" , pose, item) if item.physical?
  3256.     pose
  3257.   end
  3258.   #--------------------------------------------------------------------------
  3259.   # * New method: item_attack?
  3260.   #--------------------------------------------------------------------------
  3261.   def item_attack?(item)
  3262.     item.skill? && item.id == attack_skill_id
  3263.   end
  3264.   #--------------------------------------------------------------------------
  3265.   # * New method: item_defend?
  3266.   #--------------------------------------------------------------------------
  3267.   def item_defend?(item)
  3268.     item.skill? && item.id == guard_skill_id
  3269.   end
  3270.   #--------------------------------------------------------------------------
  3271.   # * New method: use_dual_attack?
  3272.   #--------------------------------------------------------------------------
  3273.   def use_dual_attack?
  3274.     get_all_notes =~ /<USE DUAL ATTACK>/i && double_attack?
  3275.   end
  3276.   #--------------------------------------------------------------------------
  3277.   # * New method: double_attack?
  3278.   #--------------------------------------------------------------------------
  3279.   def double_attack?
  3280.     item = @current_item
  3281.     actor? && dual_wield? && weapons.size > 1 && (item_attack?(item) ||
  3282.     (item && item.note =~ /<ALLOW DUAL ATTACK>/i))
  3283.   end
  3284.   #--------------------------------------------------------------------------
  3285.   # * New method: weapons_pose
  3286.   #--------------------------------------------------------------------------
  3287.   def weapons_pose(type, pose, dual = false)
  3288.     valid = actor? ? weapons : []
  3289.     list  = valid.collect { |item| item.custom_pose(type) }
  3290.     list.shift if dual
  3291.     list.empty? || !pose_exist?(list.first) ? pose : list.first
  3292.   end
  3293.   #--------------------------------------------------------------------------
  3294.   # * New method: custom_pose
  3295.   #--------------------------------------------------------------------------
  3296.   def custom_pose(type, pose, item)
  3297.     note   = item ? item.note : ""
  3298.     custom = item.custom_pose(type)
  3299.     custom && pose_exist?(custom, note) ? custom : pose
  3300.   end
  3301.   #--------------------------------------------------------------------------
  3302.   # * New method: pose_exist?
  3303.   #--------------------------------------------------------------------------
  3304.   def pose_exist?(pose, note = "")
  3305.     value  = "ACTION: #{make_string(pose)}"
  3306.     regexp = /<#{value}(?:(?: *, *[\w ]+)+)?>(?:[^<]|<[^\/])*<\/ACTION>/im
  3307.     get_all_poses(note) =~ regexp
  3308.   end
  3309.   #--------------------------------------------------------------------------
  3310.   # * New method: call_move_pose
  3311.   #--------------------------------------------------------------------------
  3312.   def call_move_pose(type, pose, dual)
  3313.     pose = weapons_pose(type, pose, dual)
  3314.     pose = custom_pose(type, pose, @current_item)
  3315.     call_pose(pose, false, @current_item)
  3316.   end
  3317.   #--------------------------------------------------------------------------
  3318.   # * New method: call_custom_pose
  3319.   #--------------------------------------------------------------------------
  3320.   def call_custom_pose(type, pose, item)
  3321.     pose = custom_pose(type, pose, item)
  3322.     call_pose(pose, false, item)
  3323.   end
  3324.   #--------------------------------------------------------------------------
  3325.   # * New method: need_move?
  3326.   #--------------------------------------------------------------------------
  3327.   def need_move?(item)
  3328.     return false if unmovable?
  3329.     return true  if item.note =~ /<ACTION MOVEMENT>/i
  3330.     return true  if item.skill? && item.physical?
  3331.     return true  if item.skill? && item.id == attack_skill_id
  3332.     return false
  3333.   end
  3334.   #--------------------------------------------------------------------------
  3335.   # * New method: call_damage_pose
  3336.   #--------------------------------------------------------------------------
  3337.   def call_damage_pose(item, user)
  3338.     call_pose(:hurt,     :clear, item, :skip) if hurt_pose?
  3339.     call_pose(:miss,     :clear, item, :skip) if @result.missed
  3340.     call_pose(:evade,    :clear, item, :skip) if @result.evaded
  3341.     call_pose(:critical, :clear, item, :skip) if @result.critical
  3342.     call_subsititution if @substitution
  3343.   end
  3344.   #--------------------------------------------------------------------------
  3345.   # * New method: hurt_pose?
  3346.   #--------------------------------------------------------------------------
  3347.   def hurt_pose?
  3348.     @result.hit? && @result.hp_damage > 0
  3349.   end
  3350.   #--------------------------------------------------------------------------
  3351.   # * New method: call_subsititution
  3352.   #--------------------------------------------------------------------------
  3353.   def call_subsititution
  3354.     call_pose(:substitution_on, true)
  3355.     2.times {sprite.update}
  3356.   end
  3357.   #--------------------------------------------------------------------------
  3358.   # * New method: set_active_pose
  3359.   #--------------------------------------------------------------------------
  3360.   def set_active_pose
  3361.     return if (!current_action || !current_action.item) && !current_item
  3362.     item = current_action.item ? current_action.item : current_item
  3363.     pose = :ready      if sprite_value(:ready)
  3364.     pose = :item_cast  if item.item?     && sprite_value(:itemcast)
  3365.     pose = :magic_cast if item.magical?  && sprite_value(:magiccast)
  3366.     pose = :skill_cast if item.physical? && sprite_value(:skillcast)
  3367.     pose = custom_pose("ITEM CAST", pose, item)  if pose && item.item?
  3368.     pose = custom_pose("MAGIC CAST", pose, item) if pose && item.magical?
  3369.     pose = custom_pose("SKILL CAST", pose, item) if pose && item.physical?
  3370.     @active_pose = pose
  3371.   end
  3372.   #--------------------------------------------------------------------------
  3373.   # * New method: command_pose
  3374.   #--------------------------------------------------------------------------
  3375.   def command_pose
  3376.     call_pose(:command, :clear) if sprite_value(:command)
  3377.   end
  3378.   #--------------------------------------------------------------------------
  3379.   # * New method: input_pose
  3380.   #--------------------------------------------------------------------------
  3381.   def input_pose
  3382.     call_pose(:input, :clear) if sprite_value(:input)
  3383.   end
  3384.   #--------------------------------------------------------------------------
  3385.   # * New method: cancel_pose
  3386.   #--------------------------------------------------------------------------
  3387.   def cancel_pose
  3388.     call_pose(:cancel, :clear) if sprite_value(:cancel)
  3389.   end
  3390.   #--------------------------------------------------------------------------
  3391.   # * New method: setup_counter
  3392.   #--------------------------------------------------------------------------
  3393.   def setup_counter(target)
  3394.     target.skip_pose unless [:inactive, :retreat].include?(target.pose_name)
  3395.     target.call_pose(:counter_on, :clear)
  3396.     @action_targets = [target]
  3397.     setup_immortals
  3398.     @current_item = $data_skills[attack_skill_id]
  3399.     call_action_poses
  3400.     call_pose(:counter_off)
  3401.   end
  3402.   #--------------------------------------------------------------------------
  3403.   # * New method: setup_reflect
  3404.   #--------------------------------------------------------------------------
  3405.   def setup_reflect(item)
  3406.     skip_pose unless [:reflection, :inactive, :retreat].include?(pose_name)
  3407.     @action_targets = [self]
  3408.     setup_immortals
  3409.     @current_item = item
  3410.     call_pose(:reflection, true, item)
  3411.   end
  3412.   #--------------------------------------------------------------------------
  3413.   # * New method: setup_substitute
  3414.   #--------------------------------------------------------------------------
  3415.   def setup_substitute(target)
  3416.     skip_pose unless [:substitution_on, :inactive, :retreat].include?(pose_name)
  3417.     @action_targets = [target]
  3418.     @substitution   = true
  3419.     call_pose(:substitution_off, true)
  3420.   end
  3421.   #--------------------------------------------------------------------------
  3422.   # * New method: not_in_position?
  3423.   #--------------------------------------------------------------------------
  3424.   def not_in_position?
  3425.     pose_name == :retreat
  3426.   end
  3427.   #--------------------------------------------------------------------------
  3428.   # * New method: state_pose?
  3429.   #--------------------------------------------------------------------------
  3430.   def state_pose?
  3431.     state_pose
  3432.   end
  3433.   #--------------------------------------------------------------------------
  3434.   # * New method: state_pose
  3435.   #--------------------------------------------------------------------------
  3436.   def state_pose
  3437.     states.collect {|state| state.custom_pose("STATE") }.first
  3438.   end
  3439.   #--------------------------------------------------------------------------
  3440.   # * New method: reset_pose
  3441.   #--------------------------------------------------------------------------
  3442.   def reset_pose
  3443.     return unless $game_party.in_battle
  3444.     sprite.reset_pose if sprite
  3445.   end
  3446.   #--------------------------------------------------------------------------
  3447.   # * New method: frames
  3448.   #--------------------------------------------------------------------------
  3449.   def frames
  3450.     character_name[/\[F(\d+)\]/i] ? $1.to_i : 3
  3451.   end
  3452.   #--------------------------------------------------------------------------
  3453.   # * New method: drain_setup
  3454.   #--------------------------------------------------------------------------
  3455.   def drain_setup
  3456.     self.hp += @hp_drain
  3457.     self.mp += @mp_drain
  3458.     @result.hp_damage = -@hp_drain
  3459.     @result.mp_damage = -@mp_drain
  3460.     @hp_drain = 0
  3461.     @mp_drain = 0
  3462.     @damaged  = true if $imported[:ve_damage_pop]
  3463.   end
  3464.   #--------------------------------------------------------------------------
  3465.   # * New method: start_shake
  3466.   #--------------------------------------------------------------------------
  3467.   def start_shake(power, speed, duration)
  3468.     @shake_power = power
  3469.     @shake_speed = speed
  3470.     @shake_duration = duration
  3471.   end
  3472.   #--------------------------------------------------------------------------
  3473.   # * New method: update_shake
  3474.   #--------------------------------------------------------------------------
  3475.   def update_shake
  3476.     return unless shaking?
  3477.     delta  = (@shake_power * @shake_speed * @shake_direction) / 10.0
  3478.     clear  = @shake_duration <= 1 && @shake * (@shake + delta) < 0
  3479.     @shake = clear ? 0 : @shake + delta
  3480.     @shake_direction = -1 if @shake > @shake_power * 2
  3481.     @shake_direction = 1  if @shake < - @shake_power * 2
  3482.     @shake_duration -= 1
  3483.   end
  3484.   #--------------------------------------------------------------------------
  3485.   # * New method: update_freeze
  3486.   #--------------------------------------------------------------------------
  3487.   def update_freeze
  3488.     return if @freeze == 0 || !@freeze.numeric?
  3489.     @freeze -= 1
  3490.   end
  3491.   #--------------------------------------------------------------------------
  3492.   # * New method: shaking?
  3493.   #--------------------------------------------------------------------------
  3494.   def shaking?
  3495.     @shake_duration > 0 || @shake != 0
  3496.   end
  3497.   #--------------------------------------------------------------------------
  3498.   # * New method: frozen?
  3499.   #--------------------------------------------------------------------------
  3500.   def frozen?
  3501.     (@freeze.numeric? && @freeze > 0) || @freeze == :lock || unmovable?
  3502.   end
  3503.   #--------------------------------------------------------------------------
  3504.   # * New method: unmovable?
  3505.   #--------------------------------------------------------------------------
  3506.   def unmovable?
  3507.     get_all_notes =~ /<UNMOVABLE>/i
  3508.   end
  3509.   #--------------------------------------------------------------------------
  3510.   # * New method: active_direction
  3511.   #--------------------------------------------------------------------------
  3512.   def active_direction
  3513.     members = $game_troop.members + $game_party.battle_members
  3514.     units = members.select {|member| member.active? }
  3515.     x = units.collect {|member| member.screen_x }.average
  3516.     y = units.collect {|member| member.screen_y }.average
  3517.     target_direction(x, y, {x: screen_x, y: screen_y})
  3518.   end  
  3519. end
  3520.  
  3521. #==============================================================================
  3522. # ** Game_Actor
  3523. #------------------------------------------------------------------------------
  3524. #  This class handles actors. It's used within the Game_Actors class
  3525. # ($game_actors) and referenced by the Game_Party class ($game_party).
  3526. #==============================================================================
  3527.  
  3528. class Game_Actor < Game_Battler
  3529.   #--------------------------------------------------------------------------
  3530.   # * Overwrite method: perform_collapse_effect
  3531.   #--------------------------------------------------------------------------
  3532.   def perform_collapse_effect
  3533.     if $game_party.in_battle
  3534.       reset_pose
  3535.       case collapse_type
  3536.       when 0
  3537.         @sprite_effect_type = :collapse
  3538.         Sound.play_enemy_collapse
  3539.       when 1
  3540.         @sprite_effect_type = :boss_collapse
  3541.         Sound.play_boss_collapse1
  3542.       when 2
  3543.         @sprite_effect_type = :instant_collapse
  3544.       end
  3545.     end
  3546.   end
  3547.   #--------------------------------------------------------------------------
  3548.   # * Overwrite method: perform_damage_effect
  3549.   #--------------------------------------------------------------------------
  3550.   def perform_damage_effect
  3551.     $game_troop.screen.start_shake(5, 5, 10) unless use_sprite?
  3552.     Sound.play_actor_damage
  3553.   end
  3554.   #--------------------------------------------------------------------------
  3555.   # * Alias method: param_plus
  3556.   #--------------------------------------------------------------------------
  3557.   alias :param_plus_ve_animated_battle :param_plus
  3558.   def param_plus(param_id)
  3559.     if param_id > 1 && @attack_flag
  3560.       atk_equips.compact.inject(super) {|r, item| r += item.params[param_id] }
  3561.     else
  3562.       param_plus_ve_animated_battle(param_id)
  3563.     end
  3564.   end
  3565.   #--------------------------------------------------------------------------
  3566.   # * New method: atk_feature_objects
  3567.   #--------------------------------------------------------------------------
  3568.   def atk_feature_objects
  3569.     list = @attack_flag ? atk_equips : equips.compact
  3570.     states + [actor] + [self.class] + list
  3571.   end
  3572.   #--------------------------------------------------------------------------
  3573.   # * New method: atk_all_features
  3574.   #--------------------------------------------------------------------------
  3575.   def atk_all_features
  3576.     atk_feature_objects.inject([]) {|r, obj| r + obj.features }
  3577.   end
  3578.   #--------------------------------------------------------------------------
  3579.   # * New method: atk_features
  3580.   #--------------------------------------------------------------------------
  3581.   def atk_features(code)
  3582.     atk_all_features.select {|ft| ft.code == code }
  3583.   end
  3584.   #--------------------------------------------------------------------------
  3585.   # * New method: atk_features_set
  3586.   #--------------------------------------------------------------------------
  3587.   def atk_features_set(code)
  3588.     atk_features(code).inject([]) {|r, ft| r |= [ft.data_id] }
  3589.   end
  3590.   #--------------------------------------------------------------------------
  3591.   # * New method: atk_elements
  3592.   #--------------------------------------------------------------------------
  3593.   def atk_elements
  3594.     set = atk_features_set(FEATURE_ATK_ELEMENT)
  3595.     set |= [1] if weapons.compact.empty?
  3596.     return set
  3597.   end
  3598.   #--------------------------------------------------------------------------
  3599.   # * New method: atk_states
  3600.   #--------------------------------------------------------------------------
  3601.   def atk_states
  3602.     atk_features_set(FEATURE_ATK_STATE)
  3603.   end
  3604.   #--------------------------------------------------------------------------
  3605.   # * New method: atk_equips
  3606.   #--------------------------------------------------------------------------
  3607.   def atk_equips
  3608.     ([weapons[@attack_flag - 1]] + armors).collect {|item| item }.compact
  3609.   end
  3610.   #--------------------------------------------------------------------------
  3611.   # * New method: default_direction
  3612.   #--------------------------------------------------------------------------
  3613.   def default_direction
  3614.     units = opponents_unit.members
  3615.     x = units.collect {|member| member.screen_x }.average
  3616.     y = units.collect {|member| member.screen_y }.average
  3617.     target_direction(x, y, {x: screen_x, y: screen_y})
  3618.   end
  3619.   #--------------------------------------------------------------------------
  3620.   # * New method: screen_x
  3621.   #--------------------------------------------------------------------------
  3622.   def screen_x
  3623.     return 0
  3624.   end
  3625.   #--------------------------------------------------------------------------
  3626.   # * New method: screen_y
  3627.   #--------------------------------------------------------------------------
  3628.   def screen_y
  3629.     return 0
  3630.   end
  3631.   #--------------------------------------------------------------------------
  3632.   # * New method: character_hue
  3633.   #--------------------------------------------------------------------------
  3634.   def character_hue
  3635.     hue
  3636.   end
  3637.   #--------------------------------------------------------------------------
  3638.   # * New method: intro_pose?
  3639.   #--------------------------------------------------------------------------
  3640.   def intro_pose?
  3641.     !(note =~ /<NO INTRO>/i)
  3642.   end
  3643.   #--------------------------------------------------------------------------
  3644.   # * New method: victory_pose?
  3645.   #--------------------------------------------------------------------------
  3646.   def victory_pose?
  3647.     !(note =~ /<NO VICTORY>/i)
  3648.   end
  3649. end
  3650.  
  3651. #==============================================================================
  3652. # ** Game_Enemy
  3653. #------------------------------------------------------------------------------
  3654. #  This class handles enemy characters. It's used within the Game_Troop class
  3655. # ($game_troop).
  3656. #==============================================================================
  3657.  
  3658. class Game_Enemy < Game_Battler
  3659.   #--------------------------------------------------------------------------
  3660.   # * Overwrite method: perform_damage_effect
  3661.   #--------------------------------------------------------------------------
  3662.   def perform_damage_effect
  3663.     Sound.play_enemy_damage
  3664.   end
  3665.   #--------------------------------------------------------------------------
  3666.   # * Alias method: perform_collapse_effect
  3667.   #--------------------------------------------------------------------------
  3668.   alias :perform_collapse_effect_ve_animated_battle :perform_collapse_effect
  3669.   def perform_collapse_effect
  3670.     reset_pose
  3671.     perform_collapse_effect_ve_animated_battle
  3672.   end
  3673.   #--------------------------------------------------------------------------
  3674.   # * New method: character_name
  3675.   #--------------------------------------------------------------------------
  3676.   def character_name
  3677.     @character_name = @battler_name
  3678.     @character_name
  3679.   end
  3680.   #--------------------------------------------------------------------------
  3681.   # * New method: character_hue
  3682.   #--------------------------------------------------------------------------
  3683.   def character_hue
  3684.     @character_hue = @battler_hue
  3685.     @character_hue
  3686.   end
  3687.   #--------------------------------------------------------------------------
  3688.   # * New method: character_index
  3689.   #--------------------------------------------------------------------------
  3690.   def character_index
  3691.     return 0
  3692.   end
  3693.   #--------------------------------------------------------------------------
  3694.   # * New method: visual_items
  3695.   #--------------------------------------------------------------------------
  3696.   def visual_items
  3697.     [default_part]
  3698.   end
  3699.   #--------------------------------------------------------------------------
  3700.   # * New method: default_part
  3701.   #--------------------------------------------------------------------------
  3702.   def default_part
  3703.     {name: character_name, index1: character_index, index2: character_index,
  3704.      hue: character_hue, priority: 0}
  3705.   end
  3706.   #--------------------------------------------------------------------------
  3707.   # * New method: default_direction
  3708.   #--------------------------------------------------------------------------
  3709.   def default_direction
  3710.     units = opponents_unit.battle_members
  3711.     x = units.collect {|member| member.screen_x }.average
  3712.     y = units.collect {|member| member.screen_y }.average
  3713.     target_direction(x, y, {x: screen_x, y: screen_y})
  3714.   end
  3715.   #--------------------------------------------------------------------------
  3716.   # * New method: intro_pose?
  3717.   #--------------------------------------------------------------------------
  3718.   def intro_pose?
  3719.     note =~ /<INTRO POSE>/i
  3720.   end
  3721.   #--------------------------------------------------------------------------
  3722.   # * New method: victory_pose?
  3723.   #--------------------------------------------------------------------------
  3724.   def victory_pose?
  3725.     note =~ /<VICTORY POSE>/i
  3726.   end
  3727. end
  3728.  
  3729. #==============================================================================
  3730. # ** Game_Unit
  3731. #------------------------------------------------------------------------------
  3732. #  This class handles units. It's used as a superclass of the Game_Party and
  3733. # Game_Troop classes.
  3734. #==============================================================================
  3735.  
  3736. class Game_Unit
  3737.   #--------------------------------------------------------------------------
  3738.   # * New method: moving?
  3739.   #--------------------------------------------------------------------------
  3740.   def not_in_position?
  3741.     movable_members.any? {|member| member.not_in_position? }
  3742.   end
  3743.   #--------------------------------------------------------------------------
  3744.   # * New method: moving?
  3745.   #--------------------------------------------------------------------------
  3746.   def moving?
  3747.     movable_members.any? {|member| member.moving? }
  3748.   end
  3749. end
  3750.  
  3751. #==============================================================================
  3752. # ** Game_Interpreter
  3753. #------------------------------------------------------------------------------
  3754. #  An interpreter for executing event commands. This class is used within the
  3755. # Game_Map, Game_Troop, and Game_Event classes.
  3756. #==============================================================================
  3757.  
  3758. class Game_Interpreter
  3759.   #--------------------------------------------------------------------------
  3760.   # * Alias method: comment_call
  3761.   #--------------------------------------------------------------------------
  3762.   alias :comment_call_ve_animated_battle :comment_call
  3763.   def comment_call
  3764.     call_animated_battle_comments
  3765.     comment_call_ve_animated_battle
  3766.   end
  3767.   #--------------------------------------------------------------------------
  3768.   # * New method: call_animated_battle_comments
  3769.   #--------------------------------------------------------------------------
  3770.   def call_animated_battle_comments
  3771.     $game_system.no_intro   = true if note =~ /<no intro>/i
  3772.     $game_system.no_victory = true if note =~ /<no victory>/i
  3773.   end
  3774. end
  3775.  
  3776. #==============================================================================
  3777. # ** Sprite_Battler
  3778. #------------------------------------------------------------------------------
  3779. #  This sprite is used to display battlers. It observes a instance of the
  3780. # Game_Battler class and automatically changes sprite conditions.
  3781. #==============================================================================
  3782.  
  3783. class Sprite_Battler < Sprite_Base
  3784.   #--------------------------------------------------------------------------
  3785.   # * Public Instance Variables
  3786.   #--------------------------------------------------------------------------
  3787.   attr_accessor :battler
  3788.   attr_reader   :battler_name
  3789.   #--------------------------------------------------------------------------
  3790.   # * Overwrite method: update_bitmap
  3791.   #--------------------------------------------------------------------------
  3792.   def update_bitmap
  3793.     setup_bitmap if graphic_changed?
  3794.   end
  3795.   #--------------------------------------------------------------------------
  3796.   # * Overwrite method: init_visibility
  3797.   #--------------------------------------------------------------------------
  3798.   def init_visibility
  3799.     @battler_visible = !@battler.hidden?
  3800.     self.opacity = 0 unless @battler_visible
  3801.   end
  3802.   #--------------------------------------------------------------------------
  3803.   # * Overwrite method: update_origin
  3804.   #--------------------------------------------------------------------------
  3805.   def update_origin
  3806.     update_rect if bitmap
  3807.     update_icon
  3808.     update_throw
  3809.   end
  3810.   #--------------------------------------------------------------------------
  3811.   # * Alias method: initialize
  3812.   #--------------------------------------------------------------------------
  3813.   alias :initialize_ve_animated_battle :initialize
  3814.   def initialize(viewport, battler = nil)
  3815.     initialize_ve_animated_battle(viewport, battler)
  3816.     init_variables
  3817.   end
  3818.   #--------------------------------------------------------------------------
  3819.   # * Alias method: update_effect
  3820.   #--------------------------------------------------------------------------
  3821.   alias :update_effect_ve_animated_battle :update_effect
  3822.   def update_effect
  3823.     setup_collapse
  3824.     update_effect_ve_animated_battle
  3825.     update_pose
  3826.     update_pose_loop_anim if $imported[:ve_loop_animation]
  3827.   end
  3828.   #--------------------------------------------------------------------------
  3829.   # * Alias method: revert_to_normal
  3830.   #--------------------------------------------------------------------------
  3831.   alias :revert_to_normal_ve_animated_battle :revert_to_normal
  3832.   def revert_to_normal
  3833.     revert_to_normal_ve_animated_battle
  3834.     update_rect if bitmap
  3835.   end
  3836.   #--------------------------------------------------------------------------
  3837.   # * Alias method: setup_new_effect
  3838.   #--------------------------------------------------------------------------
  3839.   alias :setup_new_effect_ve_animated_battle :setup_new_effect
  3840.   def setup_new_effect
  3841.     if @battler_visible && !@invisible && @battler.invisible
  3842.       @invisible = true
  3843.       @effect_type = :disappear
  3844.       @effect_duration = 12
  3845.     elsif @battler_visible && @invisible && !@battler.invisible
  3846.       @invisible = false
  3847.       @effect_type = :appear
  3848.       @effect_duration = 12
  3849.     end
  3850.     setup_new_effect_ve_animated_battle
  3851.   end
  3852.   #--------------------------------------------------------------------------
  3853.   # * New method: init_variables
  3854.   #--------------------------------------------------------------------------
  3855.   def init_variables
  3856.     @spin  = 0
  3857.     @frame = 0
  3858.     @sufix = ""
  3859.     @pose_sufix = ""
  3860.     @anim_sufix = VE_SPRITE_SUFIX
  3861.     @pose_count   = 0
  3862.     @frame_width  = 0
  3863.     @frame_height = 0
  3864.     @pose_value   = {}
  3865.     @icon_list    = {}
  3866.     @throw_list   = []
  3867.     start_effect(:appear) if $game_system.intro_fade && !@battler.hidden?
  3868.     @battler.clear_poses
  3869.     setup_positions
  3870.   end
  3871.   #--------------------------------------------------------------------------
  3872.   # * New method: setup_collapse
  3873.   #--------------------------------------------------------------------------
  3874.   def setup_collapse
  3875.     if @battler.dead? && !@dead
  3876.       @battler.perform_collapse_effect
  3877.       @dead = true
  3878.     elsif @dead && !@battler.dead?
  3879.       @dead = false
  3880.     end
  3881.   end
  3882.   #--------------------------------------------------------------------------
  3883.   # * New method: subject
  3884.   #--------------------------------------------------------------------------
  3885.   def subject
  3886.     @pose_battler ? @pose_battler : @battler
  3887.   end
  3888.   #--------------------------------------------------------------------------
  3889.   # * New method: sprite_value
  3890.   #--------------------------------------------------------------------------
  3891.   def sprite_value(value)
  3892.     @battler.sprite_value(value)
  3893.   end
  3894.   #--------------------------------------------------------------------------
  3895.   # * New method: graphic_changed?
  3896.   #--------------------------------------------------------------------------
  3897.   def graphic_changed?
  3898.     actor_name_change? || battler_name_change? || misc_change?
  3899.   end
  3900.   #--------------------------------------------------------------------------
  3901.   # * New method: actor_name_change?
  3902.   #--------------------------------------------------------------------------
  3903.   def actor_name_change?
  3904.     use_charset? && (@battler_name != @battler.character_name ||
  3905.     @battler_index != @battler.character_index ||
  3906.     @battler_hue   != @battler.character_hue)
  3907.   end
  3908.   #--------------------------------------------------------------------------
  3909.   # * New method: battler_name_change?
  3910.   #--------------------------------------------------------------------------
  3911.   def battler_name_change?
  3912.     !use_charset? && (@battler_name != @battler.battler_name ||
  3913.     @battler_hue  != @battler.battler_hue)
  3914.   end
  3915.   #--------------------------------------------------------------------------
  3916.   # * New method: misc_change?
  3917.   #--------------------------------------------------------------------------
  3918.   def misc_change?
  3919.     (visual_equip? && @visual_items != @battler.visual_items) ||
  3920.     @sufix != @battler.sufix || @direction != @battler.direction
  3921.   end
  3922.   #--------------------------------------------------------------------------
  3923.   # * New method: use_charset?
  3924.   #--------------------------------------------------------------------------
  3925.   def use_charset?
  3926.     sprite_value(:mode) == :charset
  3927.   end
  3928.   #--------------------------------------------------------------------------
  3929.   # * New method: visual_equip?
  3930.   #--------------------------------------------------------------------------
  3931.   def visual_equip?
  3932.     $imported[:ve_visual_equip]
  3933.   end
  3934.   #--------------------------------------------------------------------------
  3935.   # * New method: setup_bitmap
  3936.   #--------------------------------------------------------------------------
  3937.   def setup_bitmap
  3938.     if use_charset?
  3939.       @battler_name  = @battler.character_name
  3940.       @battler_hue   = @battler.character_hue
  3941.       @battler_index = @battler.character_index
  3942.     else
  3943.       @battler_name  = @battler.battler_name
  3944.       @battler_hue   = @battler.battler_hue
  3945.     end
  3946.     @sufix        = @battler.sufix
  3947.     @direction    = @battler.direction
  3948.     @visual_items = @battler.visual_items.dup if visual_equip?
  3949.     init_bitmap
  3950.     init_frame
  3951.     init_visibility
  3952.   end
  3953.   #--------------------------------------------------------------------------
  3954.   # * New method: init_bitmap
  3955.   #--------------------------------------------------------------------------
  3956.   def init_bitmap
  3957.     case sprite_value(:mode)
  3958.     when :charset
  3959.       if visual_equip?
  3960.         args = [@battler_name, @battler_hue, @visual_items, sufix]
  3961.         self.bitmap = Cache.character(*args)
  3962.       else
  3963.         self.bitmap = Cache.character(get_character_name, @battler_hue)
  3964.       end
  3965.     when :single
  3966.       self.bitmap = Cache.battler(get_battler_name, @battler_hue)
  3967.     when :sprite
  3968.       self.bitmap = Cache.battler(get_battler_name, @battler_hue)
  3969.     else
  3970.       self.bitmap = Cache.battler(@battler_name, @battler_hue)
  3971.     end
  3972.   end
  3973.   #--------------------------------------------------------------------------
  3974.   # * New method: sufix
  3975.   #--------------------------------------------------------------------------
  3976.   def sufix
  3977.     case sprite_value(:mode)
  3978.     when :charset then @sufix
  3979.     when :sprite  then @anim_sufix + @sufix
  3980.     else @sufix
  3981.     end
  3982.   end
  3983.   #--------------------------------------------------------------------------
  3984.   # * New method: get_battler_name
  3985.   #--------------------------------------------------------------------------
  3986.   def get_battler_name
  3987.     name = @battler_name + sufix
  3988.     battler_exist?(name) ? name : @battler_name
  3989.   end
  3990.   #--------------------------------------------------------------------------
  3991.   # * New method: get_character_name
  3992.   #--------------------------------------------------------------------------
  3993.   def get_character_name
  3994.     name = @battler_name + sufix
  3995.     character_exist?(name) ? name : @battler_name
  3996.   end
  3997.   #--------------------------------------------------------------------------
  3998.   # * New method: init_frame
  3999.   #--------------------------------------------------------------------------
  4000.   def init_frame
  4001.     @frame_width  = bitmap.width  / frame_number
  4002.     @frame_height = bitmap.height / row_number
  4003.   end
  4004.   #--------------------------------------------------------------------------
  4005.   # * New method: frame_number
  4006.   #--------------------------------------------------------------------------
  4007.   def frame_number
  4008.     return @battler.frames     if single_char?
  4009.     return @battler.frames * 4 if multi_char?
  4010.     return 1 unless battler_exist?(@battler_name + sufix)
  4011.     return sprite_value(:frames) if sprite_value(:mode) == :sprite
  4012.     return 1
  4013.   end
  4014.   #--------------------------------------------------------------------------
  4015.   # * New method: row_number
  4016.   #--------------------------------------------------------------------------
  4017.   def row_number
  4018.     return 4 if single_char?
  4019.     return 8 if multi_char?
  4020.     return 1 unless battler_exist?(@battler_name + sufix)
  4021.     return sprite_value(:rows) if sprite_value(:mode) == :sprite
  4022.     return 1
  4023.   end
  4024.   #--------------------------------------------------------------------------
  4025.   # * New method: single_char?
  4026.   #--------------------------------------------------------------------------
  4027.   def single_char?
  4028.     use_charset? && (single_normal? && !visual_equip?)
  4029.   end
  4030.   #--------------------------------------------------------------------------
  4031.   # * New method: multi_char?
  4032.   #--------------------------------------------------------------------------
  4033.   def multi_char?
  4034.     use_charset? && (multi_normal? || visual_equip?)
  4035.   end
  4036.   #--------------------------------------------------------------------------
  4037.   # * New method: single_normal?
  4038.   #--------------------------------------------------------------------------
  4039.   def single_normal?
  4040.     !visual_equip? && @battler_name[/^[!]?[$]./]
  4041.   end
  4042.   #--------------------------------------------------------------------------
  4043.   # * New method: multi_normal?
  4044.   #--------------------------------------------------------------------------
  4045.   def multi_normal?
  4046.     !visual_equip? && !@battler_name[/^[!]?[$]./]
  4047.   end
  4048.   #--------------------------------------------------------------------------
  4049.   # * New method: get_sign
  4050.   #--------------------------------------------------------------------------
  4051.   def get_sign
  4052.     @visual_items.any? {|part| !part[:name][/^[!]?[$]./] }
  4053.   end
  4054.   #--------------------------------------------------------------------------
  4055.   # * New method: update_rect
  4056.   #--------------------------------------------------------------------------
  4057.   def update_rect
  4058.     setup_frame
  4059.     setup_rect
  4060.     self.ox = @frame_width / 2
  4061.     self.oy = @frame_height
  4062.     self.mirror = pose_mirror
  4063.   end
  4064.   #--------------------------------------------------------------------------
  4065.   # * New method: pose_mirror
  4066.   #--------------------------------------------------------------------------
  4067.   def pose_mirror
  4068.     mirror = sprite_value(:invert)
  4069.     mirror = !mirror if @battler.timing && @battler.timing[:invert]
  4070.     mirror = !mirror if right? && sprite_value(:mirror)
  4071.     mirror
  4072.   end
  4073.   #--------------------------------------------------------------------------
  4074.   # * New method: down?
  4075.   #--------------------------------------------------------------------------
  4076.   def down?
  4077.     @battler.down?
  4078.   end
  4079.   #--------------------------------------------------------------------------
  4080.   # * New method: left?
  4081.   #--------------------------------------------------------------------------
  4082.   def left?
  4083.     @battler.left?
  4084.   end
  4085.   #--------------------------------------------------------------------------
  4086.   # * New method: right?
  4087.   #--------------------------------------------------------------------------
  4088.   def right?
  4089.     @battler.right?
  4090.   end
  4091.   #--------------------------------------------------------------------------
  4092.   # * New method: up?
  4093.   #--------------------------------------------------------------------------
  4094.   def up?
  4095.     @battler.up?
  4096.   end
  4097.   #--------------------------------------------------------------------------
  4098.   # * New method: setup_frame
  4099.   #--------------------------------------------------------------------------
  4100.   def setup_frame
  4101.     return if no_pose?
  4102.     value = @battler.timing
  4103.     value[:time] -= 1
  4104.     value[:time] = value[:wait] if value[:time] == 0
  4105.     return if value[:time] != value[:wait]
  4106.     max = value[:frame] == :all ? sprite_value(:frames) : value[:frame]
  4107.     @frame += 1
  4108.     if value[:return]
  4109.       @battler.frame = returing_value(@frame, max - 1)
  4110.       reset_frame if !value[:loop] && @battler.frame == 0
  4111.     else
  4112.       @frame %= max
  4113.       @battler.frame = value[:revert] ? max - 1 - @frame : @frame
  4114.       reset_frame if !value[:loop] && (@frame >= max - 1 || @frame == 0)
  4115.     end
  4116.   end
  4117.   #--------------------------------------------------------------------------
  4118.   # * New method: no_pose?
  4119.   #--------------------------------------------------------------------------
  4120.   def no_pose?
  4121.     @battler.timing.empty? || !@battler.timing[:time]
  4122.   end
  4123.   #--------------------------------------------------------------------------
  4124.   # * New method: reset_frame
  4125.   #--------------------------------------------------------------------------
  4126.   def reset_frame
  4127.     invert = @battler.timing[:invert]
  4128.     @battler.timing = {invert: invert}
  4129.     @frame = 0
  4130.     @spin  = 0
  4131.   end
  4132.   #--------------------------------------------------------------------------
  4133.   # * New method: setup_rect
  4134.   #--------------------------------------------------------------------------
  4135.   def setup_rect
  4136.     sign =  @battler_name[/^[$]./]
  4137.     if use_charset? && !sign
  4138.       index = @battler_index
  4139.       frame = (index % 4 * @battler.frames + @battler.frame) * @frame_width
  4140.       row   = (index / 4 * 4 + @battler.row) * @frame_height
  4141.     else
  4142.       frame = [[@battler.frame, 0].max, frame_number - 1].min * @frame_width
  4143.       row   = [[@battler.row,   0].max,   row_number - 1].min * @frame_height
  4144.     end
  4145.     self.src_rect.set(frame, row, @frame_width, @frame_height)
  4146.   end  
  4147.   #--------------------------------------------------------------------------
  4148.   # * New method: update_pose
  4149.   #--------------------------------------------------------------------------
  4150.   def update_pose
  4151.     setup_pose
  4152.     update_next_pose
  4153.   end
  4154.   #--------------------------------------------------------------------------
  4155.   # * New method: update_next_pose
  4156.   #--------------------------------------------------------------------------
  4157.   def update_next_pose
  4158.     next_pose unless @pose
  4159.     return if !@pose || !@pose[:type].is_a?(Symbol)
  4160.     update_pose_type
  4161.     next_pose unless @waiting
  4162.   end
  4163.   #--------------------------------------------------------------------------
  4164.   # * New method: setup_pose
  4165.   #--------------------------------------------------------------------------
  4166.   def setup_pose
  4167.     @current_pose = pose_list.first
  4168.     return unless @current_pose
  4169.     clear   = changed_pose?
  4170.     @frame  = 0 if changed_pose?
  4171.     battler = @current_pose[:battler]
  4172.     @pose_battler = battler unless battler == :skip
  4173.     @pose_value   = @current_pose[:value]
  4174.     @pose = @pose_value.first
  4175.     @battler.icon_list.clear if clear && @battler.pose_name != :inactive
  4176.   end
  4177.   #--------------------------------------------------------------------------
  4178.   # * New method: changed_pose?
  4179.   #--------------------------------------------------------------------------
  4180.   def changed_pose?
  4181.     @pose_value != @current_pose[:value]
  4182.   end
  4183.   #--------------------------------------------------------------------------
  4184.   # * New method: pose_list
  4185.   #--------------------------------------------------------------------------
  4186.   def pose_list
  4187.     @battler.pose_list
  4188.   end
  4189.   #--------------------------------------------------------------------------
  4190.   # * New method: update_pose_type
  4191.   #--------------------------------------------------------------------------
  4192.   def update_pose_type
  4193.     @waiting = false
  4194.     return if @pose[:hit]   && @battler.result_flag != :hit
  4195.     return if @pose[:miss]  && @battler.result_flag != :miss
  4196.     return if @pose[:count] && pose_skip
  4197.     eval("update_pose_#{@pose[:type]}")
  4198.   end
  4199.   #--------------------------------------------------------------------------
  4200.   # * New method: pose_skip
  4201.   #--------------------------------------------------------------------------
  4202.   def pose_skip
  4203.     @pose[:count].any? { |value| value.between?(@prev_count, @pose_count) }
  4204.   end
  4205.   #--------------------------------------------------------------------------
  4206.   # * New method: next_pose
  4207.   #--------------------------------------------------------------------------
  4208.   def next_pose
  4209.     return unless @current_pose
  4210.     case @current_pose[:next]
  4211.     when :loop
  4212.       @pose_value.next_item
  4213.     when :wait
  4214.       @pose_value.shift unless @pose_value.size <= 1
  4215.     when :reset
  4216.       @pose_value.shift
  4217.       reset_pose if @pose_value.empty?
  4218.     when Symbol
  4219.       @pose_value.shift
  4220.       @battler.call_pose(@current_pose[:next]) if @pose_value.empty?
  4221.     else
  4222.       last_value = @pose_value.shift
  4223.     end
  4224.     @pose_value.unshift(last_value) if @pose_value.empty? && pose_list.empty?
  4225.     @battler.pose_list.shift if @pose_value.empty?
  4226.   end
  4227.   #--------------------------------------------------------------------------
  4228.   # * New method: update_pose_wait
  4229.   #--------------------------------------------------------------------------
  4230.   def update_pose_wait
  4231.     case @pose[:time]
  4232.     when :animation
  4233.       @waiting = SceneManager.scene.spriteset.animation?
  4234.     when :action
  4235.       @waiting = SceneManager.scene.spriteset.action?(subject)
  4236.     when :movement
  4237.       @waiting = get_target.any? {|target| target.moving? }
  4238.     when :origin
  4239.       @waiting = get_target.any? {|target| target.origin? }
  4240.     when :counter
  4241.       @waiting = get_target.any? {|target| target.countered }
  4242.     when :substitution
  4243.       @waiting = get_target.any? {|target| target.substitution }
  4244.     when :tone
  4245.       @waiting = $game_troop.screen.tone_change?
  4246.     when :throw
  4247.       @waiting = get_target.any? {|target| target.sprite.throwing? }
  4248.     when :pose
  4249.       @waiting = !no_pose?
  4250.     when :freeze
  4251.       @waiting = get_target.any? {|target| target.frozen? }
  4252.     when :log
  4253.       @waiting = SceneManager.scene.log_window_wait?
  4254.     else
  4255.       @pose[:time] -= 1
  4256.       @pose[:time] = @pose[:wait] if @pose[:time] == 0
  4257.       @waiting = @pose[:time] != @pose[:wait]
  4258.     end
  4259.   end
  4260.   #--------------------------------------------------------------------------
  4261.   # * New method: update_pose_clear
  4262.   #--------------------------------------------------------------------------
  4263.   def update_pose_clear
  4264.     battler.pose_list.clear
  4265.   end
  4266.   #--------------------------------------------------------------------------
  4267.   # * New method: update_pose_action
  4268.   #--------------------------------------------------------------------------
  4269.   def update_pose_action
  4270.     get_target.each do |target|
  4271.       target.clear_loop_poses
  4272.       target.call_pose(@pose[:action], :clear, @battler.current_item, @battler)
  4273.     end
  4274.   end
  4275.   #--------------------------------------------------------------------------
  4276.   # * New method: update_pose_finish
  4277.   #--------------------------------------------------------------------------
  4278.   def update_pose_finish
  4279.     @battler.attack_flag += 1 if @battler.attack_flag
  4280.   end
  4281.   #--------------------------------------------------------------------------
  4282.   # * New method: update_pose_anim
  4283.   #--------------------------------------------------------------------------
  4284.   def update_pose_anim
  4285.     subject.targets = get_target
  4286.     subject.call_anim = true
  4287.     subject.animation = @pose[:anim]
  4288.   end
  4289.   #--------------------------------------------------------------------------
  4290.   # * New method: update_pose_effect
  4291.   #--------------------------------------------------------------------------
  4292.   def update_pose_effect
  4293.     subject.call_effect = true
  4294.     subject.damage_flag = @pose[:damage]
  4295.     subject.attack_flag = @pose[:weapon] if @pose[:weapon]
  4296.     if @pose[:target]
  4297.       subject.target_list ||= []
  4298.       subject.target_list += @pose[:target]
  4299.     else
  4300.       subject.target_list = subject.targets.dup
  4301.     end
  4302.   end
  4303.   #--------------------------------------------------------------------------
  4304.   # * New method: update_pose_loop
  4305.   #--------------------------------------------------------------------------
  4306.   def update_pose_loop
  4307.     get_target.each {|target| target.pose_loop_anim = @pose[:loop_anim] }
  4308.   end
  4309.   #--------------------------------------------------------------------------
  4310.   # * New method: update_pose_reset
  4311.   #--------------------------------------------------------------------------
  4312.   def update_pose_reset
  4313.     @battler.actions[0] = @battler.previous_action if @pose[:action]
  4314.     reset_pose if @pose[:pose]
  4315.   end
  4316.   #--------------------------------------------------------------------------
  4317.   # * New method: update_pose_plane
  4318.   #--------------------------------------------------------------------------
  4319.   def update_pose_plane
  4320.     if @pose[:delete]
  4321.       SceneManager.scene.spriteset.delete_plane(@pose[:duration])
  4322.     elsif @pose[:list]
  4323.       SceneManager.scene.spriteset.action_plane(*@pose[:list])
  4324.     end
  4325.   end
  4326.   #--------------------------------------------------------------------------
  4327.   # * New method: update_pose_sound
  4328.   #--------------------------------------------------------------------------
  4329.   def update_pose_sound
  4330.     se = RPG::SE.new(@pose[:name], @pose[:volume], @pose[:pitch])
  4331.     se.play
  4332.   end
  4333.   #--------------------------------------------------------------------------
  4334.   # * New method: update_pose_pose
  4335.   #--------------------------------------------------------------------------
  4336.   def update_pose_pose
  4337.     get_target.each do |target|
  4338.       target.row    = @pose[:row] - 1           if @pose[:row].is_a?(Numeric)
  4339.       target.row    = target.direction / 2  - 1 if @pose[:row].is_a?(Symbol)
  4340.       target.sufix  = @pose[:sufix]
  4341.       target.angle  = @pose[:angle]
  4342.       target.spin   = @pose[:spin]
  4343.       target.x_adj  = @pose[:x]
  4344.       target.y_adj  = @pose[:y]
  4345.       target.timing = @pose[:pose]
  4346.       target.frame  = @pose[:frame] - 1
  4347.       target.frame %= target.sprite_value(:frames)
  4348.     end
  4349.   end
  4350.   #--------------------------------------------------------------------------
  4351.   # * New method: update_pose_move
  4352.   #--------------------------------------------------------------------------
  4353.   def update_pose_move
  4354.     get_target.each do |target|
  4355.       target.teleport = @pose[:teleport]
  4356.       setup_target_position(target)
  4357.     end
  4358.   end
  4359.   #--------------------------------------------------------------------------
  4360.   # * New method: update_pose_counter
  4361.   #--------------------------------------------------------------------------
  4362.   def update_pose_counter
  4363.     get_target.each {|target| target.countered = @pose[:counter] }
  4364.   end
  4365.   #--------------------------------------------------------------------------
  4366.   # * New method: update_pose_substitution
  4367.   #--------------------------------------------------------------------------
  4368.   def update_pose_substitution
  4369.     get_target.each {|target| target.substitution = @pose[:substitution] }
  4370.   end
  4371.   #--------------------------------------------------------------------------
  4372.   # * New method: update_pose_jump
  4373.   #--------------------------------------------------------------------------
  4374.   def update_pose_jump
  4375.     get_target.each do |target|
  4376.       if @pose[:move]
  4377.         x_plus = (target.target_distance(:x) / 32.0).abs
  4378.         y_plus = (target.target_distance(:y) / 32.0).abs
  4379.         speed = Math.sqrt((x_plus ** 2) + (y_plus ** 2)) / @battler.move_speed
  4380.         target.jumping[:speed] = @pose[:height] * 5.0 / [speed, 1].max
  4381.       else
  4382.         target.jumping[:speed] = @pose[:speed]
  4383.       end
  4384.       target.jumping[:height] = @pose[:height]
  4385.       target.jumping[:count]  = target.jumping[:height] * 2  
  4386.     end    
  4387.   end
  4388.   #--------------------------------------------------------------------------
  4389.   # * New method: update_pose_inactive
  4390.   #--------------------------------------------------------------------------
  4391.   def update_pose_inactive
  4392.     subject.deactivate
  4393.   end
  4394.   #--------------------------------------------------------------------------
  4395.   # * New method: update_pose_count
  4396.   #--------------------------------------------------------------------------
  4397.   def update_pose_count
  4398.     @prev_count = @pose_count
  4399.     @pose_count += @pose[:add] + rand(@pose[:rand])
  4400.     @prev_count = 0 if @pose_count > @pose[:max]
  4401.     @pose_count %= @pose[:max]
  4402.   end
  4403.   #--------------------------------------------------------------------------
  4404.   # * New method: update_pose_direction
  4405.   #--------------------------------------------------------------------------
  4406.   def update_pose_direction
  4407.     dir = [subject.screen_x, subject.screen_y]
  4408.     subject.target_direction(*dir) if @pose[:return]
  4409.     subject.action_direction       if @pose[:targets]
  4410.     subject.default_direction      if @pose[:default]
  4411.     subject.active_direction       if @pose[:active]
  4412.     subject.direction = @pose[:direction] if @pose[:direction]
  4413.   end
  4414.   #--------------------------------------------------------------------------
  4415.   # * New method: update_pose_icon
  4416.   #--------------------------------------------------------------------------
  4417.   def update_pose_icon
  4418.     get_target.each do |target|
  4419.       if @pose[:delete]
  4420.         target.icon_list.delete(@pose[:index])
  4421.       else
  4422.         target.icon_list[@pose[:index]] = @pose.dup
  4423.       end
  4424.       target.sprite.update_icon
  4425.     end
  4426.   end
  4427.   #--------------------------------------------------------------------------
  4428.   # * New method: update_pose_picture
  4429.   #--------------------------------------------------------------------------
  4430.   def update_pose_picture
  4431.     if @pose[:show]
  4432.       $game_troop.screen.pictures[@pose[:id]].show(*@pose[:show])
  4433.     elsif @pose[:move]
  4434.       $game_troop.screen.pictures[@pose[:id]].move(*@pose[:move])
  4435.     elsif @pose[:delete]
  4436.      $game_troop.screen.pictures[@pose[:id]].erase
  4437.     end
  4438.   end
  4439.   #--------------------------------------------------------------------------
  4440.   # * New method: update_pose_throw
  4441.   #--------------------------------------------------------------------------
  4442.   def update_pose_throw
  4443.     get_target.each do |target|
  4444.       value = @pose.dup
  4445.       value[:user] = subject.sprite
  4446.       target.throw_list.push(value.dup)
  4447.       target.sprite.update_throw
  4448.     end  
  4449.   end
  4450.   #--------------------------------------------------------------------------
  4451.   # * New method: update_pose_shake
  4452.   #--------------------------------------------------------------------------
  4453.   def update_pose_shake
  4454.     if @pose[:screen]
  4455.       $game_troop.screen.start_shake(*@pose[:shake])
  4456.     else
  4457.       get_target.each {|target| target.start_shake(*@pose[:shake]) }
  4458.     end
  4459.   end
  4460.   #--------------------------------------------------------------------------
  4461.   # * New method: update_pose_flash
  4462.   #--------------------------------------------------------------------------
  4463.   def update_pose_flash
  4464.     if @pose[:screen]
  4465.       $game_troop.screen.start_flash(*@pose[:flash])
  4466.     else
  4467.       get_target.each {|target| target.sprite.flash(*@pose[:flash]) }
  4468.     end
  4469.   end
  4470.   #--------------------------------------------------------------------------
  4471.   # * New method: update_pose_freeze
  4472.   #--------------------------------------------------------------------------
  4473.   def update_pose_freeze
  4474.     get_target.each {|target| target.freeze = @pose[:duration] }
  4475.   end
  4476.   #--------------------------------------------------------------------------
  4477.   # * New method: update_pose_movie
  4478.   #--------------------------------------------------------------------------
  4479.   def update_pose_movie
  4480.     Graphics.play_movie("Movies/" + @pose[:name]) if @pose[:name] != ""
  4481.     update_pose_tone
  4482.   end
  4483.   #--------------------------------------------------------------------------
  4484.   # * New method: update_pose_drain
  4485.   #--------------------------------------------------------------------------
  4486.   def update_pose_drain
  4487.     get_target.each do |target|
  4488.       target.drain_setup if target.hp_drain != 0 || target.mp_drain != 0
  4489.     end
  4490.   end
  4491.   #--------------------------------------------------------------------------
  4492.   # * New method: update_pose_transition
  4493.   #--------------------------------------------------------------------------
  4494.   def update_pose_transition
  4495.     if @pose[:prepare]
  4496.       Graphics.freeze
  4497.     elsif @pose[:execute]
  4498.       time  = @pose[:duration]
  4499.       name  = "Graphics/System/" + @pose[:name]
  4500.       value = @pose[:name] == "" ? [time] : [time, name]
  4501.       Graphics.transition(*value)
  4502.     end
  4503.   end
  4504.   #--------------------------------------------------------------------------
  4505.   # * New method: update_pose_hide
  4506.   #--------------------------------------------------------------------------
  4507.   def update_pose_hide
  4508.     hidden_list.each {|target| target.invisible = !@pose[:unhide] }
  4509.   end
  4510.   #--------------------------------------------------------------------------
  4511.   # * New method: update_pose_tone
  4512.   #--------------------------------------------------------------------------
  4513.   def update_pose_tone
  4514.     eval("update_#{@pose[:priority]}_tone")
  4515.   end
  4516.   #--------------------------------------------------------------------------
  4517.   # * New method: hidden_list
  4518.   #--------------------------------------------------------------------------
  4519.   def hidden_list
  4520.     list = []
  4521.     if @pose[:all_battler]
  4522.       list += $game_party.battle_members + $game_troop.members
  4523.     elsif @pose[:all_enemies]
  4524.       list += @battler.opponents_unit
  4525.     elsif @pose[:all_friends]
  4526.       list += @battler.friends_unit
  4527.     elsif @pose[:all_targets]
  4528.       list += @battler.action_targets
  4529.     elsif @pose[:not_targets]
  4530.       battlers = $game_party.battle_members + $game_troop.members
  4531.       targets  = @battler.action_targets
  4532.       list += battlers - targets
  4533.     end
  4534.     if @pose[:exc_user]
  4535.       list -= [@battler]
  4536.     elsif @pose[:inc_user]
  4537.       list += [@battler]
  4538.     end
  4539.     list
  4540.   end
  4541.   #--------------------------------------------------------------------------
  4542.   # * New method: update_low_tone
  4543.   #--------------------------------------------------------------------------
  4544.   def update_low_tone
  4545.     screen = $game_troop.screen
  4546.     screen.old_low_tone = screen.low_tone.dup unless screen.old_low_tone
  4547.     tone = @pose[:clear] ? screen.old_low_tone.dup : @pose[:tone]
  4548.     $game_troop.screen.old_low_tone = nil if @pose[:clear]
  4549.     $game_troop.screen.start_low_tone_change(tone, @pose[:duration])
  4550.   end
  4551.   #--------------------------------------------------------------------------
  4552.   # * New method: update_normal_tone
  4553.   #--------------------------------------------------------------------------
  4554.   def update_normal_tone
  4555.     screen = $game_troop.screen
  4556.     screen.old_tone = screen.tone.dup unless screen.old_tone
  4557.     tone = @pose[:clear] ? $game_troop.screen.old_tone.dup : @pose[:tone]
  4558.     $game_troop.screen.old_tone = nil if @pose[:clear]
  4559.     $game_troop.screen.start_tone_change(tone, @pose[:duration])
  4560.   end
  4561.   #--------------------------------------------------------------------------
  4562.   # * New method: update_high_tone
  4563.   #--------------------------------------------------------------------------  
  4564.   def update_high_tone
  4565.     screen = $game_troop.screen
  4566.     screen.old_high_tone = screen.high_tone.dup unless screen.old_high_tone
  4567.     tone = @pose[:clear] ? screen.old_high_tone.dup : @pose[:tone]
  4568.     $game_troop.screen.old_high_tone = nil if @pose[:clear]
  4569.     $game_troop.screen.start_high_tone_change(tone, @pose[:duration])
  4570.   end
  4571.   #--------------------------------------------------------------------------
  4572.   # * New method: setup_target_position
  4573.   #--------------------------------------------------------------------------
  4574.   def setup_target_position(target)
  4575.     return unless @battler.use_sprite?
  4576.     if @pose[:value] == :move_to
  4577.       setup_move_to_target_position(target)
  4578.     elsif @pose[:value] == :step_foward
  4579.       setup_step_foward_position(target)
  4580.     elsif @pose[:value] == :step_backward
  4581.       setup_step_backward_position(target)
  4582.     elsif @pose[:value] == :escape
  4583.       setup_escape_position(target)
  4584.     elsif @pose[:value] == :retreat
  4585.       setup_retreat_position(target)
  4586.     elsif @pose[:value] == :substitution
  4587.       setup_substitution_position(target)
  4588.     end
  4589.     return if @waiting
  4590.     target.position_fix while target.sharing_position?
  4591.     setup_final_target_position(target)
  4592.     target.target_position = target.current_position.dup if target.unmovable?
  4593.   end
  4594.   #--------------------------------------------------------------------------
  4595.   # * New method: setup_move_to_target_position
  4596.   #--------------------------------------------------------------------------
  4597.   def setup_move_to_target_position(target)
  4598.     targets = @pose[:targets].select {|member| member.use_sprite? }
  4599.     return if targets.empty?
  4600.     return @waiting = true if targets.any? {|member| member.moving?}
  4601.     return @waiting = true if targets.any? {|member| member.damage_pose?}
  4602.     x = targets.collect {|member| member.current_position[:x]}.average
  4603.     y = targets.collect {|member| member.current_position[:y]}.average
  4604.     target.target_position[:x] = x
  4605.     target.target_position[:y] = y
  4606.     target.target_direction(x, y)
  4607.     target.adjust_position(32)
  4608.   end
  4609.   #--------------------------------------------------------------------------
  4610.   # * New method: setup_step_foward_position
  4611.   #--------------------------------------------------------------------------
  4612.   def setup_step_foward_position(target)
  4613.     target.adjust_position(-48)
  4614.   end
  4615.   #--------------------------------------------------------------------------
  4616.   # * New method: setup_step_backward_position
  4617.   #--------------------------------------------------------------------------
  4618.   def setup_step_backward_position(target)
  4619.     target.adjust_position(48)
  4620.   end
  4621.   #--------------------------------------------------------------------------
  4622.   # * New method: setup_escape_position
  4623.   #--------------------------------------------------------------------------
  4624.   def setup_escape_position(target)
  4625.     target.adjust_position(320)
  4626.     position = target.target_position
  4627.     target.target_direction(position[:x], position[:y])
  4628.   end
  4629.   #--------------------------------------------------------------------------
  4630.   # * New method: setup_retreat_position
  4631.   #--------------------------------------------------------------------------
  4632.   def setup_retreat_position(target)
  4633.     return if target.target_position[:x] == target.screen_x &&
  4634.               target.target_position[:y] == target.screen_y
  4635.     target.target_position[:x] = target.screen_x
  4636.     target.target_position[:y] = target.screen_y
  4637.     position = target.target_position
  4638.     target.target_direction(position[:x], position[:y])
  4639.   end  
  4640.   #--------------------------------------------------------------------------
  4641.   # * New method: setup_substitution_position
  4642.   #--------------------------------------------------------------------------
  4643.   def setup_substitution_position(target)
  4644.     battler = target.action_targets.first
  4645.     target.target_position = battler.current_position.dup
  4646.     x = battler.left? ? -16 : battler.right? ? 16 : 0
  4647.     y = battler.up?   ? -16 : battler.down?  ? 16 : 1
  4648.     target.target_position[:x] += x
  4649.     target.target_position[:y] += y
  4650.   end
  4651.   #--------------------------------------------------------------------------
  4652.   # * New method: setup_final_target_positio
  4653.   #--------------------------------------------------------------------------
  4654.   def setup_final_target_position(target)
  4655.     if target.left? || target.right?
  4656.       target.target_position[:x] += target.left? ? @pose[:x] : -@pose[:x]
  4657.       target.target_position[:y] += @pose[:y]
  4658.     elsif target.up? || target.down?
  4659.       target.target_position[:y] += target.up? ? @pose[:x] : -@pose[:x]
  4660.       target.target_position[:x] += @pose[:y]
  4661.     end
  4662.     target.target_position[:h] += @pose[:h]
  4663.     target.move_speed = @pose[:speed]
  4664.   end
  4665.   #--------------------------------------------------------------------------
  4666.   # * New method: reset_pose
  4667.   #--------------------------------------------------------------------------
  4668.   def reset_pose
  4669.     reset_frame
  4670.     next_pose = get_idle_pose
  4671.     @pose_count = 0
  4672.     @battler.clear_loop_poses
  4673.     @battler.call_pose(next_pose)
  4674.     update_icon
  4675.     setup_pose
  4676.   end
  4677.   #--------------------------------------------------------------------------
  4678.   # * New method: get_idle_pose
  4679.   #--------------------------------------------------------------------------
  4680.   def get_idle_pose
  4681.     pose = :idle
  4682.     pose = :danger if @battler.danger?
  4683.     pose = @battler.state_pose  if @battler.state_pose?
  4684.     pose = :guard  if @battler.guard?
  4685.     pose = @battler.active_pose if @battler.active_pose
  4686.     pose = :dead   if @battler.dead?
  4687.     pose
  4688.   end
  4689.   #--------------------------------------------------------------------------
  4690.   # * New method: get_target
  4691.   #--------------------------------------------------------------------------
  4692.   def get_target
  4693.     @pose[:target] ? @pose[:target] : [subject]
  4694.   end
  4695.   #--------------------------------------------------------------------------
  4696.   # * New method: setup_positions
  4697.   #--------------------------------------------------------------------------
  4698.   def setup_positions
  4699.     positions = {x: @battler.screen_x, y: @battler.screen_y, h: 0, j: 0}
  4700.     @battler.target_position  = positions.dup
  4701.     @battler.current_position = positions.dup
  4702.     @battler.default_position = positions.dup
  4703.     @battler.jumping = {count: 0, height: 0, speed: 10}
  4704.     reset_pose
  4705.   end
  4706.   #--------------------------------------------------------------------------
  4707.   # * New method: position
  4708.   #--------------------------------------------------------------------------
  4709.   def position
  4710.     @battler.current_position
  4711.   end
  4712.   #--------------------------------------------------------------------------
  4713.   # * New method: update_position
  4714.   #--------------------------------------------------------------------------
  4715.   def update_position
  4716.     update_misc
  4717.     update_movement
  4718.     update_jumping
  4719.     self.x  = position[:x] + adjust_x
  4720.     self.y  = position[:y] + adjust_y
  4721.     self.z = @battler.screen_z
  4722.     self.ox = @frame_width / 2
  4723.     self.oy = @frame_height + position[:h] + position[:j]
  4724.     @spin += 1 if Graphics.frame_count % 2 == 0
  4725.     self.angle  = @battler.angle + @battler.spin * @spin
  4726.   end
  4727.   #--------------------------------------------------------------------------
  4728.   # * New method: update_misc
  4729.   #--------------------------------------------------------------------------
  4730.   def update_misc
  4731.     @battler.update_shake
  4732.     @battler.update_freeze
  4733.   end
  4734.   #--------------------------------------------------------------------------
  4735.   # * New method: adjust_x
  4736.   #--------------------------------------------------------------------------
  4737.   def adjust_x
  4738.     @battler.x_adj + [1, -1].random * rand(@battler.shake + 1)
  4739.   end
  4740.   #--------------------------------------------------------------------------
  4741.   # * New method: adjust_y
  4742.   #--------------------------------------------------------------------------
  4743.   def adjust_y
  4744.     @battler.y_adj + [1, -1].random * rand(@battler.shake + 1)
  4745.   end
  4746.   #--------------------------------------------------------------------------
  4747.   # * New method: update_movement
  4748.   #--------------------------------------------------------------------------
  4749.   def update_movement
  4750.     return if @battler.frozen? || !@battler.moving?
  4751.     @battler.teleport ? update_teleport_movement : update_normal_movement
  4752.   end
  4753.   #--------------------------------------------------------------------------
  4754.   # * New method: update_teleport_movement
  4755.   #--------------------------------------------------------------------------
  4756.   def update_teleport_movement
  4757.     @battler.current_position[:x] = @battler.target_position[:x]
  4758.     @battler.current_position[:y] = @battler.target_position[:y]
  4759.     @battler.current_position[:h] = [@battler.target_position[:h], 0].max
  4760.     @battler.teleport = false
  4761.   end
  4762.   #--------------------------------------------------------------------------
  4763.   # * New method: update_normal_movement
  4764.   #--------------------------------------------------------------------------
  4765.   def update_normal_movement
  4766.     distance = set_distance
  4767.     move     = {x: 1.0, y: 1.0, h: 1.0}
  4768.     if distance[:x].abs < distance[:y].abs
  4769.       move[:x] = 1.0 / (distance[:y].abs.to_f / distance[:x].abs)
  4770.     elsif distance[:y].abs < distance[:x].abs
  4771.       move[:y] = 1.0 / (distance[:x].abs.to_f / distance[:y].abs)
  4772.     elsif distance[:h].abs < distance[:x].abs
  4773.       move[:h] = 1.0 / (distance[:x].abs.to_f / distance[:h].abs)
  4774.     end
  4775.     speed = set_speed(distance)
  4776.     x = move[:x] * speed[:x]
  4777.     y = move[:y] * speed[:y]
  4778.     h = move[:h] * speed[:h]
  4779.     set_movement(x, y, h)
  4780.   end
  4781.   #--------------------------------------------------------------------------
  4782.   # * New method: set_distance
  4783.   #--------------------------------------------------------------------------
  4784.   def set_distance
  4785.     x = @battler.target_distance(:x)
  4786.     y = @battler.target_distance(:y)
  4787.     h = @battler.target_distance(:h)
  4788.     {x: x, y: y, h: h}
  4789.   end
  4790.   #--------------------------------------------------------------------------
  4791.   # * New method: set_speed
  4792.   #--------------------------------------------------------------------------
  4793.   def set_speed(distance)
  4794.     move_speed = @battler.move_speed
  4795.     x = move_speed * (distance[:x] == 0 ? 0 : (distance[:x] > 0 ? 8 : -8))
  4796.     y = move_speed * (distance[:y] == 0 ? 0 : (distance[:y] > 0 ? 8 : -8))
  4797.     h = move_speed * (distance[:h] == 0 ? 0 : (distance[:h] > 0 ? 8 : -8))
  4798.     {x: x, y: y, h: h}
  4799.   end
  4800.   #--------------------------------------------------------------------------
  4801.   # * New method: set_movement
  4802.   #--------------------------------------------------------------------------
  4803.   def set_movement(x, y, h)
  4804.     target  = @battler.target_position
  4805.     current = @battler.current_position
  4806.     current[:x] += x
  4807.     current[:y] += y
  4808.     current[:h] += h
  4809.     current[:x] = target[:x] if in_distance?(current[:x], target[:x], x)
  4810.     current[:y] = target[:y] if in_distance?(current[:y], target[:y], y)
  4811.     current[:h] = target[:h] if in_distance?(current[:h], target[:h], h)
  4812.   end
  4813.   #--------------------------------------------------------------------------
  4814.   # * New method: in_distance?
  4815.   #--------------------------------------------------------------------------
  4816.   def in_distance?(x, y, z)
  4817.     x.between?(y - z - 1, y + z + 1)
  4818.   end
  4819.   #--------------------------------------------------------------------------
  4820.   # * New method: update_jumping
  4821.   #--------------------------------------------------------------------------
  4822.   def update_jumping
  4823.     return if @battler.jumping[:count] == 0 || @battler.frozen?
  4824.     jump = @battler.jumping
  4825.     jump[:count] = [jump[:count] - (1 * jump[:speed] / 10.0), 0].max.to_f
  4826.     count = jump[:count]
  4827.     speed = jump[:speed]
  4828.     peak  = jump[:height]
  4829.     result = (peak ** 2 - (count - peak).abs ** 2) / 2
  4830.     @battler.current_position[:j] = [result, 0].max
  4831.   end
  4832.   #--------------------------------------------------------------------------
  4833.   # * New method: update_icon
  4834.   #--------------------------------------------------------------------------
  4835.   def update_icon
  4836.     @battler.icon_list.each do |key, value|
  4837.       icon = @icon_list[key]
  4838.       @icon_list[key] = Sprite_Icon.new(self, value) if !icon
  4839.       icon.refresh       if icon && value[:icon] != icon.icon
  4840.       icon.value = value if icon && icon.value != value
  4841.     end
  4842.     @icon_list.each do |key, value|
  4843.       value.update
  4844.       delete_icon(key) if value && !@battler.icon_list[key]
  4845.     end
  4846.   end
  4847.   #--------------------------------------------------------------------------
  4848.   # * New method: update_throw
  4849.   #--------------------------------------------------------------------------
  4850.   def update_throw
  4851.     @battler.throw_list.each do |value|
  4852.       @throw_list.push(Sprite_Throw.new(self, value.dup))
  4853.       @battler.throw_list.delete(value)
  4854.     end
  4855.     @throw_list.each_with_index do |value, index|
  4856.       value.update
  4857.       delete_throw(index) if value.disposing?
  4858.     end
  4859.     @throw_list.compact!
  4860.   end
  4861.   #--------------------------------------------------------------------------
  4862.   # * New method: delete_icon
  4863.   #--------------------------------------------------------------------------
  4864.   def delete_icon(key)
  4865.     @icon_list[key].dispose
  4866.     @icon_list.delete(key)
  4867.   end
  4868.   #--------------------------------------------------------------------------
  4869.   # * New method: delete_throw
  4870.   #--------------------------------------------------------------------------
  4871.   def delete_throw(index)
  4872.     @throw_list[index].dispose
  4873.     @throw_list.delete_at(index)
  4874.   end
  4875.   #--------------------------------------------------------------------------
  4876.   # * New method: throwing?
  4877.   #--------------------------------------------------------------------------
  4878.   def throwing?
  4879.     !@throw_list.empty?
  4880.   end
  4881.   #--------------------------------------------------------------------------
  4882.   # * New method: update_pose_loop_anim
  4883.   #--------------------------------------------------------------------------
  4884.   def update_pose_loop_anim
  4885.     if @battler.pose_loop_anim && !loop_anim?(:pose_anim)
  4886.       @pose_name_list = @battler.pose_name_list.first
  4887.       animation = {type: :pose_anim, anim: @battler.pose_loop_anim, loop: 1}    
  4888.       add_loop_animation(animation)
  4889.     end
  4890.     if @battler.pose_loop_anim && loop_anim?(:pose_anim) &&
  4891.        @pose_name_list != @battler.pose_name_list.first
  4892.       @pose_loop_anim = nil
  4893.       @battler.pose_loop_anim = nil
  4894.       end_loop_anim(:pose_anim)
  4895.     end
  4896.   end
  4897. end
  4898.  
  4899. #==============================================================================
  4900. # ** Spriteset_Battle
  4901. #------------------------------------------------------------------------------
  4902. #  This class brings together battle screen sprites. It's used within the
  4903. # Scene_Battle class.
  4904. #==============================================================================
  4905.  
  4906. class Spriteset_Battle
  4907.   #--------------------------------------------------------------------------
  4908.   # * Overwrite method: create_actors
  4909.   #--------------------------------------------------------------------------
  4910.   def create_actors
  4911.     @actor_sprites = $game_party.battle_members.reverse.collect do |actor|
  4912.       Sprite_Battler.new(@viewport1, actor)
  4913.     end
  4914.     @actors_party = $game_party.battle_members.dup
  4915.   end
  4916.   #--------------------------------------------------------------------------
  4917.   # * Alias method: initialize
  4918.   #--------------------------------------------------------------------------
  4919.   alias :initialize_ve_animated_battle :initialize
  4920.   def initialize
  4921.     init_action_plane
  4922.     initialize_ve_animated_battle
  4923.   end
  4924.   #--------------------------------------------------------------------------
  4925.   # * Alias method: update
  4926.   #--------------------------------------------------------------------------
  4927.   alias :update_ve_animated_battle :update
  4928.   def update
  4929.     update_ve_animated_battle
  4930.     update_action_plane
  4931.   end
  4932.   #--------------------------------------------------------------------------
  4933.   # * Alias method: dispose
  4934.   #--------------------------------------------------------------------------
  4935.   alias :dispose_ve_animated_battle :dispose
  4936.   def dispose
  4937.     dispose_ve_animated_battle
  4938.     dispose_action_plane
  4939.   end
  4940.   #--------------------------------------------------------------------------
  4941.   # * Alias method: create_pictures
  4942.   #--------------------------------------------------------------------------
  4943.   alias :create_pictures_ve_animated_battle :create_pictures
  4944.   def create_pictures
  4945.     battler_sprites.each {|battler| battler.setup_positions }
  4946.     create_pictures_ve_animated_battle
  4947.   end
  4948.   #--------------------------------------------------------------------------
  4949.   # * Alias method: create_viewports
  4950.   #--------------------------------------------------------------------------
  4951.   alias :create_viewports_ve_animated_battle :create_viewports
  4952.   def create_viewports
  4953.     create_viewports_ve_animated_battle
  4954.     @viewport4   = Viewport.new
  4955.     @viewport4.z = 200
  4956.   end
  4957.   #--------------------------------------------------------------------------
  4958.   # * Alias method: update_viewports
  4959.   #--------------------------------------------------------------------------
  4960.   alias :update_viewports_ve_animated_battle :update_viewports
  4961.   def update_viewports
  4962.     update_viewports_ve_animated_battle
  4963.     @viewport1.ox = [1, -1].random * rand($game_troop.screen.shake)
  4964.     @viewport1.oy = [1, -1].random * rand($game_troop.screen.shake)
  4965.     @back1_sprite.tone.set($game_troop.screen.low_tone) if @back1_sprite
  4966.     @back2_sprite.tone.set($game_troop.screen.low_tone) if @back2_sprite
  4967.     @viewport4.tone.set($game_troop.screen.high_tone)
  4968.   end
  4969.   #--------------------------------------------------------------------------
  4970.   # * New method: action?
  4971.   #--------------------------------------------------------------------------
  4972.   def action?(subject)
  4973.     battler_sprites.compact.any? do |sprite|
  4974.       sprite.subject == subject && sprite.battler != subject
  4975.     end
  4976.   end
  4977.   #--------------------------------------------------------------------------
  4978.   # * New method: init_action_plane
  4979.   #--------------------------------------------------------------------------
  4980.   def init_action_plane
  4981.     @action_plane = Action_Plane.new(@viewport1)
  4982.   end
  4983.   #--------------------------------------------------------------------------
  4984.   # * New method: update_action_plane
  4985.   #--------------------------------------------------------------------------
  4986.   def update_action_plane
  4987.     @action_plane.update
  4988.   end
  4989.   #--------------------------------------------------------------------------
  4990.   # * New method: dispose_action_plane
  4991.   #--------------------------------------------------------------------------
  4992.   def dispose_action_plane
  4993.     @action_plane.dispose
  4994.   end
  4995.   #--------------------------------------------------------------------------
  4996.   # * New method: action_plane
  4997.   #--------------------------------------------------------------------------
  4998.   def action_plane(name, x, y, z, zx, zy, opacity, blend, duration)
  4999.     @action_plane.setup(name, x, y, z, zx, zy, opacity, blend, duration)
  5000.   end
  5001.   #--------------------------------------------------------------------------
  5002.   # * New method: delete_plane
  5003.   #--------------------------------------------------------------------------
  5004.   def delete_plane(duration)
  5005.     @action_plane.delete(duration)
  5006.   end
  5007. end
  5008.  
  5009. #==============================================================================
  5010. # ** Window_BattleLog
  5011. #------------------------------------------------------------------------------
  5012. #  This window shows the battle progress. Do not show the window frame.
  5013. #==============================================================================
  5014.  
  5015. class Window_BattleLog < Window_Selectable
  5016.   #--------------------------------------------------------------------------
  5017.   # * Overwrite method: wait_and_clear
  5018.   #--------------------------------------------------------------------------
  5019.   def wait_and_clear
  5020.   end
  5021.   #--------------------------------------------------------------------------
  5022.   # * Overwrite method: wait
  5023.   #--------------------------------------------------------------------------
  5024.   def wait
  5025.   end
  5026.   #--------------------------------------------------------------------------
  5027.   # * Overwrite method: back_to
  5028.   #--------------------------------------------------------------------------
  5029.   def back_to(line_number)
  5030.   end
  5031.   #--------------------------------------------------------------------------
  5032.   # * Overwrite method: display_added_states
  5033.   #--------------------------------------------------------------------------
  5034.   def display_added_states(target)
  5035.     target.result.added_state_objects.each do |state|
  5036.       state_msg = target.actor? ? state.message1 : state.message2
  5037.       next if state_msg.empty?
  5038.       replace_text(target.name + state_msg)
  5039.       wait
  5040.     end
  5041.   end
  5042.   #--------------------------------------------------------------------------
  5043.   # * Alias method: wait_and_clear
  5044.   #--------------------------------------------------------------------------
  5045.   alias :add_text_ve_animated_battle :add_text
  5046.   def add_text(text)
  5047.     skip_second_line while @lines.size > max_line_number
  5048.     add_text_ve_animated_battle(text)
  5049.   end
  5050.   #--------------------------------------------------------------------------
  5051.   # * New method: skip_second_line
  5052.   #--------------------------------------------------------------------------
  5053.   def skip_second_line
  5054.     first_line = @lines.shift
  5055.     @lines.shift
  5056.     @lines.unshift(first_line)
  5057.   end
  5058.   #--------------------------------------------------------------------------
  5059.   # * New method: wait_message_end
  5060.   #--------------------------------------------------------------------------
  5061.   def wait_message_end
  5062.     @method_wait.call(message_speed) if @method_wait && line_number > 0
  5063.     clear
  5064.   end
  5065. end
  5066.  
  5067. #==============================================================================
  5068. # ** Scene_Battle
  5069. #------------------------------------------------------------------------------
  5070. #  This class performs battle screen processing.
  5071. #==============================================================================
  5072.  
  5073. class Scene_Battle < Scene_Base
  5074.   #--------------------------------------------------------------------------
  5075.   # * Public Instance Variables
  5076.   #--------------------------------------------------------------------------
  5077.   attr_reader   :subject
  5078.   #--------------------------------------------------------------------------
  5079.   # * Overwrite method: abs_wait_short
  5080.   #--------------------------------------------------------------------------
  5081.   def abs_wait_short
  5082.     update_for_wait
  5083.   end
  5084.   #--------------------------------------------------------------------------
  5085.   # * Overwrite method: apply_item_effects
  5086.   #--------------------------------------------------------------------------
  5087.   def apply_item_effects(target, item)
  5088.     target.item_apply(@subject, item)
  5089.     refresh_status
  5090.     @log_window.display_action_results(target, item)
  5091.   end
  5092.   #--------------------------------------------------------------------------
  5093.   # * Overwrite method: execute_action
  5094.   #--------------------------------------------------------------------------
  5095.   def execute_action
  5096.     @subject.activate
  5097.     use_item
  5098.   end
  5099.   #--------------------------------------------------------------------------
  5100.   # * Overwrite method: use_item
  5101.   #--------------------------------------------------------------------------
  5102.   def use_item
  5103.     item = @subject.current_action.item
  5104.     @log_window.display_use_item(@subject, item)
  5105.     @subject.action_pose(item)
  5106.     @subject.use_item(item)
  5107.     refresh_status
  5108.   end
  5109.   #--------------------------------------------------------------------------
  5110.   # * Overwrite method: show_animation
  5111.   #--------------------------------------------------------------------------
  5112.   def show_animation(targets, animation_id)
  5113.     if animation_id < 0
  5114.       show_animated_battle_attack_animation(targets)
  5115.     else
  5116.       show_normal_animation(targets, animation_id)
  5117.     end
  5118.     wait_for_animation
  5119.   end
  5120.   #--------------------------------------------------------------------------
  5121.   # * Overwrite method: invoke_counter_attack
  5122.   #--------------------------------------------------------------------------
  5123.   def invoke_counter_attack(target, item)
  5124.     if target == @subject
  5125.       apply_item_effects(apply_substitute(target, item), item)
  5126.       return
  5127.     end
  5128.     target.setup_counter(@subject)
  5129.     @counter_flag.push(target)
  5130.   end
  5131.   #--------------------------------------------------------------------------
  5132.   # * Overwrite method: invoke_magic_reflection
  5133.   #--------------------------------------------------------------------------
  5134.   def invoke_magic_reflection(target, item)
  5135.     if target == @subject
  5136.       apply_item_effects(apply_substitute(target, item), item)
  5137.       return
  5138.     end
  5139.     @subject.setup_reflect(item)
  5140.     @reflect_flag.push(target)
  5141.   end
  5142.   #--------------------------------------------------------------------------
  5143.   # * Overwrite method: apply_substitute
  5144.   #--------------------------------------------------------------------------
  5145.   def apply_substitute(target, item)
  5146.     if check_substitute(target, item)
  5147.       substitute = target.friends_unit.substitute_battler
  5148.       if substitute && target != substitute
  5149.         @substitution = {target: target, substitute: substitute}
  5150.         substitute.setup_substitute(target)
  5151.         return substitute
  5152.       end
  5153.     end
  5154.     target
  5155.   end
  5156.   #--------------------------------------------------------------------------
  5157.   # * Alias method: create_spriteset
  5158.   #--------------------------------------------------------------------------
  5159.   alias :create_spriteset_ve_animated_battle :create_spriteset
  5160.   def create_spriteset
  5161.     create_spriteset_ve_animated_battle
  5162.     setup_spriteset
  5163.   end
  5164.   #--------------------------------------------------------------------------
  5165.   # * Alias method: update_basic
  5166.   #--------------------------------------------------------------------------
  5167.   alias :update_basic_ve_animated_battle :update_basic
  5168.   def update_basic
  5169.     update_basic_ve_animated_battle
  5170.     update_sprite_action
  5171.   end
  5172.   #--------------------------------------------------------------------------
  5173.   # * Alias method: process_action
  5174.   #--------------------------------------------------------------------------
  5175.   alias :process_action_ve_animated_battle :process_action
  5176.   def process_action
  5177.     return if active?
  5178.     process_action_ve_animated_battle
  5179.   end
  5180.   #--------------------------------------------------------------------------
  5181.   # * Alias method: turn_end
  5182.   #--------------------------------------------------------------------------
  5183.   alias :turn_end_ve_animated_battle :turn_end
  5184.   def turn_end
  5185.     turn_end_ve_animated_battle
  5186.     @spriteset.battler_sprites.each {|sprite| sprite.reset_pose }
  5187.   end
  5188.   #--------------------------------------------------------------------------
  5189.   # * Alias method: next_command
  5190.   #--------------------------------------------------------------------------
  5191.   alias :next_command_ve_animated_battle :next_command
  5192.   def next_command
  5193.     BattleManager.set_active_pose
  5194.     BattleManager.actor.input_pose   if BattleManager.actor
  5195.     next_command_ve_animated_battle
  5196.     BattleManager.actor.command_pose if BattleManager.actor
  5197.   end
  5198.   #--------------------------------------------------------------------------
  5199.   # * Alias method: prior_command
  5200.   #--------------------------------------------------------------------------
  5201.   alias :prior_command_ve_animated_battle :prior_command
  5202.   def prior_command
  5203.     BattleManager.actor.cancel_pose  if BattleManager.actor
  5204.     prior_command_ve_animated_battle
  5205.     BattleManager.clear_active_pose
  5206.     BattleManager.actor.command_pose if BattleManager.actor
  5207.   end
  5208.   #--------------------------------------------------------------------------
  5209.   # * New method: close_window
  5210.   #--------------------------------------------------------------------------
  5211.   def close_window
  5212.     abs_wait(10)
  5213.     update_for_wait while @message_window.openness > 0
  5214.     $game_message.clear
  5215.   end
  5216.   #--------------------------------------------------------------------------
  5217.   # * New method: setup_spriteset
  5218.   #--------------------------------------------------------------------------
  5219.   def setup_spriteset
  5220.     battlers = $game_party.battle_members + $game_troop.members
  5221.     battlers.each {|member| member.default_direction }
  5222.     members = $game_party.movable_members + $game_troop.movable_members
  5223.     members.each do |member|
  5224.       next if $game_system.no_intro || !member.intro_pose?
  5225.       member.call_pose(:intro, :clear)
  5226.     end
  5227.     2.times { @spriteset.update }
  5228.   end
  5229.   #--------------------------------------------------------------------------
  5230.   # * New method: log_window_wait?
  5231.   #--------------------------------------------------------------------------
  5232.   def log_window_wait?
  5233.     @log_window.line_number > 0
  5234.   end
  5235.   #--------------------------------------------------------------------------
  5236.   # * New method: log_window_clear
  5237.   #--------------------------------------------------------------------------
  5238.   def log_window_clear
  5239.     @log_window.clear
  5240.   end
  5241.   #--------------------------------------------------------------------------
  5242.   # * New method: show_animated_battle_attack_animation
  5243.   #--------------------------------------------------------------------------
  5244.   def show_animated_battle_attack_animation(targets)
  5245.     if @subject.actor? || $imported[:ve_actor_battlers]
  5246.       show_normal_animation(targets, @subject.atk_animation_id1, false)
  5247.     else
  5248.       Sound.play_enemy_attack
  5249.       abs_wait_short
  5250.     end
  5251.   end
  5252.   #--------------------------------------------------------------------------
  5253.   # * New method: next_subject?
  5254.   #--------------------------------------------------------------------------
  5255.   def next_subject?
  5256.     !@subject || !@subject.current_action
  5257.   end
  5258.   #--------------------------------------------------------------------------
  5259.   # * New method: active?
  5260.   #--------------------------------------------------------------------------
  5261.   def active?
  5262.     members = $game_troop.members + $game_party.battle_members
  5263.     members.any? {|member| member.active? }
  5264.   end
  5265.   #--------------------------------------------------------------------------
  5266.   # * New method: active?
  5267.   #--------------------------------------------------------------------------
  5268.   def active
  5269.     members = $game_troop.members + $game_party.battle_members
  5270.     members.select {|member| member.active? }.first
  5271.   end
  5272.   #--------------------------------------------------------------------------
  5273.   # * New method: update_sprite_action
  5274.   #--------------------------------------------------------------------------
  5275.   def update_sprite_action
  5276.     @old_subject = @subject
  5277.     battlers = $game_party.battle_members + $game_troop.members
  5278.     battlers.each do |subject|
  5279.       @subject = subject
  5280.       call_animation if @subject.call_anim
  5281.       call_effect    if @subject.call_effect
  5282.       call_end       if @subject.call_end
  5283.     end
  5284.     @subject = @old_subject
  5285.   end
  5286.   #--------------------------------------------------------------------------
  5287.   # * New method: call_animation
  5288.   #--------------------------------------------------------------------------
  5289.   def call_animation
  5290.     @subject.call_anim = false
  5291.     animation = @subject.animation
  5292.     @subject.animation = 0
  5293.     show_animation(@subject.targets, animation)
  5294.   end
  5295.   #--------------------------------------------------------------------------
  5296.   # * New method: call_effect
  5297.   #--------------------------------------------------------------------------
  5298.   def call_effect
  5299.     @counter_flag = []
  5300.     @reflect_flag = []
  5301.     @substitution = nil
  5302.     @subject.call_effect = false
  5303.     targets = @subject.target_list.dup
  5304.     item    = @subject.current_item
  5305.     @subject.target_list.clear
  5306.     targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  5307.     @counter_flag.each {|target| @log_window.display_counter(target, item) }
  5308.     @reflect_flag.each {|target| @log_window.display_reflection(target, item) }
  5309.     if @substitution
  5310.       substitute = @substitution[:substitute]
  5311.       target     = @substitution[:target]
  5312.       @log_window.display_substitute(substitute, target)
  5313.     end
  5314.   end
  5315.   #--------------------------------------------------------------------------
  5316.   # * New method: call_end
  5317.   #--------------------------------------------------------------------------
  5318.   def call_end
  5319.     @subject.call_end = false
  5320.     process_action_end if @subject.alive?
  5321.     @log_window.wait_message_end
  5322.   end
  5323. end
  5324.  
  5325. #==============================================================================
  5326. # ** Sprite_Object
  5327. #------------------------------------------------------------------------------
  5328. #  This the base sprite used to display icons and throw animations.
  5329. #==============================================================================
  5330.  
  5331. class Sprite_Object < Sprite_Base
  5332.   #--------------------------------------------------------------------------
  5333.   # * Public Instance Variables
  5334.   #--------------------------------------------------------------------------
  5335.   attr_accessor :value
  5336.   #--------------------------------------------------------------------------
  5337.   # * initialize
  5338.   #--------------------------------------------------------------------------
  5339.   def initialize(viewport)
  5340.     super(viewport)
  5341.     @right    = @battler.right?
  5342.     @left     = @battler.left?
  5343.     @down     = @battler.down?
  5344.     @up       = @battler.up?
  5345.     @spin     = 0
  5346.     @zooming  = 0
  5347.     @fade_in  = 0
  5348.     @fade_out = 0
  5349.     self.zoom_x = value[:izm]
  5350.     self.zoom_y = value[:izm]
  5351.   end
  5352.   #--------------------------------------------------------------------------
  5353.   # * update
  5354.   #--------------------------------------------------------------------------
  5355.   def update
  5356.     super
  5357.     update_zoom
  5358.     update_angle
  5359.     update_opacity
  5360.     update_position
  5361.   end
  5362.   #--------------------------------------------------------------------------
  5363.   # * update_opacity
  5364.   #--------------------------------------------------------------------------
  5365.   def update_opacity
  5366.     if value[:fin] > 0
  5367.       @fade_in += 1
  5368.       self.opacity = [@fade_in * value[:fin], value[:o]].min
  5369.     elsif value[:fout] > 0
  5370.       @fade_out += 1
  5371.       self.opacity = [value[:o] - @fade_out * value[:fin], 0].max
  5372.     else
  5373.       self.opacity =  value[:o]
  5374.     end
  5375.   end
  5376.   #--------------------------------------------------------------------------
  5377.   # * update_angle
  5378.   #--------------------------------------------------------------------------
  5379.   def update_angle
  5380.     @spin += 1 if Graphics.frame_count % 2 == 0
  5381.     self.angle  = value[:a] + value[:spin] * @spin
  5382.     self.angle *= -1 if @right
  5383.     self.angle -= 90 if @up
  5384.     self.angle += 90 if @down
  5385.     self.angle  = 360 + self.angle if self.angle < 0
  5386.   end
  5387.   #--------------------------------------------------------------------------
  5388.   # * update_zoom
  5389.   #--------------------------------------------------------------------------
  5390.   def update_zoom
  5391.     if self.zoom_x < value[:ezm]
  5392.       @zooming += 1
  5393.       self.zoom_x = [value[:izm] + @zooming * value[:szm], value[:ezm]].min
  5394.       self.zoom_y = [value[:izm] + @zooming * value[:szm], value[:ezm]].min
  5395.     elsif self.zoom_x > value[:ezm]
  5396.       @zooming += 1
  5397.       self.zoom_x = [value[:izm] - @zooming * value[:szm], value[:ezm]].max
  5398.       self.zoom_y = [value[:izm] - @zooming * value[:szm], value[:ezm]].max
  5399.     end
  5400.   end
  5401.   #--------------------------------------------------------------------------
  5402.   # * icon
  5403.   #--------------------------------------------------------------------------
  5404.   def icon
  5405.     value[:icon]
  5406.   end
  5407.   #--------------------------------------------------------------------------
  5408.   # * icon_changed?
  5409.   #--------------------------------------------------------------------------
  5410.   def icon_changed?
  5411.     @icon_value != (value[:image] ?  value[:image] : icon)
  5412.   end
  5413.   #--------------------------------------------------------------------------
  5414.   # * setup_icon
  5415.   #--------------------------------------------------------------------------
  5416.   def setup_icon
  5417.     @icon_value = value[:image] ?  value[:image].dup : icon
  5418.     if value[:image]
  5419.       self.bitmap = Cache.picture(value[:image])
  5420.       self.src_rect.set(0, 0, bitmap.width, bitmap.height)
  5421.       @icon_ox = bitmap.width  / 2
  5422.       @icon_oy = bitmap.height / 2
  5423.     else
  5424.       self.bitmap = Cache.system("Iconset")
  5425.       self.src_rect.set(icon % 16 * 24, icon / 16 * 24, 24, 24)
  5426.       @icon_ox = 12
  5427.       @icon_oy = 12
  5428.     end
  5429.   end  
  5430. end
  5431.  
  5432. #==============================================================================
  5433. # ** Sprite_Icon
  5434. #------------------------------------------------------------------------------
  5435. #  This sprite is used to display icons.
  5436. #==============================================================================
  5437.  
  5438. class Sprite_Icon < Sprite_Object
  5439.   #--------------------------------------------------------------------------
  5440.   # * initialize
  5441.   #--------------------------------------------------------------------------
  5442.   def initialize(battler, value)
  5443.     @battler = battler
  5444.     @value   = value.dup
  5445.     super(battler.viewport)
  5446.     setup_icon
  5447.   end
  5448.   #--------------------------------------------------------------------------
  5449.   # * update_position
  5450.   #--------------------------------------------------------------------------
  5451.   def update_position
  5452.     setup_icon if icon_changed?
  5453.     self.x  = @battler.x
  5454.     self.y  = @battler.y + (value[:above] ? 1 : -1)
  5455.     self.z  = @battler.z
  5456.     self.ox = @icon_ox
  5457.     self.oy = @icon_oy
  5458.     if @right || @left
  5459.       angle_move(:x, (@right ? adjust_x : -adjust_x))
  5460.       angle_move(:y, adjust_y)
  5461.     elsif @up || @down
  5462.       angle_move(:x, (@down ? adjust_y : -adjust_y))
  5463.       angle_move(:y, (@down ? adjust_x : -adjust_x) - 8)
  5464.     end
  5465.     self.mirror = @right
  5466.   end
  5467.   #--------------------------------------------------------------------------
  5468.   # * angle_move
  5469.   #--------------------------------------------------------------------------
  5470.   def angle_move(axis, amount)
  5471.     a = (360 - angle) * Math::PI / 180
  5472.     cos = Math.cos(a)
  5473.     sin = Math.sin(a)
  5474.     self.ox += (axis == :x ? -cos : -sin) * amount
  5475.     self.oy += (axis == :x ?  sin : -cos) * amount
  5476.   end
  5477.   #--------------------------------------------------------------------------
  5478.   # * adjust_x
  5479.   #--------------------------------------------------------------------------
  5480.   def adjust_x
  5481.     @battler.ox / 2 - value[:x]
  5482.   end
  5483.   #--------------------------------------------------------------------------
  5484.   # * adjust_y
  5485.   #--------------------------------------------------------------------------
  5486.   def adjust_y
  5487.     value[:y] - position[:h] - position[:j] - @battler.oy / 2
  5488.   end
  5489.   #--------------------------------------------------------------------------
  5490.   # * position
  5491.   #--------------------------------------------------------------------------
  5492.   def position
  5493.     @battler.position
  5494.   end
  5495. end
  5496.  
  5497. #==============================================================================
  5498. # ** Sprite_Throw
  5499. #------------------------------------------------------------------------------
  5500. #  This sprite is used to display throw animations.
  5501. #==============================================================================
  5502.  
  5503. class Sprite_Throw < Sprite_Object
  5504.   #--------------------------------------------------------------------------
  5505.   # * initialize
  5506.   #--------------------------------------------------------------------------
  5507.   def initialize(target, settings)
  5508.     @battler = settings[:user]
  5509.     @target  = target
  5510.     @value   = settings.dup
  5511.     super(target.viewport)
  5512.     setup_throw
  5513.   end
  5514.   #--------------------------------------------------------------------------
  5515.   # * setup_throw
  5516.   #--------------------------------------------------------------------------
  5517.   def setup_throw
  5518.     set_initial_position
  5519.     setup_arc
  5520.     setup_icon
  5521.     setup_animation if $imported[:ve_loop_animation] && value[:anim]
  5522.   end
  5523.   #--------------------------------------------------------------------------
  5524.   # * set_initial_position
  5525.   #--------------------------------------------------------------------------
  5526.   def set_initial_position
  5527.     if value[:return]
  5528.       @current_position = @target.position.dup
  5529.       @target_position  = @battler.position.dup
  5530.       init_ox = @target.right?  ? -value[:init_x] : value[:init_x]
  5531.       init_oy = @target.up?     ? -value[:init_y] : value[:init_y]
  5532.       end_ox  = @battler.right? ? -value[:end_x]  : value[:end_x]
  5533.       end_oy  = @battler.up?    ? -value[:end_y]  : value[:end_y]
  5534.     else
  5535.       @current_position = @battler.position.dup
  5536.       @target_position  = @target.position.dup
  5537.       init_ox = @battler.right? ? -value[:init_x] : value[:init_x]
  5538.       init_oy = @battler.up?    ? -value[:init_x] : value[:init_x]
  5539.       end_ox  = @target.right?  ? -value[:end_x]  : value[:end_x]
  5540.       end_oy  = @target.up?     ? -value[:end_y]  : value[:end_y]
  5541.     end
  5542.     @current_position[:x] += value[:init_x] + init_ox
  5543.     @current_position[:y] += value[:init_y] + init_oy
  5544.     @target_position[:x]  += value[:end_x]  + end_ox
  5545.     @target_position[:y]  += value[:end_y]  + end_oy
  5546.     @initial_position = @current_position.dup
  5547.   end
  5548.   #--------------------------------------------------------------------------
  5549.   # * setup_arc
  5550.   #--------------------------------------------------------------------------
  5551.   def setup_arc
  5552.     @arc = {}
  5553.     x_plus = (target_distance(:x) / 32.0).abs
  5554.     y_plus = (target_distance(:y) / 32.0).abs
  5555.     speed = Math.sqrt((x_plus ** 2) + (y_plus ** 2)) / value[:speed]
  5556.     @arc[:speed]  = value[:arc] * 5.0 / [speed, 1].max
  5557.     @arc[:height] = value[:arc]
  5558.     @arc[:count]  = value[:arc] * 2
  5559.     @current_position[:a] = 0
  5560.   end
  5561.   #--------------------------------------------------------------------------
  5562.   # * setup_icon
  5563.   #--------------------------------------------------------------------------
  5564.   def setup_icon
  5565.     super
  5566.     self.angle = value[:a]
  5567.   end
  5568.   #--------------------------------------------------------------------------
  5569.   # * setup_animation
  5570.   #--------------------------------------------------------------------------
  5571.   def setup_animation
  5572.     animation = {type: :throw, anim: value[:anim], loop: 1}
  5573.     add_loop_animation(animation)
  5574.   end
  5575.   #--------------------------------------------------------------------------
  5576.   # * update
  5577.   #--------------------------------------------------------------------------
  5578.   def update
  5579.     super
  5580.     update_move
  5581.     update_arc
  5582.   end
  5583.   #--------------------------------------------------------------------------
  5584.   # * update_move
  5585.   #--------------------------------------------------------------------------
  5586.   def update_move
  5587.     distance = set_distance
  5588.     move     = {x: 1.0, y: 1.0}
  5589.     if distance[:x].abs < distance[:y].abs
  5590.       move[:x] = 1.0 / (distance[:y].abs.to_f / distance[:x].abs)
  5591.     elsif distance[:y].abs < distance[:x].abs
  5592.       move[:y] = 1.0 / (distance[:x].abs.to_f / distance[:y].abs)
  5593.     end
  5594.     speed = set_speed(distance)
  5595.     x = move[:x] * speed[:x]
  5596.     y = move[:y] * speed[:y]
  5597.     set_movement(x, y)
  5598.   end
  5599.   #--------------------------------------------------------------------------
  5600.   # * set_distance
  5601.   #--------------------------------------------------------------------------
  5602.   def set_distance
  5603.     {x: target_distance(:x), y: target_distance(:y)}
  5604.   end
  5605.   #--------------------------------------------------------------------------
  5606.   # * target_distance
  5607.   #--------------------------------------------------------------------------
  5608.   def target_distance(symbol)
  5609.     @target_position[symbol] - @current_position[symbol]
  5610.   end
  5611.   #--------------------------------------------------------------------------
  5612.   # * set_speed
  5613.   #--------------------------------------------------------------------------
  5614.   def set_speed(distance)
  5615.     x = value[:speed] * (distance[:x] == 0 ? 0 : (distance[:x] > 0 ? 8 : -8))
  5616.     y = value[:speed] * (distance[:y] == 0 ? 0 : (distance[:y] > 0 ? 8 : -8))
  5617.     {x: x, y: y}
  5618.   end
  5619.   #--------------------------------------------------------------------------
  5620.   # * set_movement
  5621.   #--------------------------------------------------------------------------
  5622.   def set_movement(x, y)
  5623.     target  = @target_position
  5624.     current = @current_position
  5625.     current[:x] += x
  5626.     current[:y] += y
  5627.     current[:x] = target[:x] if in_distance?(current[:x], target[:x], x)
  5628.     current[:y] = target[:y] if in_distance?(current[:y], target[:y], y)
  5629.   end
  5630.   #--------------------------------------------------------------------------
  5631.   # * in_distance?
  5632.   #--------------------------------------------------------------------------
  5633.   def in_distance?(x, y, z)
  5634.     x.between?(y - z - 1, y + z + 1)
  5635.   end
  5636.   #--------------------------------------------------------------------------
  5637.   # * update_arc
  5638.   #--------------------------------------------------------------------------
  5639.   def update_arc
  5640.     return if @arc[:count] == 0
  5641.     @arc[:count] = [@arc[:count] - (1 * @arc[:speed] / 10.0), 0].max.to_f
  5642.     count = @arc[:count]
  5643.     speed = @arc[:speed]
  5644.     peak  = @arc[:height]  
  5645.     result = (peak ** 2 - (count - peak).abs ** 2) / 2
  5646.     @current_position[:a] = value[:revert] ? -result : result
  5647.   end
  5648.   #--------------------------------------------------------------------------
  5649.   # * update_position
  5650.   #--------------------------------------------------------------------------
  5651.   def update_position
  5652.     setup_icon if icon_changed?
  5653.     self.x = current[:x]
  5654.     self.y = current[:y] - current[:h] - current[:a]
  5655.     self.z = @battler.z + value[:z]
  5656.     self.ox = @icon_ox
  5657.     self.oy = @icon_oy
  5658.     self.mirror = @right || @up
  5659.   end
  5660.   #--------------------------------------------------------------------------
  5661.   # * current
  5662.   #--------------------------------------------------------------------------
  5663.   def current
  5664.     @current_position
  5665.   end
  5666.   #--------------------------------------------------------------------------
  5667.   # * target
  5668.   #--------------------------------------------------------------------------
  5669.   def target
  5670.     @target_position
  5671.   end
  5672.   #--------------------------------------------------------------------------
  5673.   # * disposing?
  5674.   #--------------------------------------------------------------------------
  5675.   def disposing?
  5676.     current[:x] == target[:x] && current[:y] == target[:y]
  5677.   end
  5678. end
  5679.  
  5680. #==============================================================================
  5681. # ** Action_Plane
  5682. #------------------------------------------------------------------------------
  5683. #  
  5684. #==============================================================================
  5685.  
  5686. class Action_Plane < Plane
  5687.   #--------------------------------------------------------------------------
  5688.   # * initialize
  5689.   #--------------------------------------------------------------------------
  5690.   def initialize(viewport)
  5691.     super(viewport)
  5692.     @settings = {x: 0, y: 0, opacity: 0, zoom_x: 1.0, zoom_y: 1.0}
  5693.     @duration = 1
  5694.   end
  5695.   #--------------------------------------------------------------------------
  5696.   # * dispose
  5697.   #--------------------------------------------------------------------------
  5698.   def dispose
  5699.     bitmap.dispose if bitmap
  5700.     super
  5701.   end
  5702.   #--------------------------------------------------------------------------
  5703.   # * setup
  5704.   #--------------------------------------------------------------------------
  5705.   def setup(name, x, y, z, zoom_x, zoom_y, opacity, blend, duration)
  5706.     self.bitmap = Cache.picture(name)
  5707.     self.z = z
  5708.     @settings[:x] = x
  5709.     @settings[:y] = y
  5710.     @settings[:zoom_x]  = zoom_x / 100.0
  5711.     @settings[:zoom_y]  = zoom_y / 100.0
  5712.     @settings[:opacity] = opacity
  5713.     @blend_type = blend
  5714.     @delete     = false
  5715.     @duration   = [duration, 1].max
  5716.   end
  5717.   #--------------------------------------------------------------------------
  5718.   # * delete
  5719.   #--------------------------------------------------------------------------
  5720.   def delete(duration = 60)
  5721.     @settings[:opacity] = 0
  5722.     @duration = [duration, 1].max
  5723.     @delete   = true
  5724.   end
  5725.   #--------------------------------------------------------------------------
  5726.   # * value
  5727.   #--------------------------------------------------------------------------
  5728.   def value
  5729.     @settings
  5730.   end
  5731.   #--------------------------------------------------------------------------
  5732.   # * update
  5733.   #--------------------------------------------------------------------------
  5734.   def update
  5735.     update_position
  5736.     update_opacity
  5737.     update_zoom
  5738.     update_delete
  5739.     @duration -= 1 if @duration > 0
  5740.   end
  5741.   #--------------------------------------------------------------------------
  5742.   # * update_position
  5743.   #--------------------------------------------------------------------------
  5744.   def update_position
  5745.     self.ox += value[:x]
  5746.     self.oy += value[:y]
  5747.   end
  5748.   #--------------------------------------------------------------------------
  5749.   # * update_opacity
  5750.   #--------------------------------------------------------------------------
  5751.   def update_opacity
  5752.     return if @duration == 0
  5753.     d = @duration
  5754.     self.opacity = (self.opacity * (d - 1) + value[:opacity]) / d
  5755.   end
  5756.   #--------------------------------------------------------------------------
  5757.   # * update_zoom
  5758.   #--------------------------------------------------------------------------
  5759.   def update_zoom
  5760.     return if @duration == 0
  5761.     d = @duration
  5762.     self.zoom_x = (self.zoom_x * (d - 1) + value[:zoom_x]) / d
  5763.     self.zoom_y = (self.zoom_y * (d - 1) + value[:zoom_y]) / d
  5764.   end
  5765.   #--------------------------------------------------------------------------
  5766.   # * update_delete
  5767.   #--------------------------------------------------------------------------
  5768.   def update_delete
  5769.     return if !@delete || @duration > 0
  5770.     self.bitmap.dispose
  5771.     self.bitmap = nil
  5772.     @settings   = {x: 0, y: 0, opacity: 0, zoom_x: 100.0, zoon_y: 100.0}
  5773.     @blend_type = 0
  5774.     @delete = false
  5775.   end
  5776. end
Advertisement
Add Comment
Please, Sign In to add comment