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

Project1

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

[有事请教] 关于我涛到的一个超级横版战斗(VA)的问题。

[复制链接]

Lv2.观梦者

梦石
0
星屑
780
在线时间
924 小时
注册时间
2006-6-26
帖子
1529
跳转到指定楼层
1
发表于 2012-11-11 22:17:41 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我也不知道属于什么范畴。姑且发水区,反正水区人多些。







麻烦各位帮忙看看,这每一行的动作是些什么?什么攻击啊,防御啊,我能看出来,但是有些动作我看不出来,准备、施放模仿,前进,后退,什么的,我不知道那一行对应的是什么动作?




图片出自此脚本范例。

RUBY 代码复制
  1. #==============================================================================
  2. # ** Victor Engine - Basic Module
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Version History:
  7. #  v 1.00 - 2011.12.19 > First relase
  8. #  v 1.01 - 2011.12.21 > Added Event Troop notes
  9. #  v 1.02 - 2011.12.22 > Added character frames value
  10. #  v 1.03 - 2011.12.30 > Added Actor and Enemy notes
  11. #  v 1.04 - 2012.01.01 > Added party average level and map actors
  12. #  v 1.05 - 2012.01.04 > Compatibility for Characters Scripts
  13. #  v 1.06 - 2012.01.07 > Compatibility for Fog and Light Effect
  14. #                      > Added new Sprite Character functions
  15. #  v 1.07 - 2012.01.11 > Compatibility for Control Text and Codes
  16. #  v 1.08 - 2012.01.13 > Compatibility for Trait Control
  17. #  v 1.09 - 2012.01.15 > Fixed the Regular Expressions problem with "" and “”
  18. #  v 1.10 - 2012.01.18 > Compatibility for Automatic Battlers
  19. #  v 1.11 - 2012.01.20 > Compatibility for Followers Options
  20. #  v 1.12 - 2012.01.26 > Compatibility for Animated Battle
  21. #------------------------------------------------------------------------------
  22. #   This is the basic script for the system from Victory Engine and is
  23. # required to use the scripts from the engine. This script offer some new
  24. # functions to be used within many scripts of the engine.
  25. #------------------------------------------------------------------------------
  26. # Compatibility
  27. #   Required for the Victor Engine
  28. #
  29. # * Overwrite methods (Default)
  30. #   module Cache
  31. #     def self.character(filename)
  32. #
  33. #   class Sprite_Character < Sprite_Base
  34. #     def set_character_bitmap
  35. #
  36. # * Alias methods (Default)
  37. #   class Game_Interpreter
  38. #     def command_108
  39. #
  40. #   class Window_Base < Window
  41. #     def convert_escape_characters(text)
  42. #
  43. #------------------------------------------------------------------------------
  44. # Instructions:
  45. #  To instal the script, open you script editor and paste this script on
  46. #  a new section on bellow the Materials section.
  47. #
  48. #------------------------------------------------------------------------------
  49. # New functions
  50. #
  51. # * Random number between two vales
  52. #   rand_between(min, max)
  53. #    min : min value
  54. #    max : max value
  55. #   Can be called from any class, this method return an random value between
  56. #   two specific numbers
  57. #
  58. # * Random array value
  59. #   <Array>.random
  60. #   <Array>.random!
  61. #   Returns a random object from the array, the method .random! is destructive,
  62. #   removing the value returned from the array.
  63. #
  64. # * Sum of the numeric values of a array
  65. #   <Array>.sum
  66. #   Returns the sum of all numeric values
  67. #
  68. # * Avarage of all numeric values from the array
  69. #   <Array>.average(float = false)
  70. #    float : float flag
  71. #   Returns the average of all numeric values, if floa is true, the value
  72. #   returned is a float, otherwise it's a integer.
  73. #
  74. # * Note for events
  75. #   <Event>.note
  76. #   By default, events doesn't have note boxes. This command allows to use
  77. #   comments as note boxes, following the same format as the ones on the
  78. #   database. Returns all comments on the active page of the event.
  79. #
  80. # * Comment calls
  81. #   <Event>.comment_call
  82. #   Another function for comment boxes, by default, they have absolutely no
  83. #   effect in game when called. But this method allows to make the comment
  84. #   box to behave like an script call, but with the versatility of the
  85. #   note boxes. Remember that the commands will only take effect if there
  86. #   is scripts to respond to the comment code.
  87. #
  88. #==============================================================================
  89.  
  90. #==============================================================================
  91. # ** Victor Engine
  92. #------------------------------------------------------------------------------
  93. #   Setting module for the Victor Engine
  94. #==============================================================================
  95.  
  96. module Victor_Engine
  97. end
  98.  
  99. $imported = {} if !$imported
  100. $imported[:ve_basic] = true
  101.  
  102. #==============================================================================
  103. # ** Object
  104. #------------------------------------------------------------------------------
  105. #  This class is the superclass of all other classes.
  106. #==============================================================================
  107.  
  108. class Object
  109.   #--------------------------------------------------------------------------
  110.   # * Include setting module
  111.   #--------------------------------------------------------------------------
  112.   include Victor_Engine
  113.   #-------------------------------------------------------------------------
  114.   # * New method: rand_between
  115.   #-------------------------------------------------------------------------
  116.   def rand_between(min, max)
  117.     min + rand(max - min + 1)
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # * New method: numeric?
  121.   #--------------------------------------------------------------------------
  122.   def numeric?
  123.     return false
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # * New method: float?
  127.   #--------------------------------------------------------------------------
  128.   def float?
  129.     return false
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # * New method: item?
  133.   #--------------------------------------------------------------------------
  134.   def item?
  135.     return false
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # * New method: skill?
  139.   #--------------------------------------------------------------------------
  140.   def skill?
  141.     return false
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # * New method: file_exist?
  145.   #--------------------------------------------------------------------------
  146.   def file_exist?(path, filename)
  147.     $file_list ||= {}
  148.     $file_list[path] ||= get_file_list(path)
  149.     $file_list[path].include?(filename)
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # * New method: et_file_list
  153.   #--------------------------------------------------------------------------
  154.   def get_file_list(path)
  155.     Dir.entries("#{path}").collect {|name| name.slice(/[^\.]*/) }
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # * New method: character_exist?
  159.   #--------------------------------------------------------------------------
  160.   def character_exist?(filename)
  161.     file_exist?("Graphics/Characters/", filename)
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # * New method: battler_exist?
  165.   #--------------------------------------------------------------------------
  166.   def battler_exist?(filename)
  167.     file_exist?("Graphics/Battlers/", filename)
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # * New method: get_filename
  171.   #--------------------------------------------------------------------------
  172.   def get_filename
  173.     "[\"'“‘]([^\"'”‘”’]+)[\"'”’]"
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # * New method: make_symbol
  177.   #--------------------------------------------------------------------------
  178.   def make_symbol(string)
  179.     string.downcase.gsub(" ", "_").to_sym
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # * New method: make_string
  183.   #--------------------------------------------------------------------------
  184.   def make_string(symbol)
  185.     symbol.to_s.gsub("_", " ").upcase
  186.   end
  187. end
  188.  
  189. #==============================================================================
  190. # ** Numeric
  191. #------------------------------------------------------------------------------
  192. #  This is the abstract class for numbers.
  193. #==============================================================================
  194.  
  195. class Numeric
  196.   #--------------------------------------------------------------------------
  197.   # * New method: numeric?
  198.   #--------------------------------------------------------------------------
  199.   def numeric?
  200.     return true
  201.   end
  202. end
  203.  
  204. #==============================================================================
  205. # ** Float
  206. #------------------------------------------------------------------------------
  207. #  This is the abstract class for the floating point values.
  208. #==============================================================================
  209.  
  210. class Float
  211.   #--------------------------------------------------------------------------
  212.   # * New method: float?
  213.   #--------------------------------------------------------------------------
  214.   def float?
  215.     return true
  216.   end
  217. end
  218.  
  219. #==============================================================================
  220. # ** Array     
  221. #------------------------------------------------------------------------------
  222. #  This class store arbitrary Ruby objects.
  223. #==============================================================================
  224.  
  225. class Array
  226.   #-------------------------------------------------------------------------
  227.   # * New method: random
  228.   #-------------------------------------------------------------------------
  229.   def random
  230.     self[rand(size)]
  231.   end
  232.   #-------------------------------------------------------------------------
  233.   # * New method: random!
  234.   #-------------------------------------------------------------------------
  235.   def random!
  236.     self.delete_at(rand(size))
  237.   end
  238.   #---------------------------------------------------------------------------
  239.   # * New method: sum
  240.   #---------------------------------------------------------------------------
  241.   def sum
  242.     self.inject(0) {|r, n| r += (n.numeric? ? n : 0)}
  243.   end
  244.   #---------------------------------------------------------------------------
  245.   # * New method: average
  246.   #---------------------------------------------------------------------------
  247.   def average(float = false)
  248.     self.sum / [(float ? size.to_f : size.to_i), 1].max
  249.   end
  250.   #---------------------------------------------------------------------------
  251.   # * New method: next_item
  252.   #---------------------------------------------------------------------------
  253.   def next_item
  254.     item = self.shift
  255.     self.push(item)
  256.     item
  257.   end
  258.   #---------------------------------------------------------------------------
  259.   # * New method: previous_item
  260.   #---------------------------------------------------------------------------
  261.   def previous_item
  262.     item = self.pop
  263.     self.unshift(item)
  264.     item
  265.   end
  266. end
  267.  
  268. #==============================================================================
  269. # ** RPG::Troop::Page
  270. #------------------------------------------------------------------------------
  271. #  This is the data class for battle events (pages).
  272. #==============================================================================
  273.  
  274. class RPG::Troop::Page
  275.   #--------------------------------------------------------------------------
  276.   # * New method: note
  277.   #--------------------------------------------------------------------------
  278.   def note
  279.     return "" if !@list || @list.size <= 0
  280.     comment_list = []
  281.     @list.each do |item|
  282.       next unless item && (item.code == 108 || item.code == 408)
  283.       comment_list.push(item.parameters[0])
  284.     end
  285.     comment_list.join("\r\n")
  286.   end
  287. end
  288.  
  289. #==============================================================================
  290. # ** RPG::Skill
  291. #------------------------------------------------------------------------------
  292. #  This is the data class for skills.
  293. #==============================================================================
  294.  
  295. class RPG::Skill
  296.   #--------------------------------------------------------------------------
  297.   # * New method: item?
  298.   #--------------------------------------------------------------------------
  299.   def item?
  300.     return false
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # * New method: skill?
  304.   #--------------------------------------------------------------------------
  305.   def skill?
  306.     return true
  307.   end
  308. end
  309.  
  310. #==============================================================================
  311. # ** RPG::Item
  312. #------------------------------------------------------------------------------
  313. #  This is the data class for sitems.
  314. #==============================================================================
  315.  
  316. class RPG::Item
  317.   #--------------------------------------------------------------------------
  318.   # * New method: item?
  319.   #--------------------------------------------------------------------------
  320.   def item?
  321.     return true
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # * New method: skill?
  325.   #--------------------------------------------------------------------------
  326.   def skill?
  327.     return false
  328.   end
  329. end
  330.  
  331. #==============================================================================
  332. # ** RPG::UsableItem
  333. #------------------------------------------------------------------------------
  334. #  This is the superclass for skills and items.
  335. #==============================================================================
  336.  
  337. class RPG::UsableItem < RPG::BaseItem
  338.   #--------------------------------------------------------------------------
  339.   # * New method: for_all_targets?
  340.   #--------------------------------------------------------------------------
  341.   def for_all_targets?
  342.     return false
  343.   end
  344. end
  345.  
  346. #==============================================================================
  347. # ** Cache
  348. #------------------------------------------------------------------------------
  349. #  This module loads each of graphics, creates a Bitmap object, and retains it.
  350. # To speed up load times and conserve memory, this module holds the created
  351. # Bitmap object in the internal hash, allowing the program to return
  352. # preexisting objects when the same bitmap is requested again.
  353. #==============================================================================
  354.  
  355. module Cache
  356.   #--------------------------------------------------------------------------
  357.   # * New method: character
  358.   #--------------------------------------------------------------------------
  359.   def self.character(filename, hue = 0)
  360.     load_bitmap("Graphics/Characters/", filename, hue)
  361.   end
  362. end
  363.  
  364. #==============================================================================
  365. # ** Game_BattlerBase
  366. #------------------------------------------------------------------------------
  367. #  This class handles battlers. It's used as a superclass of the Game_Battler
  368. # classes.
  369. #==============================================================================
  370.  
  371. class Game_BattlerBase
  372.   #--------------------------------------------------------------------------
  373.   # * Public Instance Variables
  374.   #--------------------------------------------------------------------------
  375.   attr_reader   :buffs
  376.   #--------------------------------------------------------------------------
  377.   # * New method: get_cond
  378.   #--------------------------------------------------------------------------
  379.   def get_cond(text)
  380.     case text.upcase
  381.     when "HIGHER"    then ">"
  382.     when "LOWER"     then "<"
  383.     when "EQUAL"     then "=="
  384.     when "DIFFERENT" then "!="
  385.     else "!="
  386.     end
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # * New method: get_param
  390.   #--------------------------------------------------------------------------
  391.   def get_param(text)
  392.     case text.upcase
  393.     when "MAXHP" then self.mhp
  394.     when "MAXMP" then self.mmp
  395.     when "MAXTP" then self.max_tp
  396.     else eval("self.#{text.downcase}")
  397.     end
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # * New method: get_param_id
  401.   #--------------------------------------------------------------------------
  402.   def get_param_id(text)
  403.     case text.upcase
  404.     when "MAXHP", "HP" then 0
  405.     when "MAXMP", "MP" then 1
  406.     when "ATK" then 2
  407.     when "DEF" then 3
  408.     when "MAT" then 4
  409.     when "MDF" then 5
  410.     when "AGI" then 6
  411.     when "LUK" then 7
  412.     end
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # * New method: danger?
  416.   #--------------------------------------------------------------------------
  417.   def danger?
  418.     hp < mhp * 25 / 100
  419.   end
  420. end
  421.  
  422. #==============================================================================
  423. # ** Game_Enemy
  424. #------------------------------------------------------------------------------
  425. #  This class handles enemy characters. It's used within the Game_Troop class
  426. # ($game_troop).
  427. #==============================================================================
  428.  
  429. class Game_Enemy < Game_Battler
  430.   #--------------------------------------------------------------------------
  431.   # * New method: note
  432.   #--------------------------------------------------------------------------
  433.   def note
  434.     enemy ? enemy.note : ""
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # * New method: get_all_notes
  438.   #--------------------------------------------------------------------------
  439.   def get_all_notes
  440.     result = note
  441.     states.compact.each {|state| result += state.note }
  442.     result
  443.   end
  444. end
  445.  
  446. #==============================================================================
  447. # ** Game_Actor
  448. #------------------------------------------------------------------------------
  449. #  This class handles actors. It's used within the Game_Actors class
  450. # ($game_actors) and referenced by the Game_Party class ($game_party).
  451. #==============================================================================
  452.  
  453. class Game_Actor < Game_Battler
  454.   #--------------------------------------------------------------------------
  455.   # * New method: note
  456.   #--------------------------------------------------------------------------
  457.   def note
  458.     actor ? actor.note : ""
  459.   end
  460.   #--------------------------------------------------------------------------
  461.   # * New method: hue
  462.   #--------------------------------------------------------------------------
  463.   def hue
  464.     @hue ? @hue : 0
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # * New method: get_all_notes
  468.   #--------------------------------------------------------------------------
  469.   def get_all_notes
  470.     result = note
  471.     result += self.class.note
  472.     equips.compact.each {|equip| result += equip.note }
  473.     states.compact.each {|state| result += state.note }
  474.     result
  475.   end
  476. end
  477.  
  478. #==============================================================================
  479. # ** Game_Party
  480. #------------------------------------------------------------------------------
  481. #  This class handles the party. It includes information on amount of gold
  482. # and items. The instance of this class is referenced by $game_party.
  483. #==============================================================================
  484.  
  485. class Game_Party < Game_Unit
  486.   #--------------------------------------------------------------------------
  487.   # * New method: average_level
  488.   #--------------------------------------------------------------------------
  489.   def average_level
  490.     battle_members.collect {|actor| actor.level }.average
  491.   end
  492. end
  493.  
  494. #==============================================================================
  495. # ** Game_Map
  496. #------------------------------------------------------------------------------
  497. #  This class handles maps. It includes scrolling and passage determination
  498. # functions. The instance of this class is referenced by $game_map.
  499. #==============================================================================
  500.  
  501. class Game_Map
  502.   #--------------------------------------------------------------------------
  503.   # * New method: event_list
  504.   #--------------------------------------------------------------------------
  505.   def event_list
  506.     events.values
  507.   end
  508.   #--------------------------------------------------------------------------
  509.   # * New method: note
  510.   #--------------------------------------------------------------------------
  511.   def note
  512.     @map ? @map.note : ""
  513.   end
  514.   #--------------------------------------------------------------------------
  515.   # * New method: vehicles
  516.   #--------------------------------------------------------------------------
  517.   def vehicles
  518.     @vehicles
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # * New method: actors
  522.   #--------------------------------------------------------------------------
  523.   def actors
  524.     [$game_player] + $game_player.followers.visible_folloers
  525.   end
  526. end
  527.  
  528. #==============================================================================
  529. # ** Game_CharacterBase
  530. #------------------------------------------------------------------------------
  531. #  This class deals with characters. Common to all characters, stores basic
  532. # data, such as coordinates and graphics. It's used as a superclass of the
  533. # Game_Character class.
  534. #==============================================================================
  535.  
  536. class Game_CharacterBase
  537.   #--------------------------------------------------------------------------
  538.   # * Public Instance Variables
  539.   #--------------------------------------------------------------------------
  540.   attr_accessor :move_speed
  541.   attr_accessor :move_frequency
  542.   #--------------------------------------------------------------------------
  543.   # * New method: is_player?
  544.   #--------------------------------------------------------------------------
  545.   def is_player?
  546.     return false
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # * New method: is_event?
  550.   #--------------------------------------------------------------------------
  551.   def is_event?
  552.     return false
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # * New method: is_follower?
  556.   #--------------------------------------------------------------------------
  557.   def is_follower?
  558.     return false
  559.   end
  560.   #--------------------------------------------------------------------------
  561.   # * New method: is_vehicle?
  562.   #--------------------------------------------------------------------------
  563.   def is_vehicle?
  564.     return false
  565.   end
  566.   #--------------------------------------------------------------------------
  567.   # * New method: frames
  568.   #--------------------------------------------------------------------------
  569.   def frames
  570.     return 3
  571.   end
  572.   #--------------------------------------------------------------------------
  573.   # * New method: hue
  574.   #--------------------------------------------------------------------------
  575.   def hue
  576.     @hue ? @hue : 0
  577.   end
  578. end
  579.  
  580. #==============================================================================
  581. # ** Game_Player
  582. #------------------------------------------------------------------------------
  583. #  This class handles the player.
  584. # The instance of this class is referenced by $game_map.
  585. #==============================================================================
  586.  
  587. class Game_Player < Game_Character
  588.   #--------------------------------------------------------------------------
  589.   # * New method: is_player?
  590.   #--------------------------------------------------------------------------
  591.   def is_player?
  592.     return true
  593.   end
  594.   #--------------------------------------------------------------------------
  595.   # * New method: perform_transfer
  596.   #--------------------------------------------------------------------------
  597.   def new_map_id
  598.     @new_map_id
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # * New method: hue
  602.   #--------------------------------------------------------------------------
  603.   def hue
  604.     actor ? actor.hue : 0
  605.   end
  606. end
  607.  
  608. #==============================================================================
  609. # ** Game_Follower
  610. #------------------------------------------------------------------------------
  611. #  This class handles the followers. Followers are the actors of the party
  612. # that follows the leader in a line. It's used within the Game_Followers class.
  613. #==============================================================================
  614.  
  615. class Game_Follower < Game_Character
  616.   #--------------------------------------------------------------------------
  617.   # * New method: is_follower?
  618.   #--------------------------------------------------------------------------
  619.   def is_follower?
  620.     return true
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # * New method: index
  624.   #--------------------------------------------------------------------------
  625.   def index
  626.     @member_index
  627.   end
  628. end
  629.  
  630. #==============================================================================
  631. # ** Game_Vehicle
  632. #------------------------------------------------------------------------------
  633. #  This class handles vehicles. It's used within the Game_Map class. If there
  634. # are no vehicles on the current map, the coordinates is set to (-1,-1).
  635. #==============================================================================
  636.  
  637. class Game_Vehicle < Game_Character
  638.   #--------------------------------------------------------------------------
  639.   # * New method: is_vehicle?
  640.   #--------------------------------------------------------------------------
  641.   def is_vehicle?
  642.     return true
  643.   end
  644.   #--------------------------------------------------------------------------
  645.   # * New method: map_id
  646.   #--------------------------------------------------------------------------
  647.   def map_id
  648.     @map_id
  649.   end
  650. end
  651.  
  652. #==============================================================================
  653. # ** Game_Event
  654. #------------------------------------------------------------------------------
  655. #  This class deals with events. It handles functions including event page
  656. # switching via condition determinants, and running parallel process events.
  657. # It's used within the Game_Map class.
  658. #==============================================================================
  659.  
  660. class Game_Event < Game_Character
  661.   #--------------------------------------------------------------------------
  662.   # * New method: name
  663.   #--------------------------------------------------------------------------
  664.   def name
  665.     @event.name
  666.   end
  667.   #--------------------------------------------------------------------------
  668.   # * New method: is_event?
  669.   #--------------------------------------------------------------------------
  670.   def is_event?
  671.     return true
  672.   end
  673.   #--------------------------------------------------------------------------
  674.   # * New method: note
  675.   #--------------------------------------------------------------------------
  676.   def note
  677.     return "" if !@page || !@page.list || @page.list.size <= 0
  678.     comment_list = []
  679.     @page.list.each do |item|
  680.       next unless item && (item.code == 108 || item.code == 408)
  681.       comment_list.push(item.parameters[0])
  682.     end
  683.     comment_list.join("\r\n")
  684.   end  
  685. end
  686.  
  687. #==============================================================================
  688. # ** Game_Interpreter
  689. #------------------------------------------------------------------------------
  690. #  An interpreter for executing event commands. This class is used within the
  691. # Game_Map, Game_Troop, and Game_Event classes.
  692. #==============================================================================
  693.  
  694. class Game_Interpreter
  695.   #--------------------------------------------------------------------------
  696.   # * Alias method: command_108
  697.   #--------------------------------------------------------------------------
  698.   alias :command_108_ve_basic_module :command_108
  699.   def command_108
  700.     command_108_ve_basic_module
  701.     comment_call
  702.   end
  703.   #--------------------------------------------------------------------------
  704.   # * New method: comment_call
  705.   #--------------------------------------------------------------------------
  706.   def comment_call
  707.   end
  708.   #--------------------------------------------------------------------------
  709.   # * New method: note
  710.   #--------------------------------------------------------------------------
  711.   def note
  712.     @comments ? @comments.join("\r\n") : ""
  713.   end
  714. end
  715.  
  716. #==============================================================================
  717. # ** Sprite_Character
  718. #------------------------------------------------------------------------------
  719. #  This sprite is used to display characters. It observes a instance of the
  720. # Game_Character class and automatically changes sprite conditions.
  721. #==============================================================================
  722.  
  723. class Sprite_Character < Sprite_Base
  724.   #--------------------------------------------------------------------------
  725.   # * Overwrite method: set_character_bitmap
  726.   #--------------------------------------------------------------------------
  727.   def set_character_bitmap
  728.     update_character_info
  729.     set_bitmap
  730.     set_bitmap_position
  731.   end
  732.   #--------------------------------------------------------------------------
  733.   # * New method: center_y
  734.   #--------------------------------------------------------------------------
  735.   def actor?
  736.     @character.is_a?(Game_Player) || @character.is_a?(Game_Follower)
  737.   end
  738.   #--------------------------------------------------------------------------
  739.   # * New method: center_y
  740.   #--------------------------------------------------------------------------
  741.   def actor
  742.     actor? ? @character.actor : nil
  743.   end
  744.   #--------------------------------------------------------------------------
  745.   # * New method: update_character_info
  746.   #--------------------------------------------------------------------------
  747.   def update_character_info
  748.   end
  749.   #--------------------------------------------------------------------------
  750.   # * New method: hue
  751.   #--------------------------------------------------------------------------
  752.   def hue
  753.     @character.hue
  754.   end
  755.   #--------------------------------------------------------------------------
  756.   # * New method: set_bitmap
  757.   #--------------------------------------------------------------------------
  758.   def set_bitmap
  759.     self.bitmap = Cache.character(set_bitmap_name, hue)
  760.   end
  761.   #--------------------------------------------------------------------------
  762.   # * New method: set_bitmap_name
  763.   #--------------------------------------------------------------------------
  764.   def set_bitmap_name
  765.     @character_name
  766.   end
  767.   #--------------------------------------------------------------------------
  768.   # * New method: set_bitmap_position
  769.   #--------------------------------------------------------------------------
  770.   def set_bitmap_position
  771.     sign = get_sign
  772.     if sign && sign.include?('$')
  773.       @cw = bitmap.width / @character.frames
  774.       @ch = bitmap.height / 4
  775.     else
  776.       @cw = bitmap.width / (@character.frames * 4)
  777.       @ch = bitmap.height / 8
  778.     end
  779.     self.ox = @cw / 2
  780.     self.oy = @ch
  781.   end
  782.   #--------------------------------------------------------------------------
  783.   # * New method: get_sign
  784.   #--------------------------------------------------------------------------
  785.   def get_sign
  786.     @character_name[/^[\!\$]./]
  787.   end
  788. end
  789.  
  790. #==============================================================================
  791. # ** Sprite_Battler
  792. #------------------------------------------------------------------------------
  793. #  This sprite is used to display battlers. It observes a instance of the
  794. # Game_Battler class and automatically changes sprite conditions.
  795. #==============================================================================
  796.  
  797. class Sprite_Battler < Sprite_Base
  798.   #--------------------------------------------------------------------------
  799.   # * Public Instance Variables
  800.   #--------------------------------------------------------------------------
  801.   attr_accessor :dmg_mirror
  802.   #--------------------------------------------------------------------------
  803.   # * New method: center_x
  804.   #--------------------------------------------------------------------------
  805.   def center_x
  806.     self.ox
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # * New method: center_y
  810.   #--------------------------------------------------------------------------
  811.   def center_y
  812.     self.oy / 2
  813.   end  
  814. end
  815.  
  816. #==============================================================================
  817. # ** Spriteset_Battle
  818. #------------------------------------------------------------------------------
  819. #  This class brings together battle screen sprites. It's used within the
  820. # Scene_Battle class.
  821. #==============================================================================
  822.  
  823. class Spriteset_Battle
  824.   #--------------------------------------------------------------------------
  825.   # * New method: sprite
  826.   #--------------------------------------------------------------------------
  827.   def sprite(subject)
  828.     battler_sprites.compact.select {|sprite| sprite.battler == subject }.first
  829.   end
  830. end
  831.  
  832. #==============================================================================
  833. # ** Window_Base
  834. #------------------------------------------------------------------------------
  835. #  This is a superclass of all windows in the game.
  836. #==============================================================================
  837.  
  838. class Window_Base < Window
  839.   #--------------------------------------------------------------------------
  840.   # * Alias method: convert_escape_characters
  841.   #--------------------------------------------------------------------------
  842.   alias :convert_escape_ve_basic_module :convert_escape_characters
  843.   def convert_escape_characters(text)
  844.     result = text.to_s.clone
  845.     result = text_replace(result)
  846.     result = convert_escape_ve_basic_module(text)
  847.     result
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # * New method: text_replace
  851.   #--------------------------------------------------------------------------
  852.   def text_replace(result)
  853.     result.gsub!(/\r/) { "" }
  854.     result.gsub!(/\\/) { "\e" }
  855.     result
  856.   end
  857. end
  858.  
  859. #==============================================================================
  860. # ** Scene_Battle
  861. #------------------------------------------------------------------------------
  862. #  This class performs battle screen processing.
  863. #==============================================================================
  864.  
  865. class Scene_Battle < Scene_Base
  866.   #--------------------------------------------------------------------------
  867.   # * Public Instance Variables
  868.   #--------------------------------------------------------------------------
  869.   attr_reader   :spriteset
  870. end
  871. #==============================================================================
  872. # ** Victor Engine - Animated Battle
  873. #------------------------------------------------------------------------------
  874. # Author : Victor Sant
  875. #
  876. # Version History:
  877. #  v beta - 2012.01.28 > Beta relase
  878. #------------------------------------------------------------------------------
  879. #  VE - Animated battle Beta
  880. #------------------------------------------------------------------------------
  881. # Compatibility
  882. #   Requires the script 'Victor Engine - Basic Module'
  883. #
  884. #------------------------------------------------------------------------------
  885. # Instructions:
  886. #  To instal the script, open you script editor and paste this script on
  887. #  a new section on bellow the Materials section. This script must also
  888. #  be bellow the script 'Victor Engine - Basic'
  889. #==============================================================================
  890.  
  891. #==============================================================================
  892. # ** Victor Engine
  893. #------------------------------------------------------------------------------
  894. #   Setting module for the Victor Engine
  895. #==============================================================================
  896.  
  897. module Victor_Engine
  898.   #--------------------------------------------------------------------------
  899.   # *
  900.   #--------------------------------------------------------------------------
  901.   VE_ACTION_SETTINGS = {}
  902.   #--------------------------------------------------------------------------
  903.   # *
  904.   #--------------------------------------------------------------------------
  905.   VE_ANIMATED_BATTLER_SUFIX = "[anim]"
  906.  
  907.   VE_BATTLE_INTRO_FADE = true
  908.   #--------------------------------------------------------------------------
  909.   # *
  910.   #--------------------------------------------------------------------------
  911.   VE_POSE_SETTINGS = {
  912.   # Main Poses
  913.   # name:    row,
  914.     idle:     1,   # Idle pose
  915.     guard:    2,   # Guard pose
  916.     evade:    2,   # Evade pose
  917.     danger:   3,   # Low HP pose
  918.     hurt:     4,   # Damage pose
  919.     attack:   5,   # Physical attack pose
  920.     use:      6,   # No type use pose
  921.     item:     6,   # Item use pose
  922.     skill:    7,   # Skill use pose
  923.     magic:    8,   # Magic use pose
  924.     advance:  9,   # Advance pose
  925.     retreat:  10,  # Retreat pose
  926.     escape:   10,  # Escape pose
  927.     victory:  11,  # Victory pose
  928.     intro:    12,  # Battle start pose
  929.     dead:     13,  # Incapacited pose
  930.  
  931.   # Advanced poses,
  932.   # name:           row,
  933.     advance_start:   nil, # Pose before the advance movement start
  934.     retreat_start:   nil, # Pose before the retreat movement start
  935.     advance_end:     nil, # Pose after the advance movement end
  936.     retreat_end:     nil, # Pose after the retreat movement end
  937.     default_cast:    11,  # Default casting pose
  938.     item_cast:       nil, # Item casting pose
  939.     magic_cast:      nil, # Magic casting pose
  940.     skill_cast:      nil, # Skill casting pose
  941.     critical_damage: nil, # Critical damage pose
  942.  
  943.   } # Não remover
  944.   #--------------------------------------------------------------------------
  945.   # *
  946.   #--------------------------------------------------------------------------
  947.   VE_DEFAULT_SPRITE = {frames: 4, rows: 14, mirror: false, mode: :sprite}
  948.   #--------------------------------------------------------------------------
  949.   # *
  950.   #--------------------------------------------------------------------------
  951.   VE_SPRITE_SETTINGS = {
  952.     'Filename' => {frames: 4, rows: 14, mirror: false, mode: :sprite},
  953.  
  954.   }
  955.   #--------------------------------------------------------------------------
  956.   # *
  957.   #--------------------------------------------------------------------------
  958.   VE_DEFAULT_ACTION = "
  959.     <action: idle, loop>
  960.     pose: user, row idle, all frames, wait 8;
  961.     wait: 32;
  962.     </action>
  963.  
  964.     <action: dead, loop>
  965.     pose: user, row dead, all frames, wait 8;
  966.     wait: 32;
  967.     </action>
  968.  
  969.     <action: danger, loop>
  970.     pose: user, row danger, all frames, wait 8;
  971.     wait: 32;
  972.     </action>
  973.  
  974.     <action: intro, reset>
  975.     pose: user, row intro, all frames, wait 16;
  976.     wait: 64;
  977.     </action>
  978.  
  979.     <action: victory>
  980.     pose: user, row victory, all frames, wait 16;
  981.     wait: 64;
  982.     </action>
  983.  
  984.     <action: default cast, loop>
  985.     pose: user, row skill cast, frame 1;
  986.     wait: 32;
  987.     </action>
  988.  
  989.     <action: guarding, loop>
  990.     pose: user, row guard, all frames, wait 12;
  991.     wait: 48;
  992.     </action>
  993.  
  994.     <action: danger, loop>
  995.     pose: user, row idle, all frames, wait 8;
  996.     wait: 32;
  997.     </action>
  998.  
  999.     <action: evade, reset>
  1000.     pose: user, row evade, all frames, wait 4;
  1001.     wait: 16;
  1002.     </action>
  1003.  
  1004.     <action: hurt, reset>
  1005.     pose: user, row hurt, all frames, wait 4;
  1006.     wait: 16
  1007.     </action>
  1008.  
  1009.     <action: inactive>
  1010.     inactive;
  1011.     </action>
  1012.  
  1013.     <action: advance>
  1014.     wait: animation;
  1015.     move: user, move to;
  1016.     jump: user, move, height 7;
  1017.     pose: user, row advance, all frames, wait 4;
  1018.     wait: movement;
  1019.     </action>
  1020.  
  1021.     <action: retreat, reset>
  1022.     move: user, retreat;
  1023.     pose: user, row retreat, all frames, wait 4;
  1024.     wait: movement;
  1025.     </action>
  1026.  
  1027.     <action: escape, reset>
  1028.     move: user, escape;
  1029.     pose: user, row retreat, all frames, wait 4;
  1030.     wait: movement;
  1031.     </action>
  1032.  
  1033.     <action: defend, reset>
  1034.     pose: user, row guard, all frames, wait 8;
  1035.     wait: 4;
  1036.     anim: target, effect;
  1037.     wait: 4;
  1038.     effect: 100%;
  1039.     wait: 20;
  1040.     </action>
  1041.  
  1042.     <action: attack, reset>
  1043.     pose: user, row attack, all frames, wait 4;
  1044.     wait: 4;
  1045.     anim: target, effect;
  1046.     wait: 8;
  1047.     effect: 100%;
  1048.     wait: 20;
  1049.     </action>
  1050.  
  1051.     <action: dual attack, reset>
  1052.     pose: user, row attack, all frames, wait 4;
  1053.     wait: 4;
  1054.     anim: target, weapon 1;
  1055.     wait: 8;
  1056.     effect: 75%, weapon 1;
  1057.     wait: 4;
  1058.     wait: animation;
  1059.     pose: user, row skill, all frames, wait 4;
  1060.     wait: 8;
  1061.     anim: target, weapon 2;
  1062.     wait: 4;
  1063.     effect: 75%, weapon 2;
  1064.     jump: target, height 12, speed 5, hit only;
  1065.     wait: 20;
  1066.     </action>
  1067.  
  1068.     <action: use, reset>
  1069.     wait: animation;
  1070.     pose: user, row item, all frames, wait 4;
  1071.     wait: 4;
  1072.     anim: target, effect;
  1073.     wait: 4;
  1074.     effect: 100%;
  1075.     wait: 20;
  1076.     </action>
  1077.  
  1078.     <action: item, reset>
  1079.     wait: animation;
  1080.     pose: user, row item, all frames, wait 4;
  1081.     wait: 4;
  1082.     anim: target, effect;
  1083.     wait: 4;
  1084.     effect: 100%;
  1085.     wait: 20;
  1086.     </action>
  1087.  
  1088.     <action: magic, reset>
  1089.     wait: animation;
  1090.     pose: user, row magic, all frames, wait 4;
  1091.     wait: 4;
  1092.     anim: target, effect;
  1093.     wait: 8;
  1094.     effect: 100%;
  1095.     wait: 20;
  1096.     </action>
  1097.  
  1098.     <action: skill, reset>
  1099.     pose: user, row attack, all frames, wait 4;
  1100.     wait: 4;
  1101.     anim: target, effect;
  1102.     wait: 8;
  1103.     effect: 100%;
  1104.     wait: 20;
  1105.     </action>
  1106.  
  1107.     <action: throw weapon, reset>
  1108.     pose: user, row attack, all frames, wait 4;
  1109.     action: target, target throw;
  1110.     wait: action;
  1111.     </action>
  1112.  
  1113.     <action: target throw, reset>
  1114.     throw: self, weapon 1, arc 10, spin +45, speed 15;
  1115.     wait: throw;
  1116.     throw: self, weapon 1, arc 10, spin +45, speed 15, return, revert;
  1117.     anim: self, weapon 1;
  1118.     effect: self, 100%;
  1119.     wait: throw;
  1120.     wait: animation;
  1121.     </action>
  1122.  
  1123.  
  1124.     "   
  1125.  
  1126.   VE_ACTION_SETTINGS['Hero_m'] = "
  1127.     <action: advance>
  1128.     wait: animation;
  1129.     move: user, move to;
  1130.     pose: user, row advance, all frames, wait 4;
  1131.     wait: movement;
  1132.     </action>
  1133.  
  1134.      "
  1135.  
  1136.   VE_SPRITE_SETTINGS.default = VE_DEFAULT_SPRITE
  1137. end
  1138. #==============================================================================
  1139. # ** Victor Engine - Animated Battle
  1140. #------------------------------------------------------------------------------
  1141. # Author : Victor Sant
  1142. #
  1143. # Version History:
  1144. #  v beta - 2012.01.28 > Beta relase
  1145. #------------------------------------------------------------------------------
  1146. #  VE - Animated battle Beta
  1147. #------------------------------------------------------------------------------
  1148. # Compatibility
  1149. #   Requires the script 'Victor Engine - Basic Module'
  1150. #
  1151. #------------------------------------------------------------------------------
  1152. # Instructions:
  1153. #  To instal the script, open you script editor and paste this script on
  1154. #  a new section on bellow the Materials section. This script must also
  1155. #  be bellow the script 'Victor Engine - Basic'
  1156. #==============================================================================
  1157.  
  1158. #==============================================================================
  1159. # ** Victor Engine
  1160. #------------------------------------------------------------------------------
  1161. #   Setting module for the Victor Engine
  1162. #==============================================================================
  1163.  
  1164. $imported[:ve_animated_battle] = true
  1165.  
  1166. #==============================================================================
  1167. # ** RPG::Skill
  1168. #------------------------------------------------------------------------------
  1169. #  This is the data class for skills.
  1170. #==============================================================================
  1171.  
  1172. class RPG::Skill
  1173.   #--------------------------------------------------------------------------
  1174.   # *
  1175.   #--------------------------------------------------------------------------
  1176.   def custom_pose?
  1177.     note =~ /<ACTION: CUSTOM([^>]*)>(.*)<\/action>/im
  1178.   end
  1179. end
  1180.  
  1181. #==============================================================================
  1182. # ** RPG::Item
  1183. #------------------------------------------------------------------------------
  1184. #  This is the data class for sitems.
  1185. #==============================================================================
  1186.  
  1187. class RPG::Item
  1188.   #--------------------------------------------------------------------------
  1189.   # *
  1190.   #--------------------------------------------------------------------------
  1191.   def custom_pose?
  1192.     note =~ /<ACTION: CUSTOM([^>]*)>(.*)<\/action>/im
  1193.   end
  1194. end
  1195.  
  1196. #==============================================================================
  1197. # ** RPG::State
  1198. #------------------------------------------------------------------------------
  1199. #  This is the data class for states.
  1200. #==============================================================================
  1201.  
  1202. class RPG::State
  1203.   #--------------------------------------------------------------------------
  1204.   # *
  1205.   #--------------------------------------------------------------------------
  1206.   def state_pose
  1207.     note =~ /<STATE POSE: (\w[\w ]+)>/i ? make_symbol($1) : nil
  1208.   end
  1209. end
  1210.  
  1211. #==============================================================================
  1212. # ** BattleManager
  1213. #------------------------------------------------------------------------------
  1214. #  This module handles the battle processing
  1215. #==============================================================================
  1216.  
  1217. class << BattleManager
  1218.   #--------------------------------------------------------------------------
  1219.   # *
  1220.   #--------------------------------------------------------------------------
  1221.   alias :init_members_ve_animated_battle :init_members
  1222.   def init_members
  1223.     $game_party.members.each {|member| member.clear_poses }
  1224.     init_members_ve_animated_battle
  1225.   end
  1226.   #--------------------------------------------------------------------------
  1227.   # *
  1228.   #--------------------------------------------------------------------------
  1229.   alias :battle_end_ve_animated_battle :battle_end
  1230.   def battle_end(result)
  1231.     $game_party.members.each {|member| member.clear_poses }
  1232.     battle_end_ve_animated_battle(result)
  1233.   end
  1234.   #--------------------------------------------------------------------------
  1235.   # *
  1236.   #--------------------------------------------------------------------------
  1237.   alias :process_victory_ve_animated_battle :process_victory
  1238.   def process_victory
  1239.     process_victory_pose
  1240.     process_victory_ve_animated_battle
  1241.   end
  1242.   #--------------------------------------------------------------------------
  1243.   # *
  1244.   #--------------------------------------------------------------------------
  1245.   alias :process_escape_ve_animated_battle :process_escape
  1246.   def process_escape
  1247.     @escaping = true
  1248.     success   = process_escape_ve_animated_battle
  1249.     @escaping = false
  1250.     return success
  1251.   end
  1252.   #--------------------------------------------------------------------------
  1253.   # *
  1254.   #--------------------------------------------------------------------------
  1255.   alias :process_abort_ve_animated_battle :process_abort
  1256.   def process_abort
  1257.     process_escape_pose if @escaping
  1258.     process_abort_ve_animated_battle
  1259.   end
  1260.   #--------------------------------------------------------------------------
  1261.   # *
  1262.   #--------------------------------------------------------------------------
  1263.   def process_victory_pose
  1264.     SceneManager.scene.update_basic while $game_party.not_in_position?
  1265.     $game_party.movable_members.each do |member|
  1266.       member.clear_idle_poses
  1267.       member.call_pose(:victory)
  1268.     end
  1269.   end
  1270.   #--------------------------------------------------------------------------
  1271.   # *
  1272.   #--------------------------------------------------------------------------
  1273.   def process_escape_pose
  1274.     $game_party.movable_members.each do |member|
  1275.       member.clear_idle_poses
  1276.       member.call_pose(:escape)
  1277.     end
  1278.     5.times { SceneManager.scene.update_basic }
  1279.     SceneManager.scene.update_basic while $game_party.moving?
  1280.   end
  1281.   #--------------------------------------------------------------------------
  1282.   # *
  1283.   #--------------------------------------------------------------------------
  1284.   def set_active_pose
  1285.     return unless actor
  1286.     actor.set_active_pose
  1287.     actor.reset_pose
  1288.   end
  1289.   #--------------------------------------------------------------------------
  1290.   # *
  1291.   #--------------------------------------------------------------------------
  1292.   def clear_active_pose
  1293.     return unless actor
  1294.     actor.active_pose = nil
  1295.     actor.reset_pose
  1296.   end
  1297. end
  1298.  
  1299. #==============================================================================
  1300. # ** Game_ActionResult
  1301. #------------------------------------------------------------------------------
  1302. #  This class handles the results of actions. This class is used within the
  1303. # Game_Battler class.
  1304. #==============================================================================
  1305.  
  1306. class Game_ActionResult
  1307.   #--------------------------------------------------------------------------
  1308.   # * New method: damage_value_adjust
  1309.   #--------------------------------------------------------------------------
  1310.   def damage_value_adjust(value, item)
  1311.     @hp_damage *= value
  1312.     @mp_damage *= value
  1313.     @hp_damage = @hp_damage.to_i
  1314.     @mp_damage = [@battler.mp, @mp_damage.to_i].min
  1315.     @hp_drain = @hp_damage if item.damage.drain?
  1316.     @mp_drain = @mp_damage if item.damage.drain?
  1317.     @hp_drain = [@battler.hp, @hp_drain].min
  1318.   end
  1319. end
  1320.  
  1321. #==============================================================================
  1322. # ** Game_Battler
  1323. #------------------------------------------------------------------------------
  1324. #  This class deals with battlers. It's used as a superclass of the Game_Actor
  1325. # and Game_Enemy classes.
  1326. #==============================================================================
  1327.  
  1328. class Game_Battler < Game_BattlerBase
  1329.   #--------------------------------------------------------------------------
  1330.   # *
  1331.   #--------------------------------------------------------------------------
  1332.   attr_accessor :row
  1333.   attr_accessor :frame
  1334.   attr_accessor :timing
  1335.  
  1336.   attr_accessor :direction
  1337.   attr_accessor :move_speed
  1338.   attr_accessor :jumping
  1339.  
  1340.   attr_accessor :pose_list
  1341.  
  1342.   attr_accessor :immortals
  1343.  
  1344.   attr_accessor :attack_flag
  1345.   attr_accessor :damage_flag
  1346.   attr_accessor :result_flag
  1347.   attr_accessor :target_flag
  1348.  
  1349.   attr_accessor :sufix
  1350.   attr_accessor :active
  1351.   attr_accessor :targets
  1352.   attr_accessor :teleport
  1353.  
  1354.   attr_accessor :call_anim
  1355.   attr_accessor :call_effect
  1356.   attr_accessor :animation
  1357.  
  1358.   attr_accessor :action_targets
  1359.   attr_accessor :active_pose
  1360.   attr_accessor :pose_loop_anim
  1361.  
  1362.   attr_accessor :icon_list
  1363.   attr_accessor :throw_list
  1364.  
  1365.   attr_accessor :current_item
  1366.  
  1367.   attr_accessor :target_position
  1368.   attr_accessor :current_position
  1369.   attr_accessor :default_position
  1370.  
  1371.   #--------------------------------------------------------------------------
  1372.   # *
  1373.   #--------------------------------------------------------------------------
  1374.   alias :initialize_ve_animated_battle :initialize
  1375.   def initialize
  1376.     init_anim_battlers_variables
  1377.     initialize_ve_animated_battle
  1378.   end
  1379.   #--------------------------------------------------------------------------
  1380.   # *
  1381.   #--------------------------------------------------------------------------
  1382.   alias :item_apply_ve_animated_battle :item_apply
  1383.   def item_apply(user, item)
  1384.     item_apply_ve_animated_battle(user, item)
  1385.     call_pose(:hurt, true, item)  if @result.hit? && @result.hp_damage > 0
  1386.     call_pose(:evade, true, item) if @result.evaded
  1387.     call_pose(:critical_damage, true, item) if @result.critical
  1388.     user.result_flag = @result.hit? ? :hit : :miss
  1389.   end
  1390.   #--------------------------------------------------------------------------
  1391.   # * Alias method: make_damage_value
  1392.   #--------------------------------------------------------------------------
  1393.   alias :make_damage_value_ve_animated_battle :make_damage_value
  1394.   def make_damage_value(user, item)
  1395.     make_damage_value_ve_animated_battle(user, item)
  1396.     @result.damage_value_adjust(user.damage_flag, item) if user.damage_flag
  1397.   end
  1398.   #--------------------------------------------------------------------------
  1399.   # *
  1400.   #--------------------------------------------------------------------------
  1401.   alias :regenerate_hp_ve_animated_battle :regenerate_hp
  1402.   def regenerate_hp
  1403.     regenerate_hp_ve_animated_battle
  1404.     call_pose(:hurt, true) if @result.hp_damage > 0
  1405.   end
  1406.   #--------------------------------------------------------------------------
  1407.   # *
  1408.   #--------------------------------------------------------------------------
  1409.   def dead?
  1410.     super && !immortal?
  1411.   end
  1412.   #--------------------------------------------------------------------------
  1413.   # * Renovação
  1414.   #--------------------------------------------------------------------------
  1415.   def refresh
  1416.     state_resist_set.each {|state_id| erase_state(state_id) }
  1417.     @hp = [[@hp, mhp].min, 0].max
  1418.     @mp = [[@mp, mmp].min, 0].max
  1419.     die if @dying && !immortal?
  1420.     return if @dying
  1421.     valid = @hp == 0 && !immortal?
  1422.     valid ? add_state(death_state_id) : remove_state(death_state_id)
  1423.     reset_pose
  1424.   end
  1425.   #--------------------------------------------------------------------------
  1426.   # *
  1427.   #--------------------------------------------------------------------------
  1428.   def immortal?
  1429.     return false unless $game_party.in_battle
  1430.     members = $game_troop.members + $game_party.battle_members
  1431.     members.any? {|member| member.immortals.include?(self) }
  1432.   end
  1433.   #--------------------------------------------------------------------------
  1434.   # *
  1435.   #--------------------------------------------------------------------------
  1436.   alias :die_ve_animated_battle :die
  1437.   def die
  1438.     return @dying = true if immortal?
  1439.     @dying = false
  1440.     die_ve_animated_battle
  1441.   end
  1442.   #--------------------------------------------------------------------------
  1443.   # *
  1444.   #--------------------------------------------------------------------------
  1445.   def init_anim_battlers_variables
  1446.     clear_poses
  1447.   end
  1448.   #--------------------------------------------------------------------------
  1449.   # *
  1450.   #--------------------------------------------------------------------------
  1451.   def clear_poses
  1452.     @sufix = ""
  1453.     @row   = 0
  1454.     @frame = 0
  1455.     @direction  = 2
  1456.     @move_speed = 1.0
  1457.     @pose_list  = []
  1458.     @targets    = []
  1459.     @immortals  = []
  1460.     @throw_list = []
  1461.     @icon_list  = {}
  1462.     @timing     = {}
  1463.     @action_targets   = []
  1464.     @target_position  = {x: 0, y: 0, h: 0, j: 0}
  1465.     @current_position = {x: 0, y: 0, h: 0, j: 0}
  1466.     @default_position = {x: 0, y: 0, h: 0, j: 0}
  1467.   end
  1468.   #--------------------------------------------------------------------------
  1469.   # *
  1470.   #--------------------------------------------------------------------------
  1471.   def call_pose(symbol, insert = false, item = nil, battler = nil)
  1472.     @pose_list.shift if insert && pose_name_list.first == symbol
  1473.     pose  = make_string(symbol)
  1474.     note  = item ? item.note : ""
  1475.     notes = note + get_all_notes + battler_settings + default_settings
  1476.     code  = "ACTION: #{pose}((?: *, *[\\w ]+)+)?"
  1477.     setup_pose(symbol, notes, code, insert, battler)
  1478.   end
  1479.   #--------------------------------------------------------------------------
  1480.   # *
  1481.   #--------------------------------------------------------------------------
  1482.   def default_settings
  1483.     VE_DEFAULT_ACTION
  1484.   end
  1485.   #--------------------------------------------------------------------------
  1486.   # *
  1487.   #--------------------------------------------------------------------------
  1488.   def battler_settings
  1489.     VE_ACTION_SETTINGS[@battler_name] ? VE_ACTION_SETTINGS[@battler_name] : ""
  1490.   end
  1491.   #--------------------------------------------------------------------------
  1492.   # *
  1493.   #--------------------------------------------------------------------------
  1494.   def setup_pose(pose, notes, code, insert, battler)
  1495.     regexp = /<#{code}>((?:[^<]|<[^\/])*)<\/ACTION>/im
  1496.     if notes.gsub(/\r\n/i, "") =~ regexp
  1497.       time, last = get_values($1)
  1498.       value = setup_value($2, battler)
  1499.       time.times do
  1500.         list = {pose: pose, next: last, value: value.dup}
  1501.         insert ? @pose_list.unshift(list) : @pose_list.push(list)
  1502.       end
  1503.     end
  1504.   end
  1505.   #--------------------------------------------------------------------------
  1506.   # *
  1507.   #--------------------------------------------------------------------------
  1508.   def pose_name_list
  1509.     @pose_list.collect {|pose| pose[:pose]}
  1510.   end
  1511.   #--------------------------------------------------------------------------
  1512.   # *
  1513.   def pose_name
  1514.     pose_name_list.first
  1515.   end
  1516.   #--------------------------------------------------------------------------
  1517.   # *
  1518.   #--------------------------------------------------------------------------
  1519.   def get_values(value)
  1520.     if value
  1521.       time = value =~ /([^,]+) TIMES/i ? [eval($1), 1].max : 1
  1522.       last = value =~ /(\w[\w ]+)/i    ? make_symbol($1)   : nil
  1523.       [time, last]
  1524.     else
  1525.       [1, nil]
  1526.     end
  1527.   end
  1528.   #--------------------------------------------------------------------------
  1529.   # *
  1530.   #--------------------------------------------------------------------------
  1531.   def clear_idle_poses
  1532.     @pose_list.delete_if {|pose| idle_pose?(pose[:pose]) }
  1533.   end
  1534.   #--------------------------------------------------------------------------
  1535.   # *
  1536.   #--------------------------------------------------------------------------
  1537.   def battler
  1538.     @pose[:battler] ? @pose[:battler] : self
  1539.   end
  1540.   #--------------------------------------------------------------------------
  1541.   # *
  1542.   #--------------------------------------------------------------------------
  1543.   def idle_pose?(pose)
  1544.     idle_pose_list.include?(pose.downcase.to_sym)
  1545.   end
  1546.   #--------------------------------------------------------------------------
  1547.   # *
  1548.   #--------------------------------------------------------------------------
  1549.   def idle_pose_list
  1550.     [:idle, :guarding, :danger, :dead, :item_cast, :magic_cast, :skill_cast,
  1551.      :default_cast] + states_pose
  1552.   end
  1553.   #--------------------------------------------------------------------------
  1554.   # *
  1555.   #--------------------------------------------------------------------------
  1556.   def states_pose
  1557.     $data_states.compact.collect {|state| state.state_pose }.compact
  1558.   end
  1559.   #--------------------------------------------------------------------------
  1560.   # *
  1561.   #--------------------------------------------------------------------------
  1562.   def setup_value(settings, battler)
  1563.     values = []
  1564.     settings.scan(/(\w+)(?:: ([^;]+)[;\n\r])?/i) do |type, value|
  1565.       values.push(set_pose_value(type, value ? value : '', battler))
  1566.     end
  1567.     values
  1568.   end
  1569.   #--------------------------------------------------------------------------
  1570.   # *
  1571.   #--------------------------------------------------------------------------
  1572.   def set_pose_value(type, value, battler)
  1573.     @pose = {}
  1574.     @pose[:battler] = battler
  1575.     @pose[:type] = make_symbol(type)
  1576.     @pose[:hit]  = value =~ /HIT ONLY/i  ? true : false
  1577.     @pose[:miss] = value =~ /MISS ONLY/i ? true : false
  1578.     set_pose_setting("#{type} #{value}")
  1579.     @pose
  1580.   end
  1581.   #--------------------------------------------------------------------------
  1582.   # *
  1583.   #--------------------------------------------------------------------------
  1584.   def set_pose_setting(value)
  1585.     case value
  1586.     when /^POSE (.*)/i then set_pose($1)
  1587.     when /^WAIT (.*)/i then set_wait($1)
  1588.     when /^MOVE (.*)/i then set_move($1)
  1589.     when /^JUMP (.*)/i then set_jump($1)
  1590.     when /^ANIM (.*)/i then set_anim($1)
  1591.     when /^ICON (.*)/i then set_icon($1)
  1592.     when /^LOOP (.*)/i then set_loop($1)
  1593.     when /^THROW (.*)/i then set_throw($1)
  1594.     when /^ACTION (.*)/i then set_action($1)
  1595.     when /^EFFECT (.*)/i then set_effect($1)
  1596.     when /^DIRECTION (.*)/i then set_direction($1)
  1597.     end
  1598.   end
  1599.   #--------------------------------------------------------------------------
  1600.   # *
  1601.   #--------------------------------------------------------------------------
  1602.   def set_pose(value)
  1603.     @pose[:target] = set_targets(value)
  1604.     @pose[:row]    = battler.set_row(value)
  1605.     @pose[:sufix]  = value =~ /SUFIX ([\[\]\w]+)/i ? $1.to_s : ""
  1606.     if value =~ /(\d+|ALL) FRAMES?/i
  1607.       wait = [value =~ /WAIT (\d+)/i ? $1.to_i : 1, 1].max
  1608.       max_frame = /(\d+) FRAMES/i ? $1.to_i : :all
  1609.       @pose[:frame] = value =~ /FRAME (\d+)/i ? $1.to_i : 1
  1610.       @pose[:pose]  = {wait: wait, time: wait, frame: max_frame}
  1611.     else
  1612.       @pose[:pose]  = {}
  1613.       @pose[:frame] = value =~ /FRAME (\d+)/i ? $1.to_i : 1
  1614.     end
  1615.   end
  1616.   #--------------------------------------------------------------------------
  1617.   # *
  1618.   #--------------------------------------------------------------------------
  1619.   def set_wait(value)
  1620.     @pose[:target] = set_targets(value)
  1621.     case value
  1622.     when /(\d+)/i
  1623.       @pose[:time] = $1.to_i
  1624.       @pose[:wait] = $1.to_i
  1625.     when /(ACTION|ANIMATION|MOVEMENT|THROW)/i
  1626.       @pose[:time] = make_symbol($1)
  1627.       @pose[:wait] = make_symbol($1)
  1628.     end
  1629.   end
  1630.   #--------------------------------------------------------------------------
  1631.   # *
  1632.   #--------------------------------------------------------------------------
  1633.   def set_move(value)
  1634.     regexp = /(MOVE TO|STEP FOWARD|RETREAT|ESCAPE)/i
  1635.     @pose[:value]  = make_symbol($1) if value =~ regexp
  1636.     @pose[:target] = battler. set_targets(value)
  1637.     @pose[:x]      = value =~ /X ([+-]?\d+)/i ? $1.to_i : 0
  1638.     @pose[:y]      = value =~ /Y ([+-]?\d+)/i ? $1.to_i : 0
  1639.     @pose[:h]      = value =~ /HEIGHT (\d+)/i ? $1.to_i : 0
  1640.     @pose[:speed]  = value =~ /SPEED (\d+)/i  ? $1.to_i / 10.0 : 1.0
  1641.     @pose[:targets]  = @action_targets if @pose[:value] == :move_to
  1642.     @pose[:teleport] = value =~ /TELEPORT/i
  1643.   end
  1644.   #--------------------------------------------------------------------------
  1645.   # *
  1646.   #--------------------------------------------------------------------------
  1647.   def set_jump(value)
  1648.     @pose[:target] = set_targets(value)
  1649.     @pose[:move]   = value =~ /MOVE/i
  1650.     @pose[:height] = value =~ /HEIGHT (\d+)/i ? [$1.to_i, 1].max : 5
  1651.     @pose[:speed]  = value =~ /SPEED (\d+)/i  ? [$1.to_i, 1].max : 10
  1652.   end
  1653.   #--------------------------------------------------------------------------
  1654.   # *
  1655.   #--------------------------------------------------------------------------
  1656.   def set_action(value)
  1657.     @pose[:target] = set_targets(value)
  1658.     value.scan(/(\w[\w ]+)/) do
  1659.       not_action = ['target','actor','friend','enemy', 'user','self']
  1660.       next if not_action.include?($1.downcase)
  1661.       @pose[:action] = make_symbol($1)
  1662.     end
  1663.   end
  1664.   #--------------------------------------------------------------------------
  1665.   # *
  1666.   #--------------------------------------------------------------------------
  1667.   def set_anim(value)
  1668.     @pose[:target] = set_targets(value)
  1669.     item = current_action ? current_action.item : nil
  1670.     case value
  1671.     when /CAST/i
  1672.       cast = item && $imported[:ve_cast_animation]
  1673.       anim = cast ? battler.cast_animation_id(item) : 0
  1674.       @pose[:anim] = anim
  1675.     when /EFFECT/i
  1676.       @pose[:anim] = item ? item.animation_id : 0
  1677.     when /ID (\d+)/i
  1678.       @pose[:anim] = $1.to_i
  1679.     when /WEAPON *(\d+)?/i
  1680.       @pose[:anim] = battler.atk_animation_id1
  1681.       @pose[:anim] = battler.atk_animation_id2 if $1 && $1.to_i == 2
  1682.     else
  1683.       @pose[:anim] = 0
  1684.     end
  1685.   end
  1686.   #--------------------------------------------------------------------------
  1687.   # *
  1688.   #--------------------------------------------------------------------------
  1689.   def set_icon(value)
  1690.     @pose[:target] = set_targets(value)
  1691.     @pose[:index]  = /INDEX (\d+)/i  ? $1.to_i : 0
  1692.     @pose[:delete] = value =~ /DELETE/i ? true : false
  1693.     return if @pose[:delete]
  1694.     set_action_icon(value)
  1695.     @pose[:x] = value =~ /X ([+-]?\d+)/i  ? $1.to_i : 0
  1696.     @pose[:y] = value =~ /Y ([+-]?\d+)/i  ? $1.to_i : 0
  1697.     @pose[:z] = value =~ /Z ([+-]?\d+)/i  ? $1.to_i : -1
  1698.     @pose[:a] = value =~ /ANGLE (\d+)/i   ? $1.to_i : 0
  1699.     @pose[:o] = value =~ /OPACITY (\d+)/i ? $1.to_i : 255
  1700.   end
  1701.   #--------------------------------------------------------------------------
  1702.   # *
  1703.   #--------------------------------------------------------------------------
  1704.   def set_throw(value)
  1705.     @pose[:target] = set_targets(value)
  1706.     set_action_icon(value)
  1707.     @pose[:revert] = value =~ /REVERT/i
  1708.     @pose[:return] = value =~ /RETURN/i
  1709.     @pose[:init_x] = value =~ /INIT X (\d+)/i ? $1.to_i : 0
  1710.     @pose[:init_y] = value =~ /INIT Y (\d+)/i ? $1.to_i : 0
  1711.     @pose[:end_x]  = value =~ /END X (\d+)/i  ? $1.to_i : 0
  1712.     @pose[:end_y]  = value =~ /END X (\d+)/i  ? $1.to_i : 0
  1713.     @pose[:anim]   = value =~ /ANIM (\d+)/i   ? $1.to_i : nil
  1714.     @pose[:arc]    = value =~ /ARC (\d+)/i    ? $1.to_i : 0
  1715.     @pose[:angle]  = value =~ /ANGLE (\d+)/i  ? $1.to_i : 0
  1716.     @pose[:speed]  = value =~ /SPEED (\d+)/i  ? $1.to_i / 10.0 : 1.0
  1717.     @pose[:z] = value =~ /Z ([+-]?\d+)/i   ? $1.to_i : -1
  1718.     @pose[:a] = value =~ /SPIN ([+-]\d+)/i ? $1.to_i : 0
  1719.     @pose[:o] = value =~ /OPACITY (\d+)/i  ? $1.to_i : 255
  1720.   end
  1721.   #--------------------------------------------------------------------------
  1722.   # *
  1723.   #--------------------------------------------------------------------------
  1724.   def set_action_icon(value)
  1725.     icon = weapon_icon($1.to_i) if value =~ /WEAPON (\d+)/i && battler.actor?
  1726.     icon = armor_icon($1.to_i)  if value =~ /ARMOR (\d+)/i  && battler.actor?
  1727.     icon = $1.to_i if value =~ /ICON (\d+)/i
  1728.     @pose[:icon] = icon ? icon : 0
  1729.   end
  1730.   #--------------------------------------------------------------------------
  1731.   # *
  1732.   #--------------------------------------------------------------------------
  1733.   def set_loop(value)
  1734.     @pose[:target]    = set_targets(value)
  1735.     @pose[:loop_anim] = value =~ /ANIM (\d+)/i ? $1.to_i : 0
  1736.   end
  1737.   #--------------------------------------------------------------------------
  1738.   # *
  1739.   #--------------------------------------------------------------------------
  1740.   def set_effect(value)
  1741.     @pose[:target] = set_targets(value)
  1742.     @pose[:damage] = $1.to_i / 100.0  if value =~ /(\d+)%/i
  1743.     @pose[:weapon] = [$1.to_i, 1].max if value =~ /WEAPON (\d+)/i
  1744.   end
  1745.   #--------------------------------------------------------------------------
  1746.   # *
  1747.   #--------------------------------------------------------------------------
  1748.   def set_targets(value)
  1749.     case value
  1750.     when /TARGET/i
  1751.       battler.action_targets.dup
  1752.     when /ACTOR ([^>,]+)/i
  1753.       acotor = $game_actors[eval($1)]
  1754.       target = $game_party.battle_members.include?(actor) ? [actor] : []
  1755.     when /FRIEND ([^>,]+)/i
  1756.       [$game_party.battle_members[eval($1)]].compact
  1757.     when /ENEMY ([^>,]+)/i
  1758.       [$game_troop.members[eval($1)]].compact
  1759.     when /RANDOM ENEMY/i
  1760.       battler.opponents_unit.members.random
  1761.     when /RANDOM FRIEND/i
  1762.       battler.firends_unit.members.random
  1763.     when /ALL ENEMIES/i
  1764.       battler.opponents_unit.members
  1765.     when /ALL FRIENDS/i
  1766.       battler.firends_unit.members
  1767.     when /SELF/i
  1768.       [self]
  1769.     else
  1770.       nil
  1771.     end
  1772.   end
  1773.   #--------------------------------------------------------------------------
  1774.   # *
  1775.   #--------------------------------------------------------------------------
  1776.   def set_row(value)
  1777.     pose = VE_POSE_SETTINGS[make_symbol($1)] if value =~ /ROW (\w+)/i
  1778.     pose = $1.to_i if value =~ /ROW (\d+)/i
  1779.     pose ? pose : 0
  1780.   end
  1781.   #--------------------------------------------------------------------------
  1782.   # *
  1783.   #--------------------------------------------------------------------------
  1784.   def set_direction(value)
  1785.     @pose[:targets]   = value =~ /TARGETS/i
  1786.     @pose[:direction] = 2 if value =~ /DOWN/i
  1787.     @pose[:direction] = 4 if value =~ /LEFT/i
  1788.     @pose[:direction] = 6 if value =~ /RIGHT/i
  1789.     @pose[:direction] = 8 if value =~ /UP/i
  1790.   end
  1791.   #--------------------------------------------------------------------------
  1792.   # *
  1793.   #--------------------------------------------------------------------------
  1794.   def weapon_icon(index)
  1795.     battler.weapons[index - 1] ? battler.weapons[index - 1].icon_index : nil
  1796.   end
  1797.   #--------------------------------------------------------------------------
  1798.   # *
  1799.   #--------------------------------------------------------------------------
  1800.   def armor_icon(index)
  1801.     battler.armors[index - 1] ? battler.armors[index - 1].icon_index : nil
  1802.   end
  1803.   #--------------------------------------------------------------------------
  1804.   # *
  1805.   #--------------------------------------------------------------------------
  1806.   def active?
  1807.     @active
  1808.   end
  1809.   #--------------------------------------------------------------------------
  1810.   # *
  1811.   #--------------------------------------------------------------------------
  1812.   def down?
  1813.     @direction == 2
  1814.   end
  1815.   #--------------------------------------------------------------------------
  1816.   # *
  1817.   #--------------------------------------------------------------------------
  1818.   def left?
  1819.     @direction == 4
  1820.   end
  1821.   #--------------------------------------------------------------------------
  1822.   # *
  1823.   #--------------------------------------------------------------------------
  1824.   def right?
  1825.     @direction == 6
  1826.   end
  1827.   #--------------------------------------------------------------------------
  1828.   # *
  1829.   #--------------------------------------------------------------------------
  1830.   def up?
  1831.     @direction == 8
  1832.   end
  1833.   #--------------------------------------------------------------------------
  1834.   # *
  1835.   #--------------------------------------------------------------------------
  1836.   def returning?
  1837.     pose_name_list.first == :retreat || pose_name_list.first == :escape
  1838.   end
  1839.   #--------------------------------------------------------------------------
  1840.   # Definição de direção do battler de acordo com o ponto alvo
  1841.   #--------------------------------------------------------------------------
  1842.   def target_direction(x, y)
  1843.     relative_x = @current_position[:x] - x
  1844.     relative_y = @current_position[:y] - y
  1845.     if relative_y.abs > relative_x.abs
  1846.       directions = returning? ? [8, 2] : [2, 8]
  1847.       @direction = (relative_y < 0 ? directions[0] : directions[1])
  1848.     elsif relative_x.abs >= relative_y.abs
  1849.       directions = returning? ? [4, 6] : [6, 4]
  1850.       @direction = (relative_x < 0 ? directions[0] : directions[1])
  1851.     end
  1852.   end
  1853.   #--------------------------------------------------------------------------
  1854.   # Definição de direção da ação do battler
  1855.   #--------------------------------------------------------------------------
  1856.   def action_direction
  1857.     units = @action_targets
  1858.     target_x = units.collect {|member| member.current_position[:x] }.average
  1859.     target_y = units.collect {|member| member.current_position[:y] }.average
  1860.     relative_x = current_position[:x] - target_x
  1861.     relative_y = current_position[:y] - target_y
  1862.     if relative_y.abs > relative_x.abs
  1863.       @direction = relative_y < 0 ? 2 : 8
  1864.     elsif relative_x.abs >= relative_y.abs
  1865.       @direction = relative_x < 0 ? 6 : 4
  1866.     end
  1867.   end
  1868.   #--------------------------------------------------------------------------
  1869.   # *
  1870.   #--------------------------------------------------------------------------
  1871.   def target_distance(symbol)
  1872.     @target_position[symbol] - @current_position[symbol]
  1873.   end
  1874.   #--------------------------------------------------------------------------
  1875.   # *
  1876.   #--------------------------------------------------------------------------
  1877.   def moving?
  1878.      @current_position != @target_position
  1879.   end
  1880.   #--------------------------------------------------------------------------
  1881.   # *
  1882.   #--------------------------------------------------------------------------
  1883.   def activate
  1884.     return unless current_action
  1885.     @active = true
  1886.     @active_pose = nil
  1887.     @action_targets = current_action.make_targets.compact.dup
  1888.     @action_targets.each {|target| immortals.push(target) unless target.dead? }
  1889.     immortals.uniq!
  1890.   end
  1891.   #--------------------------------------------------------------------------
  1892.   # *
  1893.   #--------------------------------------------------------------------------
  1894.   def deactivate
  1895.     @active = false
  1896.     @attack_flag = nil
  1897.     @result_flag = nil
  1898.     immortals = @immortals.dup
  1899.     @immortals.clear
  1900.     immortals.each {|member| member.refresh }
  1901.     @action_targets.clear
  1902.   end
  1903.   #--------------------------------------------------------------------------
  1904.   # *
  1905.   #--------------------------------------------------------------------------
  1906.   def action_pose(item)
  1907.     activate
  1908.     @current_item = item
  1909.     pose = set_action_pose(item)
  1910.     call_action_poses(pose, item)
  1911.   end
  1912.   #--------------------------------------------------------------------------
  1913.   # *
  1914.   #--------------------------------------------------------------------------
  1915.   def set_action_pose(item)
  1916.     pose = [:use,    false, item]
  1917.     pose = [:item,   false, item] if item.item?
  1918.     pose = [:skill,  false, item] if item.skill?
  1919.     pose = [:magic,  false, item] if item.magical?
  1920.     pose = set_attack_pose(item)  if item.skill? && item.id == attack_skill_id
  1921.     pose = [:defend, false, item] if item.skill? && item.id == guard_skill_id
  1922.     pose = [:custom, false, item] if item.custom_pose?
  1923.     pose
  1924.   end
  1925.   #--------------------------------------------------------------------------
  1926.   # *
  1927.   #--------------------------------------------------------------------------
  1928.   def call_action_poses(pose, item)
  1929.     clear_idle_poses
  1930.     call_pose(:advance, false, item) if need_move
  1931.     call_pose(*pose)
  1932.     call_pose(:inactive)
  1933.     call_pose(:retreat, false, item) if need_move
  1934.   end
  1935.   #--------------------------------------------------------------------------
  1936.   # *
  1937.   #--------------------------------------------------------------------------
  1938.   def need_move
  1939.     item = current_item
  1940.     return false if ranged?
  1941.     return true  if item.skill? && item.physical?
  1942.     return true  if item.skill? && item.id == attack_skill_id
  1943.     return false
  1944.   end
  1945.   #--------------------------------------------------------------------------
  1946.   # *
  1947.   #--------------------------------------------------------------------------
  1948.   def set_attack_pose(item)
  1949.     pose = [:attack, false, item]
  1950.     pose = [:dual_attack, false, item] if double_attack?
  1951.     pose
  1952.   end
  1953.   #--------------------------------------------------------------------------
  1954.   # *
  1955.   #--------------------------------------------------------------------------
  1956.   def set_active_pose
  1957.     item = current_action.item
  1958.     pose = :default_cast if VE_POSE_SETTINGS[:default_cast]
  1959.     pose = :item_cast  if item.item?     && VE_POSE_SETTINGS[:item_cast]
  1960.     pose = :magic_cast if item.magical?  && VE_POSE_SETTINGS[:magic_cast]
  1961.     pose = :skill_cast if item.physical? && VE_POSE_SETTINGS[:skill_cast]
  1962.     @active_pose = pose
  1963.   end
  1964.   #--------------------------------------------------------------------------
  1965.   # *
  1966.   #--------------------------------------------------------------------------
  1967.   def ranged?
  1968.     get_all_notes =~ /<RANGED ATTACK>/i
  1969.   end
  1970.   #--------------------------------------------------------------------------
  1971.   # *
  1972.   #--------------------------------------------------------------------------
  1973.   def double_attack?
  1974.     actor? && dual_wield? && weapons.size > 1
  1975.   end
  1976.   #--------------------------------------------------------------------------
  1977.   # *
  1978.   #--------------------------------------------------------------------------
  1979.   def not_in_position?
  1980.     @current_position[:x] != screen_x || @current_position[:y] != screen_y
  1981.   end
  1982.   #--------------------------------------------------------------------------
  1983.   # *
  1984.   #--------------------------------------------------------------------------
  1985.   def state_pose?
  1986.     state_pose
  1987.   end
  1988.   #--------------------------------------------------------------------------
  1989.   # *
  1990.   #--------------------------------------------------------------------------
  1991.   def state_pose
  1992.     state = states.find {|state| state.state_pose }
  1993.     state ? state.state_pose : nil
  1994.   end
  1995.   #--------------------------------------------------------------------------
  1996.   # *
  1997.   #--------------------------------------------------------------------------
  1998.   def reset_pose
  1999.     return unless $game_party.in_battle
  2000.     SceneManager.scene.spriteset.sprite(self).reset_pose
  2001.   end
  2002. end
  2003.  
  2004. #==============================================================================
  2005. # ** Game_Actor
  2006. #------------------------------------------------------------------------------
  2007. #  This class handles actors. It's used within the Game_Actors class
  2008. # ($game_actors) and referenced by the Game_Party class ($game_party).
  2009. #==============================================================================
  2010.  
  2011. class Game_Actor < Game_Battler
  2012.   #--------------------------------------------------------------------------
  2013.   # *
  2014.   #--------------------------------------------------------------------------
  2015.   def perform_collapse_effect
  2016.     if $game_party.in_battle
  2017.       reset_pose
  2018.       case collapse_type
  2019.       when 0
  2020.         @sprite_effect_type = :collapse
  2021.         Sound.play_enemy_collapse
  2022.       when 1
  2023.         @sprite_effect_type = :boss_collapse
  2024.         Sound.play_boss_collapse1
  2025.       when 2
  2026.         @sprite_effect_type = :instant_collapse
  2027.       end
  2028.     end
  2029.   end
  2030.   #--------------------------------------------------------------------------
  2031.   # *
  2032.   #--------------------------------------------------------------------------
  2033.   def perform_damage_effect
  2034.     $game_troop.screen.start_shake(5, 5, 10) unless use_sprite?
  2035.     Sound.play_actor_damage
  2036.   end
  2037.   #--------------------------------------------------------------------------
  2038.   # * Aquisição do valor adicional do parâmetro
  2039.   #     param_id : ID do parâmetro
  2040.   #--------------------------------------------------------------------------
  2041.   alias :param_plus_ve_animated_battle :param_plus
  2042.   def param_plus(param_id)
  2043.     if param_id > 1 && double_attack? && @attack_flag
  2044.       equip = [weapons[@attack_flag - 1]] + armors
  2045.       equip.compact.inject(super) {|r, item| r += item.params[param_id] }
  2046.     else
  2047.       param_plus_ve_animated_battle(param_id)
  2048.     end
  2049.   end
  2050.   #--------------------------------------------------------------------------
  2051.   # *
  2052.   #--------------------------------------------------------------------------
  2053.   def default_direction
  2054.     units = opponents_unit.members
  2055.     relative_x = screen_x - units.collect {|member| member.screen_x }.average
  2056.     relative_y = screen_y - units.collect {|member| member.screen_y }.average
  2057.     if relative_y.abs > relative_x.abs
  2058.       @direction = relative_y < 0 ? 2 : 8
  2059.     elsif relative_x.abs >= relative_y.abs
  2060.       @direction = relative_x < 0 ? 6 : 4
  2061.     end
  2062.   end
  2063. end
  2064.  
  2065. #==============================================================================
  2066. # ** Game_Enemy
  2067. #------------------------------------------------------------------------------
  2068. #  This class handles enemy characters. It's used within the Game_Troop class
  2069. # ($game_troop).
  2070. #==============================================================================
  2071.  
  2072. class Game_Enemy < Game_Battler
  2073.   #--------------------------------------------------------------------------
  2074.   # *
  2075.   #--------------------------------------------------------------------------
  2076.   alias :perform_collapse_effect_ve_animated_battle :perform_collapse_effect
  2077.   def perform_collapse_effect
  2078.     reset_pose
  2079.     perform_collapse_effect_ve_animated_battle
  2080.   end
  2081.   #--------------------------------------------------------------------------
  2082.   # *
  2083.   #--------------------------------------------------------------------------
  2084.   def perform_damage_effect
  2085.     Sound.play_enemy_damage
  2086.   end
  2087.   #--------------------------------------------------------------------------
  2088.   # *
  2089.   #--------------------------------------------------------------------------
  2090.   def character_name
  2091.     @battler_name
  2092.   end
  2093.   #--------------------------------------------------------------------------
  2094.   # *
  2095.   #--------------------------------------------------------------------------
  2096.   def character_hue
  2097.     @battler_hue
  2098.   end
  2099.   #--------------------------------------------------------------------------
  2100.   # *
  2101.   #--------------------------------------------------------------------------
  2102.   def character_index
  2103.     0
  2104.   end
  2105.   #--------------------------------------------------------------------------
  2106.   # *
  2107.   #--------------------------------------------------------------------------
  2108.   def visual_items
  2109.     [default_part]
  2110.   end
  2111.   #--------------------------------------------------------------------------
  2112.   # *
  2113.   #--------------------------------------------------------------------------
  2114.   def default_part
  2115.     {name: character_name.dup, index1: character_index, index2: character_index,
  2116.      hue: character_hue, priority: 0}
  2117.   end
  2118.   #--------------------------------------------------------------------------
  2119.   # *
  2120.   #--------------------------------------------------------------------------
  2121.   def default_direction
  2122.     units = opponents_unit.battle_members
  2123.     relative_x = screen_x - units.collect {|member| member.screen_x }.average
  2124.     relative_y = screen_y - units.collect {|member| member.screen_y }.average
  2125.     if relative_y.abs > relative_x.abs
  2126.       @direction = relative_y < 0 ? 2 : 8
  2127.     elsif relative_x.abs >= relative_y.abs
  2128.       @direction = relative_x < 0 ? 6 : 4
  2129.     end
  2130.   end
  2131. end
  2132.  
  2133. #==============================================================================
  2134. # ** Game_Party
  2135. #------------------------------------------------------------------------------
  2136. #  This class handles the party. It includes information on amount of gold
  2137. # and items. The instance of this class is referenced by $game_party.
  2138. #==============================================================================
  2139.  
  2140. class Game_Party < Game_Unit
  2141.   #--------------------------------------------------------------------------
  2142.   # *
  2143.   #--------------------------------------------------------------------------
  2144.   def not_in_position?
  2145.     movable_members.any? {|member| member.not_in_position? }
  2146.   end
  2147.   #--------------------------------------------------------------------------
  2148.   # *
  2149.   #--------------------------------------------------------------------------
  2150.   def moving?
  2151.     movable_members.any? {|member| member.moving? }
  2152.   end
  2153. end
  2154.  
  2155. #==============================================================================
  2156. # ** Game_Troop
  2157. #------------------------------------------------------------------------------
  2158. #  This class handles enemy groups and battle-related data. Also performs
  2159. # battle events. The instance of this class is referenced by $game_troop.
  2160. #==============================================================================
  2161.  
  2162. class Game_Troop < Game_Unit
  2163.   #--------------------------------------------------------------------------
  2164.   # *
  2165.   #--------------------------------------------------------------------------
  2166.   attr_accessor :back_attack
  2167. end
  2168.  
  2169. #==============================================================================
  2170. # ** Sprite_Battler
  2171. #------------------------------------------------------------------------------
  2172. #  This sprite is used to display battlers. It observes a instance of the
  2173. # Game_Battler class and automatically changes sprite conditions.
  2174. #==============================================================================
  2175.  
  2176. class Sprite_Battler < Sprite_Base
  2177.   #--------------------------------------------------------------------------
  2178.   # *
  2179.   #--------------------------------------------------------------------------
  2180.   attr_accessor :battler
  2181.   #--------------------------------------------------------------------------
  2182.   # *
  2183.   #--------------------------------------------------------------------------
  2184.   alias :initialize_ve_animated_battle :initialize
  2185.   def initialize(viewport, battler = nil)
  2186.     initialize_ve_animated_battle(viewport, battler)
  2187.     init_variables
  2188.   end
  2189.   #--------------------------------------------------------------------------
  2190.   # *
  2191.   #--------------------------------------------------------------------------
  2192.   alias :update_effect_ve_animated_battle :update_effect
  2193.   def update_effect
  2194.     setup_collapse
  2195.     update_effect_ve_animated_battle
  2196.     update_pose
  2197.     update_pose_loop_anim if $imported[:ve_loop_animation]
  2198.   end
  2199.   #--------------------------------------------------------------------------
  2200.   # *
  2201.   #--------------------------------------------------------------------------
  2202.   alias :revert_to_normal_ve_animated_battle :revert_to_normal
  2203.   def revert_to_normal
  2204.     revert_to_normal_ve_animated_battle
  2205.     update_rect if bitmap
  2206.   end
  2207.   #--------------------------------------------------------------------------
  2208.   # *
  2209.   #--------------------------------------------------------------------------
  2210.   def setup_collapse
  2211.     if @battler.dead? && !@dead
  2212.       @battler.perform_collapse_effect
  2213.       @dead = true
  2214.     elsif @dead && !@battler.dead?
  2215.       @dead = false
  2216.     end
  2217.   end
  2218.   #--------------------------------------------------------------------------
  2219.   # *
  2220.   #--------------------------------------------------------------------------
  2221.   def update_bitmap
  2222.     setup_bitmap if graphic_changed?
  2223.   end
  2224.   #--------------------------------------------------------------------------
  2225.   # *
  2226.   #--------------------------------------------------------------------------
  2227.   def init_visibility
  2228.     @battler_visible = !@battler.hidden?
  2229.     self.opacity = 0 unless @battler_visible
  2230.   end
  2231.   #--------------------------------------------------------------------------
  2232.   # *
  2233.   #--------------------------------------------------------------------------
  2234.   def init_variables
  2235.     @sufix = ""
  2236.     @pose_sufix = ""
  2237.     @anim_sufix = VE_ANIMATED_BATTLER_SUFIX
  2238.     @frame_width  = 0
  2239.     @frame_height = 0
  2240.     @pose_value   = {}
  2241.     @icon_list    = {}
  2242.     @throw_list   = []
  2243.     start_effect(:appear) if VE_BATTLE_INTRO_FADE && !@battler.hidden?
  2244.     @battler.clear_poses
  2245.     setup_positions
  2246.   end
  2247.   #--------------------------------------------------------------------------
  2248.   # *
  2249.   #--------------------------------------------------------------------------
  2250.   def subject
  2251.     (@pose && @pose[:battler]) ? @pose[:battler] : @battler
  2252.   end
  2253.   #--------------------------------------------------------------------------
  2254.   # *
  2255.   #--------------------------------------------------------------------------
  2256.   def sprite_settings
  2257.     VE_SPRITE_SETTINGS[@battler_name]
  2258.   end
  2259.   #--------------------------------------------------------------------------
  2260.   # *
  2261.   #--------------------------------------------------------------------------
  2262.   def graphic_changed?
  2263.     actor_name_change? || battler_name_change? || misc_change?
  2264.   end
  2265.   #--------------------------------------------------------------------------
  2266.   # *
  2267.   #--------------------------------------------------------------------------
  2268.   def actor_name_change?
  2269.     use_charset? && (@battler_name != @battler.character_name ||
  2270.     @battler_index != @battler.character_index ||
  2271.     @battler_hue   != @battler.character_hue)
  2272.   end
  2273.   #--------------------------------------------------------------------------
  2274.   # *
  2275.   #--------------------------------------------------------------------------
  2276.   def battler_name_change?
  2277.     !use_charset? && (@battler_name != @battler.battler_name ||
  2278.     @battler_hue  != @battler.battler_hue)
  2279.   end
  2280.   #--------------------------------------------------------------------------
  2281.   # *
  2282.   #--------------------------------------------------------------------------
  2283.   def misc_change?
  2284.     (visual_equip? && @visual_items != @battler.visual_items) ||
  2285.     @sufix != @battler.sufix || @direction != @battler.direction
  2286.   end
  2287.   #--------------------------------------------------------------------------
  2288.   # *
  2289.   #--------------------------------------------------------------------------
  2290.   def use_charset?
  2291.     sprite_settings[:mode] == :charset
  2292.   end
  2293.   #--------------------------------------------------------------------------
  2294.   # *
  2295.   #--------------------------------------------------------------------------
  2296.   def visual_equip?
  2297.     $imported[:ve_visual_equip]
  2298.   end
  2299.   #--------------------------------------------------------------------------
  2300.   # *
  2301.   #--------------------------------------------------------------------------
  2302.   def setup_bitmap
  2303.     if use_charset?
  2304.       @battler_name  = @battler.character_name
  2305.       @battler_hue   = @battler.character_hue
  2306.       @battler_index = @battler.character_index
  2307.     else
  2308.       @battler_name  = @battler.battler_name
  2309.       @battler_hue   = @battler.battler_hue
  2310.     end
  2311.     @sufix        = @battler.sufix
  2312.     @direction    = @battler.direction
  2313.     @visual_items = @battler.visual_items.dup if visual_equip?
  2314.     init_bitmap
  2315.     init_frame
  2316.     init_visibility
  2317.   end
  2318.   #--------------------------------------------------------------------------
  2319.   # *
  2320.   #--------------------------------------------------------------------------
  2321.   def init_bitmap
  2322.     case sprite_settings[:mode]
  2323.     when :charset
  2324.       if visual_equip?
  2325.         args = [get_name, @battler_hue, @visual_items, sufix]
  2326.         self.bitmap = Cache.character(*args)
  2327.       else
  2328.         self.bitmap = Cache.character(get_name, @battler_hue)
  2329.       end
  2330.     when :single
  2331.       self.bitmap = Cache.battler(get_name, @battler_hue)
  2332.     when :sprite
  2333.       self.bitmap = Cache.battler(get_name, @battler_hue)
  2334.     else
  2335.       self.bitmap = Cache.battler(@battler_name, @battler_hue)
  2336.     end
  2337.   end
  2338.   #--------------------------------------------------------------------------
  2339.   # *
  2340.   #--------------------------------------------------------------------------
  2341.   def sufix
  2342.     case sprite_settings[:mode]
  2343.     when :charset then @sufix
  2344.     when :single  then @pose_sufix + @sufix
  2345.     when :sprite  then @anim_sufix + @sufix
  2346.     else ""
  2347.     end
  2348.   end
  2349.   #--------------------------------------------------------------------------
  2350.   # *
  2351.   #--------------------------------------------------------------------------
  2352.   def get_name
  2353.     name = @battler_name + sufix
  2354.     battler_exist?(name) ? name : @battler_name
  2355.   end
  2356.   #--------------------------------------------------------------------------
  2357.   # *
  2358.   #--------------------------------------------------------------------------
  2359.   def init_frame
  2360.     @frame_width  = bitmap.width  / frame_number
  2361.     @frame_height = bitmap.height / row_number
  2362.   end
  2363.   #--------------------------------------------------------------------------
  2364.   # *
  2365.   #--------------------------------------------------------------------------
  2366.   def frame_number
  2367.     return 1 unless battler_exist?(@battler_name + sufix)
  2368.     return @battler.frames     if use_charset? && @battler_name[/^$./]
  2369.     return @battler.frames * 4 if use_charset? && !@battler_name[/^$./]
  2370.     return sprite_settings[:frames] if sprite_settings[:mode] == :single
  2371.     return sprite_settings[:frames] if sprite_settings[:mode] == :sprite
  2372.     return 1
  2373.   end
  2374.   #--------------------------------------------------------------------------
  2375.   # *
  2376.   #--------------------------------------------------------------------------
  2377.   def row_number
  2378.     return 1 unless battler_exist?(@battler_name + sufix)
  2379.     return 4 if use_charset? && @battler_name[/^$./]
  2380.     return 8 if use_charset? && !@battler_name[/^$./]
  2381.     return sprite_settings[:rows] if sprite_settings[:mode] == :sprite
  2382.     return 1
  2383.   end
  2384.   #--------------------------------------------------------------------------
  2385.   # *
  2386.   #--------------------------------------------------------------------------
  2387.   def update_origin
  2388.     update_rect if bitmap
  2389.     update_icon
  2390.     update_throw
  2391.   end
  2392.   #--------------------------------------------------------------------------
  2393.   # *
  2394.   #--------------------------------------------------------------------------
  2395.   def update_rect
  2396.     setup_frame
  2397.     setup_rect
  2398.     self.ox = @frame_width / 2
  2399.     self.oy = @frame_height
  2400.     self.mirror = pose_mirror
  2401.   end
  2402.   #--------------------------------------------------------------------------
  2403.   # *
  2404.   #--------------------------------------------------------------------------
  2405.   def pose_mirror
  2406.     mirror = sprite_settings[:mirror]
  2407.     return !mirror if @battler.right?
  2408.     return  mirror
  2409.   end
  2410.   #--------------------------------------------------------------------------
  2411.   # *
  2412.   #--------------------------------------------------------------------------
  2413.   def setup_frame
  2414.     return if @battler.timing.empty?
  2415.     value = @battler.timing
  2416.     value[:time] -= 1
  2417.     value[:time] = value[:wait] if value[:time] == 0
  2418.     return if value[:time] != value[:wait]
  2419.     max = value[:frame] == :all ? sprite_settings[:frames] : value[:frame]
  2420.     @battler.frame  = @battler.frame + 1
  2421.     @battler.timing = {} if @battler.frame == max - 1
  2422.   end
  2423.   #--------------------------------------------------------------------------
  2424.   # *
  2425.   #--------------------------------------------------------------------------
  2426.   def setup_rect
  2427.     sign = @battler_name[/^[$]./]
  2428.     if use_charset? && sign && !sign.include?('$')
  2429.       index = @battler_index
  2430.       frame = (index % 4 * @battler.frames + @battler.frame) * @frame_width
  2431.       row   = (index / 4 * 4 + @battler.row) * @frame_height
  2432.     else
  2433.       frame = [@battler.frame, frame_number - 1].min * @frame_width
  2434.       row   = [@battler.row  , row_number - 1].min   * @frame_height
  2435.     end
  2436.     self.src_rect.set(frame, row, @frame_width, @frame_height)
  2437.   end  
  2438.   #--------------------------------------------------------------------------
  2439.   # *
  2440.   #--------------------------------------------------------------------------
  2441.   def update_pose
  2442.     setup_pose
  2443.     return if !@pose || !@pose[:type].is_a?(Symbol)
  2444.     update_pose_type
  2445.     next_pose unless @waiting
  2446.   end
  2447.   #--------------------------------------------------------------------------
  2448.   # *
  2449.   #--------------------------------------------------------------------------
  2450.   def setup_pose
  2451.     @current_pose = pose_list.first
  2452.     return unless @current_pose
  2453.     @pose_value = @current_pose[:value]
  2454.     @pose = @pose_value.first
  2455.   end
  2456.   #--------------------------------------------------------------------------
  2457.   # *
  2458.   #--------------------------------------------------------------------------
  2459.   def pose_list
  2460.     @battler.pose_list
  2461.   end
  2462.   #--------------------------------------------------------------------------
  2463.   # *
  2464.   #--------------------------------------------------------------------------
  2465.   def update_pose_type
  2466.     @waiting = false
  2467.     return if @pose[:hit]  && @battler.result_flag != :hit
  2468.     return if @pose[:miss] && @battler.result_flag != :miss
  2469.     eval("update_pose_#{@pose[:type]}") #rescue ""
  2470.   end
  2471.   #--------------------------------------------------------------------------
  2472.   # *
  2473.   #--------------------------------------------------------------------------
  2474.   def next_pose
  2475.     return unless @current_pose
  2476.     case @current_pose[:next]
  2477.     when :loop
  2478.       @pose_value.next_item
  2479.     when :reset
  2480.       @pose_value.shift
  2481.       reset_pose if @pose_value.empty?
  2482.     when Symbol
  2483.       @pose_value.shift
  2484.       @battler.call_pose(@current_pose[:next]) if @pose_value.empty?
  2485.     else
  2486.       last_value = @pose_value.shift
  2487.     end
  2488.     @pose_value.unshift(last_value) if @pose_value.empty? && pose_list.empty?
  2489.     @battler.pose_list.shift if @pose_value.empty?
  2490.   end
  2491.   #--------------------------------------------------------------------------
  2492.   # *
  2493.   #--------------------------------------------------------------------------
  2494.   def update_pose_wait
  2495.     if @pose[:time] == :animation
  2496.       @waiting = SceneManager.scene.spriteset.animation?
  2497.     elsif @pose[:time] == :action
  2498.       @waiting = SceneManager.scene.spriteset.action?(subject)
  2499.     elsif @pose[:time] == :movement
  2500.       @waiting = subject.moving?
  2501.     elsif @pose[:time] == :throw
  2502.       @waiting = throwing?
  2503.     else
  2504.       @pose[:time] -= 1
  2505.       @pose[:time] = @pose[:wait] if @pose[:time] == 0
  2506.       @waiting = @pose[:time] != @pose[:wait]
  2507.     end
  2508.   end
  2509.   #--------------------------------------------------------------------------
  2510.   # *
  2511.   #--------------------------------------------------------------------------
  2512.   def update_pose_clear
  2513.     battler.pose_list.clear
  2514.   end
  2515.   #--------------------------------------------------------------------------
  2516.   # *
  2517.   #--------------------------------------------------------------------------
  2518.   def update_pose_action
  2519.     get_target.each do |target|
  2520.       target.call_pose(@pose[:action], true, nil, @battler)
  2521.     end
  2522.   end
  2523.   #--------------------------------------------------------------------------
  2524.   # *
  2525.   #--------------------------------------------------------------------------
  2526.   def update_pose_anim
  2527.     subject.targets = get_target
  2528.     subject.call_anim = true
  2529.     subject.animation = @pose[:anim]
  2530.   end
  2531.   #--------------------------------------------------------------------------
  2532.   # *
  2533.   #--------------------------------------------------------------------------
  2534.   def update_pose_effect
  2535.     subject.call_effect = true
  2536.     subject.attack_flag = @pose[:weapon]
  2537.     subject.damage_flag = @pose[:damage]
  2538.     subject.target_flag = @pose[:target] ? @pose[:target] : subject.targets
  2539.   end
  2540.  
  2541.   #--------------------------------------------------------------------------
  2542.   # *
  2543.   #--------------------------------------------------------------------------
  2544.   def update_pose_loop
  2545.     get_target.each {|target| target.pose_loop_anim = @pose[:loop_anim] }
  2546.   end
  2547.   #--------------------------------------------------------------------------
  2548.   # *
  2549.   #--------------------------------------------------------------------------
  2550.   def update_pose_pose
  2551.     get_target.each do |target|
  2552.       target.row    = @pose[:row] - 1
  2553.       target.sufix  = @pose[:sufix]
  2554.       target.timing = @pose[:pose]
  2555.       target.frame  = @pose[:frame] - 1
  2556.       target.frame  = target.frame % sprite_settings[:frames]
  2557.     end
  2558.   end
  2559.   #--------------------------------------------------------------------------
  2560.   # *
  2561.   #--------------------------------------------------------------------------
  2562.   def update_pose_move
  2563.     get_target.each do |target|
  2564.       target.teleport = @pose[:teleport]
  2565.       setup_target_position(target)
  2566.       target.target_position[:x] += subject.left? ? @pose[:x] : -@pose[:x]
  2567.       target.target_position[:y] += subject.down? ? @pose[:y] : -@pose[:y]
  2568.       target.target_position[:h] += @pose[:h]
  2569.       target.move_speed = @pose[:speed]
  2570.     end
  2571.   end
  2572.   #--------------------------------------------------------------------------
  2573.   # *
  2574.   #--------------------------------------------------------------------------
  2575.   def update_pose_jump
  2576.     get_target.each do |target|
  2577.       if @pose[:move]
  2578.         x_plus = (target.target_distance(:x) / 32.0).abs
  2579.         y_plus = (target.target_distance(:y) / 32.0).abs
  2580.         speed = Math.sqrt((x_plus ** 2) + (y_plus ** 2))
  2581.         target.jumping[:speed] = @pose[:height] * 5.0 / [speed, 1].max
  2582.       else
  2583.         target.jumping[:speed] = @pose[:speed]
  2584.       end
  2585.       target.jumping[:height] = @pose[:height]
  2586.       target.jumping[:count]  = target.jumping[:height] * 2  
  2587.     end   
  2588.   end
  2589.   #--------------------------------------------------------------------------
  2590.   # *
  2591.   #--------------------------------------------------------------------------
  2592.   def update_pose_inactive
  2593.     subject.deactivate
  2594.   end
  2595.   #--------------------------------------------------------------------------
  2596.   # *
  2597.   #--------------------------------------------------------------------------
  2598.   def update_pose_direction
  2599.     subject.action_direction if @pose[:targets]
  2600.     subject.direction = @pose[:direction] if @pose[:direction]
  2601.   end
  2602.   #--------------------------------------------------------------------------
  2603.   # *
  2604.   #--------------------------------------------------------------------------
  2605.   def update_pose_icon
  2606.     get_target.each do |target|
  2607.       if @pose[:delete]
  2608.         target.icon_list.delete(@pose[:index])
  2609.       else
  2610.         target.icon_list[@pose[:index]] = @pose.dup
  2611.       end
  2612.     end
  2613.   end
  2614.   #--------------------------------------------------------------------------
  2615.   # *
  2616.   #--------------------------------------------------------------------------
  2617.   def update_pose_throw
  2618.     get_target.each do |target|
  2619.       value = @pose.dup
  2620.       value[:user] = SceneManager.scene.spriteset.sprite(subject)
  2621.       target.throw_list.push(value.dup)
  2622.     end   
  2623.   end
  2624.   #--------------------------------------------------------------------------
  2625.   # *
  2626.   #--------------------------------------------------------------------------
  2627.   def setup_target_position(target)
  2628.     if @pose[:value] == :move_to
  2629.       setup_move_to_target_position(target)
  2630.     elsif @pose[:value] == :step_foward
  2631.       setup_step_foward_position(target)
  2632.     elsif @pose[:value] == :step_backward
  2633.       setup_step_backward_position(target)
  2634.     elsif @pose[:value] == :escape
  2635.       setup_escape_position(target)
  2636.     elsif @pose[:value] == :retreat
  2637.       setup_retreat_position(target)
  2638.     end
  2639.   end
  2640.   #--------------------------------------------------------------------------
  2641.   # *
  2642.   #--------------------------------------------------------------------------
  2643.   def setup_move_to_target_position(target)
  2644.     targets = @pose[:targets]
  2645.     return @waiting = true if targets.any? {|target| target.moving?}
  2646.     x = targets.collect {|target| target.current_position[:x]}.average
  2647.     y = targets.collect {|target| target.current_position[:y]}.average
  2648.     target.target_direction(x, y)
  2649.     y -= 32 if @battler.down?
  2650.     x += 32 if @battler.left?
  2651.     x -= 32 if @battler.right?
  2652.     y += 32 if @battler.up?
  2653.     target.target_position[:x] = x
  2654.     target.target_position[:y] = y
  2655.   end
  2656.   #--------------------------------------------------------------------------
  2657.   # *
  2658.   #--------------------------------------------------------------------------
  2659.   def setup_step_foward_position(target)
  2660.     target.target_position[:y] += 32 if @battler.down?
  2661.     target.target_position[:x] -= 32 if @battler.left?
  2662.     target.target_position[:x] += 32 if @battler.right?
  2663.     target.target_position[:y] -= 32 if @battler.up?
  2664.   end
  2665.   #--------------------------------------------------------------------------
  2666.   # *
  2667.   #--------------------------------------------------------------------------
  2668.   def setup_step_backward_position(target)
  2669.     target.target_position[:y] -= 32 if @battler.down?
  2670.     target.target_position[:x] += 32 if @battler.left?
  2671.     target.target_position[:x] -= 32 if @battler.right?
  2672.     target.target_position[:y] += 32 if @battler.up?
  2673.   end
  2674.   #--------------------------------------------------------------------------
  2675.   # *
  2676.   #--------------------------------------------------------------------------
  2677.   def setup_escape_position(target)
  2678.     target.target_position[:y] -= 240 if @battler.down?
  2679.     target.target_position[:x] += 240 if @battler.left?
  2680.     target.target_position[:x] -= 240 if @battler.right?
  2681.     target.target_position[:y] += 240 if @battler.up?
  2682.     position = target.target_position
  2683.     target.target_direction(position[:x], position[:y])
  2684.   end
  2685.   #--------------------------------------------------------------------------
  2686.   # *
  2687.   #--------------------------------------------------------------------------
  2688.   def setup_retreat_position(target)
  2689.     target.target_position[:x] = target.screen_x
  2690.     target.target_position[:y] = target.screen_y
  2691.     position = target.target_position
  2692.     target.target_direction(position[:x], position[:y])
  2693.   end
  2694.   #--------------------------------------------------------------------------
  2695.   # *
  2696.   #--------------------------------------------------------------------------
  2697.   def reset_pose
  2698.     old_pose = @battler.pose_name
  2699.     @battler.default_direction
  2700.     @battler.clear_idle_poses
  2701.     new_pose = get_idle_pose
  2702.     @battler.call_pose(new_pose)
  2703.     setup_pose
  2704.   end
  2705.   #--------------------------------------------------------------------------
  2706.   # *
  2707.   #--------------------------------------------------------------------------
  2708.   def get_idle_pose
  2709.     pose = :idle
  2710.     pose = :danger   if @battler.danger?
  2711.     pose = @battler.state_pose  if @battler.state_pose?
  2712.     pose = :guarding if @battler.guard?
  2713.     pose = @battler.active_pose if @battler.active_pose
  2714.     pose = :dead     if @battler.dead?
  2715.     pose
  2716.   end
  2717.   #--------------------------------------------------------------------------
  2718.   # *
  2719.   #--------------------------------------------------------------------------
  2720.   def get_target
  2721.     @pose[:target] ? @pose[:target] : [subject]
  2722.   end
  2723.   #--------------------------------------------------------------------------
  2724.   # *
  2725.   #--------------------------------------------------------------------------
  2726.   def setup_positions
  2727.     positions = {x: @battler.screen_x, y: @battler.screen_y, h: 0, j: 0}
  2728.     @battler.target_position  = positions.dup
  2729.     @battler.current_position = positions.dup
  2730.     @battler.default_position = positions.dup
  2731.     @battler.jumping = {count: 0, height: 0, speed: 10}
  2732.     reset_pose
  2733.   end
  2734.   #--------------------------------------------------------------------------
  2735.   # *
  2736.   #--------------------------------------------------------------------------
  2737.   def position
  2738.     @battler.current_position
  2739.   end
  2740.   #--------------------------------------------------------------------------
  2741.   # *
  2742.   #--------------------------------------------------------------------------
  2743.   def update_position
  2744.     update_movement
  2745.     update_jumping
  2746.     self.x = position[:x]
  2747.     self.y = position[:y] - position[:h] - position[:j]
  2748.     self.z = position[:y] + 1
  2749.   end
  2750.   #--------------------------------------------------------------------------
  2751.   # *
  2752.   #--------------------------------------------------------------------------
  2753.   def update_movement
  2754.     return unless @battler.moving?
  2755.     @battler.teleport ? update_teleport_movement : update_normal_movement
  2756.   end
  2757.   #--------------------------------------------------------------------------
  2758.   # *
  2759.   #--------------------------------------------------------------------------
  2760.   def update_movement_teleport
  2761.     @battler.current_position[:x] = @battler.target_position[:x]
  2762.     @battler.current_position[:y] = @battler.target_position[:y]
  2763.     @battler.current_position[:h] = [@battler.target_position[:h], 0].max
  2764.     @battler.teleport = false
  2765.   end
  2766.   #--------------------------------------------------------------------------
  2767.   # *
  2768.   #--------------------------------------------------------------------------
  2769.   def update_normal_movement
  2770.     distance = set_distance
  2771.     move     = {x: 1.0, y: 1.0, h: 1.0}
  2772.     if distance[:x].abs < distance[:y].abs
  2773.       move[:x] = 1.0 / (distance[:y].abs.to_f / distance[:x].abs)
  2774.     elsif distance[:y].abs < distance[:x].abs
  2775.       move[:y] = 1.0 / (distance[:x].abs.to_f / distance[:y].abs)
  2776.     elsif distance[:h].abs < distance[:x].abs
  2777.       move[:h] = 1.0 / (distance[:x].abs.to_f / distance[:h].abs)
  2778.     end
  2779.     speed = set_speed(distance)
  2780.     x = (move[:x] * speed[:x]).round
  2781.     y = (move[:y] * speed[:y]).round
  2782.     h = (move[:h] * speed[:h]).round
  2783.     set_movement(x, y, h)
  2784.   end
  2785.   #--------------------------------------------------------------------------
  2786.   # *
  2787.   #--------------------------------------------------------------------------
  2788.   def set_distance
  2789.     x = @battler.target_distance(:x)
  2790.     y = @battler.target_distance(:y)
  2791.     h = @battler.target_distance(:h)
  2792.     {x: x, y: y, h: h}
  2793.   end
  2794.   #--------------------------------------------------------------------------
  2795.   # *
  2796.   #--------------------------------------------------------------------------
  2797.   def set_speed(distance)
  2798.     move_speed = @battler.move_speed
  2799.     x = move_speed * (distance[:x] == 0 ? 0 : (distance[:x] > 0 ? 8 : -8))
  2800.     y = move_speed * (distance[:y] == 0 ? 0 : (distance[:y] > 0 ? 8 : -8))
  2801.     h = move_speed * (distance[:h] == 0 ? 0 : (distance[:h] > 0 ? 8 : -8))
  2802.     {x: x, y: y, h: h}
  2803.   end
  2804.   #--------------------------------------------------------------------------
  2805.   # *
  2806.   #--------------------------------------------------------------------------
  2807.   def set_movement(x, y, h)
  2808.     target  = @battler.target_position
  2809.     current = @battler.current_position
  2810.     current[:x] += x
  2811.     current[:y] += y
  2812.     current[:h] += h
  2813.     current[:x] = target[:x] if in_distance?(current[:x], target[:x], x)
  2814.     current[:y] = target[:y] if in_distance?(current[:y], target[:y], y)
  2815.     current[:h] = target[:h] if in_distance?(current[:h], target[:h], h)
  2816.   end
  2817.   #--------------------------------------------------------------------------
  2818.   # *
  2819.   #--------------------------------------------------------------------------
  2820.   def in_distance?(x, y, z)
  2821.     x.between?(y - z - 1, y + z + 1)
  2822.   end
  2823.   #--------------------------------------------------------------------------
  2824.   # *
  2825.   #--------------------------------------------------------------------------
  2826.   def update_jumping
  2827.     return if @battler.jumping[:count] == 0
  2828.     jump = @battler.jumping
  2829.     jump[:count] = [jump[:count] - (1 * jump[:speed] / 10.0), 0].max.to_f
  2830.     count = jump[:count]
  2831.     speed = jump[:speed]
  2832.     peak  = jump[:height]
  2833.     height = count >= peak ? count - peak : peak - count
  2834.     result = (peak ** 2 - height ** 2).to_i
  2835.     @battler.current_position[:j] = [result, 0].max
  2836.   end
  2837.   #--------------------------------------------------------------------------
  2838.   # *
  2839.   #--------------------------------------------------------------------------
  2840.   def update_icon
  2841.     @battler.icon_list.each do |key, value|
  2842.       icon = @icon_list[key]
  2843.       @icon_list[key] = Sprite_Icon.new(self, value) if !icon
  2844.       icon.refresh       if list && value[:icon] != icon.icon
  2845.       icon.value = value if icon && icon.value != value
  2846.     end
  2847.     @icon_list.each do |key, value|
  2848.       value.update
  2849.       delete_icon(key) if value && !@battler.icon_list[key]
  2850.     end
  2851.   end
  2852.   #--------------------------------------------------------------------------
  2853.   # *
  2854.   #--------------------------------------------------------------------------
  2855.   def update_throw
  2856.     @battler.throw_list.each do |value|
  2857.       @throw_list.push(Sprite_Throw.new(self, value.dup))
  2858.       @battler.throw_list.delete(value)
  2859.     end
  2860.     @throw_list.each_with_index do |value, index|
  2861.       value.update
  2862.       delete_throw(index) if value.disposing?
  2863.     end
  2864.     @throw_list.compact!
  2865.   end
  2866.   #--------------------------------------------------------------------------
  2867.   # *
  2868.   #--------------------------------------------------------------------------
  2869.   def delete_icon(key)
  2870.     @icon_list[key].dispose
  2871.     @icon_list.delete(key)
  2872.   end
  2873.   #--------------------------------------------------------------------------
  2874.   # *
  2875.   #--------------------------------------------------------------------------
  2876.   def delete_throw(index)
  2877.     @throw_list[index].dispose
  2878.     @throw_list.delete_at(index)
  2879.   end
  2880.   #--------------------------------------------------------------------------
  2881.   # *
  2882.   #--------------------------------------------------------------------------
  2883.   def throwing?
  2884.     !@throw_list.empty?
  2885.   end
  2886.   #--------------------------------------------------------------------------
  2887.   # *
  2888.   #--------------------------------------------------------------------------
  2889.   def update_pose_loop_anim
  2890.     if @battler.pose_loop_anim && !loop_anim?(:pose_anim)
  2891.       @pose_name_list = @battler.pose_name_list.first
  2892.       animation = {type: :pose_anim, anim: @battler.pose_loop_anim, loop: 1}     
  2893.       add_loop_animation(animation)
  2894.     end
  2895.     if @battler.pose_loop_anim && loop_anim?(:pose_anim) &&
  2896.        @pose_name_list != @battler.pose_name_list.first
  2897.       @pose_loop_anim = nil
  2898.       @battler.pose_loop_anim = nil
  2899.       end_loop_anim(:pose_anim)
  2900.     end
  2901.   end
  2902. end
  2903.  
  2904. #==============================================================================
  2905. # ** Spriteset_Battle
  2906. #------------------------------------------------------------------------------
  2907. #  This class brings together battle screen sprites. It's used within the
  2908. # Scene_Battle class.
  2909. #==============================================================================
  2910.  
  2911. class Spriteset_Battle
  2912.   #--------------------------------------------------------------------------
  2913.   # *
  2914.   #--------------------------------------------------------------------------
  2915.   alias :create_pictures_ve_animated_battle :create_pictures
  2916.   def create_pictures
  2917.     battler_sprites.each {|battler| battler.setup_positions }
  2918.     create_pictures_ve_animated_battle
  2919.   end
  2920.   #--------------------------------------------------------------------------
  2921.   # *
  2922.   #--------------------------------------------------------------------------
  2923.   def action?(subject)
  2924.     battler_sprites.compact.any? do |sprite|
  2925.       sprite.subject == subject && sprite.battler != subject &&
  2926.       sprite.subject != sprite.battler
  2927.     end
  2928.   end
  2929. end
  2930.  
  2931. #==============================================================================
  2932. # ** Window_BattleLog
  2933. #------------------------------------------------------------------------------
  2934. #  This window shows the battle progress. Do not show the window frame.
  2935. #==============================================================================
  2936.  
  2937. class Window_BattleLog < Window_Selectable
  2938.   #--------------------------------------------------------------------------
  2939.   # *
  2940.   #--------------------------------------------------------------------------
  2941.   def display_added_states(target)
  2942.     target.result.added_state_objects.each do |state|
  2943.       state_msg = target.actor? ? state.message1 : state.message2
  2944.       next if state_msg.empty?
  2945.       replace_text(target.name + state_msg)
  2946.       wait
  2947.       wait_for_effect
  2948.     end
  2949.   end
  2950. end
  2951.  
  2952. #==============================================================================
  2953. # ** Sprite_Icon
  2954. #------------------------------------------------------------------------------
  2955. #  This sprite is used to display icons.
  2956. #==============================================================================
  2957.  
  2958. class Sprite_Icon < Sprite_Base
  2959.   #--------------------------------------------------------------------------
  2960.   # *
  2961.   #--------------------------------------------------------------------------
  2962.   attr_accessor :value
  2963.   #--------------------------------------------------------------------------
  2964.   # *
  2965.   #--------------------------------------------------------------------------
  2966.   def initialize(battler, value)
  2967.     super(battler.viewport)
  2968.     @battler = battler
  2969.     @value   = value.dup
  2970.     refresh
  2971.   end
  2972.   #--------------------------------------------------------------------------
  2973.   # *
  2974.   #--------------------------------------------------------------------------
  2975.   def icon
  2976.     value[:icon]
  2977.   end
  2978.   #--------------------------------------------------------------------------
  2979.   # *
  2980.   #--------------------------------------------------------------------------
  2981.   def refresh
  2982.     self.bitmap = Cache.system("Iconset")
  2983.     self.src_rect.set(icon % 16 * 24, icon / 16 * 24, 24, 24)
  2984.   end
  2985.   #--------------------------------------------------------------------------
  2986.   # *
  2987.   #--------------------------------------------------------------------------
  2988.   def update
  2989.     super
  2990.     update_position
  2991.   end
  2992.   #--------------------------------------------------------------------------
  2993.   # *
  2994.   #--------------------------------------------------------------------------
  2995.   def update_position
  2996.     self.x = pos[:x] + value[:x] - @battler.ox / 2
  2997.     self.y = pos[:y] - pos[:h] - pos[:j] + value[:y] - @battler.oy / 2
  2998.     self.z = pos[:y] + value[:z]
  2999.     self.ox = 12
  3000.     self.oy = 12
  3001.     self.opacity = value[:o]
  3002.     self.angle   = value[:a] if self.angle != value[:a]
  3003.     self.mirror  = @battler.mirror
  3004.   end
  3005.   #--------------------------------------------------------------------------
  3006.   # *
  3007.   #--------------------------------------------------------------------------
  3008.   def pos
  3009.     @battler.position
  3010.   end
  3011. end
  3012.  
  3013. #==============================================================================
  3014. # ** Sprite_Throw
  3015. #------------------------------------------------------------------------------
  3016. #  This sprite is used to display throw animations.
  3017. #==============================================================================
  3018.  
  3019. class Sprite_Throw < Sprite_Base
  3020.   #--------------------------------------------------------------------------
  3021.   # *
  3022.   #--------------------------------------------------------------------------
  3023.   def initialize(target, settings)
  3024.     super(target.viewport)
  3025.     @active = settings[:user]
  3026.     @target = target
  3027.     @values = settings.dup
  3028.     setup_throw
  3029.   end
  3030.   #--------------------------------------------------------------------------
  3031.   # *
  3032.   #--------------------------------------------------------------------------
  3033.   def setup_throw
  3034.     set_initial_position
  3035.     setup_arc
  3036.     setup_icon
  3037.     setup_animation if $imported[:ve_loop_animation] && value[:anim]
  3038.   end
  3039.   #--------------------------------------------------------------------------
  3040.   # *
  3041.   #--------------------------------------------------------------------------
  3042.   def set_initial_position
  3043.     if value[:return]
  3044.       @current_position = @target.position.dup
  3045.       @target_position  = @active.position.dup
  3046.       init_oy = @target.oy / 2
  3047.       end_oy  = @active.oy / 2
  3048.     else
  3049.       @current_position = @active.position.dup
  3050.       @target_position  = @target.position.dup
  3051.       init_oy = @active.oy / 2
  3052.       end_oy  = @target.oy / 2
  3053.     end
  3054.     @current_position[:x] += value[:init_x]
  3055.     @current_position[:y] += value[:init_y] - init_oy
  3056.     @target_position[:x]  += value[:end_x]
  3057.     @target_position[:y]  += value[:end_y]  - end_oy
  3058.   end
  3059.   #--------------------------------------------------------------------------
  3060.   # *
  3061.   #--------------------------------------------------------------------------
  3062.   def setup_arc
  3063.     @arc = {}
  3064.     x_plus = (target_distance(:x) / 48.0).abs
  3065.     y_plus = (target_distance(:y) / 48.0).abs
  3066.     speed = Math.sqrt((x_plus ** 2) + (y_plus ** 2))
  3067.     @arc[:speed]  = value[:arc] * 5.0 / [speed, 1].max
  3068.     @arc[:height] = value[:arc]
  3069.     @arc[:count]  = value[:arc] * 2
  3070.     @current_position[:a] = 0
  3071.   end
  3072.   #--------------------------------------------------------------------------
  3073.   # *
  3074.   #--------------------------------------------------------------------------
  3075.   def setup_icon
  3076.     self.bitmap = Cache.system("Iconset")
  3077.     self.src_rect.set(value[:icon] % 16 * 24, value[:icon] / 16 * 24, 24, 24)
  3078.     self.angle = value[:angle]
  3079.   end
  3080.   #--------------------------------------------------------------------------
  3081.   # *
  3082.   #--------------------------------------------------------------------------
  3083.   def setup_animation
  3084.     animation = {type: :throw, anim: value[:anim], loop: 1}
  3085.     add_loop_animation(animation)
  3086.   end
  3087.   #--------------------------------------------------------------------------
  3088.   # *
  3089.   #--------------------------------------------------------------------------
  3090.   def value
  3091.     @values
  3092.   end
  3093.   #--------------------------------------------------------------------------
  3094.   # *
  3095.   #--------------------------------------------------------------------------
  3096.   def update
  3097.     super
  3098.     update_move
  3099.     update_arc
  3100.     update_position
  3101.   end
  3102.   #--------------------------------------------------------------------------
  3103.   # *
  3104.   #--------------------------------------------------------------------------
  3105.   def update_move
  3106.     distance = set_distance
  3107.     move     = {x: 1.0, y: 1.0}
  3108.     if distance[:x].abs < distance[:y].abs
  3109.       move[:x] = 1.0 / (distance[:y].abs.to_f / distance[:x].abs)
  3110.     elsif distance[:y].abs < distance[:x].abs
  3111.       move[:y] = 1.0 / (distance[:x].abs.to_f / distance[:y].abs)
  3112.     end
  3113.     speed = set_speed(distance)
  3114.     x = (move[:x] * speed[:x]).round
  3115.     y = (move[:y] * speed[:y]).round
  3116.     set_movement(x, y)
  3117.   end
  3118.   #--------------------------------------------------------------------------
  3119.   # *
  3120.   #--------------------------------------------------------------------------
  3121.   def set_distance
  3122.     {x: target_distance(:x), y: target_distance(:y)}
  3123.   end
  3124.   #--------------------------------------------------------------------------
  3125.   # *
  3126.   #--------------------------------------------------------------------------
  3127.   def target_distance(symbol)
  3128.     @target_position[symbol] - @current_position[symbol]
  3129.   end
  3130.   #--------------------------------------------------------------------------
  3131.   # *
  3132.   #--------------------------------------------------------------------------
  3133.   def set_speed(distance)
  3134.     x = value[:speed] * (distance[:x] == 0 ? 0 : (distance[:x] > 0 ? 8 : -8))
  3135.     y = value[:speed] * (distance[:y] == 0 ? 0 : (distance[:y] > 0 ? 8 : -8))
  3136.     {x: x, y: y}
  3137.   end
  3138.   #--------------------------------------------------------------------------
  3139.   # *
  3140.   #--------------------------------------------------------------------------
  3141.   def set_movement(x, y)
  3142.     target  = @target_position
  3143.     current = @current_position
  3144.     current[:x] += x
  3145.     current[:y] += y
  3146.     current[:x] = target[:x] if in_distance?(current[:x], target[:x], x)
  3147.     current[:y] = target[:y] if in_distance?(current[:y], target[:y], y)
  3148.   end
  3149.   #--------------------------------------------------------------------------
  3150.   # *
  3151.   #--------------------------------------------------------------------------
  3152.   def in_distance?(x, y, z)
  3153.     x.between?(y - z - 1, y + z + 1)
  3154.   end
  3155.   #--------------------------------------------------------------------------
  3156.   # *
  3157.   #--------------------------------------------------------------------------
  3158.   def update_arc
  3159.     return if @arc[:count] == 0
  3160.     @arc[:count] = [@arc[:count] - (1 * @arc[:speed] / 10.0), 0].max.to_f
  3161.     count = @arc[:count]
  3162.     speed = @arc[:speed]
  3163.     peak  = @arc[:height]
  3164.     height = count >= peak ? count - peak : peak - count
  3165.     result = [peak ** 2 - height ** 2, 0].max.to_i
  3166.     @current_position[:a] = value[:revert] ? -result : result
  3167.   end
  3168.   #--------------------------------------------------------------------------
  3169.   # *
  3170.   #--------------------------------------------------------------------------
  3171.   def update_position
  3172.     self.x = position[:x]
  3173.     self.y = position[:y] - position[:h] - position[:a]
  3174.     self.z = position[:y] + value[:z]
  3175.     self.ox = 12
  3176.     self.oy = 12
  3177.     self.opacity = value[:o]
  3178.     self.angle  += value[:a] if Graphics.frame_count % 2 == 0
  3179.     self.mirror  = @active.mirror
  3180.   end
  3181.   #--------------------------------------------------------------------------
  3182.   # *
  3183.   #--------------------------------------------------------------------------
  3184.   def position
  3185.     @current_position
  3186.   end
  3187.   #--------------------------------------------------------------------------
  3188.   # *
  3189.   #--------------------------------------------------------------------------
  3190.   def target
  3191.     @target_position
  3192.   end
  3193.   #--------------------------------------------------------------------------
  3194.   # *
  3195.   #--------------------------------------------------------------------------
  3196.   def disposing?
  3197.     position[:x] == target[:x] && position[:y] == target[:y]
  3198.   end
  3199. end
  3200.  
  3201. #==============================================================================
  3202. # ** Scene_Battle
  3203. #------------------------------------------------------------------------------
  3204. #  This class performs battle screen processing.
  3205. #==============================================================================
  3206.  
  3207. class Scene_Battle < Scene_Base
  3208.   #--------------------------------------------------------------------------
  3209.   # *
  3210.   #--------------------------------------------------------------------------
  3211.   def abs_wait_short
  3212.   end
  3213.   #--------------------------------------------------------------------------
  3214.   # *
  3215.   #--------------------------------------------------------------------------
  3216.   def wait_for_animation
  3217.     update_for_wait
  3218.   end
  3219.   #--------------------------------------------------------------------------
  3220.   # *
  3221.   #--------------------------------------------------------------------------
  3222.   def wait_for_effect
  3223.     update_for_wait
  3224.   end
  3225.   #--------------------------------------------------------------------------
  3226.   # *
  3227.   #--------------------------------------------------------------------------
  3228.   alias :create_spriteset_ve_animated_battle :create_spriteset
  3229.   def create_spriteset
  3230.     create_spriteset_ve_animated_battle
  3231.     $game_party.movable_members.each {|member| member.call_pose(:intro, true) }
  3232.     3.times { @spriteset.update }
  3233.   end
  3234.   #--------------------------------------------------------------------------
  3235.   # *
  3236.   #--------------------------------------------------------------------------
  3237.   alias :update_basic_ve_animated_battle :update_basic
  3238.   def update_basic
  3239.     update_basic_ve_animated_battle
  3240.     update_sprite_action
  3241.   end
  3242.   #--------------------------------------------------------------------------
  3243.   # *
  3244.   #--------------------------------------------------------------------------
  3245.   alias :turn_end_ve_animated_battle :turn_end
  3246.   def turn_end
  3247.     turn_end_ve_animated_battle
  3248.     @spriteset.battler_sprites.each {|sprite| sprite.reset_pose }
  3249.   end
  3250.   #--------------------------------------------------------------------------
  3251.   # *
  3252.   #--------------------------------------------------------------------------
  3253.   def process_action
  3254.     return if scene_changing?
  3255.     if next_subject?
  3256.       @subject = BattleManager.next_subject
  3257.       @subject.activate if @subject
  3258.     end
  3259.     return turn_end unless @subject
  3260.     return process_action_end if !@subject.active && !@subject.current_action
  3261.     if @subject.current_action
  3262.       @subject.current_action.prepare
  3263.       if @subject.current_action.valid?
  3264.         @status_window.open
  3265.         execute_action
  3266.       end
  3267.       @subject.remove_current_action
  3268.     end
  3269.   end
  3270.   #--------------------------------------------------------------------------
  3271.   # *
  3272.   #--------------------------------------------------------------------------
  3273.   def next_command
  3274.     BattleManager.set_active_pose
  3275.     if BattleManager.next_command
  3276.       start_actor_command_selection
  3277.     else
  3278.       turn_start
  3279.     end
  3280.   end
  3281.   #--------------------------------------------------------------------------
  3282.   # *
  3283.   #--------------------------------------------------------------------------
  3284.   def prior_command
  3285.     if BattleManager.prior_command
  3286.       start_actor_command_selection
  3287.     else
  3288.       start_party_command_selection
  3289.     end
  3290.     BattleManager.clear_active_pose
  3291.   end
  3292.   #--------------------------------------------------------------------------
  3293.   # *
  3294.   #--------------------------------------------------------------------------
  3295.   def show_animation(targets, animation_id)
  3296.     if animation_id < 0
  3297.       show_animated_attack_animation(targets)
  3298.     else
  3299.       show_normal_animation(targets, animation_id)
  3300.     end
  3301.     wait_for_animation
  3302.   end
  3303.   #--------------------------------------------------------------------------
  3304.   # *
  3305.   #--------------------------------------------------------------------------
  3306.   def show_animated_attack_animation(targets)
  3307.     if @subject.actor? || $imported[:ve_actor_battlers]
  3308.       show_normal_animation(targets, @subject.atk_animation_id1, false)
  3309.     else
  3310.       Sound.play_enemy_attack
  3311.       abs_wait_short
  3312.     end
  3313.   end
  3314.   #--------------------------------------------------------------------------
  3315.   # *
  3316.   #--------------------------------------------------------------------------
  3317.   def next_subject?
  3318.     !@subject || !@subject.active?
  3319.   end
  3320.   #--------------------------------------------------------------------------
  3321.   # *
  3322.   #--------------------------------------------------------------------------
  3323.   def active?
  3324.     members = $game_troop.members + $game_party.battle_members
  3325.     members.any? {|member| member.active }
  3326.   end
  3327.   #--------------------------------------------------------------------------
  3328.   # *
  3329.   #--------------------------------------------------------------------------
  3330.   def execute_action
  3331.     use_item
  3332.     @log_window.wait_and_clear
  3333.   end
  3334.   #--------------------------------------------------------------------------
  3335.   # *
  3336.   #--------------------------------------------------------------------------
  3337.   def use_item
  3338.     item = @subject.current_action.item
  3339.     @log_window.display_use_item(@subject, item)
  3340.     @subject.action_pose(item)
  3341.     @subject.use_item(item)
  3342.     refresh_status
  3343.   end
  3344.   #--------------------------------------------------------------------------
  3345.   # *
  3346.   #--------------------------------------------------------------------------
  3347.   def update_sprite_action
  3348.     @old_subject = @subject
  3349.     battlers = $game_party.battle_members + $game_troop.members
  3350.     battlers.each do |subject|
  3351.       @subject = subject
  3352.       call_animation if @subject.call_anim
  3353.       call_effect    if @subject.call_effect
  3354.     end
  3355.     @subject = @old_subject
  3356.   end
  3357.   #--------------------------------------------------------------------------
  3358.   # *
  3359.   #--------------------------------------------------------------------------
  3360.   def call_animation
  3361.     @subject.call_anim = false
  3362.     animation = @subject.animation
  3363.     @subject.animation = 0
  3364.     show_animation(@subject.targets, animation)
  3365.   end
  3366.   #--------------------------------------------------------------------------
  3367.   # *
  3368.   #--------------------------------------------------------------------------
  3369.   def call_effect
  3370.     @subject.call_effect = false
  3371.     targets = @subject.target_flag ? @subject.target_flag : @subject.targets
  3372.     item    = @subject.current_item
  3373.     targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  3374.   end
  3375. end
  3376. #==============================================================================
  3377. # ** Victor Engine - Actors Battlers
  3378. #------------------------------------------------------------------------------
  3379. # Author : Victor Sant
  3380. #
  3381. # Version History:
  3382. #  v 1.00 - 2011.12.19 > First relase
  3383. #  v 1.01 - 2011.12.30 > Faster Regular Expressions
  3384. #  v 1.02 - 2012.01.15 > Compatibility for Target Arrow
  3385. #------------------------------------------------------------------------------
  3386. #  This script adds visible battler graphics for the party actors actors
  3387. # during combat. With the visible battlers, new options will be available
  3388. # like setting actor's battlers positions and attack animations.
  3389. #------------------------------------------------------------------------------
  3390. # Compatibility
  3391. #   Requires the script 'Victor Engine - Basic Module' v 1.09 or higher
  3392. #
  3393. # * Overwrite methods (Default)
  3394. #   class Spriteset_Battle
  3395. #      def create_actors
  3396. #     def update_actors
  3397. #
  3398. #   class Scene_Battle < Scene_Base
  3399. #     def show_attack_animation(targets)
  3400. #
  3401. # * Alias methods (Default)
  3402. #   class << DataManager
  3403. #     def setup_new_game
  3404. #     def create_game_objects
  3405. #     def make_save_contents
  3406. #     def extract_save_contents(contents)
  3407. #
  3408. #   class Game_Actor < Game_Battler
  3409. #     def setup(actor_id)
  3410. #
  3411. # * Alias methods (Basic Module)
  3412. #   class Game_Interpreter
  3413. #     def comment_call
  3414. #
  3415. #------------------------------------------------------------------------------
  3416. # Instructions:
  3417. #  To instal the script, open you script editor and paste this script on
  3418. #  a new section on bellow the Materials section. This script must also
  3419. #  be bellow the script 'Victor Engine - Basic'
  3420. #
  3421. #------------------------------------------------------------------------------
  3422. # Comment calls note tags:
  3423. #  Tags to be used in events comment box, works like a script call.
  3424. #  
  3425. #  <battler name id: x>
  3426. #   This tag allows to change the actor battler graphic.
  3427. #    id : actor ID
  3428. #    x  : battler graphic filename
  3429. #
  3430. #  <battler hue id: x>
  3431. #   This tag allows to change the actor battler graphic.
  3432. #    id : actor ID
  3433. #    x  : battler graphic hue (0-360)
  3434. #
  3435. #  <battler position i: x, y>
  3436. #   This tag allows to change the battler position during combat.
  3437. #   only valid if VE_BATTLE_FORMATION = :custom
  3438. #     i : position index
  3439. #     x : new coorditante X
  3440. #     y : new coorditante X
  3441. #
  3442. #------------------------------------------------------------------------------
  3443. # Actors note tags:
  3444. #   Tags to be used on the Actors note box in the database
  3445. #
  3446. #  <battler name: x>
  3447. #   This tag allows to set the initial battler graphic filename for the actor.
  3448. #    x : battler graphic filename
  3449. #
  3450. #  <battler hue: x>
  3451. #   This tag allows to set the initial battler graphic hur for the actor.
  3452. #    x : battler graphic hue (0-360)
  3453. #
  3454. #------------------------------------------------------------------------------
  3455. # Enemies note tags:
  3456. #   Tags to be used on the Enemies note box in the database
  3457. #
  3458. #  <attack animation: x>
  3459. #   This tag allows to set the normal attack animation for the enemy
  3460. #    x : animation ID
  3461. #  
  3462. #==============================================================================
  3463.  
  3464. #==============================================================================
  3465. # ** Victor Engine
  3466. #------------------------------------------------------------------------------
  3467. #   Setting module for the Victor Engine
  3468. #==============================================================================
  3469.  
  3470. module Victor_Engine
  3471.   #--------------------------------------------------------------------------
  3472.   # * Set the battle formation
  3473.   #    Choose here how the actors battlers will be placed on the combat.
  3474.   #    :front  : horizontal placement
  3475.   #    :side   : vertical placement
  3476.   #    :iso    : isometric placement
  3477.   #    :custom : custom placement
  3478.   #--------------------------------------------------------------------------
  3479.   VE_BATTLE_FORMATION = :side
  3480.   #--------------------------------------------------------------------------
  3481.   # * Set battler centralization
  3482.   #    When true, battlers are centralized automatically.
  3483.   #    Not valid if VE_BATTLE_FORMATION = :custom
  3484.   #--------------------------------------------------------------------------
  3485.   VE_BATTLE_CENTRALIZE = true
  3486.   #--------------------------------------------------------------------------
  3487.   # * Set battlers custom positions
  3488.   #    Only if VE_BATTLE_FORMATION = :custom, allows to set the position of
  3489.   #    all party actors, don't forget to add values for all positions
  3490.   #    available if using a party bigger than the default.
  3491.   #--------------------------------------------------------------------------
  3492.   VE_CUSTOM_POSTION = {
  3493.   # Position
  3494.     1 => {x: 460, y: 180}, # Postion for the first actor.
  3495.     2 => {x: 480, y: 210}, # Postion for the second actor.
  3496.     3 => {x: 500, y: 240}, # Postion for the fourth actor.
  3497.     4 => {x: 520, y: 270}, # Postion for the fifth actor.
  3498.   } # Don't remove
  3499.   #--------------------------------------------------------------------------
  3500.   # * Actors battlers position adjust
  3501.   #    Used to adjust the position of all actors battlers.
  3502.   #--------------------------------------------------------------------------
  3503.   VE_POSITION_ADJUST = {x: 0, y: 0}
  3504.  
  3505. end
  3506.  
  3507. $imported[:ve_actor_battlers] = true
  3508.  
  3509. #==============================================================================
  3510. # ** DataManager
  3511. #------------------------------------------------------------------------------
  3512. #  This module handles the game and database objects used in game.
  3513. # Almost all global variables are initialized on this module
  3514. #==============================================================================
  3515.  
  3516. class << DataManager
  3517.   #--------------------------------------------------------------------------
  3518.   # * Alias method: setup_new_game
  3519.   #--------------------------------------------------------------------------
  3520.   alias :setup_new_game_ve_actor_battlers :setup_new_game
  3521.   def setup_new_game
  3522.     setup_new_game_ve_actor_battlers
  3523.     $game_custom_positions = VE_CUSTOM_POSTION.dup
  3524.   end
  3525.   #--------------------------------------------------------------------------
  3526.   # * Alias method: create_game_objects
  3527.   #--------------------------------------------------------------------------
  3528.   alias :create_game_objects_ve_actor_battlers :create_game_objects
  3529.   def create_game_objects
  3530.     create_game_objects_ve_actor_battlers
  3531.     $game_custom_positions = {}
  3532.   end
  3533.   #--------------------------------------------------------------------------
  3534.   # * Alias method: make_save_contents
  3535.   #--------------------------------------------------------------------------
  3536.   alias :make_save_contents_ve_actor_battlers  :make_save_contents
  3537.   def make_save_contents
  3538.     contents = make_save_contents_ve_actor_battlers
  3539.     contents[:formations_ve] = $game_custom_positions
  3540.     contents
  3541.   end
  3542.   #--------------------------------------------------------------------------
  3543.   # * Alias method: extract_save_contents
  3544.   #--------------------------------------------------------------------------
  3545.   alias :extract_save_contents_ve_actor_battlers :extract_save_contents
  3546.   def extract_save_contents(contents)
  3547.     extract_save_contents_ve_actor_battlers(contents)
  3548.     $game_custom_positions = contents[:formations_ve]
  3549.   end
  3550. end
  3551.  
  3552. #==============================================================================
  3553. # ** Game_Actor
  3554. #------------------------------------------------------------------------------
  3555. #  This class handles actors. It's used within the Game_Actors class
  3556. # ($game_actors) and referenced by the Game_Party class ($game_party).
  3557. #==============================================================================
  3558.  
  3559. class Game_Actor < Game_Battler
  3560.   #--------------------------------------------------------------------------
  3561.   # * Public Instance Variables
  3562.   #--------------------------------------------------------------------------
  3563.   attr_accessor :screen_x                 # Coordenada X na tela
  3564.   attr_accessor :screen_y                 # Coordenada Y na tela
  3565.   #--------------------------------------------------------------------------
  3566.   # * Alias method: setup
  3567.   #--------------------------------------------------------------------------
  3568.   alias :setup_ve_actor_battlers :setup
  3569.   def setup(actor_id)
  3570.     setup_ve_actor_battlers(actor_id)
  3571.     @battler_name = actor_battler_name
  3572.     @battler_hue  = actor_battler_hue
  3573.   end
  3574.   #--------------------------------------------------------------------------
  3575.   # * Overwrite method: use_sprite?
  3576.   #--------------------------------------------------------------------------
  3577.   def use_sprite?
  3578.     return true
  3579.   end
  3580.   #--------------------------------------------------------------------------
  3581.   # * Overwrite method: screen_z
  3582.   #--------------------------------------------------------------------------
  3583.   def screen_z
  3584.     return 100
  3585.   end
  3586.   #--------------------------------------------------------------------------
  3587.   # * New method: actor_battler_name
  3588.   #--------------------------------------------------------------------------
  3589.   def actor_battler_name
  3590.     actor.note =~ /<BATTLER NAME: ([^><]*)>/i ? $1.to_s : ""
  3591.   end
  3592.   #--------------------------------------------------------------------------
  3593.   # * New method: actor_battler_hue
  3594.   #--------------------------------------------------------------------------
  3595.   def actor_battler_hue
  3596.     actor.note =~ /<BATTLER HUE: (\d+)>/i ? $1.to_i : 0
  3597.   end
  3598.   #--------------------------------------------------------------------------
  3599.   # * New method: battler_name
  3600.   #--------------------------------------------------------------------------
  3601.   def battler_name=(name)
  3602.     @battler_name = name if name.is_a?(String)
  3603.   end
  3604.   #--------------------------------------------------------------------------
  3605.   # * New method: battler_hue
  3606.   #--------------------------------------------------------------------------
  3607.   def battler_hue=(hue)
  3608.     @battler_hue = hue if hue.numeric?
  3609.   end
  3610.   #--------------------------------------------------------------------------
  3611.   # * New method: screen_x
  3612.   #--------------------------------------------------------------------------
  3613.   def screen_x
  3614.     setup_x
  3615.   end
  3616.   #--------------------------------------------------------------------------
  3617.   # * New method: screen_y
  3618.   #--------------------------------------------------------------------------
  3619.   def screen_y
  3620.     setup_y
  3621.   end
  3622.   #--------------------------------------------------------------------------
  3623.   # * New method: setup_x
  3624.   #--------------------------------------------------------------------------
  3625.   def setup_x
  3626.     case VE_BATTLE_FORMATION
  3627.     when :front  then position = get_frontal_x
  3628.     when :side   then position = get_sideview_x
  3629.     when :iso    then position = get_isometric_x
  3630.     when :custom then position = $game_custom_positions[index + 1][:x]
  3631.     end
  3632.     position + VE_POSITION_ADJUST[:x]
  3633.   end
  3634.   #--------------------------------------------------------------------------
  3635.   # * New method: setup_y
  3636.   #--------------------------------------------------------------------------
  3637.   def setup_y
  3638.     case VE_BATTLE_FORMATION
  3639.     when :front  then position = get_frontal_y
  3640.     when :side   then position = get_sideview_y
  3641.     when :iso    then position = get_isometric_y
  3642.     when :custom then position = $game_custom_positions[index + 1][:y]
  3643.     end
  3644.     position + VE_POSITION_ADJUST[:y]
  3645.   end
  3646.   #--------------------------------------------------------------------------
  3647.   # * New method: get_frontal_x
  3648.   #--------------------------------------------------------------------------
  3649.   def get_frontal_x
  3650.     if VE_BATTLE_CENTRALIZE
  3651.       size = $game_party.battle_members.size
  3652.       position = (index + 1) * Graphics.width / (size + 1)
  3653.     else
  3654.       size = $game_party.max_battle_members
  3655.       position = index * Graphics.width / size + 64
  3656.     end
  3657.     position
  3658.   end
  3659.   #--------------------------------------------------------------------------
  3660.   # * New method: get_frontal_y
  3661.   #--------------------------------------------------------------------------
  3662.   def get_frontal_y
  3663.     Graphics.height - 16
  3664.   end
  3665.   #--------------------------------------------------------------------------
  3666.   # * New method: get_sideview_x
  3667.   #--------------------------------------------------------------------------
  3668.   def get_sideview_x
  3669.     if VE_BATTLE_CENTRALIZE
  3670.       size = $game_party.max_battle_members
  3671.       position = -index * (index * 6 - 6 * size) + Graphics.width - 160
  3672.     else
  3673.       position = index * 48 + Graphics.width - 192
  3674.     end
  3675.     position
  3676.   end
  3677.   #--------------------------------------------------------------------------
  3678.   # * New method: get_sideview_y
  3679.   #--------------------------------------------------------------------------
  3680.   def get_sideview_y
  3681.     if VE_BATTLE_CENTRALIZE
  3682.       size = $game_party.battle_members.size
  3683.       position = (index - size) * 40 + size * 20 + Graphics.height - 160
  3684.     else
  3685.       position = index * 32 +  Graphics.height - 192
  3686.     end
  3687.     position
  3688.   end
  3689.   #--------------------------------------------------------------------------
  3690.   # * New method: get_isometric_x
  3691.   #--------------------------------------------------------------------------
  3692.   def get_isometric_x
  3693.     if VE_BATTLE_CENTRALIZE
  3694.       position = -index * (index * 22 - 32) + Graphics.width - 160
  3695.     else
  3696.       position = index * 32 +  Graphics.width - 192
  3697.     end
  3698.     position
  3699.   end
  3700.   #--------------------------------------------------------------------------
  3701.   # * New method: get_isometric_y
  3702.   #--------------------------------------------------------------------------
  3703.   def get_isometric_y
  3704.     if VE_BATTLE_CENTRALIZE
  3705.       position = index * (40 - index * 6) + Graphics.height - 160
  3706.     else
  3707.       position = Graphics.height - 96 - index * 32
  3708.     end
  3709.     position
  3710.   end
  3711. end
  3712.  
  3713. #==============================================================================
  3714. # ** Game_Enemy
  3715. #------------------------------------------------------------------------------
  3716. #  This class handles enemy characters. It's used within the Game_Troop class
  3717. # ($game_troop).
  3718. #==============================================================================
  3719.  
  3720. class Game_Enemy < Game_Battler
  3721.   #--------------------------------------------------------------------------
  3722.   # * New method: atk_animation_id1
  3723.   #--------------------------------------------------------------------------
  3724.   def atk_animation_id1
  3725.     enemy.note =~ /<ATTACK ANIM(?:ATION): (\d+)>/i ? $1.to_i : 1
  3726.   end
  3727.   #--------------------------------------------------------------------------
  3728.   # * New method: atk_animation_id2
  3729.   #--------------------------------------------------------------------------
  3730.   def atk_animation_id2
  3731.     return 0
  3732.   end
  3733. end
  3734.  
  3735. #==============================================================================
  3736. # ** Game_Interpreter
  3737. #------------------------------------------------------------------------------
  3738. #  An interpreter for executing event commands. This class is used within the
  3739. # Game_Map, Game_Troop, and Game_Event classes.
  3740. #==============================================================================
  3741.  
  3742. class Game_Interpreter
  3743.   #--------------------------------------------------------------------------
  3744.   # * Alias method: comment_call
  3745.   #--------------------------------------------------------------------------
  3746.   alias :comment_call_ve_actor_battlers :comment_call
  3747.   def comment_call
  3748.     change_battler_name
  3749.     change_battler_hue
  3750.     change_position
  3751.     comment_call_ve_actor_battlers
  3752.   end
  3753.   #--------------------------------------------------------------------------
  3754.   # * New method: change_battler_name
  3755.   #--------------------------------------------------------------------------
  3756.   def change_battler_name
  3757.     note.scan(/<BATTLER NAME (\d+): ([^><]*)>/i) do |id, name|
  3758.       $game_actors[id.to_i].battler_name = name
  3759.     end
  3760.   end
  3761.   #--------------------------------------------------------------------------
  3762.   # * New method: change_battler_hue
  3763.   #--------------------------------------------------------------------------
  3764.   def change_battler_hue
  3765.     note.scan(/<BATTLER HUE (\d+): (\d+)>/i) do |id, hue|
  3766.       $game_actors[id.to_i].battler_hue = hue
  3767.     end
  3768.   end
  3769.   #--------------------------------------------------------------------------
  3770.   # * New method: change_position
  3771.   #--------------------------------------------------------------------------
  3772.   def change_position
  3773.     regexp = /<CHANGE POSTION (\d+): (\d+) *, *(\d+)>/i
  3774.     note.scan(regexp) do |i, x, y|
  3775.       $game_custom_positions[i.to_i][:x] = x.to_i
  3776.       $game_custom_positions[i.to_i][:y] = y.to_i
  3777.     end
  3778.   end
  3779. end
  3780.  
  3781. #==============================================================================
  3782. # ** Spriteset_Battle
  3783. #------------------------------------------------------------------------------
  3784. #  This class brings together battle screen sprites. It's used within the
  3785. # Scene_Battle class.
  3786. #==============================================================================
  3787.  
  3788. class Spriteset_Battle
  3789.   #--------------------------------------------------------------------------
  3790.   # * Overwrite method: create_actors
  3791.   #--------------------------------------------------------------------------
  3792.   def create_actors
  3793.     @actor_sprites = $game_party.battle_members.reverse.collect do |actor|
  3794.       Sprite_Battler.new(@viewport1, actor)
  3795.     end
  3796.     @actors_party = $game_party.battle_members.dup
  3797.   end
  3798.   #--------------------------------------------------------------------------
  3799.   # * Overwrite method: update_actors
  3800.   #--------------------------------------------------------------------------
  3801.   def update_actors
  3802.     update_party if $game_party.battle_members != @actors_party
  3803.     @actor_sprites.each {|sprite| sprite.update }
  3804.   end
  3805.   #--------------------------------------------------------------------------
  3806.   # * New method: update_party
  3807.   #--------------------------------------------------------------------------
  3808.   def update_party
  3809.     @actor_sprites.each_index do |i|
  3810.       next if $game_party.battle_members.include?(@actor_sprites[i].battler)
  3811.       @actor_sprites[i].dispose
  3812.       @actor_sprites[i] = nil
  3813.     end
  3814.     $game_party.battle_members.collect do |actor|
  3815.       next if @actors_party.include?(actor)
  3816.       @actor_sprites.push(Sprite_Battler.new(@viewport1, actor))
  3817.     end
  3818.     @actor_sprites.compact!
  3819.     @actors_party = $game_party.battle_members.dup
  3820.     $game_party.battle_members.each do |actor|
  3821.       old_position = [actor.screen_x, actor.screen_y]
  3822.       actor.setup_position
  3823.       if old_position != [actor.screen_x, actor.screen_y]
  3824.         sprite(actor).start_effect(:appear)
  3825.       end
  3826.     end
  3827.   end
  3828. end
  3829.  
  3830. #==============================================================================
  3831. # ** Scene_Battle
  3832. #------------------------------------------------------------------------------
  3833. #  This class performs battle screen processing.
  3834. #==============================================================================
  3835.  
  3836. class Scene_Battle < Scene_Base
  3837.   #--------------------------------------------------------------------------
  3838.   # * Overwrite method: show_attack_animation
  3839.   #--------------------------------------------------------------------------
  3840.   def show_attack_animation(targets)
  3841.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  3842.     show_normal_animation(targets, @subject.atk_animation_id2, true)
  3843.   end
  3844. end
  3845. #==============================================================================
  3846. #
  3847. # ▼ Yanfly Engine Ace - Ace Battle Engine v1.19
  3848. # -- Last Updated: 2012.01.29
  3849. # -- Level: Normal, Hard
  3850. # -- Requires: n/a
  3851. #
  3852. #==============================================================================
  3853.  
  3854. $imported = {} if $imported.nil?
  3855. $imported["YEA-BattleEngine"] = true
  3856.  
  3857. #==============================================================================
  3858. # ▼ Updates
  3859. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3860. # 2012.01.29 - Visual Changes: Buff stacks now show one popup upon one skill.
  3861. # 2012.01.24 - Compatibility Update: Enemy Levels
  3862. # 2012.01.18 - Bug Fixed: Help Window clears text upon selecting nil items.
  3863. # 2012.01.11 - Added <one animation> tag for multi-hit skills to play an
  3864. #              animation only once.
  3865. #            - Reduced lag from battle system constantly recreating bitmaps.
  3866. # 2012.01.10 - Compatibility Update: Battle System FTB
  3867. # 2012.01.09 - Anticrash methods implemented.
  3868. #            - Damage Popups are now separate for damage formulas and recovery.
  3869. # 2012.01.05 - Bug fixed: Game no longer crashes with escape skills/items.
  3870. # 2012.01.02 - Compatibility Update: Target Manager
  3871. #            - Added Option: AUTO_FAST
  3872. #            - Random hits now show animations individually.
  3873. # 2011.12.30 - Compatibility Update: Enemy Levels
  3874. #            - Added Option to center the actors in the HUD.
  3875. # 2011.12.27 - Bug fixed: TP Damage skills and items no longer crash game.
  3876. #            - Default battle system bug fixes are now included from YEA's Ace
  3877. #              Core Engine.
  3878. #            - Groundwork is also made to support future battle system types.
  3879. #            - Multi-hit actions no longer linger when a target dies during the
  3880. #              middle of one of the hits.
  3881. #            - Compatibility Update: Lunatic Objects v1.02
  3882. # 2011.12.26 - Bug fixed: Multi-hit popups occured even after an enemy's dead.
  3883. # 2011.12.22 - Bug fixed: Elemental Resistance popup didn't show.
  3884. # 2011.12.20 - Bug fixed: Death state popups against immortal states.
  3885. #            - Bug fixed: During State popup fix.
  3886. #            - Added HIDE_POPUP_SWITCH.
  3887. # 2011.12.17 - Compatibiilty Update: Cast Animations
  3888. # 2011.12.15 - Compatibility Update: Battle Command List
  3889. # 2011.12.14 - Compatibility Update: Lunatic Objects
  3890. # 2011.12.13 - Compatibility Update: Command Party
  3891. # 2011.12.12 - Bug fixed: Turn stalling if no inputable members.
  3892. # 2011.12.10 - Compatibility update for Automatic Party HUD.
  3893. #            - Popup graphical bug fixed.
  3894. #            - Bug fixed: Didn't wait for boss dead animations.
  3895. #            - Bug fixed: Surprise attacks that froze the game.
  3896. #            - Bug fixed: Popups didn't show for straight recovery effects.
  3897. # 2011.12.08 - Finished Script.
  3898. # 2011.12.04 - Started Script.
  3899. #
  3900. #==============================================================================
  3901. # ▼ Introduction
  3902. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3903. # Ace Battle Engine works as a foundation for future battle engine add-ons. It
  3904. # allows for easier management of the battle engine without adding too many
  3905. # features, allowing users to customize what they want as they see fit. While
  3906. # the Ace Battle Engine isn't an entirely new engine, it gives users control
  3907. # that RPG Maker VX Ace didn't originally give them.
  3908. #
  3909. # Furthermore, this script provides some new features. They are as follows:
  3910. #
  3911. # -----------------------------------------------------------------------------
  3912. # Animation Fixes
  3913. # -----------------------------------------------------------------------------
  3914. # Though the Yanfly Engine Ace - Ace Core Engine script contains these fixes,
  3915. # these fixes are included in this script as well to ensure it's working for
  3916. # the battle script in the event someone chooses not to work with the Ace Core
  3917. # Engine script. The animation fixes prevent excessive animation overlaying
  3918. # (and making the screen look really ugly) and prevents animation clashing
  3919. # between two dual wielding normal attack animations.
  3920. #
  3921. # -----------------------------------------------------------------------------
  3922. # Enemy Animations
  3923. # -----------------------------------------------------------------------------
  3924. # Enemies now show battle animations when they deliver attacks and skills
  3925. # against the player's party. Before in RPG Maker VX Ace, it was nothing more
  3926. # than just sound effects and the screen shaking. Now, animations play where
  3927. # the status window is and relative to the position of each party member.
  3928. #
  3929. # -----------------------------------------------------------------------------
  3930. # Left/Right Command Selection
  3931. # -----------------------------------------------------------------------------
  3932. # While choosing actions, the player can press Left or Right to move freely
  3933. # between (alive) actors to change their skills. Players no longer have to
  3934. # cancel all the way back to change one person's skill and reselect everything.
  3935. # On that note, there is now the option that when a battle starts or at the
  3936. # end of a turn, players will start immediately at command selection rather
  3937. # than needing to select "Fight" in the Party Command Window.
  3938. #
  3939. # -----------------------------------------------------------------------------
  3940. # Popups
  3941. # -----------------------------------------------------------------------------
  3942. # Dealing damage, inflicting states, adding buffs, landing critical hits,
  3943. # striking weaknesses, missing attacks, you name it, there's probably a popup
  3944. # for it. Popups deliver information to the player in a quick or orderly
  3945. # fashion without requiring the player to read lines of text.
  3946. #
  3947. # -----------------------------------------------------------------------------
  3948. # Targeting Window
  3949. # -----------------------------------------------------------------------------
  3950. # When targeting enemies, the window is no longer displayed. Instead, the
  3951. # targeted enemies are highlighted and their names are shown at the top of the
  3952. # screen in a help window. Another thing that's changed is when skills that
  3953. # target multiple targets are selected, there is a confirmation step that the
  3954. # player must take before continuing. In this confirmation step, all of the
  3955. # multiple targets are selected and in the help window would display the scope
  3956. # of the skill (such as "All Foes" or "Random Foes"). RPG Maker VX Ace skipped
  3957. # this step by default.
  3958. #
  3959. # -----------------------------------------------------------------------------
  3960. # Toggling On and Off Special Effects and Text
  3961. # -----------------------------------------------------------------------------
  3962. # Not everybody likes having the screen shake or the enemies blink when they
  3963. # take damage. These effects can now be toggled on and off. Certain text can
  3964. # also be toggled on and off from appearing. A lot of the displayed text has
  3965. # been rendered redundant through the use of popups.
  3966. #
  3967. # -----------------------------------------------------------------------------
  3968. # Visual Battle Status Window
  3969. # -----------------------------------------------------------------------------
  3970. # Rather than just having rows of names with HP and MP bars next to them, the
  3971. # Battle Status Window now displays actors' faces and their gauges aligned at
  3972. # the bottom. More status effects can be shown in addition to showing more
  3973. # members on screen at once. The Battle Status Window is also optimized to
  3974. # refresh less (thus, removing potential lag from the system).
  3975. #
  3976. # -----------------------------------------------------------------------------
  3977. # Window Position Changes
  3978. # -----------------------------------------------------------------------------
  3979. # Windows such as the Skill Window and Item Window have been rearranged to
  3980. # always provide the player a clear view of the battlefield rather than opening
  3981. # up and covering everything. As such, the window positions are placed at the
  3982. # bottom of the screen and are repositioned.
  3983. #
  3984. #==============================================================================
  3985. # ▼ Instructions
  3986. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3987. # To install this script, open up your script editor and copy/paste this script
  3988. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  3989. #
  3990. # -----------------------------------------------------------------------------
  3991. # Skill Notetags - These notetags go in the skills notebox in the database.
  3992. # -----------------------------------------------------------------------------
  3993. # <one animation>
  3994. # Causes the action to display the action animation only once, even if it's a
  3995. # multi-hit action. This is used primarily for non-all scope targeting.
  3996. #
  3997. # -----------------------------------------------------------------------------
  3998. # Item Notetags - These notetags go in the items notebox in the database.
  3999. # -----------------------------------------------------------------------------
  4000. # <one animation>
  4001. # Causes the action to display the action animation only once, even if it's a
  4002. # multi-hit action. This is used primarily for non-all scope targeting.
  4003. #
  4004. # -----------------------------------------------------------------------------
  4005. # Enemy Notetags - These notetags go in the enemy notebox in the database.
  4006. # -----------------------------------------------------------------------------
  4007. # <atk ani 1: x>
  4008. # <atk ani 2: x>
  4009. # Changes the normal attack animation of the particular enemy to animation x.
  4010. # Attack animation 1 is the first one that plays. If there's a second animation
  4011. # then the second one will play after in mirrored form.
  4012. #
  4013. # -----------------------------------------------------------------------------
  4014. # State Notetags - These notetags go in the state notebox in the database.
  4015. # -----------------------------------------------------------------------------
  4016. # <popup add: string>
  4017. # <popup rem: string>
  4018. # <popup dur: string>
  4019. # Status effects now create popups whenever they're inflicted. However, if you
  4020. # don't like that a certain status effect uses a particular colour setting,
  4021. # change "string" to one of the rulesets below to cause that popup to use a
  4022. # different ruleset.
  4023. #
  4024. # <popup hide add>
  4025. # <popup hide rem>
  4026. # <popup hide dur>
  4027. # Not everybody wants status effects to show popups when inflicted. When this
  4028. # is the case, insert the respective tag to hide popups from appearing when the
  4029. # state is added, removed, or during the stand-by phases.
  4030. #
  4031. # -----------------------------------------------------------------------------
  4032. # Debug Tools - These tools only work during Test Play.
  4033. # -----------------------------------------------------------------------------
  4034. # - F5 Key -
  4035. # Recovers all actors. Restores their HP and MP to max. Does not affect TP.
  4036. # All states and buffs are removed whether they are positive or negative.
  4037. #
  4038. # - F6 Key -
  4039. # Sets all actors to have 1 HP, 0 MP, and 0 TP. States are unaffected.
  4040. #
  4041. # - F7 Key -
  4042. # Sets all actors to have max TP. Everything else is unaffected.
  4043. #
  4044. # - F8 Key -
  4045. # Kills all enemies in battle. Ends the battle quickly.
  4046. #
  4047. #==============================================================================
  4048. # ▼ Compatibility
  4049. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  4050. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  4051. # it will run with RPG Maker VX without adjusting.
  4052. #
  4053. #==============================================================================
  4054.  
  4055. module YEA
  4056.   module BATTLE
  4057.  
  4058.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4059.     # - General Battle Settings -
  4060.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4061.     # These settings are adjusted for the overall battle system. These are
  4062.     # various miscellaneous options to adjust. Each of the settings below will
  4063.     # explain what they do. Change default enemy battle animations here, too.
  4064.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4065.     BLINK_EFFECTS      = false  # Blink sprite when damaged?
  4066.     FLASH_WHITE_EFFECT = true   # Flash enemy white when it starts an attack.
  4067.     SCREEN_SHAKE       = false  # Shake screen in battle?
  4068.     SKIP_PARTY_COMMAND = true   # Skips the Fight/Escape menu.
  4069.     AUTO_FAST          = true   # Causes message windows to not wait.
  4070.     ENEMY_ATK_ANI      = 36     # Sets default attack animation for enemies.
  4071.  
  4072.     # If this switch is ON, popups will be hidden. If OFF, the popups will be
  4073.     # shown. If you do not wish to use this switch, set it to 0.
  4074.     HIDE_POPUP_SWITCH  = 0
  4075.  
  4076.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4077.     # - Battle Status Window -
  4078.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4079.     # This sets the default battle system your game will use. If your game
  4080.     # doesn't have any other battle systems installed, it will use :dtb.
  4081.     #
  4082.     # Battle System        Requirement
  4083.     #   :dtb               - Default Turn Battle. Default system.
  4084.     #   :ftb               - YEA Battle System Add-On: Free Turn Battle
  4085.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4086.     DEFAULT_BATTLE_SYSTEM = :yctb     # Default battle system set.
  4087.  
  4088.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4089.     # - Battle Status Window -
  4090.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4091.     # Here, you can adjust the settings for the battle status window. The
  4092.     # battle status window, by default, will show the actor's face, HP, MP, TP
  4093.     # (if viable), and any inflicted status effects.
  4094.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4095.     BATTLESTATUS_NAME_FONT_SIZE = 20    # Font size used for name.
  4096.     BATTLESTATUS_TEXT_FONT_SIZE = 16    # Font size used for HP, MP, TP.
  4097.     BATTLESTATUS_NO_ACTION_ICON = 185   # No action icon.
  4098.     BATTLESTATUS_HPGAUGE_Y_PLUS = 11    # Y Location buffer used for HP gauge.
  4099.     BATTLESTATUS_CENTER_FACES   = false # Center faces for the Battle Status.
  4100.  
  4101.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4102.     # - Help Window Text -
  4103.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4104.     # When selecting a target to attack, this is the text that will be shown
  4105.     # in place of a target's name for special cases. These special cases are
  4106.     # for selections that were originally non-targetable battle scopes.
  4107.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4108.     HELP_TEXT_ALL_FOES        = "All Foes"
  4109.     HELP_TEXT_ONE_RANDOM_FOE  = "One Random Foe"
  4110.     HELP_TEXT_MANY_RANDOM_FOE = "%d Random Foes"
  4111.     HELP_TEXT_ALL_ALLIES      = "All Allies"
  4112.     HELP_TEXT_ALL_DEAD_ALLIES = "All Dead Allies"
  4113.     HELP_TEXT_ONE_RANDOM_ALLY = "One Random Ally"
  4114.     HELP_TEXT_RANDOM_ALLIES   = "%d Random Allies"
  4115.  
  4116.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4117.     # - Popup Settings -
  4118.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4119.     # These settings will adjust the popups that appear in battle. Popups
  4120.     # deliver information to your player as battlers deal damage, inflict
  4121.     # status effects, and more.
  4122.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4123.     ENABLE_POPUPS  = true     # Set this to false if you wish to disable them.
  4124.     FLASH_CRITICAL = true     # Sets critical hits to flash.
  4125.  
  4126.     # This hash adjusts the popup settings that will govern how popups appear.
  4127.     # Adjust them accordingly.
  4128.     POPUP_SETTINGS ={
  4129.       :offset     => -24,         # Height offset of a popup.
  4130.       :fade       => 12,          # Fade rate for each popup.
  4131.       :full       => 60,          # Frames before a popup fades.
  4132.       :hp_dmg     => "-%s ",      # SprintF for HP damage.
  4133.       :hp_heal    => "+%s ",      # SprintF for HP healing.
  4134.       :mp_dmg     => "-%s MP",    # SprintF for MP damage.
  4135.       :mp_heal    => "+%s MP",    # SprintF for MP healing.
  4136.       :tp_dmg     => "-%s TP",    # SprintF for MP damage.
  4137.       :tp_heal    => "+%s TP",    # SprintF for MP healing.
  4138.       :drained    => "DRAIN",     # Text display for draining HP/MP.
  4139.       :critical   => "CRITICAL!", # Text display for critical hit.
  4140.       :missed     => "MISS",      # Text display for missed attack.
  4141.       :evaded     => "EVADE!",    # Text display for evaded attack.
  4142.       :nulled     => "NULL",      # Text display for nulled attack.
  4143.       :failed     => "FAILED",    # Text display for a failed attack.
  4144.       :add_state  => "+%s",      # SprintF for added states.
  4145.       :rem_state  => "-%s",      # SprintF for removed states.
  4146.       :dur_state  => "%s",        # SprintF for during states.
  4147.       :ele_rates  => true,        # This will display elemental affinities.
  4148.       :ele_wait   => 20,          # This is how many frames will wait.
  4149.       :weakpoint  => "WEAKPOINT", # Appears if foe is weak to element.
  4150.       :resistant  => "RESIST",    # Appears if foe is resistant to element.
  4151.       :immune     => "IMMUNE",    # Appears if foe is immune to element.
  4152.       :absorbed   => "ABSORB",    # Appears if foe can absorb the element.
  4153.       :add_buff   => "%s+",      # Appears when a positive buff is applied.
  4154.       :add_debuff => "%s-",      # Appears when a negative buff is applied.
  4155.     } # Do not remove this.
  4156.  
  4157.     # This is the default font used for the popups. Adjust them accordingly
  4158.     # or even add new ones.
  4159.     DEFAULT = ["VL Gothic", "Verdana", "Arial", "Courier"]
  4160.  
  4161.     # The following are the various rules that govern the individual popup
  4162.     # types that will appear. Adjust them accordingly. Here is a list of what
  4163.     # each category does.
  4164.     #   Zoom1    The zoom the popup starts at. Values over 2.0 may cause lag.
  4165.     #   Zoom2    The zoom the popup goes to. Values over 2.0 may cause lag.
  4166.     #   Sz       The font size used for the popup text.
  4167.     #   Bold     Applying bold for the popup text.
  4168.     #   Italic   Applying italic for the popup text.
  4169.     #   Red      The red value of the popup text.
  4170.     #   Grn      The green value of the popup text.
  4171.     #   Blu      The blue value of the popup text.
  4172.     #   Font     The font used for the popup text.
  4173.     POPUP_RULES ={
  4174.       # Type     => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font]
  4175.       "DEFAULT"  => [   2.0,   1.0, 24, true,  false, 255, 255, 255, DEFAULT],
  4176.       "CRITICAL" => [   2.0,   1.0, 24, true,  false, 255,  80,  80, DEFAULT],
  4177.       "HP_DMG"   => [   2.0,   1.0, 36, true,  false, 255, 255, 255, DEFAULT],
  4178.       "HP_HEAL"  => [   2.0,   1.0, 36, true,  false, 130, 250, 130, DEFAULT],
  4179.       "MP_DMG"   => [   2.0,   1.0, 36, true,  false, 220, 180, 255, DEFAULT],
  4180.       "MP_HEAL"  => [   2.0,   1.0, 36, true,  false, 160, 230, 255, DEFAULT],
  4181.       "TP_DMG"   => [   2.0,   1.0, 36, true,  false, 242, 108,  78, DEFAULT],
  4182.       "TP_HEAL"  => [   2.0,   1.0, 36, true,  false, 251, 175,  92, DEFAULT],
  4183.       "ADDSTATE" => [   2.0,   1.0, 24, true,  false, 240, 100, 100, DEFAULT],
  4184.       "REMSTATE" => [   2.0,   1.0, 24, true,  false, 125, 170, 225, DEFAULT],
  4185.       "DURSTATE" => [   2.0,   1.0, 24, true,  false, 255, 240, 150, DEFAULT],
  4186.       "DRAIN"    => [   2.0,   1.0, 36, true,  false, 250, 190, 255, DEFAULT],
  4187.       "POSITIVE" => [   2.0,   1.0, 24, true,  false, 110, 210, 245, DEFAULT],
  4188.       "NEGATIVE" => [   2.0,   1.0, 24, true,  false, 245, 155, 195, DEFAULT],
  4189.       "WEAK_ELE" => [   0.5,   1.0, 24, true,  false, 240, 110,  80, DEFAULT],
  4190.       "IMMU_ELE" => [   0.5,   1.0, 24, true,  false, 185, 235, 255, DEFAULT],
  4191.       "REST_ELE" => [   0.5,   1.0, 24, true,  false, 145, 230, 180, DEFAULT],
  4192.       "ABSB_ELE" => [   0.5,   1.0, 24, true,  false, 250, 190, 255, DEFAULT],
  4193.       "BUFF"     => [   2.0,   1.0, 24, true,  false, 255, 240, 100, DEFAULT],
  4194.       "DEBUFF"   => [   2.0,   1.0, 24, true,  false, 160, 130, 200, DEFAULT],
  4195.     } # Do not remove this.
  4196.  
  4197.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4198.     # - Streamlined Messages -
  4199.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4200.     # Want to remove some of those annoying messages that appear all the time?
  4201.     # Now you can! Select which messages you want to enable or disable. Some of
  4202.     # these messages will be rendered useless due to popups.
  4203.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4204.     MSG_ENEMY_APPEARS  = false  # Message when enemy appears start of battle.
  4205.     MSG_CURRENT_STATE  = false  # Show which states has affected battler.
  4206.     MSG_CURRENT_ACTION = true   # Show the current action of the battler.
  4207.     MSG_COUNTERATTACK  = true   # Show the message for a counterattack.
  4208.     MSG_REFLECT_MAGIC  = true   # Show message for reflecting magic attacks.
  4209.     MSG_SUBSTITUTE_HIT = true   # Show message for ally taking another's hit.
  4210.     MSG_FAILURE_HIT    = false  # Show effect failed against target.
  4211.     MSG_CRITICAL_HIT   = false  # Show attack was a critical hit.
  4212.     MSG_HIT_MISSED     = false  # Show attack missed the target.
  4213.     MSG_EVASION        = false  # Show attack was evaded by the target.
  4214.     MSG_HP_DAMAGE      = false  # Show HP damage to target.
  4215.     MSG_MP_DAMAGE      = false  # Show MP damage to target.
  4216.     MSG_TP_DAMAGE      = false  # Show TP damage to target.
  4217.     MSG_ADDED_STATES   = false  # Show target's added states.
  4218.     MSG_REMOVED_STATES = false  # Show target's removed states.
  4219.     MSG_CHANGED_BUFFS  = false  # Show target's changed buffs.
  4220.  
  4221.   end # BATTLE
  4222. end # YEA
  4223.  
  4224. #==============================================================================
  4225. # ▼ Editting anything past this point may potentially result in causing
  4226. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  4227. # halitosis so edit at your own risk.
  4228. #==============================================================================
  4229.  
  4230. module YEA
  4231.   module REGEXP
  4232.   module ENEMY
  4233.  
  4234.     ATK_ANI1 = /<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
  4235.     ATK_ANI2 = /<(?:ATK_ANI_2|atk ani 2):[ ]*(\d+)>/i
  4236.  
  4237.   end # ENEMY
  4238.   module USABLEITEM
  4239.  
  4240.     ONE_ANIMATION = /<(?:ONE_ANIMATION|one animation)>/i
  4241.  
  4242.   end # USABLEITEM
  4243.   module STATE
  4244.  
  4245.     POPUP_ADD = /<(?:POPUP_ADD_RULE|popup add rule|popup add):[ ](.*)>/i
  4246.     POPUP_REM = /<(?:POPUP_REM_RULE|popup rem rule|popup rem):[ ](.*)>/i
  4247.     POPUP_DUR = /<(?:POPUP_DUR_RULE|popup dur rule|popup dur):[ ](.*)>/i
  4248.  
  4249.     HIDE_ADD  = /<(?:POPUP_HIDE_ADD|popup hide add|hide add)>/i
  4250.     HIDE_REM  = /<(?:POPUP_HIDE_REM|popup hide rem|hide rem)>/i
  4251.     HIDE_DUR  = /<(?:POPUP_HIDE_DUR|popup hide dur|hide dur)>/i
  4252.  
  4253.   end # STATE
  4254.   end # REGEXP
  4255. end # YEA
  4256.  
  4257. #==============================================================================
  4258. # ■ Switch
  4259. #==============================================================================
  4260.  
  4261. module Switch
  4262.  
  4263.   #--------------------------------------------------------------------------
  4264.   # self.hide_popups
  4265.   #--------------------------------------------------------------------------
  4266.   def self.hide_popups
  4267.     return false if YEA::BATTLE::HIDE_POPUP_SWITCH <= 0
  4268.     return $game_switches[YEA::BATTLE::HIDE_POPUP_SWITCH]
  4269.   end
  4270.  
  4271. end # Switch
  4272.  
  4273. #==============================================================================
  4274. # ■ Colour
  4275. #==============================================================================
  4276.  
  4277. module Colour
  4278.  
  4279.   #--------------------------------------------------------------------------
  4280.   # self.text_colour
  4281.   #--------------------------------------------------------------------------
  4282.   def self.text_colour(index)
  4283.     windowskin = Cache.system("Window")
  4284.     x = 64 + (index % 8) * 8
  4285.     y = 96 + (index / 8) * 8
  4286.     return windowskin.get_pixel(x, y)
  4287.   end
  4288.  
  4289. end # Colour
  4290.  
  4291. #==============================================================================
  4292. # ■ Icon
  4293. #==============================================================================
  4294.  
  4295. module Icon
  4296.  
  4297.   #--------------------------------------------------------------------------
  4298.   # self.no_action
  4299.   #--------------------------------------------------------------------------
  4300.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
  4301.  
  4302. end # Icon
  4303.  
  4304. #==============================================================================
  4305. # ■ Numeric
  4306. #==============================================================================
  4307.  
  4308. class Numeric
  4309.  
  4310.   #--------------------------------------------------------------------------
  4311.   # new method: group_digits
  4312.   #--------------------------------------------------------------------------
  4313.   unless $imported["YEA-CoreEngine"]
  4314.   def group; return self.to_s; end
  4315.   end # $imported["YEA-CoreEngine"]
  4316.  
  4317. end # Numeric
  4318.  
  4319. #==============================================================================
  4320. # ■ DataManager
  4321. #==============================================================================
  4322.  
  4323. module DataManager
  4324.  
  4325.   #--------------------------------------------------------------------------
  4326.   # alias method: load_database
  4327.   #--------------------------------------------------------------------------
  4328.   class <<self; alias load_database_abe load_database; end
  4329.   def self.load_database
  4330.     load_database_abe
  4331.     load_notetags_abe
  4332.   end
  4333.  
  4334.   #--------------------------------------------------------------------------
  4335.   # new method: load_notetags_abe
  4336.   #--------------------------------------------------------------------------
  4337.   def self.load_notetags_abe
  4338.     groups = [$data_enemies, $data_states, $data_skills, $data_items]
  4339.     for group in groups
  4340.       for obj in group
  4341.         next if obj.nil?
  4342.         obj.load_notetags_abe
  4343.       end
  4344.     end
  4345.   end
  4346.  
  4347. end # DataManager
  4348.  
  4349. #==============================================================================
  4350. # ■ RPG::UsableItem
  4351. #==============================================================================
  4352.  
  4353. class RPG::UsableItem < RPG::BaseItem
  4354.  
  4355.   #--------------------------------------------------------------------------
  4356.   # public instance variables
  4357.   #--------------------------------------------------------------------------
  4358.   attr_accessor :one_animation
  4359.  
  4360.   #--------------------------------------------------------------------------
  4361.   # common cache: load_notetags_abe
  4362.   #--------------------------------------------------------------------------
  4363.   def load_notetags_abe
  4364.     @one_animation = false
  4365.     #---
  4366.     self.note.split(/[\r\n]+/).each { |line|
  4367.       case line
  4368.       #---
  4369.       when YEA::REGEXP::USABLEITEM::ONE_ANIMATION
  4370.         @one_animation = true
  4371.       end
  4372.     } # self.note.split
  4373.     #---
  4374.   end
  4375.  
  4376. end # RPG::UsableItem
  4377.  
  4378. #==============================================================================
  4379. # ■ RPG::Enemy
  4380. #==============================================================================
  4381.  
  4382. class RPG::Enemy < RPG::BaseItem
  4383.  
  4384.   #--------------------------------------------------------------------------
  4385.   # public instance variables
  4386.   #--------------------------------------------------------------------------
  4387.   attr_accessor :atk_animation_id1
  4388.   attr_accessor :atk_animation_id2
  4389.  
  4390.   #--------------------------------------------------------------------------
  4391.   # common cache: load_notetags_abe
  4392.   #--------------------------------------------------------------------------
  4393.   def load_notetags_abe
  4394.     @atk_animation_id1 = YEA::BATTLE::ENEMY_ATK_ANI
  4395.     @atk_animation_id2 = 0
  4396.     #---
  4397.     self.note.split(/[\r\n]+/).each { |line|
  4398.       case line
  4399.       #---
  4400.       when YEA::REGEXP::ENEMY::ATK_ANI1
  4401.         @atk_animation_id1 = $1.to_i
  4402.       when YEA::REGEXP::ENEMY::ATK_ANI2
  4403.         @atk_animation_id2 = $1.to_i
  4404.       end
  4405.     } # self.note.split
  4406.     #---
  4407.   end
  4408.  
  4409. end # RPG::Enemy
  4410.  
  4411. #==============================================================================
  4412. # ■ RPG::Enemy
  4413. #==============================================================================
  4414.  
  4415. class RPG::State < RPG::BaseItem
  4416.  
  4417.   #--------------------------------------------------------------------------
  4418.   # public instance variables
  4419.   #--------------------------------------------------------------------------
  4420.   attr_accessor :popup_rules
  4421.  
  4422.   #--------------------------------------------------------------------------
  4423.   # common cache: load_notetags_abe
  4424.   #--------------------------------------------------------------------------
  4425.   def load_notetags_abe
  4426.     @popup_rules = {
  4427.       :add_state => "ADDSTATE",
  4428.       :rem_state => "REMSTATE",
  4429.       :dur_state => nil
  4430.     } # Do not remove this.
  4431.     #---
  4432.     self.note.split(/[\r\n]+/).each { |line|
  4433.       case line
  4434.       #---
  4435.       when YEA::REGEXP::STATE::POPUP_ADD
  4436.         @popup_rules[:add_state] = $1.upcase.to_s
  4437.       when YEA::REGEXP::STATE::POPUP_REM
  4438.         @popup_rules[:rem_state] = $1.upcase.to_s
  4439.       when YEA::REGEXP::STATE::POPUP_DUR
  4440.         @popup_rules[:dur_state] = $1.upcase.to_s
  4441.       when YEA::REGEXP::STATE::HIDE_ADD
  4442.         @popup_rules[:add_state] = nil
  4443.       when YEA::REGEXP::STATE::HIDE_REM
  4444.         @popup_rules[:rem_state] = nil
  4445.       when YEA::REGEXP::STATE::HIDE_DUR
  4446.         @popup_rules[:dur_state] = nil
  4447.       end
  4448.     } # self.note.split
  4449.     #---
  4450.   end
  4451.  
  4452. end # RPG::State
  4453.  
  4454. #==============================================================================
  4455. # ■ BattleManager
  4456. #==============================================================================
  4457.  
  4458. module BattleManager
  4459.  
  4460.   #--------------------------------------------------------------------------
  4461.   # overwrite method: self.battle_start
  4462.   #--------------------------------------------------------------------------
  4463.   def self.battle_start
  4464.     $game_system.battle_count += 1
  4465.     $game_party.on_battle_start
  4466.     $game_troop.on_battle_start
  4467.     return unless YEA::BATTLE::MSG_ENEMY_APPEARS
  4468.     $game_troop.enemy_names.each do |name|
  4469.       $game_message.add(sprintf(Vocab::Emerge, name))
  4470.     end
  4471.     if @preemptive
  4472.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  4473.     elsif @surprise
  4474.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  4475.     end
  4476.     wait_for_message
  4477.   end
  4478.  
  4479.   #--------------------------------------------------------------------------
  4480.   # overwrite method: make_action_orders
  4481.   #--------------------------------------------------------------------------
  4482.   def self.make_action_orders
  4483.     make_dtb_action_orders if btype?(:dtb)
  4484.   end
  4485.  
  4486.   #--------------------------------------------------------------------------
  4487.   # new method: make_dtb_action_orders
  4488.   #--------------------------------------------------------------------------
  4489.   def self.make_dtb_action_orders
  4490.     @action_battlers = []
  4491.     @action_battlers += $game_party.members unless @surprise
  4492.     @action_battlers += $game_troop.members unless @preemptive
  4493.     @action_battlers.each {|battler| battler.make_speed }
  4494.     @action_battlers.sort! {|a,b| b.speed - a.speed }
  4495.   end
  4496.  
  4497.   #--------------------------------------------------------------------------
  4498.   # overwrite method: turn_start
  4499.   #--------------------------------------------------------------------------
  4500.   def self.turn_start
  4501.     @phase = :turn
  4502.     clear_actor
  4503.     $game_troop.increase_turn
  4504.     @performed_battlers = []
  4505.     make_action_orders
  4506.   end
  4507.  
  4508.   #--------------------------------------------------------------------------
  4509.   # overwrite method: next_subject
  4510.   #--------------------------------------------------------------------------
  4511.   def self.next_subject
  4512.     @performed_battlers = [] if @performed_battlers.nil?
  4513.     loop do
  4514.       @action_battlers -= @performed_battlers
  4515.       battler = @action_battlers.shift
  4516.       return nil unless battler
  4517.       next unless battler.index && battler.alive?
  4518.       @performed_battlers.push(battler)
  4519.       return battler
  4520.     end
  4521.   end
  4522.  
  4523.   #--------------------------------------------------------------------------
  4524.   # overwrite method: force_action
  4525.   #--------------------------------------------------------------------------
  4526.   def self.force_action(battler)
  4527.     @action_forced = [] if @action_forced == nil
  4528.     @action_forced.push(battler)
  4529.     return unless Switch.forced_action_remove
  4530.     @action_battlers.delete(battler)
  4531.   end
  4532.  
  4533.   #--------------------------------------------------------------------------
  4534.   # overwrite method: action_forced?
  4535.   #--------------------------------------------------------------------------
  4536.   def self.action_forced?
  4537.     @action_forced != nil
  4538.   end
  4539.  
  4540.   #--------------------------------------------------------------------------
  4541.   # overwrite method: action_forced_battler
  4542.   #--------------------------------------------------------------------------
  4543.   def self.action_forced_battler
  4544.     @action_forced.shift
  4545.   end
  4546.  
  4547.   #--------------------------------------------------------------------------
  4548.   # overwrite method: clear_action_force
  4549.   #--------------------------------------------------------------------------
  4550.   def self.clear_action_force
  4551.     return if @action_forced.nil?
  4552.     @action_forced = nil if @action_forced.empty?
  4553.   end
  4554.  
  4555.   #--------------------------------------------------------------------------
  4556.   # new method: self.init_battle_type
  4557.   #--------------------------------------------------------------------------
  4558.   def self.init_battle_type
  4559.     set_btype($game_system.battle_system)
  4560.   end
  4561.  
  4562.   #--------------------------------------------------------------------------
  4563.   # new method: self.set_btype
  4564.   #--------------------------------------------------------------------------
  4565.   def self.set_btype(btype = :dtb)
  4566.     @battle_type = btype
  4567.   end
  4568.  
  4569.   #--------------------------------------------------------------------------
  4570.   # new method: self.btype?
  4571.   #--------------------------------------------------------------------------
  4572.   def self.btype?(btype)
  4573.     return @battle_type == btype
  4574.   end
  4575.  
  4576. end # BattleManager
  4577.  
  4578. #==============================================================================
  4579. # ■ Game_System
  4580. #==============================================================================
  4581.  
  4582. class Game_System
  4583.  
  4584.   #--------------------------------------------------------------------------
  4585.   # new method: battle_system
  4586.   #--------------------------------------------------------------------------
  4587.   def battle_system
  4588.     if @battle_system.nil?
  4589.       return battle_system_corrected(YEA::BATTLE::DEFAULT_BATTLE_SYSTEM)
  4590.     else
  4591.       return battle_system_corrected(@battle_system)
  4592.     end
  4593.   end
  4594.  
  4595.   #--------------------------------------------------------------------------
  4596.   # new method: set_battle_system
  4597.   #--------------------------------------------------------------------------
  4598.   def set_battle_system(type)
  4599.     case type
  4600.     when :dtb; @battle_system = :dtb
  4601.     when :ftb; @battle_system = $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  4602.     else;      @battle_system = :dtb
  4603.     end
  4604.   end
  4605.  
  4606.   #--------------------------------------------------------------------------
  4607.   # new method: battle_system_corrected
  4608.   #--------------------------------------------------------------------------
  4609.   def battle_system_corrected(type)
  4610.     case type
  4611.     when :dtb; return :dtb
  4612.     when :ftb; return $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  4613.     else;      return :dtb
  4614.     end
  4615.   end
  4616.  
  4617. end # Game_System
  4618.  
  4619. #==============================================================================
  4620. # ■ Sprite_Base
  4621. #==============================================================================
  4622.  
  4623. class Sprite_Base < Sprite
  4624.  
  4625.   #--------------------------------------------------------------------------
  4626.   # new method: start_pseudo_animation
  4627.   #--------------------------------------------------------------------------
  4628.   unless $imported["YEA-CoreEngine"]
  4629.   def start_pseudo_animation(animation, mirror = false)
  4630.     dispose_animation
  4631.     @animation = animation
  4632.     return if @animation.nil?
  4633.     @ani_mirror = mirror
  4634.     set_animation_rate
  4635.     @ani_duration = @animation.frame_max * @ani_rate + 1
  4636.     @ani_sprites = []
  4637.   end
  4638.   end # $imported["YEA-CoreEngine"]
  4639.  
  4640. end # Sprite_Base
  4641.  
  4642. #==============================================================================
  4643. # ■ Sprite_Battler
  4644. #==============================================================================
  4645.  
  4646. class Sprite_Battler < Sprite_Base
  4647.  
  4648.   #--------------------------------------------------------------------------
  4649.   # public instance variables
  4650.   #--------------------------------------------------------------------------
  4651.   attr_accessor :effect_type
  4652.   attr_accessor :battler_visible
  4653.   attr_accessor :popups
  4654.  
  4655.   #--------------------------------------------------------------------------
  4656.   # alias method: initialize
  4657.   #--------------------------------------------------------------------------
  4658.   alias sprite_battler_initialize_abe initialize
  4659.   def initialize(viewport, battler = nil)
  4660.     sprite_battler_initialize_abe(viewport, battler)
  4661.     @popups = []
  4662.     @popup_flags = []
  4663.   end
  4664.  
  4665.   #--------------------------------------------------------------------------
  4666.   # alias method: update_bitmap
  4667.   #--------------------------------------------------------------------------
  4668.   alias sprite_battler_update_bitmap_abe update_bitmap
  4669.   def update_bitmap
  4670.     return if @battler.actor? && @battler.battler_name == ""
  4671.     sprite_battler_update_bitmap_abe
  4672.   end
  4673.  
  4674.   #--------------------------------------------------------------------------
  4675.   # alias method: setup_new_animation
  4676.   #--------------------------------------------------------------------------
  4677.   unless $imported["YEA-CoreEngine"]
  4678.   alias sprite_battler_setup_new_animation_abe setup_new_animation
  4679.   def setup_new_animation
  4680.     sprite_battler_setup_new_animation_abe
  4681.     return if @battler.pseudo_ani_id <= 0
  4682.     animation = $data_animations[@battler.pseudo_ani_id]
  4683.     mirror = @battler.animation_mirror
  4684.     start_pseudo_animation(animation, mirror)
  4685.     @battler.pseudo_ani_id = 0
  4686.   end
  4687.   end # $imported["YEA-CoreEngine"]
  4688.  
  4689.   #--------------------------------------------------------------------------
  4690.   # alias method: setup_new_effect
  4691.   #--------------------------------------------------------------------------
  4692.   alias sprite_battler_setup_new_effect_abe setup_new_effect
  4693.   def setup_new_effect
  4694.     sprite_battler_setup_new_effect_abe
  4695.     setup_popups
  4696.   end
  4697.  
  4698.   #--------------------------------------------------------------------------
  4699.   # new method: setup_popups
  4700.   #--------------------------------------------------------------------------
  4701.   def setup_popups
  4702.     return unless @battler.use_sprite?
  4703.     @battler.popups = [] if @battler.popups.nil?
  4704.     return if @battler.popups == []
  4705.     array = @battler.popups.shift
  4706.     create_new_popup(array[0], array[1], array[2])
  4707.   end
  4708.  
  4709.   #--------------------------------------------------------------------------
  4710.   # new method: create_new_popup
  4711.   #--------------------------------------------------------------------------
  4712.   def create_new_popup(value, rules, flags)
  4713.     return if @battler == nil
  4714.     return if flags & @popup_flags != []
  4715.     array = YEA::BATTLE::POPUP_RULES[rules]
  4716.     for popup in @popups
  4717.       popup.y -= 24
  4718.     end
  4719.     return unless SceneManager.scene.is_a?(Scene_Battle)
  4720.     return if SceneManager.scene.spriteset.nil?
  4721.     view = SceneManager.scene.spriteset.viewportPopups
  4722.     new_popup = Sprite_Popup.new(view, @battler, value, rules, flags)
  4723.     @popups.push(new_popup)
  4724.     @popup_flags.push("weakness") if flags.include?("weakness")
  4725.     @popup_flags.push("resistant") if flags.include?("resistant")
  4726.     @popup_flags.push("immune") if flags.include?("immune")
  4727.     @popup_flags.push("absorbed") if flags.include?("absorbed")
  4728.   end
  4729.  
  4730.   #--------------------------------------------------------------------------
  4731.   # alias method: update_effect
  4732.   #--------------------------------------------------------------------------
  4733.   alias sprite_battler_update_effect_abe update_effect
  4734.   def update_effect
  4735.     sprite_battler_update_effect_abe
  4736.     update_popups
  4737.   end
  4738.  
  4739.   #--------------------------------------------------------------------------
  4740.   # new method: update_popups
  4741.   #--------------------------------------------------------------------------
  4742.   def update_popups
  4743.     for popup in @popups
  4744.       popup.update
  4745.       next unless popup.opacity <= 0
  4746.       popup.bitmap.dispose
  4747.       popup.dispose
  4748.       @popups.delete(popup)
  4749.       popup = nil
  4750.     end
  4751.     @popup_flags = [] if @popups == [] && @popup_flags != []
  4752.     return unless SceneManager.scene_is?(Scene_Battle)
  4753.     if @current_active_battler != SceneManager.scene.subject
  4754.       @current_active_battler = SceneManager.scene.subject
  4755.       @popup_flags = []
  4756.     end
  4757.   end
  4758.  
  4759. end # Sprite_Battler
  4760.  
  4761. #==============================================================================
  4762. # ■ Sprite_Popup
  4763. #==============================================================================
  4764.  
  4765. class Sprite_Popup < Sprite_Base
  4766.  
  4767.   #--------------------------------------------------------------------------
  4768.   # public instance variables
  4769.   #--------------------------------------------------------------------------
  4770.   attr_accessor :flags
  4771.  
  4772.   #--------------------------------------------------------------------------
  4773.   # initialize
  4774.   #--------------------------------------------------------------------------
  4775.   def initialize(viewport, battler, value, rules, flags)
  4776.     super(viewport)
  4777.     @value = value
  4778.     @rules = rules
  4779.     @rules = "DEFAULT" unless YEA::BATTLE::POPUP_RULES.include?(@rules)
  4780.     @fade = YEA::BATTLE::POPUP_SETTINGS[:fade]
  4781.     @full = YEA::BATTLE::POPUP_SETTINGS[:full]
  4782.     @flags = flags
  4783.     @battler = battler
  4784.     create_popup_bitmap
  4785.   end
  4786.  
  4787.   #--------------------------------------------------------------------------
  4788.   # create_popup_bitmap
  4789.   #--------------------------------------------------------------------------
  4790.   def create_popup_bitmap
  4791.     rules_array = YEA::BATTLE::POPUP_RULES[@rules]
  4792.     bw = Graphics.width
  4793.     bw += 48 if @flags.include?("state")
  4794.     bh = Font.default_size * 3
  4795.     bitmap = Bitmap.new(bw, bh)
  4796.     bitmap.font.name = rules_array[8]
  4797.     size = @flags.include?("critical") ? rules_array[2] * 1.2 : rules_array[2]
  4798.     bitmap.font.size = size
  4799.     bitmap.font.bold = rules_array[3]
  4800.     bitmap.font.italic = rules_array[4]
  4801.     if flags.include?("critical")
  4802.       crit = YEA::BATTLE::POPUP_RULES["CRITICAL"]
  4803.       bitmap.font.out_color.set(crit[5], crit[6], crit[7], 255)
  4804.     else
  4805.       bitmap.font.out_color.set(0, 0, 0, 255)
  4806.     end
  4807.     dx = 0; dy = 0; dw = 0
  4808.     dx += 24 if @flags.include?("state")
  4809.     dw += 24 if @flags.include?("state")
  4810.     if @flags.include?("state") || @flags.include?("buff")
  4811.       c_width = bitmap.text_size(@value).width
  4812.       icon_bitmap = $game_temp.iconset
  4813.       icon_index = flag_state_icon
  4814.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  4815.       bitmap.blt(dx+(bw-c_width)/2-36, (bh - 24)/2, icon_bitmap, rect, 255)
  4816.     end
  4817.     bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
  4818.     bitmap.draw_text(dx, dy, bw-dw, bh, @value, 1)
  4819.     self.bitmap = bitmap
  4820.     self.x = @battler.screen_x
  4821.     self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
  4822.     self.x -= SceneManager.scene.spriteset.viewport1.ox
  4823.     self.y = @battler.screen_y - @battler.sprite.oy/2
  4824.     self.y -= @battler.sprite.oy/2 if @battler.actor?
  4825.     self.y -= SceneManager.scene.spriteset.viewport1.oy
  4826.     self.ox = bw/2; self.oy = bh/2
  4827.     self.zoom_x = self.zoom_y = rules_array[0]
  4828.     if @flags.include?("no zoom")
  4829.       self.zoom_x = self.zoom_y = rules_array[1]
  4830.     end
  4831.     @target_zoom = rules_array[1]
  4832.     @zoom_direction = (self.zoom_x > @target_zoom) ? "down" : "up"
  4833.     self.z = 500
  4834.   end
  4835.  
  4836.   #--------------------------------------------------------------------------
  4837.   # update
  4838.   #--------------------------------------------------------------------------
  4839.   def update
  4840.     super
  4841.     #---
  4842.     if @flags.include?("critical") && YEA::BATTLE::FLASH_CRITICAL
  4843.       @hue_duration = 2 if @hue_duration == nil || @hue_duration == 0
  4844.       @hue_duration -= 1
  4845.       self.bitmap.hue_change(15) if @hue_duration <= 0
  4846.     end
  4847.     #---
  4848.     if @zoom_direction == "up"
  4849.       self.zoom_x = [self.zoom_x + 0.075, @target_zoom].min
  4850.       self.zoom_y = [self.zoom_y + 0.075, @target_zoom].min
  4851.     else
  4852.       self.zoom_x = [self.zoom_x - 0.075, @target_zoom].max
  4853.       self.zoom_y = [self.zoom_y - 0.075, @target_zoom].max
  4854.     end
  4855.     #---
  4856.     @full -= 1
  4857.     return if @full > 0
  4858.     self.y -= 1
  4859.     self.opacity -= @fade
  4860.   end
  4861.  
  4862.   #--------------------------------------------------------------------------
  4863.   # flag_state_icon
  4864.   #--------------------------------------------------------------------------
  4865.   def flag_state_icon
  4866.     for item in @flags; return item if item.is_a?(Integer); end
  4867.     return 0
  4868.   end
  4869.  
  4870. end # Sprite_Popup
  4871.  
  4872. #==============================================================================
  4873. # ■ Spriteset_Battle
  4874. #==============================================================================
  4875.  
  4876. class Spriteset_Battle
  4877.  
  4878.   #--------------------------------------------------------------------------
  4879.   # public instance variables
  4880.   #--------------------------------------------------------------------------
  4881.   attr_accessor :actor_sprites
  4882.   attr_accessor :enemy_sprites
  4883.   attr_accessor :viewport1
  4884.   attr_accessor :viewportPopups
  4885.  
  4886.   #--------------------------------------------------------------------------
  4887.   # alias method: create_viewports
  4888.   #--------------------------------------------------------------------------
  4889.   alias spriteset_battle_create_viewports_abe create_viewports
  4890.   def create_viewports
  4891.     spriteset_battle_create_viewports_abe
  4892.     @viewportPopups = Viewport.new
  4893.     @viewportPopups.z = 200
  4894.   end
  4895.  
  4896.   #--------------------------------------------------------------------------
  4897.   # alias method: dispose_viewports
  4898.   #--------------------------------------------------------------------------
  4899.   alias spriteset_battle_dispose_viewports_abe dispose_viewports
  4900.   def dispose_viewports
  4901.     spriteset_battle_dispose_viewports_abe
  4902.     @viewportPopups.dispose
  4903.   end
  4904.  
  4905.   #--------------------------------------------------------------------------
  4906.   # alias method: update_viewports
  4907.   #--------------------------------------------------------------------------
  4908.   alias spriteset_battle_update_viewports_abe update_viewports
  4909.   def update_viewports
  4910.     spriteset_battle_update_viewports_abe
  4911.     @viewportPopups.update
  4912.   end
  4913.  
  4914. end # Spriteset_Battle
  4915.  
  4916. #==============================================================================
  4917. # ■ Game_Temp
  4918. #==============================================================================
  4919.  
  4920. class Game_Temp
  4921.  
  4922.   #--------------------------------------------------------------------------
  4923.   # public instance variables
  4924.   #--------------------------------------------------------------------------
  4925.   attr_accessor :battle_aid
  4926.   attr_accessor :evaluating
  4927.   attr_accessor :iconset
  4928.  
  4929.   #--------------------------------------------------------------------------
  4930.   # alias method: initialize
  4931.   #--------------------------------------------------------------------------
  4932.   alias game_temp_initialize_abe initialize
  4933.   def initialize
  4934.     game_temp_initialize_abe
  4935.     @iconset = Cache.system("Iconset")
  4936.   end
  4937.  
  4938. end # Game_Temp
  4939.  
  4940. #==============================================================================
  4941. # ■ Game_Action
  4942. #==============================================================================
  4943.  
  4944. class Game_Action
  4945.  
  4946.   #--------------------------------------------------------------------------
  4947.   # overwrite method: speed
  4948.   #--------------------------------------------------------------------------
  4949.   def speed
  4950.     speed = subject.agi
  4951.     speed += item.speed if item
  4952.     speed += subject.atk_speed if attack?
  4953.     return speed
  4954.   end
  4955.  
  4956.   #--------------------------------------------------------------------------
  4957.   # alias method: evaluate_item_with_target
  4958.   #--------------------------------------------------------------------------
  4959.   alias evaluate_item_with_target_abe evaluate_item_with_target
  4960.   def evaluate_item_with_target(target)
  4961.     $game_temp.evaluating = true
  4962.     result = evaluate_item_with_target_abe(target)
  4963.     $game_temp.evaluating = false
  4964.     return result
  4965.   end
  4966.  
  4967. end # Game_Action
  4968.  
  4969. #==============================================================================
  4970. # ■ Game_ActionResult
  4971. #==============================================================================
  4972.  
  4973. class Game_ActionResult
  4974.  
  4975.   #--------------------------------------------------------------------------
  4976.   # alias method: clear
  4977.   #--------------------------------------------------------------------------
  4978.   alias game_actionresult_clear_abe clear
  4979.   def clear
  4980.     game_actionresult_clear_abe
  4981.     clear_stored_damage
  4982.   end
  4983.  
  4984.   #--------------------------------------------------------------------------
  4985.   # new method: clear_stored_damage
  4986.   #--------------------------------------------------------------------------
  4987.   def clear_stored_damage
  4988.     @stored_hp_damage = 0
  4989.     @stored_mp_damage = 0
  4990.     @stored_tp_damage = 0
  4991.     @stored_hp_drain = 0
  4992.     @stored_mp_drain = 0
  4993.   end
  4994.  
  4995.   #--------------------------------------------------------------------------
  4996.   # new method: store_damage
  4997.   #--------------------------------------------------------------------------
  4998.   def store_damage
  4999.     @stored_hp_damage += @hp_damage
  5000.     @stored_mp_damage += @mp_damage
  5001.     @stored_tp_damage += @tp_damage
  5002.     @stored_hp_drain += @hp_drain
  5003.     @stored_mp_drain += @mp_drain
  5004.   end
  5005.  
  5006.   #--------------------------------------------------------------------------
  5007.   # new method: restore_damage
  5008.   #--------------------------------------------------------------------------
  5009.   def restore_damage
  5010.     @hp_damage = @stored_hp_damage
  5011.     @mp_damage = @stored_mp_damage
  5012.     @tp_damage = @stored_tp_damage
  5013.     @hp_drain = @stored_hp_drain
  5014.     @mp_drain = @stored_mp_drain
  5015.   end
  5016.  
  5017. end # Game_ActionResult
  5018.  
  5019. #==============================================================================
  5020. # ■ Game_BattlerBase
  5021. #==============================================================================
  5022.  
  5023. class Game_BattlerBase
  5024.  
  5025.   #--------------------------------------------------------------------------
  5026.   # public instance variables
  5027.   #--------------------------------------------------------------------------
  5028.   attr_accessor :popups
  5029.  
  5030.   #--------------------------------------------------------------------------
  5031.   # new method: create_popup
  5032.   #--------------------------------------------------------------------------
  5033.   def create_popup(value, rules = "DEFAULT", flags = [])
  5034.     return unless SceneManager.scene_is?(Scene_Battle)
  5035.     return unless YEA::BATTLE::ENABLE_POPUPS
  5036.     return if Switch.hide_popups
  5037.     @popups = [] if @popups.nil?
  5038.     @popups.push([value, rules, flags])
  5039.   end
  5040.  
  5041.   #--------------------------------------------------------------------------
  5042.   # new method: make_damage_popups
  5043.   #--------------------------------------------------------------------------
  5044.   def make_damage_popups(user)
  5045.     if @result.hp_drain != 0
  5046.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  5047.       rules = "DRAIN"
  5048.       user.create_popup(text, rules)
  5049.       setting = :hp_dmg  if @result.hp_drain < 0
  5050.       setting = :hp_heal if @result.hp_drain > 0
  5051.       rules = "HP_DMG"   if @result.hp_drain < 0
  5052.       rules = "HP_HEAL"  if @result.hp_drain > 0
  5053.       value = @result.hp_drain.abs
  5054.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  5055.       user.create_popup(text, rules)
  5056.     end
  5057.     if @result.mp_drain != 0
  5058.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  5059.       rules = "DRAIN"
  5060.       user.create_popup(text, rules)
  5061.       setting = :mp_dmg  if @result.mp_drain < 0
  5062.       setting = :mp_heal if @result.mp_drain > 0
  5063.       rules = "HP_DMG"   if @result.mp_drain < 0
  5064.       rules = "HP_HEAL"  if @result.mp_drain > 0
  5065.       value = @result.mp_drain.abs
  5066.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  5067.       user.create_popup(text, rules)
  5068.     end
  5069.     #---
  5070.     flags = []
  5071.     flags.push("critical") if @result.critical
  5072.     if @result.hp_damage != 0
  5073.       setting = :hp_dmg  if @result.hp_damage > 0
  5074.       setting = :hp_heal if @result.hp_damage < 0
  5075.       rules = "HP_DMG"   if @result.hp_damage > 0
  5076.       rules = "HP_HEAL"  if @result.hp_damage < 0
  5077.       value = @result.hp_damage.abs
  5078.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  5079.       create_popup(text, rules, flags)
  5080.     end
  5081.     if @result.mp_damage != 0
  5082.       setting = :mp_dmg  if @result.mp_damage > 0
  5083.       setting = :mp_heal if @result.mp_damage < 0
  5084.       rules = "MP_DMG"   if @result.mp_damage > 0
  5085.       rules = "MP_HEAL"  if @result.mp_damage < 0
  5086.       value = @result.mp_damage.abs
  5087.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  5088.       create_popup(text, rules, flags)
  5089.     end
  5090.     if @result.tp_damage != 0
  5091.       setting = :tp_dmg  if @result.tp_damage > 0
  5092.       setting = :tp_heal if @result.tp_damage < 0
  5093.       rules = "TP_DMG"   if @result.tp_damage > 0
  5094.       rules = "TP_HEAL"  if @result.tp_damage < 0
  5095.       value = @result.tp_damage.abs
  5096.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  5097.       create_popup(text, rules)
  5098.     end
  5099.     @result.store_damage
  5100.     @result.clear_damage_values
  5101.   end
  5102.  
  5103.   #--------------------------------------------------------------------------
  5104.   # alias method: erase_state
  5105.   #--------------------------------------------------------------------------
  5106.   alias game_battlerbase_erase_state_abe erase_state
  5107.   def erase_state(state_id)
  5108.     make_state_popup(state_id, :rem_state) if @states.include?(state_id)
  5109.     game_battlerbase_erase_state_abe(state_id)
  5110.   end
  5111.  
  5112.   #--------------------------------------------------------------------------
  5113.   # new method: make_during_state_popup
  5114.   #--------------------------------------------------------------------------
  5115.   def make_during_state_popup
  5116.     state_id = most_important_state_id
  5117.     return if state_id == 0
  5118.     make_state_popup(state_id, :dur_state)
  5119.   end
  5120.  
  5121.   #--------------------------------------------------------------------------
  5122.   # new method: most_important_state_id
  5123.   #--------------------------------------------------------------------------
  5124.   def most_important_state_id
  5125.     states.each {|state| return state.id unless state.message3.empty? }
  5126.     return 0
  5127.   end
  5128.  
  5129.   #--------------------------------------------------------------------------
  5130.   # new method: make_state_popup
  5131.   #--------------------------------------------------------------------------
  5132.   def make_state_popup(state_id, type)
  5133.     state = $data_states[state_id]
  5134.     return if state.icon_index == 0
  5135.     rules = state.popup_rules[type]
  5136.     return if rules.nil?
  5137.     text = sprintf(YEA::BATTLE::POPUP_SETTINGS[type], state.name)
  5138.     flags = ["state", state.icon_index]
  5139.     create_popup(text, rules, flags)
  5140.   end
  5141.  
  5142.   #--------------------------------------------------------------------------
  5143.   # new method: make_miss_popups
  5144.   #--------------------------------------------------------------------------
  5145.   def make_miss_popups(user, item)
  5146.     return if dead?
  5147.     if @result.missed
  5148.       text = YEA::BATTLE::POPUP_SETTINGS[:missed]
  5149.       rules = "DEFAULT"
  5150.       create_popup(text, rules)
  5151.     end
  5152.     if @result.evaded
  5153.       text = YEA::BATTLE::POPUP_SETTINGS[:evaded]
  5154.       rules = "DEFAULT"
  5155.       create_popup(text, rules)
  5156.     end
  5157.     if @result.hit? && !@result.success
  5158.       text = YEA::BATTLE::POPUP_SETTINGS[:failed]
  5159.       rules = "DEFAULT"
  5160.       create_popup(text, rules)
  5161.     end
  5162.     if @result.hit? && item.damage.to_hp?
  5163.       if @result.hp_damage == 0 && @result.hp_damage == 0
  5164.         text = YEA::BATTLE::POPUP_SETTINGS[:nulled]
  5165.         rules = "DEFAULT"
  5166.         create_popup(text, rules)
  5167.       end
  5168.     end
  5169.   end
  5170.  
  5171.   #--------------------------------------------------------------------------
  5172.   # new method: make_rate_popup
  5173.   #--------------------------------------------------------------------------
  5174.   def make_rate_popup(rate)
  5175.     return if rate == 1.0
  5176.     flags = []
  5177.     if rate > 1.0
  5178.       text = YEA::BATTLE::POPUP_SETTINGS[:weakpoint]
  5179.       rules = "WEAK_ELE"
  5180.       flags.push("weakness")
  5181.     elsif rate == 0.0
  5182.       text = YEA::BATTLE::POPUP_SETTINGS[:immune]
  5183.       rules = "IMMU_ELE"
  5184.       flags.push("immune")
  5185.     elsif rate < 0.0
  5186.       text = YEA::BATTLE::POPUP_SETTINGS[:absorbed]
  5187.       rules = "ABSB_ELE"
  5188.       flags.push("absorbed")
  5189.     else
  5190.       text = YEA::BATTLE::POPUP_SETTINGS[:resistant]
  5191.       rules = "REST_ELE"
  5192.       flags.push("resistant")
  5193.     end
  5194.     create_popup(text, rules, flags)
  5195.   end
  5196.  
  5197.   #--------------------------------------------------------------------------
  5198.   # new method: make_buff_popup
  5199.   #--------------------------------------------------------------------------
  5200.   def make_buff_popup(param_id, positive = true)
  5201.     return unless alive?
  5202.     name = Vocab::param(param_id)
  5203.     if positive
  5204.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_buff], name)
  5205.       rules = "BUFF"
  5206.       buff_level = 1
  5207.     else
  5208.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_debuff], name)
  5209.       rules = "DEBUFF"
  5210.       buff_level = -1
  5211.     end
  5212.     icon = buff_icon_index(buff_level, param_id)
  5213.     flags = ["buff", icon]
  5214.     return if @popups.include?([text, rules, flags])
  5215.     create_popup(text, rules, flags)
  5216.   end
  5217.  
  5218. end # Game_BattlerBase
  5219.  
  5220. #==============================================================================
  5221. # ■ Game_Battler
  5222. #==============================================================================
  5223.  
  5224. class Game_Battler < Game_BattlerBase
  5225.  
  5226.   #--------------------------------------------------------------------------
  5227.   # public instance variables
  5228.   #--------------------------------------------------------------------------
  5229.   attr_accessor :pseudo_ani_id
  5230.  
  5231.   #--------------------------------------------------------------------------
  5232.   # alias method: on_battle_end
  5233.   #--------------------------------------------------------------------------
  5234.   alias game_battler_on_battle_end_abe on_battle_end
  5235.   def on_battle_end
  5236.     game_battler_on_battle_end_abe
  5237.     @popups = []
  5238.   end
  5239.  
  5240.   #--------------------------------------------------------------------------
  5241.   # alias method: clear_sprite_effects
  5242.   #--------------------------------------------------------------------------
  5243.   alias game_battler_clear_sprite_effects_abe clear_sprite_effects
  5244.   def clear_sprite_effects
  5245.     game_battler_clear_sprite_effects_abe
  5246.     @pseudo_ani_id = 0
  5247.   end
  5248.  
  5249.   #--------------------------------------------------------------------------
  5250.   # alias method: item_apply
  5251.   #--------------------------------------------------------------------------
  5252.   alias game_battler_item_apply_abe item_apply
  5253.   def item_apply(user, item)
  5254.     game_battler_item_apply_abe(user, item)
  5255.     make_miss_popups(user, item)
  5256.   end
  5257.  
  5258.   #--------------------------------------------------------------------------
  5259.   # alias method: make_damage_value
  5260.   #--------------------------------------------------------------------------
  5261.   alias game_battler_make_damage_value_abe make_damage_value
  5262.   def make_damage_value(user, item)
  5263.     game_battler_make_damage_value_abe(user, item)
  5264.     rate = item_element_rate(user, item)
  5265.     make_rate_popup(rate) unless $game_temp.evaluating
  5266.   end
  5267.  
  5268.   #--------------------------------------------------------------------------
  5269.   # alias method: execute_damage
  5270.   #--------------------------------------------------------------------------
  5271.   alias game_battler_execute_damage_abe execute_damage
  5272.   def execute_damage(user)
  5273.     game_battler_execute_damage_abe(user)
  5274.     make_damage_popups(user)
  5275.   end
  5276.  
  5277.   #--------------------------------------------------------------------------
  5278.   # alias method: item_effect_recover_hp
  5279.   #--------------------------------------------------------------------------
  5280.   alias game_battler_item_effect_recover_hp_abe item_effect_recover_hp
  5281.   def item_effect_recover_hp(user, item, effect)
  5282.     game_battler_item_effect_recover_hp_abe(user, item, effect)
  5283.     make_damage_popups(user)
  5284.   end
  5285.  
  5286.   #--------------------------------------------------------------------------
  5287.   # alias method: item_effect_recover_mp
  5288.   #--------------------------------------------------------------------------
  5289.   alias game_battler_item_effect_recover_mp_abe item_effect_recover_mp
  5290.   def item_effect_recover_mp(user, item, effect)
  5291.     game_battler_item_effect_recover_mp_abe(user, item, effect)
  5292.     make_damage_popups(user)
  5293.   end
  5294.  
  5295.   #--------------------------------------------------------------------------
  5296.   # alias method: item_effect_gain_tp
  5297.   #--------------------------------------------------------------------------
  5298.   alias game_battler_item_effect_gain_tp_abe item_effect_gain_tp
  5299.   def item_effect_gain_tp(user, item, effect)
  5300.     game_battler_item_effect_gain_tp_abe(user, item, effect)
  5301.     make_damage_popups(user)
  5302.   end
  5303.  
  5304.   #--------------------------------------------------------------------------
  5305.   # alias method: item_user_effect
  5306.   #--------------------------------------------------------------------------
  5307.   alias game_battler_item_user_effect_abe item_user_effect
  5308.   def item_user_effect(user, item)
  5309.     game_battler_item_user_effect_abe(user, item)
  5310.     @result.restore_damage
  5311.   end
  5312.  
  5313.   #--------------------------------------------------------------------------
  5314.   # alias method: add_new_state
  5315.   #--------------------------------------------------------------------------
  5316.   alias game_battler_add_new_state_abe add_new_state
  5317.   def add_new_state(state_id)
  5318.     game_battler_add_new_state_abe(state_id)
  5319.     make_state_popup(state_id, :add_state) if @states.include?(state_id)
  5320.   end
  5321.  
  5322.   #--------------------------------------------------------------------------
  5323.   # alias method: add_buff
  5324.   #--------------------------------------------------------------------------
  5325.   alias game_battler_add_buff_abe add_buff
  5326.   def add_buff(param_id, turns)
  5327.     make_buff_popup(param_id, true)
  5328.     game_battler_add_buff_abe(param_id, turns)
  5329.   end
  5330.  
  5331.   #--------------------------------------------------------------------------
  5332.   # alias method: add_debuff
  5333.   #--------------------------------------------------------------------------
  5334.   alias game_battler_add_debuff_abe add_debuff
  5335.   def add_debuff(param_id, turns)
  5336.     make_buff_popup(param_id, false)
  5337.     game_battler_add_debuff_abe(param_id, turns)
  5338.   end
  5339.  
  5340.   #--------------------------------------------------------------------------
  5341.   # alias method: regenerate_all
  5342.   #--------------------------------------------------------------------------
  5343.   alias game_battler_regenerate_all_abe regenerate_all
  5344.   def regenerate_all
  5345.     game_battler_regenerate_all_abe
  5346.     return unless alive?
  5347.     make_damage_popups(self)
  5348.   end
  5349.  
  5350.   #--------------------------------------------------------------------------
  5351.   # new method: can_collapse?
  5352.   #--------------------------------------------------------------------------
  5353.   def can_collapse?
  5354.     return false unless dead?
  5355.     unless actor?
  5356.       return false unless sprite.battler_visible
  5357.       array = [:collapse, :boss_collapse, :instant_collapse]
  5358.       return false if array.include?(sprite.effect_type)
  5359.     end
  5360.     return true
  5361.   end
  5362.  
  5363.   #--------------------------------------------------------------------------
  5364.   # new method: draw_mp?
  5365.   #--------------------------------------------------------------------------
  5366.   def draw_mp?; return true; end
  5367.  
  5368.   #--------------------------------------------------------------------------
  5369.   # new method: draw_tp?
  5370.   #--------------------------------------------------------------------------
  5371.   def draw_tp?
  5372.     return $data_system.opt_display_tp
  5373.   end
  5374.  
  5375. end # Game_Battler
  5376.  
  5377. #==============================================================================
  5378. # ■ Game_Actor
  5379. #==============================================================================
  5380.  
  5381. class Game_Actor < Game_Battler
  5382.  
  5383.   #def battler_name
  5384.     #return "Slime"
  5385.   #end
  5386.  
  5387.   #def battler_hue
  5388.     #return 0
  5389.   #end
  5390.  
  5391.   #--------------------------------------------------------------------------
  5392.   # overwrite method: perform_damage_effect
  5393.   #--------------------------------------------------------------------------
  5394.   def perform_damage_effect
  5395.     $game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
  5396.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  5397.     Sound.play_actor_damage
  5398.   end
  5399.  
  5400.   #--------------------------------------------------------------------------
  5401.   # overwrite method: use_sprite?
  5402.   #--------------------------------------------------------------------------
  5403.   def use_sprite?; return true; end
  5404.  
  5405.   #--------------------------------------------------------------------------
  5406.   # new method: screen_x
  5407.   #--------------------------------------------------------------------------
  5408.   def screen_x
  5409.     return 0 unless SceneManager.scene_is?(Scene_Battle)
  5410.     status_window = SceneManager.scene.status_window
  5411.     return 0 if status_window.nil?
  5412.     item_rect_width = (status_window.width-24) / $game_party.max_battle_members
  5413.     ext = SceneManager.scene.info_viewport.ox
  5414.     rect = SceneManager.scene.status_window.item_rect(self.index)
  5415.     constant = 128 + 12
  5416.     return constant + rect.x + item_rect_width / 2 - ext
  5417.   end
  5418.  
  5419.   #--------------------------------------------------------------------------
  5420.   # new method: screen_y
  5421.   #--------------------------------------------------------------------------
  5422.   def screen_y
  5423.     return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
  5424.     return Graphics.height - 120 if SceneManager.scene.status_window.nil?
  5425.     return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
  5426.   end
  5427.  
  5428.   #--------------------------------------------------------------------------
  5429.   # new method: screen_z
  5430.   #--------------------------------------------------------------------------
  5431.   def screen_z; return 100; end
  5432.  
  5433.   #--------------------------------------------------------------------------
  5434.   # new method: sprite
  5435.   #--------------------------------------------------------------------------
  5436.   def sprite
  5437.     index = $game_party.battle_members.index(self)
  5438.     return SceneManager.scene.spriteset.actor_sprites[index]
  5439.   end
  5440.  
  5441.   #--------------------------------------------------------------------------
  5442.   # new method: draw_mp?
  5443.   #--------------------------------------------------------------------------
  5444.   def draw_mp?
  5445.     return true unless draw_tp?
  5446.     for skill in skills
  5447.       next unless added_skill_types.include?(skill.stype_id)
  5448.       return true if skill.mp_cost > 0
  5449.     end
  5450.     return false
  5451.   end
  5452.  
  5453.   #--------------------------------------------------------------------------
  5454.   # new method: draw_tp?
  5455.   #--------------------------------------------------------------------------
  5456.   def draw_tp?
  5457.     return false unless $data_system.opt_display_tp
  5458.     for skill in skills
  5459.       next unless added_skill_types.include?(skill.stype_id)
  5460.       return true if skill.tp_cost > 0
  5461.     end
  5462.     return false
  5463.   end
  5464.  
  5465. end # Game_Actor
  5466.  
  5467. #==============================================================================
  5468. # ■ Game_Enemy
  5469. #==============================================================================
  5470.  
  5471. class Game_Enemy < Game_Battler
  5472.  
  5473.   #--------------------------------------------------------------------------
  5474.   # overwrite method: perform_damage_effect
  5475.   #--------------------------------------------------------------------------
  5476.   def perform_damage_effect
  5477.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  5478.     Sound.play_enemy_damage
  5479.   end
  5480.  
  5481.   #--------------------------------------------------------------------------
  5482.   # new methods: attack_animation_id
  5483.   #--------------------------------------------------------------------------
  5484.   def atk_animation_id1; return enemy.atk_animation_id1; end
  5485.   def atk_animation_id2; return enemy.atk_animation_id2; end
  5486.  
  5487.   #--------------------------------------------------------------------------
  5488.   # new method: sprite
  5489.   #--------------------------------------------------------------------------
  5490.   def sprite
  5491.     return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  5492.   end
  5493.  
  5494. end # Game_Enemy
  5495.  
  5496. #==============================================================================
  5497. # ■ Game_Unit
  5498. #==============================================================================
  5499.  
  5500. class Game_Unit
  5501.  
  5502.   #--------------------------------------------------------------------------
  5503.   # alias method: make_actions
  5504.   #--------------------------------------------------------------------------
  5505.   alias game_unit_make_actions_abe make_actions
  5506.   def make_actions
  5507.     game_unit_make_actions_abe
  5508.     refresh_autobattler_status_window
  5509.   end
  5510.  
  5511.   #--------------------------------------------------------------------------
  5512.   # new method: refresh_autobattler_status_window
  5513.   #--------------------------------------------------------------------------
  5514.   def refresh_autobattler_status_window
  5515.     return unless SceneManager.scene_is?(Scene_Battle)
  5516.     return unless self.is_a?(Game_Party)
  5517.     SceneManager.scene.refresh_autobattler_status_window
  5518.   end
  5519.  
  5520. end # Game_Unit
  5521.  
  5522. #==============================================================================
  5523. # ■ Window_PartyCommand
  5524. #==============================================================================
  5525.  
  5526. class Window_PartyCommand < Window_Command
  5527.  
  5528.   #--------------------------------------------------------------------------
  5529.   # overwrite method: process_handling
  5530.   #--------------------------------------------------------------------------
  5531.   def process_handling
  5532.     return unless open? && active
  5533.     return process_dir6 if Input.repeat?(:RIGHT)
  5534.     return super
  5535.   end
  5536.  
  5537.   #--------------------------------------------------------------------------
  5538.   # new method: process_dir6
  5539.   #--------------------------------------------------------------------------
  5540.   def process_dir6
  5541.     Sound.play_cursor
  5542.     Input.update
  5543.     deactivate
  5544.     call_handler(:dir6)
  5545.   end
  5546.  
  5547. end # Window_PartyCommand
  5548.  
  5549. #==============================================================================
  5550. # ■ Window_ActorCommand
  5551. #==============================================================================
  5552.  
  5553. class Window_ActorCommand < Window_Command
  5554.  
  5555.   #--------------------------------------------------------------------------
  5556.   # overwrite method: process_handling
  5557.   #--------------------------------------------------------------------------
  5558.   def process_handling
  5559.     return unless open? && active
  5560.     return process_dir4 if Input.repeat?(:LEFT)
  5561.     return process_dir6 if Input.repeat?(:RIGHT)
  5562.     return super
  5563.   end
  5564.  
  5565.   #--------------------------------------------------------------------------
  5566.   # new method: process_dir4
  5567.   #--------------------------------------------------------------------------
  5568.   def process_dir4
  5569.     Sound.play_cursor
  5570.     Input.update
  5571.     deactivate
  5572.     call_handler(:cancel)
  5573.   end
  5574.  
  5575.   #--------------------------------------------------------------------------
  5576.   # new method: process_dir6
  5577.   #--------------------------------------------------------------------------
  5578.   def process_dir6
  5579.     Sound.play_cursor
  5580.     Input.update
  5581.     deactivate
  5582.     call_handler(:dir6)
  5583.   end
  5584.  
  5585. end # Window_ActorCommand
  5586.  
  5587. #==============================================================================
  5588. # ■ Window_BattleStatus
  5589. #==============================================================================
  5590.  
  5591. class Window_BattleStatus < Window_Selectable
  5592.  
  5593.   #--------------------------------------------------------------------------
  5594.   # overwrite method: initialize
  5595.   #--------------------------------------------------------------------------
  5596.   def initialize
  5597.     super(0, 0, window_width, window_height)
  5598.     self.openness = 0
  5599.     @party = $game_party.battle_members.clone
  5600.   end
  5601.  
  5602.   #--------------------------------------------------------------------------
  5603.   # overwrite method: col_max
  5604.   #--------------------------------------------------------------------------
  5605.   def col_max; return $game_party.max_battle_members; end
  5606.  
  5607.   #--------------------------------------------------------------------------
  5608.   # new method: battle_members
  5609.   #--------------------------------------------------------------------------
  5610.   def battle_members; return $game_party.battle_members; end
  5611.  
  5612.   #--------------------------------------------------------------------------
  5613.   # new method: actor
  5614.   #--------------------------------------------------------------------------
  5615.   def actor; return battle_members[@index]; end
  5616.  
  5617.   #--------------------------------------------------------------------------
  5618.   # overwrite method: update
  5619.   #--------------------------------------------------------------------------
  5620.   def update
  5621.     super
  5622.     return if @party == $game_party.battle_members
  5623.     @party = $game_party.battle_members.clone
  5624.     refresh
  5625.   end
  5626.  
  5627.   #--------------------------------------------------------------------------
  5628.   # overwrite method: draw_item
  5629.   #--------------------------------------------------------------------------
  5630.   def draw_item(index)
  5631.     return if index.nil?
  5632.     clear_item(index)
  5633.     actor = battle_members[index]
  5634.     rect = item_rect(index)
  5635.     return if actor.nil?
  5636.     draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
  5637.     draw_actor_name(actor, rect.x, rect.y, rect.width-8)
  5638.     draw_actor_action(actor, rect.x, rect.y)
  5639.     draw_actor_icons(actor, rect.x, line_height*1, rect.width)
  5640.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  5641.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  5642.     draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  5643.     if draw_tp?(actor) && draw_mp?(actor)
  5644.       dw = rect.width/2-2
  5645.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  5646.       draw_actor_tp(actor, rect.x+2, line_height*3, dw)
  5647.       dw = rect.width - rect.width/2 - 2
  5648.       draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
  5649.     elsif draw_tp?(actor) && !draw_mp?(actor)
  5650.       draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
  5651.     else
  5652.       draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
  5653.     end
  5654.   end
  5655.  
  5656.   #--------------------------------------------------------------------------
  5657.   # overwrite method: item_rect
  5658.   #--------------------------------------------------------------------------
  5659.   def item_rect(index)
  5660.     rect = Rect.new
  5661.     rect.width = contents.width / $game_party.max_battle_members
  5662.     rect.height = contents.height
  5663.     rect.x = index * rect.width
  5664.     if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
  5665.       rect.x += (contents.width - $game_party.members.size * rect.width) / 2
  5666.     end
  5667.     rect.y = 0
  5668.     return rect
  5669.   end
  5670.  
  5671.   #--------------------------------------------------------------------------
  5672.   # overwrite method: draw_face
  5673.   #--------------------------------------------------------------------------
  5674.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  5675.     bitmap = Cache.face(face_name)
  5676.     fx = [(96 - item_rect(0).width + 1) / 2, 0].max
  5677.     fy = face_index / 4 * 96 + 2
  5678.     fw = [item_rect(0).width - 4, 92].min
  5679.     rect = Rect.new(fx, fy, fw, 92)
  5680.     rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
  5681.     contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
  5682.     bitmap.dispose
  5683.   end
  5684.  
  5685.   #--------------------------------------------------------------------------
  5686.   # overwrite method: draw_actor_name
  5687.   #--------------------------------------------------------------------------
  5688.   def draw_actor_name(actor, dx, dy, dw = 112)
  5689.     reset_font_settings
  5690.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  5691.     change_color(hp_color(actor))
  5692.     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  5693.   end
  5694.  
  5695.   #--------------------------------------------------------------------------
  5696.   # new method: draw_actor_action
  5697.   #--------------------------------------------------------------------------
  5698.   def draw_actor_action(actor, dx, dy)
  5699.     draw_icon(action_icon(actor), dx, dy)
  5700.   end
  5701.  
  5702.   #--------------------------------------------------------------------------
  5703.   # new method: action_icon
  5704.   #--------------------------------------------------------------------------
  5705.   def action_icon(actor)
  5706.     return Icon.no_action if actor.current_action.nil?
  5707.     return Icon.no_action if actor.current_action.item.nil?
  5708.     return actor.current_action.item.icon_index
  5709.   end
  5710.  
  5711.   #--------------------------------------------------------------------------
  5712.   # new method: draw_tp?
  5713.   #--------------------------------------------------------------------------
  5714.   def draw_tp?(actor)
  5715.     return actor.draw_tp?
  5716.   end
  5717.  
  5718.   #--------------------------------------------------------------------------
  5719.   # new method: draw_mp?
  5720.   #--------------------------------------------------------------------------
  5721.   def draw_mp?(actor)
  5722.     return actor.draw_mp?
  5723.   end
  5724.  
  5725.   #--------------------------------------------------------------------------
  5726.   # overwrite method: draw_current_and_max_values
  5727.   #--------------------------------------------------------------------------
  5728.   def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  5729.     change_color(color1)
  5730.     draw_text(dx, dy, dw, line_height, current.group, 2)
  5731.   end
  5732.  
  5733.   #--------------------------------------------------------------------------
  5734.   # overwrite method: draw_actor_hp
  5735.   #--------------------------------------------------------------------------
  5736.   def draw_actor_hp(actor, dx, dy, width = 124)
  5737.     draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  5738.     change_color(system_color)
  5739.     cy = (Font.default_size - contents.font.size) / 2 + 1
  5740.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
  5741.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  5742.       hp_color(actor), normal_color)
  5743.     end
  5744.  
  5745.   #--------------------------------------------------------------------------
  5746.   # overwrite method: draw_actor_mp
  5747.   #--------------------------------------------------------------------------
  5748.   def draw_actor_mp(actor, dx, dy, width = 124)
  5749.     draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  5750.     change_color(system_color)
  5751.     cy = (Font.default_size - contents.font.size) / 2 + 1
  5752.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
  5753.     draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  5754.       mp_color(actor), normal_color)
  5755.     end
  5756.  
  5757.   #--------------------------------------------------------------------------
  5758.   # overwrite method: draw_actor_tp
  5759.   #--------------------------------------------------------------------------
  5760.   def draw_actor_tp(actor, dx, dy, width = 124)
  5761.     draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  5762.     change_color(system_color)
  5763.     cy = (Font.default_size - contents.font.size) / 2 + 1
  5764.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
  5765.     change_color(tp_color(actor))
  5766.     draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  5767.   end
  5768.  
  5769. end # Window_BattleStatus
  5770.  
  5771. #==============================================================================
  5772. # ■ Window_BattleActor
  5773. #==============================================================================
  5774.  
  5775. class Window_BattleActor < Window_BattleStatus
  5776.  
  5777.   #--------------------------------------------------------------------------
  5778.   # overwrite method: show
  5779.   #--------------------------------------------------------------------------
  5780.   def show
  5781.     create_flags
  5782.     super
  5783.   end
  5784.  
  5785.   #--------------------------------------------------------------------------
  5786.   # new method: create_flags
  5787.   #--------------------------------------------------------------------------
  5788.   def create_flags
  5789.     set_select_flag(:any)
  5790.     select(0)
  5791.     return if $game_temp.battle_aid.nil?
  5792.     if $game_temp.battle_aid.need_selection?
  5793.       select(0)
  5794.       set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
  5795.     elsif $game_temp.battle_aid.for_user?
  5796.       battler = BattleManager.actor
  5797.       id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
  5798.       select(id)
  5799.       set_select_flag(:user)
  5800.     elsif $game_temp.battle_aid.for_all?
  5801.       select(0)
  5802.       set_select_flag(:all)
  5803.       set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
  5804.     elsif $game_temp.battle_aid.for_random?
  5805.       select(0)
  5806.       set_select_flag(:random) if $game_temp.battle_aid.for_random?
  5807.     end
  5808.   end
  5809.  
  5810.   #--------------------------------------------------------------------------
  5811.   # new method: set_flag
  5812.   #--------------------------------------------------------------------------
  5813.   def set_select_flag(flag)
  5814.     @select_flag = flag
  5815.     case @select_flag
  5816.     when :all, :all_dead, :random
  5817.       @cursor_all = true
  5818.     else
  5819.       @cursor_all = false
  5820.     end
  5821.   end
  5822.  
  5823.   #--------------------------------------------------------------------------
  5824.   # overwrite method: update_cursor
  5825.   #--------------------------------------------------------------------------
  5826.   def update_cursor
  5827.     if @cursor_all
  5828.       cursor_rect.set(0, 0, contents.width, contents.height)
  5829.       self.top_row = 0
  5830.     elsif @index < 0
  5831.       cursor_rect.empty
  5832.     else
  5833.       ensure_cursor_visible
  5834.       cursor_rect.set(item_rect(@index))
  5835.     end
  5836.   end
  5837.  
  5838.   #--------------------------------------------------------------------------
  5839.   # overwrite method: cursor_movable?
  5840.   #--------------------------------------------------------------------------
  5841.   def cursor_movable?
  5842.     return false if @select_flag == :user
  5843.     return super
  5844.   end
  5845.  
  5846.   #--------------------------------------------------------------------------
  5847.   # overwrite method: current_item_enabled?
  5848.   #--------------------------------------------------------------------------
  5849.   def current_item_enabled?
  5850.     return true if $game_temp.battle_aid.nil?
  5851.     if $game_temp.battle_aid.need_selection?
  5852.       member = $game_party.battle_members[@index]
  5853.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  5854.     elsif $game_temp.battle_aid.for_dead_friend?
  5855.       for member in $game_party.battle_members
  5856.         return true if member.dead?
  5857.       end
  5858.       return false
  5859.     end
  5860.     return true
  5861.   end
  5862.  
  5863. end # Window_BattleActor
  5864.  
  5865. #==============================================================================
  5866. # ■ Window_BattleStatusAid
  5867. #==============================================================================
  5868.  
  5869. class Window_BattleStatusAid < Window_BattleStatus
  5870.  
  5871.   #--------------------------------------------------------------------------
  5872.   # public instance variables
  5873.   #--------------------------------------------------------------------------
  5874.   attr_accessor :status_window
  5875.  
  5876.   #--------------------------------------------------------------------------
  5877.   # overwrite method: initialize
  5878.   #--------------------------------------------------------------------------
  5879.   def initialize
  5880.     super
  5881.     self.visible = false
  5882.     self.openness = 255
  5883.   end
  5884.  
  5885.   #--------------------------------------------------------------------------
  5886.   # overwrite method: window_width
  5887.   #--------------------------------------------------------------------------
  5888.   def window_width; return 128; end
  5889.  
  5890.   #--------------------------------------------------------------------------
  5891.   # overwrite method: show
  5892.   #--------------------------------------------------------------------------
  5893.   def show
  5894.     super
  5895.     refresh
  5896.   end
  5897.  
  5898.   #--------------------------------------------------------------------------
  5899.   # overwrite method: refresh
  5900.   #--------------------------------------------------------------------------
  5901.   def refresh
  5902.     contents.clear
  5903.     return if @status_window.nil?
  5904.     draw_item(@status_window.index)
  5905.   end
  5906.  
  5907.   #--------------------------------------------------------------------------
  5908.   # overwrite method: item_rect
  5909.   #--------------------------------------------------------------------------
  5910.   def item_rect(index)
  5911.     return Rect.new(0, 0, contents.width, contents.height)
  5912.   end
  5913.  
  5914. end # Window_BattleStatusAid
  5915.  
  5916. #==============================================================================
  5917. # ■ Window_BattleEnemy
  5918. #==============================================================================
  5919.  
  5920. class Window_BattleEnemy < Window_Selectable
  5921.  
  5922.   #--------------------------------------------------------------------------
  5923.   # overwrite method: initialize
  5924.   #--------------------------------------------------------------------------
  5925.   def initialize(info_viewport)
  5926.     super(0, Graphics.height, window_width, fitting_height(1))
  5927.     refresh
  5928.     self.visible = false
  5929.     @info_viewport = info_viewport
  5930.   end
  5931.  
  5932.   #--------------------------------------------------------------------------
  5933.   # overwrite method: col_max
  5934.   #--------------------------------------------------------------------------
  5935.   def col_max; return item_max; end
  5936.  
  5937.   #--------------------------------------------------------------------------
  5938.   # overwrite method: show
  5939.   #--------------------------------------------------------------------------
  5940.   def show
  5941.     create_flags
  5942.     super
  5943.   end
  5944.  
  5945.   #--------------------------------------------------------------------------
  5946.   # new method: create_flags
  5947.   #--------------------------------------------------------------------------
  5948.   def create_flags
  5949.     set_select_flag(:any)
  5950.     select(0)
  5951.     return if $game_temp.battle_aid.nil?
  5952.     if $game_temp.battle_aid.need_selection?
  5953.       select(0)
  5954.     elsif $game_temp.battle_aid.for_all?
  5955.       select(0)
  5956.       set_select_flag(:all)
  5957.     elsif $game_temp.battle_aid.for_random?
  5958.       select(0)
  5959.       set_select_flag(:random)
  5960.     end
  5961.   end
  5962.  
  5963.   #--------------------------------------------------------------------------
  5964.   # new method: set_flag
  5965.   #--------------------------------------------------------------------------
  5966.   def set_select_flag(flag)
  5967.     @select_flag = flag
  5968.     case @select_flag
  5969.     when :all, :random
  5970.       @cursor_all = true
  5971.     else
  5972.       @cursor_all = false
  5973.     end
  5974.   end
  5975.  
  5976.   #--------------------------------------------------------------------------
  5977.   # new method: select_all?
  5978.   #--------------------------------------------------------------------------
  5979.   def select_all?
  5980.     return true if @select_flag == :all
  5981.     return true if @select_flag == :random
  5982.     return false
  5983.   end
  5984.  
  5985.   #--------------------------------------------------------------------------
  5986.   # overwrite method: update_cursor
  5987.   #--------------------------------------------------------------------------
  5988.   def update_cursor
  5989.     if @cursor_all
  5990.       cursor_rect.set(0, 0, contents.width, contents.height)
  5991.       self.top_row = 0
  5992.     elsif @index < 0
  5993.       cursor_rect.empty
  5994.     else
  5995.       ensure_cursor_visible
  5996.       cursor_rect.set(item_rect(@index))
  5997.     end
  5998.   end
  5999.  
  6000.   #--------------------------------------------------------------------------
  6001.   # overwrite method: cursor_movable?
  6002.   #--------------------------------------------------------------------------
  6003.   def cursor_movable?
  6004.     return false if @select_flag == :user
  6005.     return super
  6006.   end
  6007.  
  6008.   #--------------------------------------------------------------------------
  6009.   # overwrite method: current_item_enabled?
  6010.   #--------------------------------------------------------------------------
  6011.   def current_item_enabled?
  6012.     return true if $game_temp.battle_aid.nil?
  6013.     if $game_temp.battle_aid.need_selection?
  6014.       member = $game_party.battle_members[@index]
  6015.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  6016.     elsif $game_temp.battle_aid.for_dead_friend?
  6017.       for member in $game_party.battle_members
  6018.         return true if member.dead?
  6019.       end
  6020.       return false
  6021.     end
  6022.     return true
  6023.   end
  6024.  
  6025.   #--------------------------------------------------------------------------
  6026.   # overwrite method: enemy
  6027.   #--------------------------------------------------------------------------
  6028.   def enemy; @data[index]; end
  6029.  
  6030.   #--------------------------------------------------------------------------
  6031.   # overwrite method: refresh
  6032.   #--------------------------------------------------------------------------
  6033.   def refresh
  6034.     make_item_list
  6035.     create_contents
  6036.     draw_all_items
  6037.   end
  6038.  
  6039.   #--------------------------------------------------------------------------
  6040.   # overwrite method: make_item_list
  6041.   #--------------------------------------------------------------------------
  6042.   def make_item_list
  6043.     @data = $game_troop.alive_members
  6044.     @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  6045.   end
  6046.  
  6047.   #--------------------------------------------------------------------------
  6048.   # overwrite method: draw_item
  6049.   #--------------------------------------------------------------------------
  6050.   def draw_item(index); return; end
  6051.  
  6052.   #--------------------------------------------------------------------------
  6053.   # overwrite method: update
  6054.   #--------------------------------------------------------------------------
  6055.   def update
  6056.     super
  6057.     return unless active
  6058.     enemy.sprite_effect_type = :whiten
  6059.     return unless select_all?
  6060.     for enemy in $game_troop.alive_members
  6061.       enemy.sprite_effect_type = :whiten
  6062.     end
  6063.   end
  6064.  
  6065. end # Window_BattleEnemy
  6066.  
  6067. #==============================================================================
  6068. # ■ Window_BattleHelp
  6069. #==============================================================================
  6070.  
  6071. class Window_BattleHelp < Window_Help
  6072.  
  6073.   #--------------------------------------------------------------------------
  6074.   # public instance variables
  6075.   #--------------------------------------------------------------------------
  6076.   attr_accessor :actor_window
  6077.   attr_accessor :enemy_window
  6078.  
  6079.   #--------------------------------------------------------------------------
  6080.   # update
  6081.   #--------------------------------------------------------------------------
  6082.   def update
  6083.     super
  6084.     if !self.visible and @text != ""
  6085.       @text = ""
  6086.       return refresh
  6087.     end
  6088.     update_battler_name
  6089.   end
  6090.  
  6091.   #--------------------------------------------------------------------------
  6092.   # update_battler_name
  6093.   #--------------------------------------------------------------------------
  6094.   def update_battler_name
  6095.     return unless @actor_window.active || @enemy_window.active
  6096.     if @actor_window.active
  6097.       battler = $game_party.battle_members[@actor_window.index]
  6098.     elsif @enemy_window.active
  6099.       battler = @enemy_window.enemy
  6100.     end
  6101.     if special_display?
  6102.       refresh_special_case(battler)
  6103.     else
  6104.       refresh_battler_name(battler) if battler_name(battler) != @text
  6105.     end
  6106.   end
  6107.  
  6108.   #--------------------------------------------------------------------------
  6109.   # battler_name
  6110.   #--------------------------------------------------------------------------
  6111.   def battler_name(battler)
  6112.     text = battler.name.clone
  6113.     return text
  6114.   end
  6115.  
  6116.   #--------------------------------------------------------------------------
  6117.   # refresh_battler_name
  6118.   #--------------------------------------------------------------------------
  6119.   def refresh_battler_name(battler)
  6120.     contents.clear
  6121.     reset_font_settings
  6122.     change_color(normal_color)
  6123.     @text = battler_name(battler)
  6124.     icons = battler.state_icons + battler.buff_icons
  6125.     dy = icons.size <= 0 ? line_height / 2 : 0
  6126.     draw_text(0, dy, contents.width, line_height, @text, 1)
  6127.     dx = (contents.width - (icons.size * 24)) / 2
  6128.     draw_actor_icons(battler, dx, line_height, contents.width)
  6129.   end
  6130.  
  6131.   #--------------------------------------------------------------------------
  6132.   # special_display?
  6133.   #--------------------------------------------------------------------------
  6134.   def special_display?
  6135.     return false if $game_temp.battle_aid.nil?
  6136.     return false if $game_temp.battle_aid.for_user?
  6137.     return !$game_temp.battle_aid.need_selection?
  6138.   end
  6139.  
  6140.   #--------------------------------------------------------------------------
  6141.   # refresh_special_case
  6142.   #--------------------------------------------------------------------------
  6143.   def refresh_special_case(battler)
  6144.     if $game_temp.battle_aid.for_opponent?
  6145.       if $game_temp.battle_aid.for_all?
  6146.         text = YEA::BATTLE::HELP_TEXT_ALL_FOES
  6147.       else
  6148.         case $game_temp.battle_aid.number_of_targets
  6149.         when 1
  6150.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
  6151.         else
  6152.           number = $game_temp.battle_aid.number_of_targets
  6153.           text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
  6154.         end
  6155.       end
  6156.     else # $game_temp.battle_aid.for_friend?
  6157.       if $game_temp.battle_aid.for_dead_friend?
  6158.         text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
  6159.       elsif $game_temp.battle_aid.for_random?
  6160.         case $game_temp.battle_aid.number_of_targets
  6161.         when 1
  6162.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
  6163.         else
  6164.           number = $game_temp.battle_aid.number_of_targets
  6165.           text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
  6166.         end
  6167.       else
  6168.         text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
  6169.       end
  6170.     end
  6171.     return if text == @text
  6172.     @text = text
  6173.     contents.clear
  6174.     reset_font_settings
  6175.     draw_text(0, 0, contents.width, line_height*2, @text, 1)
  6176.   end
  6177.  
  6178. end # Window_BattleHelp
  6179.  
  6180. #==============================================================================
  6181. # ■ Window_BattleLog
  6182. #==============================================================================
  6183.  
  6184. class Window_BattleLog < Window_Selectable
  6185.  
  6186.   #--------------------------------------------------------------------------
  6187.   # alias method: display_current_state
  6188.   #--------------------------------------------------------------------------
  6189.   alias window_battlelog_display_current_state_abe display_current_state
  6190.   def display_current_state(subject)
  6191.     subject.make_during_state_popup
  6192.     return unless YEA::BATTLE::MSG_CURRENT_STATE
  6193.     window_battlelog_display_current_state_abe(subject)
  6194.   end
  6195.  
  6196.   #--------------------------------------------------------------------------
  6197.   # alias method: display_use_item
  6198.   #--------------------------------------------------------------------------
  6199.   alias window_battlelog_display_use_item_abe display_use_item
  6200.   def display_use_item(subject, item)
  6201.     return unless YEA::BATTLE::MSG_CURRENT_ACTION
  6202.     window_battlelog_display_use_item_abe(subject, item)
  6203.   end
  6204.  
  6205.   #--------------------------------------------------------------------------
  6206.   # alias method: display_counter
  6207.   #--------------------------------------------------------------------------
  6208.   alias window_battlelog_display_counter_abe display_counter
  6209.   def display_counter(target, item)
  6210.     if YEA::BATTLE::MSG_COUNTERATTACK
  6211.       window_battlelog_display_counter_abe(target, item)
  6212.     else
  6213.       Sound.play_evasion
  6214.     end
  6215.   end
  6216.  
  6217.   #--------------------------------------------------------------------------
  6218.   # alias method: display_reflection
  6219.   #--------------------------------------------------------------------------
  6220.   alias window_battlelog_display_reflection_abe display_reflection
  6221.   def display_reflection(target, item)
  6222.     if YEA::BATTLE::MSG_REFLECT_MAGIC
  6223.       window_battlelog_display_reflection_abe(target, item)
  6224.     else
  6225.       Sound.play_reflection
  6226.     end
  6227.   end
  6228.  
  6229.   #--------------------------------------------------------------------------
  6230.   # alias method: display_substitute
  6231.   #--------------------------------------------------------------------------
  6232.   alias window_battlelog_display_substitute_abe display_substitute
  6233.   def display_substitute(substitute, target)
  6234.     return unless YEA::BATTLE::MSG_SUBSTITUTE_HIT
  6235.     window_battlelog_display_substitute_abe(substitute, target)
  6236.   end
  6237.  
  6238.   #--------------------------------------------------------------------------
  6239.   # alias method: display_failure
  6240.   #--------------------------------------------------------------------------
  6241.   alias window_battlelog_display_failure_abe display_failure
  6242.   def display_failure(target, item)
  6243.     return unless YEA::BATTLE::MSG_FAILURE_HIT
  6244.     window_battlelog_display_failure_abe(target, item)
  6245.   end
  6246.  
  6247.   #--------------------------------------------------------------------------
  6248.   # alias method: display_critical
  6249.   #--------------------------------------------------------------------------
  6250.   alias window_battlelog_display_critical_abe display_critical
  6251.   def display_critical(target, item)
  6252.     return unless YEA::BATTLE::MSG_CRITICAL_HIT
  6253.     window_battlelog_display_critical_abe(target, item)
  6254.   end
  6255.  
  6256.   #--------------------------------------------------------------------------
  6257.   # alias method: display_miss
  6258.   #--------------------------------------------------------------------------
  6259.   alias window_battlelog_display_miss_abe display_miss
  6260.   def display_miss(target, item)
  6261.     return unless YEA::BATTLE::MSG_HIT_MISSED
  6262.     window_battlelog_display_miss_abe(target, item)
  6263.   end
  6264.  
  6265.   #--------------------------------------------------------------------------
  6266.   # alias method: display_evasion
  6267.   #--------------------------------------------------------------------------
  6268.   alias window_battlelog_display_evasion_abe display_evasion
  6269.   def display_evasion(target, item)
  6270.     if YEA::BATTLE::MSG_EVASION
  6271.       window_battlelog_display_evasion_abe(target, item)
  6272.     else
  6273.       if !item || item.physical?
  6274.         Sound.play_evasion
  6275.       else
  6276.         Sound.play_magic_evasion
  6277.       end
  6278.     end
  6279.   end
  6280.  
  6281.   #--------------------------------------------------------------------------
  6282.   # overwrite method: display_hp_damage
  6283.   #--------------------------------------------------------------------------
  6284.   def display_hp_damage(target, item)
  6285.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  6286.     if target.result.hp_damage > 0 && target.result.hp_drain == 0
  6287.       target.perform_damage_effect
  6288.     end
  6289.     Sound.play_recovery if target.result.hp_damage < 0
  6290.     return unless YEA::BATTLE::MSG_HP_DAMAGE
  6291.     add_text(target.result.hp_damage_text)
  6292.     wait
  6293.   end
  6294.  
  6295.   #--------------------------------------------------------------------------
  6296.   # overwrite method: display_mp_damage
  6297.   #--------------------------------------------------------------------------
  6298.   def display_mp_damage(target, item)
  6299.     return if target.dead? || target.result.mp_damage == 0
  6300.     Sound.play_recovery if target.result.mp_damage < 0
  6301.     return unless YEA::BATTLE::MSG_MP_DAMAGE
  6302.     add_text(target.result.mp_damage_text)
  6303.     wait
  6304.   end
  6305.  
  6306.   #--------------------------------------------------------------------------
  6307.   # overwrite method: display_tp_damage
  6308.   #--------------------------------------------------------------------------
  6309.   def display_tp_damage(target, item)
  6310.     return if target.dead? || target.result.tp_damage == 0
  6311.     Sound.play_recovery if target.result.tp_damage < 0
  6312.     return unless YEA::BATTLE::MSG_TP_DAMAGE
  6313.     add_text(target.result.tp_damage_text)
  6314.     wait
  6315.   end
  6316.  
  6317.   #--------------------------------------------------------------------------
  6318.   # alias method: display_added_states
  6319.   #--------------------------------------------------------------------------
  6320.   alias window_battlelog_display_added_states_abe display_added_states
  6321.   def display_added_states(target)
  6322.     return unless YEA::BATTLE::MSG_ADDED_STATES
  6323.     window_battlelog_display_added_states_abe(target)
  6324.   end
  6325.  
  6326.   #--------------------------------------------------------------------------
  6327.   # alias method: display_removed_states
  6328.   #--------------------------------------------------------------------------
  6329.   alias window_battlelog_display_removed_states_abe display_removed_states
  6330.   def display_removed_states(target)
  6331.     return unless YEA::BATTLE::MSG_REMOVED_STATES
  6332.     window_battlelog_display_removed_states_abe(target)
  6333.   end
  6334.  
  6335.   #--------------------------------------------------------------------------
  6336.   # alias method: display_changed_buffs
  6337.   #--------------------------------------------------------------------------
  6338.   alias window_battlelog_display_changed_buffs_abe display_changed_buffs
  6339.   def display_changed_buffs(target)
  6340.     return unless YEA::BATTLE::MSG_CHANGED_BUFFS
  6341.     window_battlelog_display_changed_buffs_abe(target)
  6342.   end
  6343.  
  6344. end # Window_BattleLog
  6345.  
  6346. #==============================================================================
  6347. # ■ Window_SkillList
  6348. #==============================================================================
  6349.  
  6350. class Window_SkillList < Window_Selectable
  6351.  
  6352.   #--------------------------------------------------------------------------
  6353.   # overwrite method: spacing
  6354.   #--------------------------------------------------------------------------
  6355.   def spacing
  6356.     return 8 if $game_party.in_battle
  6357.     return super
  6358.   end
  6359.  
  6360. end # Window_SkillList
  6361.  
  6362. #==============================================================================
  6363. # ■ Window_ItemList
  6364. #==============================================================================
  6365.  
  6366. class Window_ItemList < Window_Selectable
  6367.  
  6368.   #--------------------------------------------------------------------------
  6369.   # overwrite method: spacing
  6370.   #--------------------------------------------------------------------------
  6371.   def spacing
  6372.     return 8 if $game_party.in_battle
  6373.     return super
  6374.   end
  6375.  
  6376. end # Window_ItemList
  6377.  
  6378. #==============================================================================
  6379. # ■ Scene_Battle
  6380. #==============================================================================
  6381.  
  6382. class Scene_Battle < Scene_Base
  6383.  
  6384.   #--------------------------------------------------------------------------
  6385.   # public instance variables
  6386.   #--------------------------------------------------------------------------
  6387.   attr_accessor :enemy_window
  6388.   attr_accessor :info_viewport
  6389.   attr_accessor :spriteset
  6390.   attr_accessor :status_window
  6391.   attr_accessor :status_aid_window
  6392.   attr_accessor :subject
  6393.  
  6394.   #--------------------------------------------------------------------------
  6395.   # alias method: create_spriteset
  6396.   #--------------------------------------------------------------------------
  6397.   alias scene_battle_create_spriteset_abe create_spriteset
  6398.   def create_spriteset
  6399.     BattleManager.init_battle_type
  6400.     scene_battle_create_spriteset_abe
  6401.   end
  6402.  
  6403.   #--------------------------------------------------------------------------
  6404.   # alias method: update_basic
  6405.   #--------------------------------------------------------------------------
  6406.   alias scene_battle_update_basic_abe update_basic
  6407.   def update_basic
  6408.     scene_battle_update_basic_abe
  6409.     update_debug
  6410.   end
  6411.  
  6412.   #--------------------------------------------------------------------------
  6413.   # new method: update_debug
  6414.   #--------------------------------------------------------------------------
  6415.   def update_debug
  6416.     return unless $TEST || $BTEST
  6417.     debug_heal_party if Input.trigger?(:F5)
  6418.     debug_damage_party if Input.trigger?(:F6)
  6419.     debug_fill_tp if Input.trigger?(:F7)
  6420.     debug_kill_all if Input.trigger?(:F8)
  6421.   end
  6422.  
  6423.   #--------------------------------------------------------------------------
  6424.   # new method: debug_heal_party
  6425.   #--------------------------------------------------------------------------
  6426.   def debug_heal_party
  6427.     Sound.play_recovery
  6428.     for member in $game_party.battle_members
  6429.       member.recover_all
  6430.     end
  6431.     @status_window.refresh
  6432.   end
  6433.  
  6434.   #--------------------------------------------------------------------------
  6435.   # new method: debug_damage_party
  6436.   #--------------------------------------------------------------------------
  6437.   def debug_damage_party
  6438.     Sound.play_actor_damage
  6439.     for member in $game_party.alive_members
  6440.       member.hp = 1
  6441.       member.mp = 0
  6442.       member.tp = 0
  6443.     end
  6444.     @status_window.refresh
  6445.   end
  6446.  
  6447.   #--------------------------------------------------------------------------
  6448.   # new method: debug_fill_tp
  6449.   #--------------------------------------------------------------------------
  6450.   def debug_fill_tp
  6451.     Sound.play_recovery
  6452.     for member in $game_party.alive_members
  6453.       member.tp = member.max_tp
  6454.     end
  6455.     @status_window.refresh
  6456.   end
  6457.  
  6458.   #--------------------------------------------------------------------------
  6459.   # new method: debug_kill_all
  6460.   #--------------------------------------------------------------------------
  6461.   def debug_kill_all
  6462.     for enemy in $game_troop.alive_members
  6463.       enemy.hp = 0
  6464.       enemy.perform_collapse_effect
  6465.     end
  6466.     BattleManager.judge_win_loss
  6467.     @log_window.wait
  6468.     @log_window.wait_for_effect
  6469.   end
  6470.  
  6471.   #--------------------------------------------------------------------------
  6472.   # alias method: create_all_windows
  6473.   #--------------------------------------------------------------------------
  6474.   alias scene_battle_create_all_windows_abe create_all_windows
  6475.   def create_all_windows
  6476.     scene_battle_create_all_windows_abe
  6477.     create_battle_status_aid_window
  6478.     set_help_window
  6479.   end
  6480.  
  6481.   #--------------------------------------------------------------------------
  6482.   # alias method: create_info_viewport
  6483.   #--------------------------------------------------------------------------
  6484.   alias scene_battle_create_info_viewport_abe create_info_viewport
  6485.   def create_info_viewport
  6486.     scene_battle_create_info_viewport_abe
  6487.     @status_window.refresh
  6488.   end
  6489.  
  6490.   #--------------------------------------------------------------------------
  6491.   # new method: create_battle_status_aid_window
  6492.   #--------------------------------------------------------------------------
  6493.   def create_battle_status_aid_window
  6494.     @status_aid_window = Window_BattleStatusAid.new
  6495.     @status_aid_window.status_window = @status_window
  6496.     @status_aid_window.x = Graphics.width - @status_aid_window.width
  6497.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  6498.   end
  6499.  
  6500.   #--------------------------------------------------------------------------
  6501.   # overwrite method: create_help_window
  6502.   #--------------------------------------------------------------------------
  6503.   def create_help_window
  6504.     @help_window = Window_BattleHelp.new
  6505.     @help_window.hide
  6506.   end
  6507.  
  6508.   #--------------------------------------------------------------------------
  6509.   # new method: set_help_window
  6510.   #--------------------------------------------------------------------------
  6511.   def set_help_window
  6512.     @help_window.actor_window = @actor_window
  6513.     @help_window.enemy_window = @enemy_window
  6514.   end
  6515.  
  6516.   #--------------------------------------------------------------------------
  6517.   # alias method: create_party_command_window
  6518.   #--------------------------------------------------------------------------
  6519.   alias scene_battle_create_party_command_window_abe create_party_command_window
  6520.   def create_party_command_window
  6521.     scene_battle_create_party_command_window_abe
  6522.     @party_command_window.set_handler(:dir6, method(:command_fight))
  6523.   end
  6524.  
  6525.   #--------------------------------------------------------------------------
  6526.   # alias method: create_actor_command_window
  6527.   #--------------------------------------------------------------------------
  6528.   alias scene_battle_create_actor_command_window_abe create_actor_command_window
  6529.   def create_actor_command_window
  6530.     scene_battle_create_actor_command_window_abe
  6531.     @actor_command_window.set_handler(:dir4, method(:prior_command))
  6532.     @actor_command_window.set_handler(:dir6, method(:next_command))
  6533.   end
  6534.  
  6535.   #--------------------------------------------------------------------------
  6536.   # alias method: create_skill_window
  6537.   #--------------------------------------------------------------------------
  6538.   alias scene_battle_create_skill_window_abe create_skill_window
  6539.   def create_skill_window
  6540.     scene_battle_create_skill_window_abe
  6541.     @skill_window.height = @info_viewport.rect.height
  6542.     @skill_window.width = Graphics.width - @actor_command_window.width
  6543.     @skill_window.y = Graphics.height - @skill_window.height
  6544.   end
  6545.  
  6546.   #--------------------------------------------------------------------------
  6547.   # alias method: create_item_window
  6548.   #--------------------------------------------------------------------------
  6549.   alias scene_battle_create_item_window_abe create_item_window
  6550.   def create_item_window
  6551.     scene_battle_create_item_window_abe
  6552.     @item_window.height = @skill_window.height
  6553.     @item_window.width = @skill_window.width
  6554.     @item_window.y = Graphics.height - @item_window.height
  6555.   end
  6556.  
  6557.   #--------------------------------------------------------------------------
  6558.   # alias method: show_fast?
  6559.   #--------------------------------------------------------------------------
  6560.   alias scene_battle_show_fast_abe show_fast?
  6561.   def show_fast?
  6562.     return true if YEA::BATTLE::AUTO_FAST
  6563.     return scene_battle_show_fast_abe
  6564.   end
  6565.  
  6566.   #--------------------------------------------------------------------------
  6567.   # alias method: next_command
  6568.   #--------------------------------------------------------------------------
  6569.   alias scene_battle_next_command_abe next_command
  6570.   def next_command
  6571.     @status_window.show
  6572.     redraw_current_status
  6573.     @actor_command_window.show
  6574.     @status_aid_window.hide
  6575.     scene_battle_next_command_abe
  6576.   end
  6577.  
  6578.   #--------------------------------------------------------------------------
  6579.   # alias method: prior_command
  6580.   #--------------------------------------------------------------------------
  6581.   alias scene_battle_prior_command_abe prior_command
  6582.   def prior_command
  6583.     redraw_current_status
  6584.     scene_battle_prior_command_abe
  6585.   end
  6586.  
  6587.   #--------------------------------------------------------------------------
  6588.   # new method: redraw_current_status
  6589.   #--------------------------------------------------------------------------
  6590.   def redraw_current_status
  6591.     return if @status_window.index < 0
  6592.     @status_window.draw_item(@status_window.index)
  6593.   end
  6594.  
  6595.   #--------------------------------------------------------------------------
  6596.   # alias method: command_attack
  6597.   #--------------------------------------------------------------------------
  6598.   alias scene_battle_command_attack_abe command_attack
  6599.   def command_attack
  6600.     $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
  6601.     scene_battle_command_attack_abe
  6602.   end
  6603.  
  6604.   #--------------------------------------------------------------------------
  6605.   # alias method: command_skill
  6606.   #--------------------------------------------------------------------------
  6607.   alias scene_battle_command_skill_abe command_skill
  6608.   def command_skill
  6609.     scene_battle_command_skill_abe
  6610.     @status_window.hide
  6611.     @actor_command_window.hide
  6612.     @status_aid_window.show
  6613.   end
  6614.  
  6615.   #--------------------------------------------------------------------------
  6616.   # alias method: command_item
  6617.   #--------------------------------------------------------------------------
  6618.   alias scene_battle_command_item_abe command_item
  6619.   def command_item
  6620.     scene_battle_command_item_abe
  6621.     @status_window.hide
  6622.     @actor_command_window.hide
  6623.     @status_aid_window.show
  6624.   end
  6625.  
  6626.   #--------------------------------------------------------------------------
  6627.   # overwrite method: on_skill_ok
  6628.   #--------------------------------------------------------------------------
  6629.   def on_skill_ok
  6630.     @skill = @skill_window.item
  6631.     $game_temp.battle_aid = @skill
  6632.     BattleManager.actor.input.set_skill(@skill.id)
  6633.     BattleManager.actor.last_skill.object = @skill
  6634.     if @skill.for_opponent?
  6635.       select_enemy_selection
  6636.     elsif @skill.for_friend?
  6637.       select_actor_selection
  6638.     else
  6639.       @skill_window.hide
  6640.       next_command
  6641.       $game_temp.battle_aid = nil
  6642.     end
  6643.   end
  6644.  
  6645.   #--------------------------------------------------------------------------
  6646.   # alias method: on_skill_cancel
  6647.   #--------------------------------------------------------------------------
  6648.   alias scene_battle_on_skill_cancel_abe on_skill_cancel
  6649.   def on_skill_cancel
  6650.     scene_battle_on_skill_cancel_abe
  6651.     @status_window.show
  6652.     @actor_command_window.show
  6653.     @status_aid_window.hide
  6654.   end
  6655.  
  6656.   #--------------------------------------------------------------------------
  6657.   # overwrite method: on_item_ok
  6658.   #--------------------------------------------------------------------------
  6659.   def on_item_ok
  6660.     @item = @item_window.item
  6661.     $game_temp.battle_aid = @item
  6662.     BattleManager.actor.input.set_item(@item.id)
  6663.     if @item.for_opponent?
  6664.       select_enemy_selection
  6665.     elsif @item.for_friend?
  6666.       select_actor_selection
  6667.     else
  6668.       @item_window.hide
  6669.       next_command
  6670.       $game_temp.battle_aid = nil
  6671.     end
  6672.     $game_party.last_item.object = @item
  6673.   end
  6674.  
  6675.   #--------------------------------------------------------------------------
  6676.   # alias method: on_item_cancel
  6677.   #--------------------------------------------------------------------------
  6678.   alias scene_battle_on_item_cancel_abe on_item_cancel
  6679.   def on_item_cancel
  6680.     scene_battle_on_item_cancel_abe
  6681.     @status_window.show
  6682.     @actor_command_window.show
  6683.     @status_aid_window.hide
  6684.   end
  6685.  
  6686.   #--------------------------------------------------------------------------
  6687.   # alias method: select_actor_selection
  6688.   #--------------------------------------------------------------------------
  6689.   alias scene_battle_select_actor_selection_abe select_actor_selection
  6690.   def select_actor_selection
  6691.     @status_aid_window.refresh
  6692.     scene_battle_select_actor_selection_abe
  6693.     @status_window.hide
  6694.     @skill_window.hide
  6695.     @item_window.hide
  6696.     @help_window.show
  6697.   end
  6698.  
  6699.   #--------------------------------------------------------------------------
  6700.   # alias method: on_actor_ok
  6701.   #--------------------------------------------------------------------------
  6702.   alias scene_battle_on_actor_ok_abe on_actor_ok
  6703.   def on_actor_ok
  6704.     $game_temp.battle_aid = nil
  6705.     scene_battle_on_actor_ok_abe
  6706.     @status_window.show
  6707.     if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
  6708.       @actor_command_window.visible = !@confirm_command_window.visible
  6709.     else
  6710.       @actor_command_window.show
  6711.     end
  6712.     @status_aid_window.hide
  6713.   end
  6714.  
  6715.   #--------------------------------------------------------------------------
  6716.   # alias method: on_actor_cancel
  6717.   #--------------------------------------------------------------------------
  6718.   alias scene_battle_on_actor_cancel_abe on_actor_cancel
  6719.   def on_actor_cancel
  6720.     BattleManager.actor.input.clear
  6721.     @status_aid_window.refresh
  6722.     $game_temp.battle_aid = nil
  6723.     scene_battle_on_actor_cancel_abe
  6724.     case @actor_command_window.current_symbol
  6725.     when :skill
  6726.       @skill_window.show
  6727.     when :item
  6728.       @item_window.show
  6729.     end
  6730.   end
  6731.  
  6732.   #--------------------------------------------------------------------------
  6733.   # alias method: select_enemy_selection
  6734.   #--------------------------------------------------------------------------
  6735.   alias scene_battle_select_enemy_selection_abe select_enemy_selection
  6736.   def select_enemy_selection
  6737.     @status_aid_window.refresh
  6738.     scene_battle_select_enemy_selection_abe
  6739.     @help_window.show
  6740.   end
  6741.   #--------------------------------------------------------------------------
  6742.   # alias method: on_enemy_ok
  6743.   #--------------------------------------------------------------------------
  6744.   alias scene_battle_on_enemy_ok_abe on_enemy_ok
  6745.   def on_enemy_ok
  6746.     $game_temp.battle_aid = nil
  6747.     scene_battle_on_enemy_ok_abe
  6748.   end
  6749.  
  6750.   #--------------------------------------------------------------------------
  6751.   # alias method: on_enemy_cancel
  6752.   #--------------------------------------------------------------------------
  6753.   alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
  6754.   def on_enemy_cancel
  6755.     BattleManager.actor.input.clear
  6756.     @status_aid_window.refresh
  6757.     $game_temp.battle_aid = nil
  6758.     scene_battle_on_enemy_cancel_abe
  6759.     if @skill_window.visible || @item_window.visible
  6760.       @help_window.show
  6761.     else
  6762.       @help_window.hide
  6763.     end
  6764.   end
  6765.  
  6766.   #--------------------------------------------------------------------------
  6767.   # alias method: battle_start
  6768.   #--------------------------------------------------------------------------
  6769.   alias scene_battle_battle_start_abe battle_start
  6770.   def battle_start
  6771.     scene_battle_battle_start_abe
  6772.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  6773.     @party_command_window.deactivate
  6774.     if BattleManager.input_start
  6775.       command_fight
  6776.     else
  6777.       turn_start
  6778.     end
  6779.   end
  6780.  
  6781.   #--------------------------------------------------------------------------
  6782.   # overwrite method: turn_end
  6783.   #--------------------------------------------------------------------------
  6784.   def turn_end
  6785.     all_battle_members.each do |battler|
  6786.       battler.on_turn_end
  6787.       status_redraw_target(battler)
  6788.       @log_window.display_auto_affected_status(battler)
  6789.       @log_window.wait_and_clear
  6790.     end
  6791.     update_party_cooldowns if $imported["YEA-CommandParty"]
  6792.     BattleManager.turn_end
  6793.     process_event
  6794.     start_party_command_selection
  6795.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  6796.     if BattleManager.input_start
  6797.       @party_command_window.deactivate
  6798.       command_fight
  6799.     else
  6800.       @party_command_window.deactivate
  6801.       turn_start
  6802.     end
  6803.   end
  6804.  
  6805.   #--------------------------------------------------------------------------
  6806.   # overwrite method: execute_action
  6807.   #--------------------------------------------------------------------------
  6808.   def execute_action
  6809.     @subject.sprite_effect_type = :whiten if YEA::BATTLE::FLASH_WHITE_EFFECT
  6810.     use_item
  6811.     @log_window.wait_and_clear
  6812.   end
  6813.  
  6814.   #--------------------------------------------------------------------------
  6815.   # overwrite method: apply_item_effects
  6816.   #--------------------------------------------------------------------------
  6817.   def apply_item_effects(target, item)
  6818.     if $imported["YEA-LunaticObjects"]
  6819.       lunatic_object_effect(:prepare, item, @subject, target)
  6820.     end
  6821.     target.item_apply(@subject, item)
  6822.     status_redraw_target(@subject)
  6823.     status_redraw_target(target) unless target == @subject
  6824.     @log_window.display_action_results(target, item)
  6825.     if $imported["YEA-LunaticObjects"]
  6826.       lunatic_object_effect(:during, item, @subject, target)
  6827.     end
  6828.     perform_collapse_check(target)
  6829.   end
  6830.  
  6831.   #--------------------------------------------------------------------------
  6832.   # overwite method: invoke_counter_attack
  6833.   #--------------------------------------------------------------------------
  6834.   def invoke_counter_attack(target, item)
  6835.     @log_window.display_counter(target, item)
  6836.     attack_skill = $data_skills[target.attack_skill_id]
  6837.     @subject.item_apply(target, attack_skill)
  6838.     status_redraw_target(@subject)
  6839.     status_redraw_target(target) unless target == @subject
  6840.     @log_window.display_action_results(@subject, attack_skill)
  6841.     perform_collapse_check(target)
  6842.     perform_collapse_check(@subject)
  6843.   end
  6844.  
  6845.   #--------------------------------------------------------------------------
  6846.   # new method: perform_collapse_check
  6847.   #--------------------------------------------------------------------------
  6848.   def perform_collapse_check(target)
  6849.     return if YEA::BATTLE::MSG_ADDED_STATES
  6850.     target.perform_collapse_effect if target.can_collapse?
  6851.     @log_window.wait
  6852.     @log_window.wait_for_effect
  6853.   end
  6854.  
  6855.   #--------------------------------------------------------------------------
  6856.   # overwrite method: show_attack_animation
  6857.   #--------------------------------------------------------------------------
  6858.   def show_attack_animation(targets)
  6859.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  6860.     wait_for_animation
  6861.     show_normal_animation(targets, @subject.atk_animation_id2, true)
  6862.   end
  6863.  
  6864.   #--------------------------------------------------------------------------
  6865.   # overwrite method: show_normal_animation
  6866.   #--------------------------------------------------------------------------
  6867.   def show_normal_animation(targets, animation_id, mirror = false)
  6868.     animation = $data_animations[animation_id]
  6869.     return if animation.nil?
  6870.     ani_check = false
  6871.     targets.each do |target|
  6872.       if ani_check && target.animation_id <= 0
  6873.         target.pseudo_ani_id = animation_id
  6874.       else
  6875.         target.animation_id = animation_id
  6876.       end
  6877.       target.animation_mirror = mirror
  6878.       ani_check = true if animation.to_screen?
  6879.     end
  6880.   end
  6881.  
  6882.   #--------------------------------------------------------------------------
  6883.   # overwrite method: process_action_end
  6884.   #--------------------------------------------------------------------------
  6885.   def process_action_end
  6886.     @subject.on_action_end
  6887.     status_redraw_target(@subject)
  6888.     @log_window.display_auto_affected_status(@subject)
  6889.     @log_window.wait_and_clear
  6890.     @log_window.display_current_state(@subject)
  6891.     @log_window.wait_and_clear
  6892.     BattleManager.judge_win_loss
  6893.   end
  6894.  
  6895.   #--------------------------------------------------------------------------
  6896.   # overwrite method: use_item
  6897.   #--------------------------------------------------------------------------
  6898.   def use_item
  6899.     item = @subject.current_action.item
  6900.     @log_window.display_use_item(@subject, item)
  6901.     @subject.use_item(item)
  6902.     status_redraw_target(@subject)
  6903.     if $imported["YEA-LunaticObjects"]
  6904.       lunatic_object_effect(:before, item, @subject, @subject)
  6905.     end
  6906.     process_casting_animation if $imported["YEA-CastAnimations"]
  6907.     targets = @subject.current_action.make_targets.compact rescue []
  6908.     show_animation(targets, item.animation_id) if show_all_animation?(item)
  6909.     targets.each {|target|
  6910.       if $imported["YEA-TargetManager"]
  6911.         target = alive_random_target(target, item) if item.for_random?
  6912.       end
  6913.       item.repeats.times { invoke_item(target, item) } }
  6914.     if $imported["YEA-LunaticObjects"]
  6915.       lunatic_object_effect(:after, item, @subject, @subject)
  6916.     end
  6917.   end
  6918.  
  6919.   #--------------------------------------------------------------------------
  6920.   # alias method: invoke_item
  6921.   #--------------------------------------------------------------------------
  6922.   alias scene_battle_invoke_item_abe invoke_item
  6923.   def invoke_item(target, item)
  6924.     show_animation([target], item.animation_id) if separate_ani?(target, item)
  6925.     if target.dead? != item.for_dead_friend?
  6926.       @subject.last_target_index = target.index
  6927.       return
  6928.     end
  6929.     scene_battle_invoke_item_abe(target, item)
  6930.   end
  6931.  
  6932.   #--------------------------------------------------------------------------
  6933.   # new method: show_all_animation?
  6934.   #--------------------------------------------------------------------------
  6935.   def show_all_animation?(item)
  6936.     return true if item.one_animation
  6937.     return false if $data_animations[item.animation_id].nil?
  6938.     return false unless $data_animations[item.animation_id].to_screen?
  6939.     return true
  6940.   end
  6941.  
  6942.   #--------------------------------------------------------------------------
  6943.   # new method: separate_ani?
  6944.   #--------------------------------------------------------------------------
  6945.   def separate_ani?(target, item)
  6946.     return false if item.one_animation
  6947.     return false if $data_animations[item.animation_id].nil?
  6948.     return false if $data_animations[item.animation_id].to_screen?
  6949.     return target.dead? == item.for_dead_friend?
  6950.   end
  6951.  
  6952.   #--------------------------------------------------------------------------
  6953.   # new method: status_redraw_target
  6954.   #--------------------------------------------------------------------------
  6955.   def status_redraw_target(target)
  6956.     return unless target.actor?
  6957.     @status_window.draw_item($game_party.battle_members.index(target))
  6958.   end
  6959.  
  6960.   #--------------------------------------------------------------------------
  6961.   # alias method: start_party_command_selection
  6962.   #--------------------------------------------------------------------------
  6963.   alias start_party_command_selection_abe start_party_command_selection
  6964.   def start_party_command_selection
  6965.     @status_window.refresh unless scene_changing?
  6966.     start_party_command_selection_abe
  6967.   end
  6968.  
  6969.   #--------------------------------------------------------------------------
  6970.   # overwrite method: refresh_status
  6971.   #--------------------------------------------------------------------------
  6972.   def refresh_status; return; end
  6973.  
  6974.   #--------------------------------------------------------------------------
  6975.   # new method: refresh_autobattler_status_window
  6976.   #--------------------------------------------------------------------------
  6977.   def refresh_autobattler_status_window
  6978.     for member in $game_party.battle_members
  6979.       next unless member.auto_battle?
  6980.       @status_window.draw_item(member.index)
  6981.     end
  6982.   end
  6983.  
  6984.   #--------------------------------------------------------------------------
  6985.   # new method: hide_extra_gauges
  6986.   #--------------------------------------------------------------------------
  6987.   def hide_extra_gauges
  6988.     # Made for compatibility
  6989.   end
  6990.  
  6991.   #--------------------------------------------------------------------------
  6992.   # new method: show_extra_gauges
  6993.   #--------------------------------------------------------------------------
  6994.   def show_extra_gauges
  6995.     # Made for compatibility
  6996.   end
  6997.  
  6998. end # Scene_Battle
  6999. #------------------------------------------------------------------------------
  7000. # Compatibility
  7001. #   Requires the script 'Victor Engine - Basic Module'
  7002. #
  7003. #
  7004. #------------------------------------------------------------------------------
  7005. # Instructions:
  7006. #  To instal the script, open you script editor and paste this script on
  7007. #  a new section on bellow the Materials section. This script must also
  7008. #  be bellow the script 'Victor Engine - Basic'
  7009. #
  7010. #------------------------------------------------------------------------------
  7011. # Additional instructions:
  7012. #  
  7013. #  The Yanfly Engine Ace scripts must be placed *bellow* the Victor Engine
  7014. #  sctipts. This scripts must be placed bellow Yanfly Engine Ace scripts.
  7015. #  
  7016. #==============================================================================
  7017.  
  7018. #==============================================================================
  7019. # ** VE - Animated Battle X YEA - Ace Batte Engie
  7020. #------------------------------------------------------------------------------
  7021. #  Compatibility Patch for VE - Animated Battle and YEA - Ace Batte Engie
  7022. #==============================================================================
  7023.  
  7024. if $imported[:ve_animated_battle] && $imported["YEA-BattleEngine"]
  7025.  
  7026.   #==============================================================================
  7027.   # ** Scene_Battle
  7028.   #------------------------------------------------------------------------------
  7029.   #  This class performs battle screen processing.
  7030.   #==============================================================================
  7031.  
  7032.   class Scene_Battle < Scene_Base
  7033.     #--------------------------------------------------------------------------
  7034.     # *
  7035.     #--------------------------------------------------------------------------
  7036.     alias :turn_end_veyea_animated_battle :turn_end
  7037.     def turn_end
  7038.       turn_end_veyea_animated_battle
  7039.       @spriteset.battler_sprites.each {|sprite| sprite.reset_pose }
  7040.     end
  7041.     #--------------------------------------------------------------------------
  7042.     # *
  7043.     #--------------------------------------------------------------------------
  7044.     def use_item
  7045.       item = @subject.current_action.item
  7046.       @log_window.display_use_item(@subject, item)
  7047.       @subject.action_pose(item)
  7048.       @subject.use_item(item)
  7049.       refresh_status
  7050.     end
  7051.     #--------------------------------------------------------------------------
  7052.     # *
  7053.     #--------------------------------------------------------------------------
  7054.     def separate_ani?(target, item)
  7055.       return false
  7056.     end
  7057.   end
  7058.   #==============================================================================
  7059.   # ** Spriteset_Battle
  7060.   #------------------------------------------------------------------------------
  7061.   #  This class brings together battle screen sprites. It's used within the
  7062.   # Scene_Battle class.
  7063.   #==============================================================================
  7064.   class Spriteset_Battle
  7065.     #--------------------------------------------------------------------------
  7066.     # *
  7067.     #--------------------------------------------------------------------------
  7068.     def create_actors
  7069.       @actor_sprites = $game_party.battle_members.reverse.collect do |actor|
  7070.         Sprite_Battler.new(@viewport1, actor)
  7071.       end
  7072.       @actors_party = $game_party.battle_members.dup
  7073.     end
  7074.   end
  7075. end
  7076.  
  7077. #==============================================================================
  7078. # ** VE - Actors Battler X YEA - Ace Batte Engie
  7079. #------------------------------------------------------------------------------
  7080. #  Compatibility Patch for VE - Actors Battler and YEA - Ace Batte Engie
  7081. #==============================================================================
  7082.  
  7083. if $imported[:ve_actor_battlers] && $imported["YEA-BattleEngine"]
  7084.  
  7085.   #==============================================================================
  7086.   # ** Game_Actor
  7087.   #------------------------------------------------------------------------------
  7088.   #  This class handles actors. It's used within the Game_Actors class
  7089.   # ($game_actors) and referenced by the Game_Party class ($game_party).
  7090.   #==============================================================================
  7091.  
  7092.   class Game_Actor < Game_Battler
  7093.     #--------------------------------------------------------------------------
  7094.     # *
  7095.     #--------------------------------------------------------------------------
  7096.     def screen_x
  7097.       setup_x
  7098.     end
  7099.     #--------------------------------------------------------------------------
  7100.     # *
  7101.     #--------------------------------------------------------------------------
  7102.     def screen_y
  7103.       setup_y
  7104.     end
  7105.   end
  7106. end






PS:顺便问一下,此素材出自什么游戏?这素材很棒啊!!!
我是不是可以签名了?

Lv3.寻梦者

伴侣:北岛谜烟

梦石
0
星屑
3012
在线时间
3547 小时
注册时间
2012-8-7
帖子
12181

贵宾

2
发表于 2012-11-11 22:27:19 | 只看该作者
不知道。。 水区没好人
本人收不到提醒(点评|回复|@人),总之有事情到空间留言一起普通普通
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
780
在线时间
924 小时
注册时间
2006-6-26
帖子
1529
3
 楼主| 发表于 2012-11-12 23:24:56 | 只看该作者
乖乖,,6R死了,,。。越来越没人了……………………
我是不是可以签名了?
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-19 05:54

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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