查看: 3218|回复: 2

[已经解决] ATB战斗系统脚本的问题

[复制链接]
梦石
0
星屑
155
在线时间
32 小时
注册时间
2015-4-24
回帖
16
发表于 2017-6-10 18:36:03 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 水晶飞风 于 2017-6-10 18:36 编辑

首先这个是一个兼容 Yanfly Engine Ace - Ace Battle Engine v1.22 ATB战斗系统

一个问题脚本,作者在做这个脚本时没考虑到一下事情

1.角色通过怪物的攻击触发了物理反击
2.物理反击将怪物致死了。

在经过这些事情后会弹出这个窗口

脚本 "ATB战斗系统" 第462行: 发生 NoMethodError。
undefined method 'stamina_cost' for Nil:Class

已近单独拿出来测试过应该不是脚本冲突问题(单独是指,这个脚本外加 yanfly的战斗引擎)
拜托各位了_(:зゝ∠)_


这个是出现问题的部分

  1.   #--------------------------------------------------------------------------
  2.   # ● New Method on_turn_end
  3.   #--------------------------------------------------------------------------
  4.   def stamina_loss
  5.     if self.actor?
  6.       @stamina -= input.stamina_cost
  7.     else
  8. #这里是报错的部分
  9.       @stamina -= @actions[0].stamina_cost
  10.     end
  11.     BattleManager.add_action
  12.   end
  13. end
复制代码



这个是整个脚本

  1. =begin
  2. YanFly Compatible Customisable ATB/Stamina Based Battle System Script
  3. by Fomar0153
  4. Version 1.2
  5. ----------------------
  6. Notes
  7. ----------------------
  8. Requires Yanfly Engine Ace - Ace Battle Engine
  9. Customises the battle system to be similar to
  10. ATB or Stamina based battle systems.
  11. ----------------------
  12. Instructions
  13. ----------------------
  14. Edit variables in CBS to suit your needs.
  15. The guard status should be set to 2~2 turns.
  16. ----------------------
  17. Change Log
  18. ----------------------
  19. 1.0 -> 1.1 Added CTB related options
  20.            Added the ability to pass a turn
  21.            Added options for turn functionality to be based on time
  22.            or number of actions
  23.            Added the ability to change the bar colours based on states
  24. 1.1 -> 1.2 Fixed a bug when escaping using CTB mode
  25. ----------------------
  26. Known bugs
  27. ----------------------
  28. None
  29. =end

  30. $imported = {} if $imported.nil?
  31. $imported["Fomar0153-CBS"] = true

  32. module CBS

  33.   MAX_STAMINA = 1000
  34.   RESET_STAMINA = true
  35.   
  36.   # If ATB is set to false then the bars won't appear and
  37.   # the pauses where the bars would be filling up are removed
  38.   # effectively turning this into a CTB system
  39.   ATB = true
  40.   SAMINA_GAUGE_NAME = "ATB"
  41.   ENABLE_PASSING = true
  42.   PASSING_COST = 200

  43.   # If TURN_LENGTH is set to 0 then a turn length will be
  44.   # decided on number of actions
  45.   # TURN_LENGTH is number of seconds per turn
  46.   TURN_LENGTH = 4
  47.   
  48.   ESCAPE_COST = 500
  49.   # If reset stamina is set to true then all characters
  50.   # will start with a random amount of stamina capped at
  51.   # the percentage you set.
  52.   # If reset stamina is set to false then this just
  53.   # affects enemies.
  54.   STAMINA_START_PERCENT = 20

  55.   # Default skill cost
  56.   # If you want to customise skill costs do it like this
  57.   # SKILL_COST[skill_id] = cost
  58.   SKILL_COST = []
  59.   SKILL_COST[0] = 1000
  60.   # Attack
  61.   SKILL_COST[1] = 500
  62.   # Guard
  63.   SKILL_COST[2] = 500
  64.   SKILL_COST[80] = 500
  65.   SKILL_COST[82] = 0
  66.   ITEM_COST = 1000

  67.   #---------速度惩罚状态!
  68.   # If you prefer to have states handle agility buffs then set STATES_HANDLE_AGI to true
  69.   STATES_HANDLE_AGI = false
  70.   # In the following section mult means the amount you multiply stamina gains by
  71.   # if STATES_HANDLE_AGI is set to true then it is only used to determine bar color
  72.   # with debuffs taking precedence over buffs
  73.   STAMINA_STATES = []
  74.     # Default colour
  75.   STAMINA_STATES[0] = [1,31,32]
  76.   # in the form
  77.   # STAMINA_STATES[STATE_ID] = [MULT,FILL_COLOUR,EMPTY_COLOR]
  78.   # e.g. Haste
  79.   STAMINA_STATES[17] = [1.9,4,32]
  80.   STAMINA_STATES[17] = [2.5,4,32]
  81.   # e.g. Stop  
  82.   #STAMINA_STATES[11] = [0,8,32]
  83.   # e.g. Slow  
  84.   #STAMINA_STATES[12] = [0.5,8,32]

  85. #--------------------------------------------------------------------------
  86.   # ● New Method stamina_gain
  87.   #--------------------------------------------------------------------------
  88.   def self.stamina_gain(battler)
  89.     return ((2 + [0, battler.agi / 10].max) * self.stamina_mult(battler)).to_i
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● New Method stamina_gain
  93.   #--------------------------------------------------------------------------
  94.   def self.stamina_mult(battler)
  95.     return 1 if STATES_HANDLE_AGI
  96.     mult = STAMINA_STATES[0][0]
  97.     for state in battler.states
  98.       unless STAMINA_STATES[state.id].nil?
  99.         mult *= STAMINA_STATES[state.id][0]
  100.       end
  101.     end
  102.     return mult
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● New Method stamina_gain
  106.   #--------------------------------------------------------------------------
  107.   def self.stamina_colors(battler)
  108.     colors = STAMINA_STATES[0]
  109.     for state in battler.states
  110.       unless STAMINA_STATES[state.id].nil?
  111.         if STAMINA_STATES[state.id][0] < colors[0] or colors[0] == 1
  112.           colors = STAMINA_STATES[state.id]
  113.         end
  114.       end
  115.     end
  116.     return colors
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # ● New Method stamina_start
  120.   #--------------------------------------------------------------------------
  121.   def self.stamina_start(battler)
  122.     battler.stamina = rand(MAX_STAMINA * STAMINA_START_PERCENT / 100)
  123.   end
  124. end

  125. class Game_BattlerBase
  126.   #--------------------------------------------------------------------------
  127.   # ● New attr_accessor
  128.   #--------------------------------------------------------------------------
  129.   attr_accessor :stamina
  130.   #--------------------------------------------------------------------------
  131.   # ● Aliases initialize
  132.   #--------------------------------------------------------------------------
  133.   alias yf_fomar_cbs_initialize initialize
  134.   def initialize
  135.     yf_fomar_cbs_initialize
  136.     @stamina = 0
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● New Method stamina_rate
  140.   #--------------------------------------------------------------------------
  141.   def stamina_rate
  142.     @stamina.to_f / CBS::MAX_STAMINA
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ● New Method stamina_rate
  146.   #--------------------------------------------------------------------------
  147.   def stamina_gain
  148.     return if not movable?
  149.     @stamina = [CBS::MAX_STAMINA, @stamina + CBS.stamina_gain(self)].min
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● New Method stamina_color
  153.   #--------------------------------------------------------------------------
  154.   def stamina_color
  155.     for state in @states
  156.       unless CBS::STAMINA_STATES[state].nil?
  157.         return STAMINA_STATES[state]
  158.       end
  159.     end
  160.     return STAMINA_STATES[0]
  161.   end
  162. end

  163. class Scene_Battle < Scene_Base
  164.   #--------------------------------------------------------------------------
  165.   # ● Rewrote update
  166.   #--------------------------------------------------------------------------
  167.   def update
  168.     super
  169.     if (CBS::ENABLE_PASSING and @actor_command_window.active) and Input.press?(:A)
  170.       command_pass
  171.     end
  172.     if BattleManager.in_turn? and !inputting?
  173.       while @subject.nil? and !CBS::ATB
  174.         process_stamina
  175.       end
  176.       if CBS::ATB
  177.         process_stamina
  178.       end
  179.       process_event
  180.       process_action
  181.     end
  182.     BattleManager.judge_win_loss
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ● Rewrote Method update_info_viewport
  186.   #--------------------------------------------------------------------------
  187.   def update_info_viewport
  188.     move_info_viewport(0)   if @party_command_window.active
  189.     move_info_viewport(128) if @actor_command_window.active
  190.     move_info_viewport(64)  if BattleManager.in_turn? and !inputting?
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ● New Method inputting?
  194.   #--------------------------------------------------------------------------
  195.   def inputting?
  196.     return @actor_command_window.active || @skill_window.active ||
  197.       @item_window.active || @actor_window.active || @enemy_window.active
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● New Method process_stamina
  201.   #--------------------------------------------------------------------------
  202.   def process_stamina
  203.     @actor_command_window.close
  204.     return if @subject
  205.     BattleManager.advance_turn
  206.     all_battle_members.each do |battler|
  207.       battler.stamina_gain
  208.     end
  209.     @status_window.refresh_stamina
  210.     if @status_window.close?
  211.       @status_window.open
  212.      end
  213.     if BattleManager.escaping?
  214.       $game_party.battle_members.each do |battler|
  215.         if battler.stamina < CBS::MAX_STAMINA
  216.           $game_troop.members.each do |enemy|
  217.             if enemy.stamina == CBS::MAX_STAMINA
  218.               enemy.make_actions
  219.               @subject = enemy
  220.             end
  221.           end
  222.           return
  223.         end
  224.       end
  225.       unless BattleManager.process_escape
  226.         $game_party.battle_members.each do |actor|
  227.           actor.stamina -= CBS::ESCAPE_COST
  228.         end
  229.         BattleManager.set_escaping(false) unless CBS::ATB
  230.       end
  231.     end
  232.     all_battle_members.each do |battler|
  233.       if battler.stamina == CBS::MAX_STAMINA
  234.         battler.make_actions
  235.         @subject = battler
  236.         if @subject.inputable? and battler.is_a?(Game_Actor)
  237.           @actor_command_window.setup(@subject)
  238.           @status_window.index = @subject.index
  239.           BattleManager.set_actor(battler)
  240.         end
  241.         return
  242.       end
  243.     end
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● Rewrote start_party_command_selection Yanfly version
  247.   #--------------------------------------------------------------------------
  248.   def start_party_command_selection
  249.     unless scene_changing?
  250.       refresh_status
  251.       @status_window.unselect
  252.       @status_window.open
  253.       if BattleManager.input_start
  254.         @actor_command_window.close
  255.         @party_command_window.setup
  256.       else
  257.         @party_command_window.deactivate
  258.         turn_start
  259.       end
  260.     end
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● Rewrote start_actor_command_selection
  264.   #--------------------------------------------------------------------------
  265.   def start_actor_command_selection
  266.     @party_command_window.close
  267.     BattleManager.set_escaping(false)
  268.     turn_start
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   # ● Rewrote prior_command Yanfly version
  272.   #--------------------------------------------------------------------------
  273.   def prior_command
  274.     redraw_current_status
  275.     start_party_command_selection
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● Rewrote process_action
  279.   #--------------------------------------------------------------------------
  280.   def process_action
  281.     return if scene_changing?
  282.     if !@subject || !@subject.current_action
  283.       @subject = BattleManager.next_subject
  284.     end
  285.     if Input.trigger?(:B) and (@subject == nil)
  286.       start_party_command_selection
  287.     end
  288.     return unless @subject
  289.     if @subject.current_action
  290.       @subject.current_action.prepare
  291.       if @subject.current_action.valid?
  292.         @status_window.open
  293.         execute_action
  294.       end
  295.       @subject.remove_current_action
  296.       refresh_status
  297.       @log_window.display_auto_affected_status(@subject)
  298.       @log_window.wait_and_clear
  299.     end
  300.     process_action_end unless @subject.current_action
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # ● Aliases use_item
  304.   #--------------------------------------------------------------------------
  305.   alias cbs_use_item use_item
  306.   def use_item
  307.     cbs_use_item
  308.     @subject.stamina_loss
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● Rewrote turn_end
  312.   #--------------------------------------------------------------------------
  313.   def turn_end
  314.     all_battle_members.each do |battler|
  315.       battler.on_turn_end
  316.       refresh_status
  317.       @log_window.display_auto_affected_status(battler)
  318.       @log_window.wait_and_clear
  319.     end
  320.     #BattleManager.turn_end
  321.     #process_event
  322.     #start_party_command_selection
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● Rewrote command_fight
  326.   #--------------------------------------------------------------------------
  327.   def command_fight
  328.     BattleManager.next_command
  329.     start_actor_command_selection
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ● Rewrote command_escape
  333.   #--------------------------------------------------------------------------
  334.   def command_escape
  335.     @party_command_window.close
  336.     BattleManager.set_escaping(true)
  337.     turn_start
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● New method command_pass
  341.   #--------------------------------------------------------------------------
  342.   def command_pass
  343.     BattleManager.actor.stamina -= CBS::PASSING_COST
  344.     BattleManager.clear_actor
  345.     @subject = nil
  346.     turn_start
  347.     @actor_command_window.active = false
  348.     @actor_command_window.close
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ● Destroyed next_command
  352.   #--------------------------------------------------------------------------
  353.   def next_command
  354.     @status_window.show
  355.     @actor_command_window.show
  356.     @status_aid_window.hide
  357.   end
  358. end




  359. module BattleManager
  360.   #--------------------------------------------------------------------------
  361.   # ● Rewrote setup
  362.   #--------------------------------------------------------------------------
  363.   def self.setup(troop_id, can_escape = true, can_lose = false)
  364.     init_members
  365.     $game_troop.setup(troop_id)
  366.     @can_escape = can_escape
  367.     @can_lose = can_lose
  368.     make_escape_ratio
  369.     @escaping = false
  370.     @turn_counter = 0
  371.     @actions_per_turn = $game_party.members.size + $game_troop.members.size
  372.     ($game_party.members + $game_troop.members).each do |battler|
  373.       if battler.is_a?(Game_Enemy) or CBS::RESET_STAMINA
  374.         CBS.stamina_start(battler)
  375.       end
  376.     end
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   # ● New Method set_escaping
  380.   #--------------------------------------------------------------------------
  381.   def self.set_escaping(escaping)
  382.     @escaping = escaping
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # ● New Method escaping?
  386.   #--------------------------------------------------------------------------
  387.   def self.escaping?
  388.     return @escaping
  389.   end
  390.   #--------------------------------------------------------------------------
  391.   # ● Rewrote turn_start Yanfly version
  392.   #--------------------------------------------------------------------------
  393.   def self.turn_start
  394.     @phase = :turn
  395.     clear_actor
  396.     $game_troop.increase_turn if $game_troop.turn_count == 0
  397.     @performed_battlers = []
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # ● New Method set_actor
  401.   #--------------------------------------------------------------------------
  402.   def self.set_actor(actor)
  403.     @actor_index = actor.index
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # ● New Increase action counter
  407.   #--------------------------------------------------------------------------
  408.   def self.add_action
  409.     return if @actions_per_turn.nil?
  410.     @turn_counter += 1
  411.     if @turn_counter == @actions_per_turn and CBS::TURN_LENGTH == 0
  412.       $game_troop.increase_turn
  413.       SceneManager.scene.turn_end
  414.       @turn_counter = 0
  415.     end
  416.   end
  417.   #--------------------------------------------------------------------------
  418.   # ● New Method advance_turn
  419.   #--------------------------------------------------------------------------
  420.   def self.advance_turn
  421.     return if CBS::TURN_LENGTH == 0
  422.     @turn_counter += 1
  423.     if @turn_counter == 60 * CBS::TURN_LENGTH
  424.       $game_troop.increase_turn
  425.       SceneManager.scene.turn_end
  426.       @turn_counter = 0
  427.     end
  428.   end
  429. end

  430. class Game_Battler < Game_BattlerBase
  431.   #--------------------------------------------------------------------------
  432.   # ● Rewrote on_turn_end
  433.   #--------------------------------------------------------------------------
  434.   def on_turn_end
  435.     @result.clear
  436.     regenerate_all
  437.     update_state_turns
  438.     update_buff_turns
  439.     remove_states_auto(2)
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ● New Method on_turn_end
  443.   #--------------------------------------------------------------------------
  444.   def stamina_loss
  445.     if self.actor?
  446.       @stamina -= input.stamina_cost
  447.     else
  448.       @stamina -= @actions[0].stamina_cost
  449.     end
  450.     BattleManager.add_action
  451.   end
  452. end

  453. class Game_Actor < Game_Battler
  454.   #--------------------------------------------------------------------------
  455.   # ● Rewrote input
  456.   #--------------------------------------------------------------------------
  457.   def input
  458.     if @actions[@action_input_index] == nil
  459.       @actions[@action_input_index] = Game_Action.new(self)
  460.     end
  461.     return @actions[@action_input_index]
  462.   end
  463. end

  464. class Game_Action
  465.   #--------------------------------------------------------------------------
  466.   # ● New Method stamina_cost
  467.   #--------------------------------------------------------------------------
  468.   def stamina_cost
  469.     if @item.is_skill?
  470.       return CBS::SKILL_COST[item.id] if CBS::SKILL_COST[item.id]
  471.       return CBS::SKILL_COST[0]
  472.     end
  473.     return CBS::ITEM_COST if @item.is_item?
  474.     return CBS::MAX_STAMINA
  475.   end
  476. end

  477. class Window_BattleStatus < Window_Selectable
  478.   #--------------------------------------------------------------------------
  479.   # Aliases method: draw_item yanfly version
  480.   #--------------------------------------------------------------------------
  481.   alias prefomar_draw_item draw_item
  482.   def draw_item(index)
  483.     unless CBS::ATB
  484.       prefomar_draw_item(index)
  485.       return
  486.     end
  487.     return if index.nil?
  488.     clear_item(index)
  489.     actor = battle_members[index]
  490.     rect = item_rect(index)
  491.     return if actor.nil?
  492.     draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
  493.     draw_actor_name(actor, rect.x, rect.y, rect.width-8)
  494.     draw_actor_action(actor, rect.x, rect.y)
  495.     draw_actor_icons(actor, rect.x, line_height*1, rect.width)
  496.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  497.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  498.     draw_actor_hp(actor, rect.x+2, line_height*2, rect.width-4)
  499.     if draw_tp?(actor) && draw_mp?(actor)
  500.       dw = rect.width/2-2
  501.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  502.       draw_actor_tp(actor, rect.x+2, line_height*2+gx, dw)
  503.       dw = rect.width - rect.width/2 - 2
  504.       draw_actor_mp(actor, rect.x+rect.width/2, line_height*2+gx, dw)
  505.     elsif draw_tp?(actor) && !draw_mp?(actor)
  506.       draw_actor_tp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  507.     else
  508.       draw_actor_mp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  509.     end
  510.     draw_actor_stamina(actor, rect.x+2, line_height*3, rect.width-4)
  511.   end
  512.   #--------------------------------------------------------------------------
  513.   # overwrite method: draw_item yanfly version
  514.   #--------------------------------------------------------------------------
  515.   def draw_item_stamina(index)
  516.     return if index.nil?
  517.     actor = battle_members[index]
  518.     rect = item_rect(index)
  519.     return if actor.nil?
  520.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  521.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  522.     draw_actor_stamina(actor, rect.x+2, line_height*3, rect.width-4)
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # new method: refresh_stamina
  526.   #--------------------------------------------------------------------------
  527.   def refresh_stamina
  528.     return unless CBS::ATB
  529.     item_max.times {|i| draw_item_stamina(i) }
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # new method: draw_actor_stamina
  533.   #--------------------------------------------------------------------------
  534.   def draw_actor_stamina(actor, dx, dy, width = 124)
  535.     draw_gauge(dx, dy, width, actor.stamina_rate, text_color(CBS.stamina_colors(actor)[2]),text_color(CBS.stamina_colors(actor)[1]))
  536.     change_color(system_color)
  537.     cy = (Font.default_size - contents.font.size) / 2 + 1
  538.     draw_text(dx+2, dy+cy, 30, line_height, CBS::SAMINA_GAUGE_NAME)
  539.   end
  540. end
复制代码


最后就是yangfly的战斗引擎了,我想应该是需要的
  1. #==============================================================================
  2. #
  3. # ¥ Yanfly Engine Ace - Ace Battle Engine v1.22
  4. # -- Last Updated: 2012.03.04
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-BattleEngine"] = true

  11. #==============================================================================
  12. # ¥ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.03.04 - Bug fixed: Input crash bug.
  15. # 2012.02.13 - Bug fixed: Odd Victory game crash fixed.
  16. # 2012.02.12 - Bug fixed: Displayed damage in combat log is correct now.
  17. # 2012.01.29 - Visual Changes: Buff stacks now show one popup upon one skill.
  18. # 2012.01.24 - Compatibility Update: Enemy Levels
  19. # 2012.01.18 - Bug Fixed: Help Window clears text upon selecting nil items.
  20. # 2012.01.11 - Added <one animation> tag for multi-hit skills to play an
  21. #              animation only once.
  22. #            - Reduced lag from battle system constantly recreating bitmaps.
  23. # 2012.01.10 - Compatibility Update: Battle System FTB
  24. # 2012.01.09 - Anticrash methods implemented.
  25. #            - Damage Popups are now separate for damage formulas and recovery.
  26. # 2012.01.05 - Bug fixed: Game no longer crashes with escape skills/items.
  27. # 2012.01.02 - Compatibility Update: Target Manager
  28. #            - Added Option: AUTO_FAST
  29. #            - Random hits now show animations individually.
  30. # 2011.12.30 - Compatibility Update: Enemy Levels
  31. #            - Added Option to center the actors in the HUD.
  32. # 2011.12.27 - Bug fixed: TP Damage skills and items no longer crash game.
  33. #            - Default battle system bug fixes are now included from YEA's Ace
  34. #              Core Engine.
  35. #            - Groundwork is also made to support future battle system types.
  36. #            - Multi-hit actions no longer linger when a target dies during the
  37. #              middle of one of the hits.
  38. #            - Compatibility Update: Lunatic Objects v1.02
  39. # 2011.12.26 - Bug fixed: Multi-hit popups occured even after an enemy's dead.
  40. # 2011.12.22 - Bug fixed: Elemental Resistance popup didn't show.
  41. # 2011.12.20 - Bug fixed: Death state popups against immortal states.
  42. #            - Bug fixed: During State popup fix.
  43. #            - Added HIDE_POPUP_SWITCH.
  44. # 2011.12.17 - Compatibiilty Update: Cast Animations
  45. # 2011.12.15 - Compatibility Update: Battle Command List
  46. # 2011.12.14 - Compatibility Update: Lunatic Objects
  47. # 2011.12.13 - Compatibility Update: Command Party
  48. # 2011.12.12 - Bug fixed: Turn stalling if no inputable members.
  49. # 2011.12.10 - Compatibility update for Automatic Party HUD.
  50. #            - Popup graphical bug fixed.
  51. #            - Bug fixed: Didn't wait for boss dead animations.
  52. #            - Bug fixed: Surprise attacks that froze the game.
  53. #            - Bug fixed: Popups didn't show for straight recovery effects.
  54. # 2011.12.08 - Finished Script.
  55. # 2011.12.04 - Started Script.
  56. #
  57. #==============================================================================
  58. # ¥ Introduction
  59. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  60. # Ace Battle Engine works as a foundation for future battle engine add-ons. It
  61. # allows for easier management of the battle engine without adding too many
  62. # features, allowing users to customize what they want as they see fit. While
  63. # the Ace Battle Engine isn't an entirely new engine, it gives users control
  64. # that RPG Maker VX Ace didn't originally give them.
  65. #
  66. # Furthermore, this script provides some new features. They are as follows:
  67. #
  68. # -----------------------------------------------------------------------------
  69. # Animation Fixes
  70. # -----------------------------------------------------------------------------
  71. # Though the Yanfly Engine Ace - Ace Core Engine script contains these fixes,
  72. # these fixes are included in this script as well to ensure it's working for
  73. # the battle script in the event someone chooses not to work with the Ace Core
  74. # Engine script. The animation fixes prevent excessive animation overlaying
  75. # (and making the screen look really ugly) and prevents animation clashing
  76. # between two dual wielding normal attack animations.
  77. #
  78. # -----------------------------------------------------------------------------
  79. # Enemy Animations
  80. # -----------------------------------------------------------------------------
  81. # Enemies now show battle animations when they deliver attacks and skills
  82. # against the player's party. Before in RPG Maker VX Ace, it was nothing more
  83. # than just sound effects and the screen shaking. Now, animations play where
  84. # the status window is and relative to the position of each party member.
  85. #
  86. # -----------------------------------------------------------------------------
  87. # Left/Right Command Selection
  88. # -----------------------------------------------------------------------------
  89. # While choosing actions, the player can press Left or Right to move freely
  90. # between (alive) actors to change their skills. Players no longer have to
  91. # cancel all the way back to change one person's skill and reselect everything.
  92. # On that note, there is now the option that when a battle starts or at the
  93. # end of a turn, players will start immediately at command selection rather
  94. # than needing to select "Fight" in the Party Command Window.
  95. #
  96. # -----------------------------------------------------------------------------
  97. # Popups
  98. # -----------------------------------------------------------------------------
  99. # Dealing damage, inflicting states, adding buffs, landing critical hits,
  100. # striking weaknesses, missing attacks, you name it, there's probably a popup
  101. # for it. Popups deliver information to the player in a quick or orderly
  102. # fashion without requiring the player to read lines of text.
  103. #
  104. # -----------------------------------------------------------------------------
  105. # Targeting Window
  106. # -----------------------------------------------------------------------------
  107. # When targeting enemies, the window is no longer displayed. Instead, the
  108. # targeted enemies are highlighted and their names are shown at the top of the
  109. # screen in a help window. Another thing that's changed is when skills that
  110. # target multiple targets are selected, there is a confirmation step that the
  111. # player must take before continuing. In this confirmation step, all of the
  112. # multiple targets are selected and in the help window would display the scope
  113. # of the skill (such as "All Foes" or "Random Foes"). RPG Maker VX Ace skipped
  114. # this step by default.
  115. #
  116. # -----------------------------------------------------------------------------
  117. # Toggling On and Off Special Effects and Text
  118. # -----------------------------------------------------------------------------
  119. # Not everybody likes having the screen shake or the enemies blink when they
  120. # take damage. These effects can now be toggled on and off. Certain text can
  121. # also be toggled on and off from appearing. A lot of the displayed text has
  122. # been rendered redundant through the use of popups.
  123. #
  124. # -----------------------------------------------------------------------------
  125. # Visual Battle Status Window
  126. # -----------------------------------------------------------------------------
  127. # Rather than just having rows of names with HP and MP bars next to them, the
  128. # Battle Status Window now displays actors' faces and their gauges aligned at
  129. # the bottom. More status effects can be shown in addition to showing more
  130. # members on screen at once. The Battle Status Window is also optimized to
  131. # refresh less (thus, removing potential lag from the system).
  132. #
  133. # -----------------------------------------------------------------------------
  134. # Window Position Changes
  135. # -----------------------------------------------------------------------------
  136. # Windows such as the Skill Window and Item Window have been rearranged to
  137. # always provide the player a clear view of the battlefield rather than opening
  138. # up and covering everything. As such, the window positions are placed at the
  139. # bottom of the screen and are repositioned.
  140. #
  141. #==============================================================================
  142. # ¥ Instructions
  143. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  144. # To install this script, open up your script editor and copy/paste this script
  145. # to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save.
  146. #
  147. # -----------------------------------------------------------------------------
  148. # Skill Notetags - These notetags go in the skills notebox in the database.
  149. # -----------------------------------------------------------------------------
  150. # <one animation>
  151. # Causes the action to display the action animation only once, even if it's a
  152. # multi-hit action. This is used primarily for non-all scope targeting.
  153. #
  154. # -----------------------------------------------------------------------------
  155. # Item Notetags - These notetags go in the items notebox in the database.
  156. # -----------------------------------------------------------------------------
  157. # <one animation>
  158. # Causes the action to display the action animation only once, even if it's a
  159. # multi-hit action. This is used primarily for non-all scope targeting.
  160. #
  161. # -----------------------------------------------------------------------------
  162. # Enemy Notetags - These notetags go in the enemy notebox in the database.
  163. # -----------------------------------------------------------------------------
  164. # <atk ani 1: x>
  165. # <atk ani 2: x>
  166. # Changes the normal attack animation of the particular enemy to animation x.
  167. # Attack animation 1 is the first one that plays. If there's a second animation
  168. # then the second one will play after in mirrored form.
  169. #
  170. # -----------------------------------------------------------------------------
  171. # State Notetags - These notetags go in the state notebox in the database.
  172. # -----------------------------------------------------------------------------
  173. # <popup add: string>
  174. # <popup rem: string>
  175. # <popup dur: string>
  176. # Status effects now create popups whenever they're inflicted. However, if you
  177. # don't like that a certain status effect uses a particular colour setting,
  178. # change "string" to one of the rulesets below to cause that popup to use a
  179. # different ruleset.
  180. #
  181. # <popup hide add>
  182. # <popup hide rem>
  183. # <popup hide dur>
  184. # Not everybody wants status effects to show popups when inflicted. When this
  185. # is the case, insert the respective tag to hide popups from appearing when the
  186. # state is added, removed, or during the stand-by phases.
  187. #
  188. # -----------------------------------------------------------------------------
  189. # Debug Tools - These tools only work during Test Play.
  190. # -----------------------------------------------------------------------------
  191. # - F5 Key -
  192. # Recovers all actors. Restores their HP and MP to max. Does not affect TP.
  193. # All states and buffs are removed whether they are positive or negative.
  194. #
  195. # - F6 Key -
  196. # Sets all actors to have 1 HP, 0 MP, and 0 TP. States are unaffected.
  197. #
  198. # - F7 Key -
  199. # Sets all actors to have max TP. Everything else is unaffected.
  200. #
  201. # - F8 Key -
  202. # Kills all enemies in battle. Ends the battle quickly.
  203. #
  204. #==============================================================================
  205. # ¥ Compatibility
  206. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  207. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  208. # it will run with RPG Maker VX without adjusting.
  209. #
  210. #==============================================================================

  211. module YEA
  212.   module BATTLE
  213.    
  214.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  215.     # - General Battle Settings -
  216.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  217.     # These settings are adjusted for the overall battle system. These are
  218.     # various miscellaneous options to adjust. Each of the settings below will
  219.     # explain what they do. Change default enemy battle animations here, too.
  220.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  221.     BLINK_EFFECTS      = false  # Blink sprite when damaged?
  222.     FLASH_WHITE_EFFECT = true   # Flash enemy white when it starts an attack.
  223.     SCREEN_SHAKE       = false  # Shake screen in battle?
  224.     SKIP_PARTY_COMMAND = true   # Skips the Fight/Escape menu.
  225.     AUTO_FAST          = true   # Causes message windows to not wait.
  226.     ENEMY_ATK_ANI      = 36     # Sets default attack animation for enemies.
  227.    
  228.     # If this switch is ON, popups will be hidden. If OFF, the popups will be
  229.     # shown. If you do not wish to use this switch, set it to 0.
  230.     HIDE_POPUP_SWITCH  = 0
  231.    
  232.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  233.     # - Battle Status Window -
  234.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  235.     # This sets the default battle system your game will use. If your game
  236.     # doesn't have any other battle systems installed, it will use :dtb.
  237.     #
  238.     # Battle System        Requirement
  239.     #   :dtb               - Default Turn Battle. Default system.
  240.     #   :ftb               - YEA Battle System Add-On: Free Turn Battle
  241.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  242.     DEFAULT_BATTLE_SYSTEM = :dtb     # Default battle system set.
  243.    
  244.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  245.     # - Battle Status Window -
  246.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  247.     # Here, you can adjust the settings for the battle status window. The
  248.     # battle status window, by default, will show the actor's face, HP, MP, TP
  249.     # (if viable), and any inflicted status effects.
  250.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  251.     BATTLESTATUS_NAME_FONT_SIZE = 20    # Font size used for name.
  252.     BATTLESTATUS_TEXT_FONT_SIZE = 16    # Font size used for HP, MP, TP.
  253.     BATTLESTATUS_NO_ACTION_ICON = 185   # No action icon.
  254.     BATTLESTATUS_HPGAUGE_Y_PLUS = 11    # Y Location buffer used for HP gauge.
  255.     BATTLESTATUS_CENTER_FACES   = false # Center faces for the Battle Status.
  256.    
  257.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  258.     # - Help Window Text -
  259.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  260.     # When selecting a target to attack, this is the text that will be shown
  261.     # in place of a target's name for special cases. These special cases are
  262.     # for selections that were originally non-targetable battle scopes.
  263.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  264.     HELP_TEXT_ALL_FOES        = "All Foes"
  265.     HELP_TEXT_ONE_RANDOM_FOE  = "One Random Foe"
  266.     HELP_TEXT_MANY_RANDOM_FOE = "%d Random Foes"
  267.     HELP_TEXT_ALL_ALLIES      = "All Allies"
  268.     HELP_TEXT_ALL_DEAD_ALLIES = "All Dead Allies"
  269.     HELP_TEXT_ONE_RANDOM_ALLY = "One Random Ally"
  270.     HELP_TEXT_RANDOM_ALLIES   = "%d Random Allies"
  271.    
  272.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  273.     # - Popup Settings -
  274.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  275.     # These settings will adjust the popups that appear in battle. Popups
  276.     # deliver information to your player as battlers deal damage, inflict
  277.     # status effects, and more.
  278.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  279.     ENABLE_POPUPS  = true     # Set this to false if you wish to disable them.
  280.     FLASH_CRITICAL = true     # Sets critical hits to flash.
  281.    
  282.     # This hash adjusts the popup settings that will govern how popups appear.
  283.     # Adjust them accordingly.
  284.     POPUP_SETTINGS ={
  285.       :offset     => -24,         # Height offset of a popup.
  286.       :fade       => 12,          # Fade rate for each popup.
  287.       :full       => 60,          # Frames before a popup fades.
  288.       :hp_dmg     => "-%s ",      # SprintF for HP damage.
  289.       :hp_heal    => "+%s ",      # SprintF for HP healing.
  290.       :mp_dmg     => "-%s MP",    # SprintF for MP damage.
  291.       :mp_heal    => "+%s MP",    # SprintF for MP healing.
  292.       :tp_dmg     => "-%s TP",    # SprintF for MP damage.
  293.       :tp_heal    => "+%s TP",    # SprintF for MP healing.
  294.       :drained    => "DRAIN",     # Text display for draining HP/MP.
  295.       :critical   => "CRITICAL!", # Text display for critical hit.
  296.       :missed     => "MISS",      # Text display for missed attack.
  297.       :evaded     => "EVADE!",    # Text display for evaded attack.
  298.       :nulled     => "NULL",      # Text display for nulled attack.
  299.       :failed     => "FAILED",    # Text display for a failed attack.
  300.       :add_state  => "+%s",      # SprintF for added states.
  301.       :rem_state  => "-%s",      # SprintF for removed states.
  302.       :dur_state  => "%s",        # SprintF for during states.
  303.       :ele_rates  => true,        # This will display elemental affinities.
  304.       :ele_wait   => 20,          # This is how many frames will wait.
  305.       :weakpoint  => "WEAKPOINT", # Appears if foe is weak to element.
  306.       :resistant  => "RESIST",    # Appears if foe is resistant to element.
  307.       :immune     => "IMMUNE",    # Appears if foe is immune to element.
  308.       :absorbed   => "ABSORB",    # Appears if foe can absorb the element.
  309.       :add_buff   => "%s{",      # Appears when a positive buff is applied.
  310.       :add_debuff => "%s|",      # Appears when a negative buff is applied.
  311.     } # Do not remove this.
  312.    
  313.     # This is the default font used for the popups. Adjust them accordingly
  314.     # or even add new ones.
  315.     DEFAULT = ["VL Gothic", "Verdana", "Arial", "Courier"]
  316.    
  317.     # The following are the various rules that govern the individual popup
  318.     # types that will appear. Adjust them accordingly. Here is a list of what
  319.     # each category does.
  320.     #   Zoom1    The zoom the popup starts at. Values over 2.0 may cause lag.
  321.     #   Zoom2    The zoom the popup goes to. Values over 2.0 may cause lag.
  322.     #   Sz       The font size used for the popup text.
  323.     #   Bold     Applying bold for the popup text.
  324.     #   Italic   Applying italic for the popup text.
  325.     #   Red      The red value of the popup text.
  326.     #   Grn      The green value of the popup text.
  327.     #   Blu      The blue value of the popup text.
  328.     #   Font     The font used for the popup text.
  329.     POPUP_RULES ={
  330.       # Type     => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font]
  331.       "DEFAULT"  => [   2.0,   1.0, 24, true,  false, 255, 255, 255, DEFAULT],
  332.       "CRITICAL" => [   2.0,   1.0, 24, true,  false, 255,  80,  80, DEFAULT],
  333.       "HP_DMG"   => [   2.0,   1.0, 36, true,  false, 255, 255, 255, DEFAULT],
  334.       "HP_HEAL"  => [   2.0,   1.0, 36, true,  false, 130, 250, 130, DEFAULT],
  335.       "MP_DMG"   => [   2.0,   1.0, 36, true,  false, 220, 180, 255, DEFAULT],
  336.       "MP_HEAL"  => [   2.0,   1.0, 36, true,  false, 160, 230, 255, DEFAULT],
  337.       "TP_DMG"   => [   2.0,   1.0, 36, true,  false, 242, 108,  78, DEFAULT],
  338.       "TP_HEAL"  => [   2.0,   1.0, 36, true,  false, 251, 175,  92, DEFAULT],
  339.       "ADDSTATE" => [   2.0,   1.0, 24, true,  false, 240, 100, 100, DEFAULT],
  340.       "REMSTATE" => [   2.0,   1.0, 24, true,  false, 125, 170, 225, DEFAULT],
  341.       "DURSTATE" => [   2.0,   1.0, 24, true,  false, 255, 240, 150, DEFAULT],
  342.       "DRAIN"    => [   2.0,   1.0, 36, true,  false, 250, 190, 255, DEFAULT],
  343.       "POSITIVE" => [   2.0,   1.0, 24, true,  false, 110, 210, 245, DEFAULT],
  344.       "NEGATIVE" => [   2.0,   1.0, 24, true,  false, 245, 155, 195, DEFAULT],
  345.       "WEAK_ELE" => [   0.5,   1.0, 24, true,  false, 240, 110,  80, DEFAULT],
  346.       "IMMU_ELE" => [   0.5,   1.0, 24, true,  false, 185, 235, 255, DEFAULT],
  347.       "REST_ELE" => [   0.5,   1.0, 24, true,  false, 145, 230, 180, DEFAULT],
  348.       "ABSB_ELE" => [   0.5,   1.0, 24, true,  false, 250, 190, 255, DEFAULT],
  349.       "BUFF"     => [   2.0,   1.0, 24, true,  false, 255, 240, 100, DEFAULT],
  350.       "DEBUFF"   => [   2.0,   1.0, 24, true,  false, 160, 130, 200, DEFAULT],
  351.     } # Do not remove this.
  352.    
  353.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  354.     # - Streamlined Messages -
  355.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  356.     # Want to remove some of those annoying messages that appear all the time?
  357.     # Now you can! Select which messages you want to enable or disable. Some of
  358.     # these messages will be rendered useless due to popups.
  359.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  360.     MSG_ENEMY_APPEARS  = false  # Message when enemy appears start of battle.
  361.     MSG_CURRENT_STATE  = false  # Show which states has affected battler.
  362.     MSG_CURRENT_ACTION = true   # Show the current action of the battler.
  363.     MSG_COUNTERATTACK  = true   # Show the message for a counterattack.
  364.     MSG_REFLECT_MAGIC  = true   # Show message for reflecting magic attacks.
  365.     MSG_SUBSTITUTE_HIT = true   # Show message for ally taking another's hit.
  366.     MSG_FAILURE_HIT    = false  # Show effect failed against target.
  367.     MSG_CRITICAL_HIT   = false  # Show attack was a critical hit.
  368.     MSG_HIT_MISSED     = false  # Show attack missed the target.
  369.     MSG_EVASION        = false  # Show attack was evaded by the target.
  370.     MSG_HP_DAMAGE      = false  # Show HP damage to target.
  371.     MSG_MP_DAMAGE      = false  # Show MP damage to target.
  372.     MSG_TP_DAMAGE      = false  # Show TP damage to target.
  373.     MSG_ADDED_STATES   = false  # Show target's added states.
  374.     MSG_REMOVED_STATES = false  # Show target's removed states.
  375.     MSG_CHANGED_BUFFS  = false  # Show target's changed buffs.
  376.    
  377.   end # BATTLE
  378. end # YEA

  379. #==============================================================================
  380. # ¥ Editting anything past this point may potentially result in causing
  381. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  382. # halitosis so edit at your own risk.
  383. #==============================================================================

  384. module YEA
  385.   module REGEXP
  386.   module ENEMY
  387.    
  388.     ATK_ANI1 = /<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
  389.     ATK_ANI2 = /<(?:ATK_ANI_2|atk ani 2):[ ]*(\d+)>/i
  390.    
  391.   end # ENEMY
  392.   module USABLEITEM
  393.    
  394.     ONE_ANIMATION = /<(?:ONE_ANIMATION|one animation)>/i
  395.    
  396.   end # USABLEITEM
  397.   module STATE
  398.    
  399.     POPUP_ADD = /<(?:POPUP_ADD_RULE|popup add rule|popup add):[ ](.*)>/i
  400.     POPUP_REM = /<(?:POPUP_REM_RULE|popup rem rule|popup rem):[ ](.*)>/i
  401.     POPUP_DUR = /<(?:POPUP_DUR_RULE|popup dur rule|popup dur):[ ](.*)>/i
  402.    
  403.     HIDE_ADD  = /<(?:POPUP_HIDE_ADD|popup hide add|hide add)>/i
  404.     HIDE_REM  = /<(?:POPUP_HIDE_REM|popup hide rem|hide rem)>/i
  405.     HIDE_DUR  = /<(?:POPUP_HIDE_DUR|popup hide dur|hide dur)>/i
  406.    
  407.   end # STATE
  408.   end # REGEXP
  409. end # YEA

  410. #==============================================================================
  411. # ¡ Switch
  412. #==============================================================================

  413. module Switch
  414.   
  415.   #--------------------------------------------------------------------------
  416.   # self.hide_popups
  417.   #--------------------------------------------------------------------------
  418.   def self.hide_popups
  419.     return false if YEA::BATTLE::HIDE_POPUP_SWITCH <= 0
  420.     return $game_switches[YEA::BATTLE::HIDE_POPUP_SWITCH]
  421.   end
  422.   
  423. end # Switch

  424. #==============================================================================
  425. # ¡ Colour
  426. #==============================================================================

  427. module Colour
  428.   
  429.   #--------------------------------------------------------------------------
  430.   # self.text_colour
  431.   #--------------------------------------------------------------------------
  432.   def self.text_colour(index)
  433.     windowskin = Cache.system("Window")
  434.     x = 64 + (index % 8) * 8
  435.     y = 96 + (index / 8) * 8
  436.     return windowskin.get_pixel(x, y)
  437.   end
  438.   
  439. end # Colour

  440. #==============================================================================
  441. # ¡ Icon
  442. #==============================================================================

  443. module Icon
  444.   
  445.   #--------------------------------------------------------------------------
  446.   # self.no_action
  447.   #--------------------------------------------------------------------------
  448.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
  449.    
  450. end # Icon

  451. #==============================================================================
  452. # ¡ Numeric
  453. #==============================================================================

  454. class Numeric
  455.   
  456.   #--------------------------------------------------------------------------
  457.   # new method: group_digits
  458.   #--------------------------------------------------------------------------
  459.   unless $imported["YEA-CoreEngine"]
  460.   def group; return self.to_s; end
  461.   end # $imported["YEA-CoreEngine"]
  462.    
  463. end # Numeric

  464. #==============================================================================
  465. # ¡ DataManager
  466. #==============================================================================

  467. module DataManager
  468.   
  469.   #--------------------------------------------------------------------------
  470.   # alias method: load_database
  471.   #--------------------------------------------------------------------------
  472.   class <<self; alias load_database_abe load_database; end
  473.   def self.load_database
  474.     load_database_abe
  475.     load_notetags_abe
  476.   end
  477.   
  478.   #--------------------------------------------------------------------------
  479.   # new method: load_notetags_abe
  480.   #--------------------------------------------------------------------------
  481.   def self.load_notetags_abe
  482.     groups = [$data_enemies, $data_states, $data_skills, $data_items]
  483.     for group in groups
  484.       for obj in group
  485.         next if obj.nil?
  486.         obj.load_notetags_abe
  487.       end
  488.     end
  489.   end
  490.   
  491. end # DataManager

  492. #==============================================================================
  493. # ¡ RPG::UsableItem
  494. #==============================================================================

  495. class RPG::UsableItem < RPG::BaseItem
  496.   
  497.   #--------------------------------------------------------------------------
  498.   # public instance variables
  499.   #--------------------------------------------------------------------------
  500.   attr_accessor :one_animation
  501.   
  502.   #--------------------------------------------------------------------------
  503.   # common cache: load_notetags_abe
  504.   #--------------------------------------------------------------------------
  505.   def load_notetags_abe
  506.     @one_animation = false
  507.     #---
  508.     self.note.split(/[\r\n]+/).each { |line|
  509.       case line
  510.       #---
  511.       when YEA::REGEXP::USABLEITEM::ONE_ANIMATION
  512.         @one_animation = true
  513.       end
  514.     } # self.note.split
  515.     #---
  516.   end
  517.   
  518. end # RPG::UsableItem

  519. #==============================================================================
  520. # ¡ RPG::Enemy
  521. #==============================================================================

  522. class RPG::Enemy < RPG::BaseItem
  523.   
  524.   #--------------------------------------------------------------------------
  525.   # public instance variables
  526.   #--------------------------------------------------------------------------
  527.   attr_accessor :atk_animation_id1
  528.   attr_accessor :atk_animation_id2
  529.   
  530.   #--------------------------------------------------------------------------
  531.   # common cache: load_notetags_abe
  532.   #--------------------------------------------------------------------------
  533.   def load_notetags_abe
  534.     @atk_animation_id1 = YEA::BATTLE::ENEMY_ATK_ANI
  535.     @atk_animation_id2 = 0
  536.     #---
  537.     self.note.split(/[\r\n]+/).each { |line|
  538.       case line
  539.       #---
  540.       when YEA::REGEXP::ENEMY::ATK_ANI1
  541.         @atk_animation_id1 = $1.to_i
  542.       when YEA::REGEXP::ENEMY::ATK_ANI2
  543.         @atk_animation_id2 = $1.to_i
  544.       end
  545.     } # self.note.split
  546.     #---
  547.   end
  548.   
  549. end # RPG::Enemy

  550. #==============================================================================
  551. # ¡ RPG::Enemy
  552. #==============================================================================

  553. class RPG::State < RPG::BaseItem
  554.   
  555.   #--------------------------------------------------------------------------
  556.   # public instance variables
  557.   #--------------------------------------------------------------------------
  558.   attr_accessor :popup_rules
  559.   
  560.   #--------------------------------------------------------------------------
  561.   # common cache: load_notetags_abe
  562.   #--------------------------------------------------------------------------
  563.   def load_notetags_abe
  564.     @popup_rules = {
  565.       :add_state => "ADDSTATE",
  566.       :rem_state => "REMSTATE",
  567.       :dur_state => nil
  568.     } # Do not remove this.
  569.     #---
  570.     self.note.split(/[\r\n]+/).each { |line|
  571.       case line
  572.       #---
  573.       when YEA::REGEXP::STATE::POPUP_ADD
  574.         @popup_rules[:add_state] = $1.upcase.to_s
  575.       when YEA::REGEXP::STATE::POPUP_REM
  576.         @popup_rules[:rem_state] = $1.upcase.to_s
  577.       when YEA::REGEXP::STATE::POPUP_DUR
  578.         @popup_rules[:dur_state] = $1.upcase.to_s
  579.       when YEA::REGEXP::STATE::HIDE_ADD
  580.         @popup_rules[:add_state] = nil
  581.       when YEA::REGEXP::STATE::HIDE_REM
  582.         @popup_rules[:rem_state] = nil
  583.       when YEA::REGEXP::STATE::HIDE_DUR
  584.         @popup_rules[:dur_state] = nil
  585.       end
  586.     } # self.note.split
  587.     #---
  588.   end
  589.   
  590. end # RPG::State

  591. #==============================================================================
  592. # ¡ BattleManager
  593. #==============================================================================

  594. module BattleManager
  595.   
  596.   #--------------------------------------------------------------------------
  597.   # overwrite method: self.battle_start
  598.   #--------------------------------------------------------------------------
  599.   def self.battle_start
  600.     $game_system.battle_count += 1
  601.     $game_party.on_battle_start
  602.     $game_troop.on_battle_start
  603.     return unless YEA::BATTLE::MSG_ENEMY_APPEARS
  604.     $game_troop.enemy_names.each do |name|
  605.       $game_message.add(sprintf(Vocab::Emerge, name))
  606.     end
  607.     if @preemptive
  608.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  609.     elsif @surprise
  610.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  611.     end
  612.     wait_for_message
  613.   end
  614.   
  615.   #--------------------------------------------------------------------------
  616.   # overwrite method: make_action_orders
  617.   #--------------------------------------------------------------------------
  618.   def self.make_action_orders
  619.     make_dtb_action_orders if btype?(:dtb)
  620.   end
  621.   
  622.   #--------------------------------------------------------------------------
  623.   # new method: make_dtb_action_orders
  624.   #--------------------------------------------------------------------------
  625.   def self.make_dtb_action_orders
  626.     @action_battlers = []
  627.     @action_battlers += $game_party.members unless @surprise
  628.     @action_battlers += $game_troop.members unless @preemptive
  629.     @action_battlers.each {|battler| battler.make_speed }
  630.     @action_battlers.sort! {|a,b| b.speed - a.speed }
  631.   end
  632.   
  633.   #--------------------------------------------------------------------------
  634.   # overwrite method: turn_start
  635.   #--------------------------------------------------------------------------
  636.   def self.turn_start
  637.     @phase = :turn
  638.     clear_actor
  639.     $game_troop.increase_turn
  640.     @performed_battlers = []
  641.     make_action_orders
  642.   end
  643.   
  644.   #--------------------------------------------------------------------------
  645.   # overwrite method: next_subject
  646.   #--------------------------------------------------------------------------
  647.   def self.next_subject
  648.     @performed_battlers = [] if @performed_battlers.nil?
  649.     loop do
  650.       @action_battlers -= @performed_battlers
  651.       battler = @action_battlers.shift
  652.       return nil unless battler
  653.       next unless battler.index && battler.alive?
  654.       @performed_battlers.push(battler)
  655.       return battler
  656.     end
  657.   end
  658.   
  659.   #--------------------------------------------------------------------------
  660.   # overwrite method: force_action
  661.   #--------------------------------------------------------------------------
  662.   def self.force_action(battler)
  663.     @action_forced = [] if @action_forced == nil
  664.     @action_forced.push(battler)
  665.     return unless Switch.forced_action_remove
  666.     @action_battlers.delete(battler)
  667.   end
  668.   
  669.   #--------------------------------------------------------------------------
  670.   # overwrite method: action_forced?
  671.   #--------------------------------------------------------------------------
  672.   def self.action_forced?
  673.     @action_forced != nil
  674.   end
  675.   
  676.   #--------------------------------------------------------------------------
  677.   # overwrite method: action_forced_battler
  678.   #--------------------------------------------------------------------------
  679.   def self.action_forced_battler
  680.     @action_forced.shift
  681.   end
  682.   
  683.   #--------------------------------------------------------------------------
  684.   # overwrite method: clear_action_force
  685.   #--------------------------------------------------------------------------
  686.   def self.clear_action_force
  687.     return if @action_forced.nil?
  688.     @action_forced = nil if @action_forced.empty?
  689.   end
  690.   
  691.   #--------------------------------------------------------------------------
  692.   # new method: self.init_battle_type
  693.   #--------------------------------------------------------------------------
  694.   def self.init_battle_type
  695.     set_btype($game_system.battle_system)
  696.   end
  697.   
  698.   #--------------------------------------------------------------------------
  699.   # new method: self.set_btype
  700.   #--------------------------------------------------------------------------
  701.   def self.set_btype(btype = :dtb)
  702.     @battle_type = btype
  703.   end
  704.   
  705.   #--------------------------------------------------------------------------
  706.   # new method: self.btype?
  707.   #--------------------------------------------------------------------------
  708.   def self.btype?(btype)
  709.     return @battle_type == btype
  710.   end
  711.   
  712. end # BattleManager

  713. #==============================================================================
  714. # ¡ Game_System
  715. #==============================================================================

  716. class Game_System
  717.   
  718.   #--------------------------------------------------------------------------
  719.   # new method: battle_system
  720.   #--------------------------------------------------------------------------
  721.   def battle_system
  722.     if @battle_system.nil?
  723.       return battle_system_corrected(YEA::BATTLE::DEFAULT_BATTLE_SYSTEM)
  724.     else
  725.       return battle_system_corrected(@battle_system)
  726.     end
  727.   end
  728.   
  729.   #--------------------------------------------------------------------------
  730.   # new method: set_battle_system
  731.   #--------------------------------------------------------------------------
  732.   def set_battle_system(type)
  733.     case type
  734.     when :dtb; @battle_system = :dtb
  735.     when :ftb; @battle_system = $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  736.     else;      @battle_system = :dtb
  737.     end
  738.   end
  739.   
  740.   #--------------------------------------------------------------------------
  741.   # new method: battle_system_corrected
  742.   #--------------------------------------------------------------------------
  743.   def battle_system_corrected(type)
  744.     case type
  745.     when :dtb; return :dtb
  746.     when :ftb; return $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  747.     else;      return :dtb
  748.     end
  749.   end
  750.   
  751. end # Game_System

  752. #==============================================================================
  753. # ¡ Sprite_Base
  754. #==============================================================================

  755. class Sprite_Base < Sprite
  756.   
  757.   #--------------------------------------------------------------------------
  758.   # new method: start_pseudo_animation
  759.   #--------------------------------------------------------------------------
  760.   unless $imported["YEA-CoreEngine"]
  761.   def start_pseudo_animation(animation, mirror = false)
  762.     dispose_animation
  763.     @animation = animation
  764.     return if @animation.nil?
  765.     @ani_mirror = mirror
  766.     set_animation_rate
  767.     @ani_duration = @animation.frame_max * @ani_rate + 1
  768.     @ani_sprites = []
  769.   end
  770.   end # $imported["YEA-CoreEngine"]
  771.   
  772. end # Sprite_Base

  773. #==============================================================================
  774. # ¡ Sprite_Battler
  775. #==============================================================================

  776. class Sprite_Battler < Sprite_Base
  777.   
  778.   #--------------------------------------------------------------------------
  779.   # public instance variables
  780.   #--------------------------------------------------------------------------
  781.   attr_accessor :effect_type
  782.   attr_accessor :battler_visible
  783.   attr_accessor :popups
  784.   
  785.   #--------------------------------------------------------------------------
  786.   # alias method: initialize
  787.   #--------------------------------------------------------------------------
  788.   alias sprite_battler_initialize_abe initialize
  789.   def initialize(viewport, battler = nil)
  790.     sprite_battler_initialize_abe(viewport, battler)
  791.     @popups = []
  792.     @popup_flags = []
  793.   end
  794.   
  795.   #--------------------------------------------------------------------------
  796.   # alias method: update_bitmap
  797.   #--------------------------------------------------------------------------
  798.   alias sprite_battler_update_bitmap_abe update_bitmap
  799.   def update_bitmap
  800.     return if @battler.actor? && @battler.battler_name == ""
  801.     sprite_battler_update_bitmap_abe
  802.   end
  803.   
  804.   #--------------------------------------------------------------------------
  805.   # alias method: setup_new_animation
  806.   #--------------------------------------------------------------------------
  807.   unless $imported["YEA-CoreEngine"]
  808.   alias sprite_battler_setup_new_animation_abe setup_new_animation
  809.   def setup_new_animation
  810.     sprite_battler_setup_new_animation_abe
  811.     return if @battler.pseudo_ani_id <= 0
  812.     animation = $data_animations[@battler.pseudo_ani_id]
  813.     mirror = @battler.animation_mirror
  814.     start_pseudo_animation(animation, mirror)
  815.     @battler.pseudo_ani_id = 0
  816.   end
  817.   end # $imported["YEA-CoreEngine"]
  818.   
  819.   #--------------------------------------------------------------------------
  820.   # alias method: setup_new_effect
  821.   #--------------------------------------------------------------------------
  822.   alias sprite_battler_setup_new_effect_abe setup_new_effect
  823.   def setup_new_effect
  824.     sprite_battler_setup_new_effect_abe
  825.     setup_popups
  826.   end
  827.   
  828.   #--------------------------------------------------------------------------
  829.   # new method: setup_popups
  830.   #--------------------------------------------------------------------------
  831.   def setup_popups
  832.     return unless @battler.use_sprite?
  833.     @battler.popups = [] if @battler.popups.nil?
  834.     return if @battler.popups == []
  835.     array = @battler.popups.shift
  836.     create_new_popup(array[0], array[1], array[2])
  837.   end
  838.   
  839.   #--------------------------------------------------------------------------
  840.   # new method: create_new_popup
  841.   #--------------------------------------------------------------------------
  842.   def create_new_popup(value, rules, flags)
  843.     return if @battler == nil
  844.     return if flags & @popup_flags != []
  845.     array = YEA::BATTLE::POPUP_RULES[rules]
  846.     for popup in @popups
  847.       popup.y -= 24
  848.     end
  849.     return unless SceneManager.scene.is_a?(Scene_Battle)
  850.     return if SceneManager.scene.spriteset.nil?
  851.     view = SceneManager.scene.spriteset.viewportPopups
  852.     new_popup = Sprite_Popup.new(view, @battler, value, rules, flags)
  853.     @popups.push(new_popup)
  854.     @popup_flags.push("weakness") if flags.include?("weakness")
  855.     @popup_flags.push("resistant") if flags.include?("resistant")
  856.     @popup_flags.push("immune") if flags.include?("immune")
  857.     @popup_flags.push("absorbed") if flags.include?("absorbed")
  858.   end
  859.   
  860.   #--------------------------------------------------------------------------
  861.   # alias method: update_effect
  862.   #--------------------------------------------------------------------------
  863.   alias sprite_battler_update_effect_abe update_effect
  864.   def update_effect
  865.     sprite_battler_update_effect_abe
  866.     update_popups
  867.   end
  868.   
  869.   #--------------------------------------------------------------------------
  870.   # new method: update_popups
  871.   #--------------------------------------------------------------------------
  872.   def update_popups
  873.     for popup in @popups
  874.       popup.update
  875.       next unless popup.opacity <= 0
  876.       popup.bitmap.dispose
  877.       popup.dispose
  878.       @popups.delete(popup)
  879.       popup = nil
  880.     end
  881.     @popup_flags = [] if @popups == [] && @popup_flags != []
  882.     return unless SceneManager.scene_is?(Scene_Battle)
  883.     if @current_active_battler != SceneManager.scene.subject
  884.       @current_active_battler = SceneManager.scene.subject
  885.       @popup_flags = []
  886.     end
  887.   end
  888.   
  889. end # Sprite_Battler

  890. #==============================================================================
  891. # ¡ Sprite_Popup
  892. #==============================================================================

  893. class Sprite_Popup < Sprite_Base
  894.   
  895.   #--------------------------------------------------------------------------
  896.   # public instance variables
  897.   #--------------------------------------------------------------------------
  898.   attr_accessor :flags
  899.   
  900.   #--------------------------------------------------------------------------
  901.   # initialize
  902.   #--------------------------------------------------------------------------
  903.   def initialize(viewport, battler, value, rules, flags)
  904.     super(viewport)
  905.     @value = value
  906.     @rules = rules
  907.     @rules = "DEFAULT" unless YEA::BATTLE::POPUP_RULES.include?(@rules)
  908.     @fade = YEA::BATTLE::POPUP_SETTINGS[:fade]
  909.     @full = YEA::BATTLE::POPUP_SETTINGS[:full]
  910.     @flags = flags
  911.     @battler = battler
  912.     create_popup_bitmap
  913.   end
  914.   
  915.   #--------------------------------------------------------------------------
  916.   # create_popup_bitmap
  917.   #--------------------------------------------------------------------------
  918.   def create_popup_bitmap
  919.     rules_array = YEA::BATTLE::POPUP_RULES[@rules]
  920.     bw = Graphics.width
  921.     bw += 48 if @flags.include?("state")
  922.     bh = Font.default_size * 3
  923.     bitmap = Bitmap.new(bw, bh)
  924.     bitmap.font.name = rules_array[8]
  925.     size = @flags.include?("critical") ? rules_array[2] * 1.2 : rules_array[2]
  926.     bitmap.font.size = size
  927.     bitmap.font.bold = rules_array[3]
  928.     bitmap.font.italic = rules_array[4]
  929.     if flags.include?("critical")
  930.       crit = YEA::BATTLE::POPUP_RULES["CRITICAL"]
  931.       bitmap.font.out_color.set(crit[5], crit[6], crit[7], 255)
  932.     else
  933.       bitmap.font.out_color.set(0, 0, 0, 255)
  934.     end
  935.     dx = 0; dy = 0; dw = 0
  936.     dx += 24 if @flags.include?("state")
  937.     dw += 24 if @flags.include?("state")
  938.     if @flags.include?("state") || @flags.include?("buff")
  939.       c_width = bitmap.text_size(@value).width
  940.       icon_bitmap = $game_temp.iconset
  941.       icon_index = flag_state_icon
  942.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  943.       bitmap.blt(dx+(bw-c_width)/2-36, (bh - 24)/2, icon_bitmap, rect, 255)
  944.     end
  945.     bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
  946.     bitmap.draw_text(dx, dy, bw-dw, bh, @value, 1)
  947.     self.bitmap = bitmap
  948.     self.x = @battler.screen_x
  949.     self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
  950.     self.x -= SceneManager.scene.spriteset.viewport1.ox
  951.     self.y = @battler.screen_y - @battler.sprite.oy/2
  952.     self.y -= @battler.sprite.oy/2 if @battler.actor?
  953.     self.y -= SceneManager.scene.spriteset.viewport1.oy
  954.     self.ox = bw/2; self.oy = bh/2
  955.     self.zoom_x = self.zoom_y = rules_array[0]
  956.     if @flags.include?("no zoom")
  957.       self.zoom_x = self.zoom_y = rules_array[1]
  958.     end
  959.     @target_zoom = rules_array[1]
  960.     @zoom_direction = (self.zoom_x > @target_zoom) ? "down" : "up"
  961.     self.z = 500
  962.   end
  963.   
  964.   #--------------------------------------------------------------------------
  965.   # update
  966.   #--------------------------------------------------------------------------
  967.   def update
  968.     super
  969.     #---
  970.     if @flags.include?("critical") && YEA::BATTLE::FLASH_CRITICAL
  971.       @hue_duration = 2 if @hue_duration == nil || @hue_duration == 0
  972.       @hue_duration -= 1
  973.       self.bitmap.hue_change(15) if @hue_duration <= 0
  974.     end
  975.     #---
  976.     if @zoom_direction == "up"
  977.       self.zoom_x = [self.zoom_x + 0.075, @target_zoom].min
  978.       self.zoom_y = [self.zoom_y + 0.075, @target_zoom].min
  979.     else
  980.       self.zoom_x = [self.zoom_x - 0.075, @target_zoom].max
  981.       self.zoom_y = [self.zoom_y - 0.075, @target_zoom].max
  982.     end
  983.     #---
  984.     @full -= 1
  985.     return if @full > 0
  986.     self.y -= 1
  987.     self.opacity -= @fade
  988.   end
  989.   
  990.   #--------------------------------------------------------------------------
  991.   # flag_state_icon
  992.   #--------------------------------------------------------------------------
  993.   def flag_state_icon
  994.     for item in @flags; return item if item.is_a?(Integer); end
  995.     return 0
  996.   end
  997.   
  998. end # Sprite_Popup

  999. #==============================================================================
  1000. # ¡ Spriteset_Battle
  1001. #==============================================================================

  1002. class Spriteset_Battle
  1003.   
  1004.   #--------------------------------------------------------------------------
  1005.   # public instance variables
  1006.   #--------------------------------------------------------------------------
  1007.   attr_accessor :actor_sprites
  1008.   attr_accessor :enemy_sprites
  1009.   attr_accessor :viewport1
  1010.   attr_accessor :viewportPopups
  1011.   
  1012.   #--------------------------------------------------------------------------
  1013.   # alias method: create_viewports
  1014.   #--------------------------------------------------------------------------
  1015.   alias spriteset_battle_create_viewports_abe create_viewports
  1016.   def create_viewports
  1017.     spriteset_battle_create_viewports_abe
  1018.     @viewportPopups = Viewport.new
  1019.     @viewportPopups.z = 200
  1020.   end
  1021.   
  1022.   #--------------------------------------------------------------------------
  1023.   # alias method: dispose_viewports
  1024.   #--------------------------------------------------------------------------
  1025.   alias spriteset_battle_dispose_viewports_abe dispose_viewports
  1026.   def dispose_viewports
  1027.     spriteset_battle_dispose_viewports_abe
  1028.     @viewportPopups.dispose
  1029.   end
  1030.   
  1031.   #--------------------------------------------------------------------------
  1032.   # alias method: update_viewports
  1033.   #--------------------------------------------------------------------------
  1034.   alias spriteset_battle_update_viewports_abe update_viewports
  1035.   def update_viewports
  1036.     spriteset_battle_update_viewports_abe
  1037.     @viewportPopups.update
  1038.   end
  1039.   
  1040. end # Spriteset_Battle

  1041. #==============================================================================
  1042. # ¡ Game_Temp
  1043. #==============================================================================

  1044. class Game_Temp
  1045.   
  1046.   #--------------------------------------------------------------------------
  1047.   # public instance variables
  1048.   #--------------------------------------------------------------------------
  1049.   attr_accessor :battle_aid
  1050.   attr_accessor :evaluating
  1051.   attr_accessor :iconset
  1052.   
  1053.   #--------------------------------------------------------------------------
  1054.   # alias method: initialize
  1055.   #--------------------------------------------------------------------------
  1056.   alias game_temp_initialize_abe initialize
  1057.   def initialize
  1058.     game_temp_initialize_abe
  1059.     @iconset = Cache.system("Iconset")
  1060.   end
  1061.   
  1062. end # Game_Temp

  1063. #==============================================================================
  1064. # ¡ Game_Action
  1065. #==============================================================================

  1066. class Game_Action
  1067.   
  1068.   #--------------------------------------------------------------------------
  1069.   # overwrite method: speed
  1070.   #--------------------------------------------------------------------------
  1071.   def speed
  1072.     speed = subject.agi
  1073.     speed += item.speed if item
  1074.     speed += subject.atk_speed if attack?
  1075.     return speed
  1076.   end
  1077.   
  1078.   #--------------------------------------------------------------------------
  1079.   # alias method: evaluate_item_with_target
  1080.   #--------------------------------------------------------------------------
  1081.   alias evaluate_item_with_target_abe evaluate_item_with_target
  1082.   def evaluate_item_with_target(target)
  1083.     $game_temp.evaluating = true
  1084.     result = evaluate_item_with_target_abe(target)
  1085.     $game_temp.evaluating = false
  1086.     return result
  1087.   end
  1088.   
  1089. end # Game_Action

  1090. #==============================================================================
  1091. # ¡ Game_ActionResult
  1092. #==============================================================================

  1093. class Game_ActionResult
  1094.   
  1095.   #--------------------------------------------------------------------------
  1096.   # alias method: clear
  1097.   #--------------------------------------------------------------------------
  1098.   alias game_actionresult_clear_abe clear
  1099.   def clear
  1100.     game_actionresult_clear_abe
  1101.     clear_stored_damage
  1102.   end
  1103.   
  1104.   #--------------------------------------------------------------------------
  1105.   # new method: clear_stored_damage
  1106.   #--------------------------------------------------------------------------
  1107.   def clear_stored_damage
  1108.     @stored_hp_damage = 0
  1109.     @stored_mp_damage = 0
  1110.     @stored_tp_damage = 0
  1111.     @stored_hp_drain = 0
  1112.     @stored_mp_drain = 0
  1113.   end
  1114.   
  1115.   #--------------------------------------------------------------------------
  1116.   # new method: store_damage
  1117.   #--------------------------------------------------------------------------
  1118.   def store_damage
  1119.     @stored_hp_damage += @hp_damage
  1120.     @stored_mp_damage += @mp_damage
  1121.     @stored_tp_damage += @tp_damage
  1122.     @stored_hp_drain += @hp_drain
  1123.     @stored_mp_drain += @mp_drain
  1124.   end
  1125.   
  1126.   #--------------------------------------------------------------------------
  1127.   # new method: restore_damage
  1128.   #--------------------------------------------------------------------------
  1129.   def restore_damage
  1130.     @hp_damage = @stored_hp_damage
  1131.     @mp_damage = @stored_mp_damage
  1132.     @tp_damage = @stored_tp_damage
  1133.     @hp_drain = @stored_hp_drain
  1134.     @mp_drain = @stored_mp_drain
  1135.     clear_stored_damage
  1136.   end
  1137.   
  1138. end # Game_ActionResult

  1139. #==============================================================================
  1140. # ¡ Game_BattlerBase
  1141. #==============================================================================

  1142. class Game_BattlerBase
  1143.   
  1144.   #--------------------------------------------------------------------------
  1145.   # public instance variables
  1146.   #--------------------------------------------------------------------------
  1147.   attr_accessor :popups
  1148.   
  1149.   #--------------------------------------------------------------------------
  1150.   # new method: create_popup
  1151.   #--------------------------------------------------------------------------
  1152.   def create_popup(value, rules = "DEFAULT", flags = [])
  1153.     return unless SceneManager.scene_is?(Scene_Battle)
  1154.     return unless YEA::BATTLE::ENABLE_POPUPS
  1155.     return if Switch.hide_popups
  1156.     @popups = [] if @popups.nil?
  1157.     @popups.push([value, rules, flags])
  1158.   end
  1159.   
  1160.   #--------------------------------------------------------------------------
  1161.   # new method: make_damage_popups
  1162.   #--------------------------------------------------------------------------
  1163.   def make_damage_popups(user)
  1164.     if @result.hp_drain != 0
  1165.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1166.       rules = "DRAIN"
  1167.       user.create_popup(text, rules)
  1168.       setting = :hp_dmg  if @result.hp_drain < 0
  1169.       setting = :hp_heal if @result.hp_drain > 0
  1170.       rules = "HP_DMG"   if @result.hp_drain < 0
  1171.       rules = "HP_HEAL"  if @result.hp_drain > 0
  1172.       value = @result.hp_drain.abs
  1173.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1174.       user.create_popup(text, rules)
  1175.     end
  1176.     if @result.mp_drain != 0
  1177.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1178.       rules = "DRAIN"
  1179.       user.create_popup(text, rules)
  1180.       setting = :mp_dmg  if @result.mp_drain < 0
  1181.       setting = :mp_heal if @result.mp_drain > 0
  1182.       rules = "HP_DMG"   if @result.mp_drain < 0
  1183.       rules = "HP_HEAL"  if @result.mp_drain > 0
  1184.       value = @result.mp_drain.abs
  1185.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1186.       user.create_popup(text, rules)
  1187.     end
  1188.     #---
  1189.     flags = []
  1190.     flags.push("critical") if @result.critical
  1191.     if @result.hp_damage != 0
  1192.       setting = :hp_dmg  if @result.hp_damage > 0
  1193.       setting = :hp_heal if @result.hp_damage < 0
  1194.       rules = "HP_DMG"   if @result.hp_damage > 0
  1195.       rules = "HP_HEAL"  if @result.hp_damage < 0
  1196.       value = @result.hp_damage.abs
  1197.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1198.       create_popup(text, rules, flags)
  1199.     end
  1200.     if @result.mp_damage != 0
  1201.       setting = :mp_dmg  if @result.mp_damage > 0
  1202.       setting = :mp_heal if @result.mp_damage < 0
  1203.       rules = "MP_DMG"   if @result.mp_damage > 0
  1204.       rules = "MP_HEAL"  if @result.mp_damage < 0
  1205.       value = @result.mp_damage.abs
  1206.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1207.       create_popup(text, rules, flags)
  1208.     end
  1209.     if @result.tp_damage != 0
  1210.       setting = :tp_dmg  if @result.tp_damage > 0
  1211.       setting = :tp_heal if @result.tp_damage < 0
  1212.       rules = "TP_DMG"   if @result.tp_damage > 0
  1213.       rules = "TP_HEAL"  if @result.tp_damage < 0
  1214.       value = @result.tp_damage.abs
  1215.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1216.       create_popup(text, rules)
  1217.     end
  1218.     @result.store_damage
  1219.     @result.clear_damage_values
  1220.   end
  1221.   
  1222.   #--------------------------------------------------------------------------
  1223.   # alias method: erase_state
  1224.   #--------------------------------------------------------------------------
  1225.   alias game_battlerbase_erase_state_abe erase_state
  1226.   def erase_state(state_id)
  1227.     make_state_popup(state_id, :rem_state) if @states.include?(state_id)
  1228.     game_battlerbase_erase_state_abe(state_id)
  1229.   end
  1230.   
  1231.   #--------------------------------------------------------------------------
  1232.   # new method: make_during_state_popup
  1233.   #--------------------------------------------------------------------------
  1234.   def make_during_state_popup
  1235.     state_id = most_important_state_id
  1236.     return if state_id == 0
  1237.     make_state_popup(state_id, :dur_state)
  1238.   end
  1239.   
  1240.   #--------------------------------------------------------------------------
  1241.   # new method: most_important_state_id
  1242.   #--------------------------------------------------------------------------
  1243.   def most_important_state_id
  1244.     states.each {|state| return state.id unless state.message3.empty? }
  1245.     return 0
  1246.   end
  1247.   
  1248.   #--------------------------------------------------------------------------
  1249.   # new method: make_state_popup
  1250.   #--------------------------------------------------------------------------
  1251.   def make_state_popup(state_id, type)
  1252.     state = $data_states[state_id]
  1253.     return if state.icon_index == 0
  1254.     rules = state.popup_rules[type]
  1255.     return if rules.nil?
  1256.     text = sprintf(YEA::BATTLE::POPUP_SETTINGS[type], state.name)
  1257.     flags = ["state", state.icon_index]
  1258.     create_popup(text, rules, flags)
  1259.   end
  1260.   
  1261.   #--------------------------------------------------------------------------
  1262.   # new method: make_miss_popups
  1263.   #--------------------------------------------------------------------------
  1264.   def make_miss_popups(user, item)
  1265.     return if dead?
  1266.     if @result.missed
  1267.       text = YEA::BATTLE::POPUP_SETTINGS[:missed]
  1268.       rules = "DEFAULT"
  1269.       create_popup(text, rules)
  1270.     end
  1271.     if @result.evaded
  1272.       text = YEA::BATTLE::POPUP_SETTINGS[:evaded]
  1273.       rules = "DEFAULT"
  1274.       create_popup(text, rules)
  1275.     end
  1276.     if @result.hit? && !@result.success
  1277.       text = YEA::BATTLE::POPUP_SETTINGS[:failed]
  1278.       rules = "DEFAULT"
  1279.       create_popup(text, rules)
  1280.     end
  1281.     if @result.hit? && item.damage.to_hp?
  1282.       if @result.hp_damage == 0 && @result.hp_damage == 0
  1283.         text = YEA::BATTLE::POPUP_SETTINGS[:nulled]
  1284.         rules = "DEFAULT"
  1285.         create_popup(text, rules)
  1286.       end
  1287.     end
  1288.   end
  1289.   
  1290.   #--------------------------------------------------------------------------
  1291.   # new method: make_rate_popup
  1292.   #--------------------------------------------------------------------------
  1293.   def make_rate_popup(rate)
  1294.     return if rate == 1.0
  1295.     flags = []
  1296.     if rate > 1.0
  1297.       text = YEA::BATTLE::POPUP_SETTINGS[:weakpoint]
  1298.       rules = "WEAK_ELE"
  1299.       flags.push("weakness")
  1300.     elsif rate == 0.0
  1301.       text = YEA::BATTLE::POPUP_SETTINGS[:immune]
  1302.       rules = "IMMU_ELE"
  1303.       flags.push("immune")
  1304.     elsif rate < 0.0
  1305.       text = YEA::BATTLE::POPUP_SETTINGS[:absorbed]
  1306.       rules = "ABSB_ELE"
  1307.       flags.push("absorbed")
  1308.     else
  1309.       text = YEA::BATTLE::POPUP_SETTINGS[:resistant]
  1310.       rules = "REST_ELE"
  1311.       flags.push("resistant")
  1312.     end
  1313.     create_popup(text, rules, flags)
  1314.   end
  1315.   
  1316.   #--------------------------------------------------------------------------
  1317.   # new method: make_buff_popup
  1318.   #--------------------------------------------------------------------------
  1319.   def make_buff_popup(param_id, positive = true)
  1320.     return unless SceneManager.scene_is?(Scene_Battle)
  1321.     return unless alive?
  1322.     name = Vocab::param(param_id)
  1323.     if positive
  1324.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_buff], name)
  1325.       rules = "BUFF"
  1326.       buff_level = 1
  1327.     else
  1328.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_debuff], name)
  1329.       rules = "DEBUFF"
  1330.       buff_level = -1
  1331.     end
  1332.     icon = buff_icon_index(buff_level, param_id)
  1333.     flags = ["buff", icon]
  1334.     return if @popups.include?([text, rules, flags])
  1335.     create_popup(text, rules, flags)
  1336.   end
  1337.   
  1338. end # Game_BattlerBase

  1339. #==============================================================================
  1340. # ¡ Game_Battler
  1341. #==============================================================================

  1342. class Game_Battler < Game_BattlerBase
  1343.   
  1344.   #--------------------------------------------------------------------------
  1345.   # public instance variables
  1346.   #--------------------------------------------------------------------------
  1347.   attr_accessor :pseudo_ani_id
  1348.   
  1349.   #--------------------------------------------------------------------------
  1350.   # alias method: on_battle_end
  1351.   #--------------------------------------------------------------------------
  1352.   alias game_battler_on_battle_end_abe on_battle_end
  1353.   def on_battle_end
  1354.     game_battler_on_battle_end_abe
  1355.     @popups = []
  1356.   end
  1357.   
  1358.   #--------------------------------------------------------------------------
  1359.   # alias method: clear_sprite_effects
  1360.   #--------------------------------------------------------------------------
  1361.   alias game_battler_clear_sprite_effects_abe clear_sprite_effects
  1362.   def clear_sprite_effects
  1363.     game_battler_clear_sprite_effects_abe
  1364.     @pseudo_ani_id = 0
  1365.   end
  1366.   
  1367.   #--------------------------------------------------------------------------
  1368.   # alias method: item_apply
  1369.   #--------------------------------------------------------------------------
  1370.   alias game_battler_item_apply_abe item_apply
  1371.   def item_apply(user, item)
  1372.     game_battler_item_apply_abe(user, item)
  1373.     make_miss_popups(user, item)
  1374.   end
  1375.   
  1376.   #--------------------------------------------------------------------------
  1377.   # alias method: make_damage_value
  1378.   #--------------------------------------------------------------------------
  1379.   alias game_battler_make_damage_value_abe make_damage_value
  1380.   def make_damage_value(user, item)
  1381.     game_battler_make_damage_value_abe(user, item)
  1382.     rate = item_element_rate(user, item)
  1383.     make_rate_popup(rate) unless $game_temp.evaluating
  1384.   end
  1385.   
  1386.   #--------------------------------------------------------------------------
  1387.   # alias method: execute_damage
  1388.   #--------------------------------------------------------------------------
  1389.   alias game_battler_execute_damage_abe execute_damage
  1390.   def execute_damage(user)
  1391.     game_battler_execute_damage_abe(user)
  1392.     make_damage_popups(user)
  1393.   end
  1394.   
  1395.   #--------------------------------------------------------------------------
  1396.   # alias method: item_effect_recover_hp
  1397.   #--------------------------------------------------------------------------
  1398.   alias game_battler_item_effect_recover_hp_abe item_effect_recover_hp
  1399.   def item_effect_recover_hp(user, item, effect)
  1400.     game_battler_item_effect_recover_hp_abe(user, item, effect)
  1401.     make_damage_popups(user)
  1402.   end
  1403.   
  1404.   #--------------------------------------------------------------------------
  1405.   # alias method: item_effect_recover_mp
  1406.   #--------------------------------------------------------------------------
  1407.   alias game_battler_item_effect_recover_mp_abe item_effect_recover_mp
  1408.   def item_effect_recover_mp(user, item, effect)
  1409.     game_battler_item_effect_recover_mp_abe(user, item, effect)
  1410.     make_damage_popups(user)
  1411.   end
  1412.   
  1413.   #--------------------------------------------------------------------------
  1414.   # alias method: item_effect_gain_tp
  1415.   #--------------------------------------------------------------------------
  1416.   alias game_battler_item_effect_gain_tp_abe item_effect_gain_tp
  1417.   def item_effect_gain_tp(user, item, effect)
  1418.     game_battler_item_effect_gain_tp_abe(user, item, effect)
  1419.     make_damage_popups(user)
  1420.   end
  1421.   
  1422.   #--------------------------------------------------------------------------
  1423.   # alias method: item_user_effect
  1424.   #--------------------------------------------------------------------------
  1425.   alias game_battler_item_user_effect_abe item_user_effect
  1426.   def item_user_effect(user, item)
  1427.     game_battler_item_user_effect_abe(user, item)
  1428.     @result.restore_damage
  1429.   end
  1430.   
  1431.   #--------------------------------------------------------------------------
  1432.   # alias method: add_new_state
  1433.   #--------------------------------------------------------------------------
  1434.   alias game_battler_add_new_state_abe add_new_state
  1435.   def add_new_state(state_id)
  1436.     game_battler_add_new_state_abe(state_id)
  1437.     make_state_popup(state_id, :add_state) if @states.include?(state_id)
  1438.   end
  1439.   
  1440.   #--------------------------------------------------------------------------
  1441.   # alias method: add_buff
  1442.   #--------------------------------------------------------------------------
  1443.   alias game_battler_add_buff_abe add_buff
  1444.   def add_buff(param_id, turns)
  1445.     make_buff_popup(param_id, true)
  1446.     game_battler_add_buff_abe(param_id, turns)
  1447.   end
  1448.   
  1449.   #--------------------------------------------------------------------------
  1450.   # alias method: add_debuff
  1451.   #--------------------------------------------------------------------------
  1452.   alias game_battler_add_debuff_abe add_debuff
  1453.   def add_debuff(param_id, turns)
  1454.     make_buff_popup(param_id, false)
  1455.     game_battler_add_debuff_abe(param_id, turns)
  1456.   end
  1457.   
  1458.   #--------------------------------------------------------------------------
  1459.   # alias method: regenerate_all
  1460.   #--------------------------------------------------------------------------
  1461.   alias game_battler_regenerate_all_abe regenerate_all
  1462.   def regenerate_all
  1463.     game_battler_regenerate_all_abe
  1464.     return unless alive?
  1465.     make_damage_popups(self)
  1466.   end
  1467.   
  1468.   #--------------------------------------------------------------------------
  1469.   # new method: can_collapse?
  1470.   #--------------------------------------------------------------------------
  1471.   def can_collapse?
  1472.     return false unless dead?
  1473.     unless actor?
  1474.       return false unless sprite.battler_visible
  1475.       array = [:collapse, :boss_collapse, :instant_collapse]
  1476.       return false if array.include?(sprite.effect_type)
  1477.     end
  1478.     return true
  1479.   end
  1480.   
  1481.   #--------------------------------------------------------------------------
  1482.   # new method: draw_mp?
  1483.   #--------------------------------------------------------------------------
  1484.   def draw_mp?; return true; end
  1485.   
  1486.   #--------------------------------------------------------------------------
  1487.   # new method: draw_tp?
  1488.   #--------------------------------------------------------------------------
  1489.   def draw_tp?
  1490.     return $data_system.opt_display_tp
  1491.   end
  1492.   
  1493. end # Game_Battler

  1494. #==============================================================================
  1495. # ¡ Game_Actor
  1496. #==============================================================================

  1497. class Game_Actor < Game_Battler
  1498.   
  1499.   #--------------------------------------------------------------------------
  1500.   # overwrite method: perform_damage_effect
  1501.   #--------------------------------------------------------------------------
  1502.   def perform_damage_effect
  1503.     $game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
  1504.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1505.     Sound.play_actor_damage
  1506.   end
  1507.   
  1508.   #--------------------------------------------------------------------------
  1509.   # overwrite method: use_sprite?
  1510.   #--------------------------------------------------------------------------
  1511.   def use_sprite?; return true; end
  1512.    
  1513.   #--------------------------------------------------------------------------
  1514.   # new method: screen_x
  1515.   #--------------------------------------------------------------------------
  1516.   def screen_x
  1517.     return 0 unless SceneManager.scene_is?(Scene_Battle)
  1518.     status_window = SceneManager.scene.status_window
  1519.     return 0 if status_window.nil?
  1520.     item_rect_width = (status_window.width-24) / $game_party.max_battle_members
  1521.     ext = SceneManager.scene.info_viewport.ox
  1522.     rect = SceneManager.scene.status_window.item_rect(self.index)
  1523.     constant = 128 + 12
  1524.     return constant + rect.x + item_rect_width / 2 - ext
  1525.   end
  1526.   
  1527.   #--------------------------------------------------------------------------
  1528.   # new method: screen_y
  1529.   #--------------------------------------------------------------------------
  1530.   def screen_y
  1531.     return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
  1532.     return Graphics.height - 120 if SceneManager.scene.status_window.nil?
  1533.     return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
  1534.   end
  1535.   
  1536.   #--------------------------------------------------------------------------
  1537.   # new method: screen_z
  1538.   #--------------------------------------------------------------------------
  1539.   def screen_z; return 100; end
  1540.   
  1541.   #--------------------------------------------------------------------------
  1542.   # new method: sprite
  1543.   #--------------------------------------------------------------------------
  1544.   def sprite
  1545.     index = $game_party.battle_members.index(self)
  1546.     return SceneManager.scene.spriteset.actor_sprites[index]
  1547.   end
  1548.   
  1549.   #--------------------------------------------------------------------------
  1550.   # new method: draw_mp?
  1551.   #--------------------------------------------------------------------------
  1552.   def draw_mp?
  1553.     return true unless draw_tp?
  1554.     for skill in skills
  1555.       next unless added_skill_types.include?(skill.stype_id)
  1556.       return true if skill.mp_cost > 0
  1557.     end
  1558.     return false
  1559.   end
  1560.   
  1561.   #--------------------------------------------------------------------------
  1562.   # new method: draw_tp?
  1563.   #--------------------------------------------------------------------------
  1564.   def draw_tp?
  1565.     return false unless $data_system.opt_display_tp
  1566.     for skill in skills
  1567.       next unless added_skill_types.include?(skill.stype_id)
  1568.       return true if skill.tp_cost > 0
  1569.     end
  1570.     return false
  1571.   end
  1572.   
  1573.   #--------------------------------------------------------------------------
  1574.   # alias method: input
  1575.   #--------------------------------------------------------------------------
  1576.   alias game_actor_input_abe input
  1577.   def input
  1578.     if @actions.nil?
  1579.       make_actions
  1580.       @action_input_index = 0
  1581.     end
  1582.     if @actions[@action_input_index].nil?
  1583.       @actions[@action_input_index] = Game_Action.new(self)
  1584.     end
  1585.     return game_actor_input_abe
  1586.   end
  1587.   
  1588. end # Game_Actor

  1589. #==============================================================================
  1590. # ¡ Game_Enemy
  1591. #==============================================================================

  1592. class Game_Enemy < Game_Battler
  1593.   
  1594.   #--------------------------------------------------------------------------
  1595.   # overwrite method: perform_damage_effect
  1596.   #--------------------------------------------------------------------------
  1597.   def perform_damage_effect
  1598.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1599.     Sound.play_enemy_damage
  1600.   end
  1601.   
  1602.   #--------------------------------------------------------------------------
  1603.   # new methods: attack_animation_id
  1604.   #--------------------------------------------------------------------------
  1605.   def atk_animation_id1; return enemy.atk_animation_id1; end
  1606.   def atk_animation_id2; return enemy.atk_animation_id2; end
  1607.   
  1608.   #--------------------------------------------------------------------------
  1609.   # new method: sprite
  1610.   #--------------------------------------------------------------------------
  1611.   def sprite
  1612.     return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  1613.   end
  1614.   
  1615. end # Game_Enemy

  1616. #==============================================================================
  1617. # ¡ Game_Unit
  1618. #==============================================================================

  1619. class Game_Unit
  1620.   
  1621.   #--------------------------------------------------------------------------
  1622.   # alias method: make_actions
  1623.   #--------------------------------------------------------------------------
  1624.   alias game_unit_make_actions_abe make_actions
  1625.   def make_actions
  1626.     game_unit_make_actions_abe
  1627.     refresh_autobattler_status_window
  1628.   end
  1629.   
  1630.   #--------------------------------------------------------------------------
  1631.   # new method: refresh_autobattler_status_window
  1632.   #--------------------------------------------------------------------------
  1633.   def refresh_autobattler_status_window
  1634.     return unless SceneManager.scene_is?(Scene_Battle)
  1635.     return unless self.is_a?(Game_Party)
  1636.     SceneManager.scene.refresh_autobattler_status_window
  1637.   end
  1638.   
  1639. end # Game_Unit

  1640. #==============================================================================
  1641. # ¡ Window_PartyCommand
  1642. #==============================================================================

  1643. class Window_PartyCommand < Window_Command
  1644.   
  1645.   #--------------------------------------------------------------------------
  1646.   # overwrite method: process_handling
  1647.   #--------------------------------------------------------------------------
  1648.   def process_handling
  1649.     return unless open? && active
  1650.     return process_dir6 if Input.repeat?(:RIGHT)
  1651.     return super
  1652.   end
  1653.   
  1654.   #--------------------------------------------------------------------------
  1655.   # new method: process_dir6
  1656.   #--------------------------------------------------------------------------
  1657.   def process_dir6
  1658.     Sound.play_cursor
  1659.     Input.update
  1660.     deactivate
  1661.     call_handler(:dir6)
  1662.   end
  1663.   
  1664. end # Window_PartyCommand

  1665. #==============================================================================
  1666. # ¡ Window_ActorCommand
  1667. #==============================================================================

  1668. class Window_ActorCommand < Window_Command
  1669.   
  1670.   #--------------------------------------------------------------------------
  1671.   # overwrite method: process_handling
  1672.   #--------------------------------------------------------------------------
  1673.   def process_handling
  1674.     return unless open? && active
  1675.     return process_dir4 if Input.repeat?(:LEFT)
  1676.     return process_dir6 if Input.repeat?(:RIGHT)
  1677.     return super
  1678.   end
  1679.   
  1680.   #--------------------------------------------------------------------------
  1681.   # new method: process_dir4
  1682.   #--------------------------------------------------------------------------
  1683.   def process_dir4
  1684.     Sound.play_cursor
  1685.     Input.update
  1686.     deactivate
  1687.     call_handler(:cancel)
  1688.   end
  1689.   
  1690.   #--------------------------------------------------------------------------
  1691.   # new method: process_dir6
  1692.   #--------------------------------------------------------------------------
  1693.   def process_dir6
  1694.     Sound.play_cursor
  1695.     Input.update
  1696.     deactivate
  1697.     call_handler(:dir6)
  1698.   end
  1699.   
  1700. end # Window_ActorCommand

  1701. #==============================================================================
  1702. # ¡ Window_BattleStatus
  1703. #==============================================================================

  1704. class Window_BattleStatus < Window_Selectable
  1705.   
  1706.   #--------------------------------------------------------------------------
  1707.   # overwrite method: initialize
  1708.   #--------------------------------------------------------------------------
  1709.   def initialize
  1710.     super(0, 0, window_width, window_height)
  1711.     self.openness = 0
  1712.     @party = $game_party.battle_members.clone
  1713.   end
  1714.   
  1715.   #--------------------------------------------------------------------------
  1716.   # overwrite method: col_max
  1717.   #--------------------------------------------------------------------------
  1718.   def col_max; return $game_party.max_battle_members; end
  1719.   
  1720.   #--------------------------------------------------------------------------
  1721.   # new method: battle_members
  1722.   #--------------------------------------------------------------------------
  1723.   def battle_members; return $game_party.battle_members; end
  1724.   
  1725.   #--------------------------------------------------------------------------
  1726.   # new method: actor
  1727.   #--------------------------------------------------------------------------
  1728.   def actor; return battle_members[@index]; end
  1729.   
  1730.   #--------------------------------------------------------------------------
  1731.   # overwrite method: update
  1732.   #--------------------------------------------------------------------------
  1733.   def update
  1734.     super
  1735.     return if @party == $game_party.battle_members
  1736.     @party = $game_party.battle_members.clone
  1737.     refresh
  1738.   end
  1739.   
  1740.   #--------------------------------------------------------------------------
  1741.   # overwrite method: draw_item
  1742.   #--------------------------------------------------------------------------
  1743.   def draw_item(index)
  1744.     return if index.nil?
  1745.     clear_item(index)
  1746.     actor = battle_members[index]
  1747.     rect = item_rect(index)
  1748.     return if actor.nil?
  1749.     draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
  1750.     draw_actor_name(actor, rect.x, rect.y, rect.width-8)
  1751.     draw_actor_action(actor, rect.x, rect.y)
  1752.     draw_actor_icons(actor, rect.x, line_height*1, rect.width)
  1753.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  1754.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  1755.     draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  1756.     if draw_tp?(actor) && draw_mp?(actor)
  1757.       dw = rect.width/2-2
  1758.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  1759.       draw_actor_tp(actor, rect.x+2, line_height*3, dw)
  1760.       dw = rect.width - rect.width/2 - 2
  1761.       draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
  1762.     elsif draw_tp?(actor) && !draw_mp?(actor)
  1763.       draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
  1764.     else
  1765.       draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
  1766.     end
  1767.   end
  1768.   
  1769.   #--------------------------------------------------------------------------
  1770.   # overwrite method: item_rect
  1771.   #--------------------------------------------------------------------------
  1772.   def item_rect(index)
  1773.     rect = Rect.new
  1774.     rect.width = contents.width / $game_party.max_battle_members
  1775.     rect.height = contents.height
  1776.     rect.x = index * rect.width
  1777.     if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
  1778.       rect.x += (contents.width - $game_party.members.size * rect.width) / 2
  1779.     end
  1780.     rect.y = 0
  1781.     return rect
  1782.   end
  1783.   
  1784.   #--------------------------------------------------------------------------
  1785.   # overwrite method: draw_face
  1786.   #--------------------------------------------------------------------------
  1787.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  1788.     bitmap = Cache.face(face_name)
  1789.     fx = [(96 - item_rect(0).width + 1) / 2, 0].max
  1790.     fy = face_index / 4 * 96 + 2
  1791.     fw = [item_rect(0).width - 4, 92].min
  1792.     rect = Rect.new(fx, fy, fw, 92)
  1793.     rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
  1794.     contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
  1795.     bitmap.dispose
  1796.   end
  1797.   
  1798.   #--------------------------------------------------------------------------
  1799.   # overwrite method: draw_actor_name
  1800.   #--------------------------------------------------------------------------
  1801.   def draw_actor_name(actor, dx, dy, dw = 112)
  1802.     reset_font_settings
  1803.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  1804.     change_color(hp_color(actor))
  1805.     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  1806.   end
  1807.   
  1808.   #--------------------------------------------------------------------------
  1809.   # new method: draw_actor_action
  1810.   #--------------------------------------------------------------------------
  1811.   def draw_actor_action(actor, dx, dy)
  1812.     draw_icon(action_icon(actor), dx, dy)
  1813.   end
  1814.   
  1815.   #--------------------------------------------------------------------------
  1816.   # new method: action_icon
  1817.   #--------------------------------------------------------------------------
  1818.   def action_icon(actor)
  1819.     return Icon.no_action if actor.current_action.nil?
  1820.     return Icon.no_action if actor.current_action.item.nil?
  1821.     return actor.current_action.item.icon_index
  1822.   end
  1823.   
  1824.   #--------------------------------------------------------------------------
  1825.   # new method: draw_tp?
  1826.   #--------------------------------------------------------------------------
  1827.   def draw_tp?(actor)
  1828.     return actor.draw_tp?
  1829.   end
  1830.   
  1831.   #--------------------------------------------------------------------------
  1832.   # new method: draw_mp?
  1833.   #--------------------------------------------------------------------------
  1834.   def draw_mp?(actor)
  1835.     return actor.draw_mp?
  1836.   end
  1837.   
  1838.   #--------------------------------------------------------------------------
  1839.   # overwrite method: draw_current_and_max_values
  1840.   #--------------------------------------------------------------------------
  1841.   def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  1842.     change_color(color1)
  1843.     draw_text(dx, dy, dw, line_height, current.group, 2)
  1844.   end
  1845.   
  1846.   #--------------------------------------------------------------------------
  1847.   # overwrite method: draw_actor_hp
  1848.   #--------------------------------------------------------------------------
  1849.   def draw_actor_hp(actor, dx, dy, width = 124)
  1850.     draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  1851.     change_color(system_color)
  1852.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1853.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
  1854.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  1855.       hp_color(actor), normal_color)
  1856.     end
  1857.    
  1858.   #--------------------------------------------------------------------------
  1859.   # overwrite method: draw_actor_mp
  1860.   #--------------------------------------------------------------------------
  1861.   def draw_actor_mp(actor, dx, dy, width = 124)
  1862.     draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  1863.     change_color(system_color)
  1864.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1865.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
  1866.     draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  1867.       mp_color(actor), normal_color)
  1868.     end
  1869.    
  1870.   #--------------------------------------------------------------------------
  1871.   # overwrite method: draw_actor_tp
  1872.   #--------------------------------------------------------------------------
  1873.   def draw_actor_tp(actor, dx, dy, width = 124)
  1874.     draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  1875.     change_color(system_color)
  1876.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1877.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
  1878.     change_color(tp_color(actor))
  1879.     draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  1880.   end
  1881.   
  1882. end # Window_BattleStatus

  1883. #==============================================================================
  1884. # ¡ Window_BattleActor
  1885. #==============================================================================

  1886. class Window_BattleActor < Window_BattleStatus
  1887.   
  1888.   #--------------------------------------------------------------------------
  1889.   # overwrite method: show
  1890.   #--------------------------------------------------------------------------
  1891.   def show
  1892.     create_flags
  1893.     super
  1894.   end
  1895.   
  1896.   #--------------------------------------------------------------------------
  1897.   # new method: create_flags
  1898.   #--------------------------------------------------------------------------
  1899.   def create_flags
  1900.     set_select_flag(:any)
  1901.     select(0)
  1902.     return if $game_temp.battle_aid.nil?
  1903.     if $game_temp.battle_aid.need_selection?
  1904.       select(0)
  1905.       set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
  1906.     elsif $game_temp.battle_aid.for_user?
  1907.       battler = BattleManager.actor
  1908.       id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
  1909.       select(id)
  1910.       set_select_flag(:user)
  1911.     elsif $game_temp.battle_aid.for_all?
  1912.       select(0)
  1913.       set_select_flag(:all)
  1914.       set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
  1915.     elsif $game_temp.battle_aid.for_random?
  1916.       select(0)
  1917.       set_select_flag(:random) if $game_temp.battle_aid.for_random?
  1918.     end
  1919.   end
  1920.   
  1921.   #--------------------------------------------------------------------------
  1922.   # new method: set_flag
  1923.   #--------------------------------------------------------------------------
  1924.   def set_select_flag(flag)
  1925.     @select_flag = flag
  1926.     case @select_flag
  1927.     when :all, :all_dead, :random
  1928.       @cursor_all = true
  1929.     else
  1930.       @cursor_all = false
  1931.     end
  1932.   end
  1933.   
  1934.   #--------------------------------------------------------------------------
  1935.   # overwrite method: update_cursor
  1936.   #--------------------------------------------------------------------------
  1937.   def update_cursor
  1938.     if @cursor_all
  1939.       cursor_rect.set(0, 0, contents.width, contents.height)
  1940.       self.top_row = 0
  1941.     elsif @index < 0
  1942.       cursor_rect.empty
  1943.     else
  1944.       ensure_cursor_visible
  1945.       cursor_rect.set(item_rect(@index))
  1946.     end
  1947.   end
  1948.   
  1949.   #--------------------------------------------------------------------------
  1950.   # overwrite method: cursor_movable?
  1951.   #--------------------------------------------------------------------------
  1952.   def cursor_movable?
  1953.     return false if @select_flag == :user
  1954.     return super
  1955.   end
  1956.   
  1957.   #--------------------------------------------------------------------------
  1958.   # overwrite method: current_item_enabled?
  1959.   #--------------------------------------------------------------------------
  1960.   def current_item_enabled?
  1961.     return true if $game_temp.battle_aid.nil?
  1962.     if $game_temp.battle_aid.need_selection?
  1963.       member = $game_party.battle_members[@index]
  1964.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  1965.     elsif $game_temp.battle_aid.for_dead_friend?
  1966.       for member in $game_party.battle_members
  1967.         return true if member.dead?
  1968.       end
  1969.       return false
  1970.     end
  1971.     return true
  1972.   end
  1973.   
  1974. end # Window_BattleActor

  1975. #==============================================================================
  1976. # ¡ Window_BattleStatusAid
  1977. #==============================================================================

  1978. class Window_BattleStatusAid < Window_BattleStatus
  1979.   
  1980.   #--------------------------------------------------------------------------
  1981.   # public instance variables
  1982.   #--------------------------------------------------------------------------
  1983.   attr_accessor :status_window
  1984.   
  1985.   #--------------------------------------------------------------------------
  1986.   # overwrite method: initialize
  1987.   #--------------------------------------------------------------------------
  1988.   def initialize
  1989.     super
  1990.     self.visible = false
  1991.     self.openness = 255
  1992.   end
  1993.   
  1994.   #--------------------------------------------------------------------------
  1995.   # overwrite method: window_width
  1996.   #--------------------------------------------------------------------------
  1997.   def window_width; return 128; end
  1998.   
  1999.   #--------------------------------------------------------------------------
  2000.   # overwrite method: show
  2001.   #--------------------------------------------------------------------------
  2002.   def show
  2003.     super
  2004.     refresh
  2005.   end
  2006.   
  2007.   #--------------------------------------------------------------------------
  2008.   # overwrite method: refresh
  2009.   #--------------------------------------------------------------------------
  2010.   def refresh
  2011.     contents.clear
  2012.     return if @status_window.nil?
  2013.     draw_item(@status_window.index)
  2014.   end
  2015.   
  2016.   #--------------------------------------------------------------------------
  2017.   # overwrite method: item_rect
  2018.   #--------------------------------------------------------------------------
  2019.   def item_rect(index)
  2020.     return Rect.new(0, 0, contents.width, contents.height)
  2021.   end
  2022.   
  2023. end # Window_BattleStatusAid

  2024. #==============================================================================
  2025. # ¡ Window_BattleEnemy
  2026. #==============================================================================

  2027. class Window_BattleEnemy < Window_Selectable
  2028.   
  2029.   #--------------------------------------------------------------------------
  2030.   # overwrite method: initialize
  2031.   #--------------------------------------------------------------------------
  2032.   def initialize(info_viewport)
  2033.     super(0, Graphics.height, window_width, fitting_height(1))
  2034.     refresh
  2035.     self.visible = false
  2036.     @info_viewport = info_viewport
  2037.   end
  2038.   
  2039.   #--------------------------------------------------------------------------
  2040.   # overwrite method: col_max
  2041.   #--------------------------------------------------------------------------
  2042.   def col_max; return item_max; end
  2043.   
  2044.   #--------------------------------------------------------------------------
  2045.   # overwrite method: show
  2046.   #--------------------------------------------------------------------------
  2047.   def show
  2048.     create_flags
  2049.     super
  2050.   end
  2051.   
  2052.   #--------------------------------------------------------------------------
  2053.   # new method: create_flags
  2054.   #--------------------------------------------------------------------------
  2055.   def create_flags
  2056.     set_select_flag(:any)
  2057.     select(0)
  2058.     return if $game_temp.battle_aid.nil?
  2059.     if $game_temp.battle_aid.need_selection?
  2060.       select(0)
  2061.     elsif $game_temp.battle_aid.for_all?
  2062.       select(0)
  2063.       set_select_flag(:all)
  2064.     elsif $game_temp.battle_aid.for_random?
  2065.       select(0)
  2066.       set_select_flag(:random)
  2067.     end
  2068.   end
  2069.   
  2070.   #--------------------------------------------------------------------------
  2071.   # new method: set_flag
  2072.   #--------------------------------------------------------------------------
  2073.   def set_select_flag(flag)
  2074.     @select_flag = flag
  2075.     case @select_flag
  2076.     when :all, :random
  2077.       @cursor_all = true
  2078.     else
  2079.       @cursor_all = false
  2080.     end
  2081.   end
  2082.   
  2083.   #--------------------------------------------------------------------------
  2084.   # new method: select_all?
  2085.   #--------------------------------------------------------------------------
  2086.   def select_all?
  2087.     return true if @select_flag == :all
  2088.     return true if @select_flag == :random
  2089.     return false
  2090.   end
  2091.   
  2092.   #--------------------------------------------------------------------------
  2093.   # overwrite method: update_cursor
  2094.   #--------------------------------------------------------------------------
  2095.   def update_cursor
  2096.     if @cursor_all
  2097.       cursor_rect.set(0, 0, contents.width, contents.height)
  2098.       self.top_row = 0
  2099.     elsif @index < 0
  2100.       cursor_rect.empty
  2101.     else
  2102.       ensure_cursor_visible
  2103.       cursor_rect.set(item_rect(@index))
  2104.     end
  2105.   end
  2106.   
  2107.   #--------------------------------------------------------------------------
  2108.   # overwrite method: cursor_movable?
  2109.   #--------------------------------------------------------------------------
  2110.   def cursor_movable?
  2111.     return false if @select_flag == :user
  2112.     return super
  2113.   end
  2114.   
  2115.   #--------------------------------------------------------------------------
  2116.   # overwrite method: current_item_enabled?
  2117.   #--------------------------------------------------------------------------
  2118.   def current_item_enabled?
  2119.     return true if $game_temp.battle_aid.nil?
  2120.     if $game_temp.battle_aid.need_selection?
  2121.       member = $game_party.battle_members[@index]
  2122.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  2123.     elsif $game_temp.battle_aid.for_dead_friend?
  2124.       for member in $game_party.battle_members
  2125.         return true if member.dead?
  2126.       end
  2127.       return false
  2128.     end
  2129.     return true
  2130.   end
  2131.   
  2132.   #--------------------------------------------------------------------------
  2133.   # overwrite method: enemy
  2134.   #--------------------------------------------------------------------------
  2135.   def enemy; @data[index]; end
  2136.   
  2137.   #--------------------------------------------------------------------------
  2138.   # overwrite method: refresh
  2139.   #--------------------------------------------------------------------------
  2140.   def refresh
  2141.     make_item_list
  2142.     create_contents
  2143.     draw_all_items
  2144.   end
  2145.   
  2146.   #--------------------------------------------------------------------------
  2147.   # overwrite method: make_item_list
  2148.   #--------------------------------------------------------------------------
  2149.   def make_item_list
  2150.     @data = $game_troop.alive_members
  2151.     @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  2152.   end
  2153.   
  2154.   #--------------------------------------------------------------------------
  2155.   # overwrite method: draw_item
  2156.   #--------------------------------------------------------------------------
  2157.   def draw_item(index); return; end
  2158.   
  2159.   #--------------------------------------------------------------------------
  2160.   # overwrite method: update
  2161.   #--------------------------------------------------------------------------
  2162.   def update
  2163.     super
  2164.     return unless active
  2165.     enemy.sprite_effect_type = :whiten
  2166.     return unless select_all?
  2167.     for enemy in $game_troop.alive_members
  2168.       enemy.sprite_effect_type = :whiten
  2169.     end
  2170.   end
  2171.   
  2172. end # Window_BattleEnemy

  2173. #==============================================================================
  2174. # ¡ Window_BattleHelp
  2175. #==============================================================================

  2176. class Window_BattleHelp < Window_Help
  2177.   
  2178.   #--------------------------------------------------------------------------
  2179.   # public instance variables
  2180.   #--------------------------------------------------------------------------
  2181.   attr_accessor :actor_window
  2182.   attr_accessor :enemy_window
  2183.   
  2184.   #--------------------------------------------------------------------------
  2185.   # update
  2186.   #--------------------------------------------------------------------------
  2187.   def update
  2188.     super
  2189.     if !self.visible and @text != ""
  2190.       @text = ""
  2191.       return refresh
  2192.     end
  2193.     update_battler_name
  2194.   end
  2195.   
  2196.   #--------------------------------------------------------------------------
  2197.   # update_battler_name
  2198.   #--------------------------------------------------------------------------
  2199.   def update_battler_name
  2200.     return unless @actor_window.active || @enemy_window.active
  2201.     if @actor_window.active
  2202.       battler = $game_party.battle_members[@actor_window.index]
  2203.     elsif @enemy_window.active
  2204.       battler = @enemy_window.enemy
  2205.     end
  2206.     if special_display?
  2207.       refresh_special_case(battler)
  2208.     else
  2209.       refresh_battler_name(battler) if battler_name(battler) != @text
  2210.     end
  2211.   end
  2212.   
  2213.   #--------------------------------------------------------------------------
  2214.   # battler_name
  2215.   #--------------------------------------------------------------------------
  2216.   def battler_name(battler)
  2217.     text = battler.name.clone
  2218.     return text
  2219.   end
  2220.   
  2221.   #--------------------------------------------------------------------------
  2222.   # refresh_battler_name
  2223.   #--------------------------------------------------------------------------
  2224.   def refresh_battler_name(battler)
  2225.     contents.clear
  2226.     reset_font_settings
  2227.     change_color(normal_color)
  2228.     @text = battler_name(battler)
  2229.     icons = battler.state_icons + battler.buff_icons
  2230.     dy = icons.size <= 0 ? line_height / 2 : 0
  2231.     draw_text(0, dy, contents.width, line_height, @text, 1)
  2232.     dx = (contents.width - (icons.size * 24)) / 2
  2233.     draw_actor_icons(battler, dx, line_height, contents.width)
  2234.   end
  2235.   
  2236.   #--------------------------------------------------------------------------
  2237.   # special_display?
  2238.   #--------------------------------------------------------------------------
  2239.   def special_display?
  2240.     return false if $game_temp.battle_aid.nil?
  2241.     return false if $game_temp.battle_aid.for_user?
  2242.     return !$game_temp.battle_aid.need_selection?
  2243.   end
  2244.   
  2245.   #--------------------------------------------------------------------------
  2246.   # refresh_special_case
  2247.   #--------------------------------------------------------------------------
  2248.   def refresh_special_case(battler)
  2249.     if $game_temp.battle_aid.for_opponent?
  2250.       if $game_temp.battle_aid.for_all?
  2251.         text = YEA::BATTLE::HELP_TEXT_ALL_FOES
  2252.       else
  2253.         case $game_temp.battle_aid.number_of_targets
  2254.         when 1
  2255.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
  2256.         else
  2257.           number = $game_temp.battle_aid.number_of_targets
  2258.           text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
  2259.         end
  2260.       end
  2261.     else # $game_temp.battle_aid.for_friend?
  2262.       if $game_temp.battle_aid.for_dead_friend?
  2263.         text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
  2264.       elsif $game_temp.battle_aid.for_random?
  2265.         case $game_temp.battle_aid.number_of_targets
  2266.         when 1
  2267.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
  2268.         else
  2269.           number = $game_temp.battle_aid.number_of_targets
  2270.           text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
  2271.         end
  2272.       else
  2273.         text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
  2274.       end
  2275.     end
  2276.     return if text == @text
  2277.     @text = text
  2278.     contents.clear
  2279.     reset_font_settings
  2280.     draw_text(0, 0, contents.width, line_height*2, @text, 1)
  2281.   end
  2282.   
  2283. end # Window_BattleHelp

  2284. #==============================================================================
  2285. # ¡ Window_BattleLog
  2286. #==============================================================================

  2287. class Window_BattleLog < Window_Selectable
  2288.   
  2289.   #--------------------------------------------------------------------------
  2290.   # alias method: display_current_state
  2291.   #--------------------------------------------------------------------------
  2292.   alias window_battlelog_display_current_state_abe display_current_state
  2293.   def display_current_state(subject)
  2294.     subject.make_during_state_popup
  2295.     return unless YEA::BATTLE::MSG_CURRENT_STATE
  2296.     window_battlelog_display_current_state_abe(subject)
  2297.   end
  2298.   
  2299.   #--------------------------------------------------------------------------
  2300.   # alias method: display_use_item
  2301.   #--------------------------------------------------------------------------
  2302.   alias window_battlelog_display_use_item_abe display_use_item
  2303.   def display_use_item(subject, item)
  2304.     return unless YEA::BATTLE::MSG_CURRENT_ACTION
  2305.     window_battlelog_display_use_item_abe(subject, item)
  2306.   end
  2307.   
  2308.   #--------------------------------------------------------------------------
  2309.   # alias method: display_counter
  2310.   #--------------------------------------------------------------------------
  2311.   alias window_battlelog_display_counter_abe display_counter
  2312.   def display_counter(target, item)
  2313.     if YEA::BATTLE::MSG_COUNTERATTACK
  2314.       window_battlelog_display_counter_abe(target, item)
  2315.     else
  2316.       Sound.play_evasion
  2317.     end
  2318.   end
  2319.   
  2320.   #--------------------------------------------------------------------------
  2321.   # alias method: display_reflection
  2322.   #--------------------------------------------------------------------------
  2323.   alias window_battlelog_display_reflection_abe display_reflection
  2324.   def display_reflection(target, item)
  2325.     if YEA::BATTLE::MSG_REFLECT_MAGIC
  2326.       window_battlelog_display_reflection_abe(target, item)
  2327.     else
  2328.       Sound.play_reflection
  2329.     end
  2330.   end
  2331.   
  2332.   #--------------------------------------------------------------------------
  2333.   # alias method: display_substitute
  2334.   #--------------------------------------------------------------------------
  2335.   alias window_battlelog_display_substitute_abe display_substitute
  2336.   def display_substitute(substitute, target)
  2337.     return unless YEA::BATTLE::MSG_SUBSTITUTE_HIT
  2338.     window_battlelog_display_substitute_abe(substitute, target)
  2339.   end
  2340.   
  2341.   #--------------------------------------------------------------------------
  2342.   # alias method: display_failure
  2343.   #--------------------------------------------------------------------------
  2344.   alias window_battlelog_display_failure_abe display_failure
  2345.   def display_failure(target, item)
  2346.     return unless YEA::BATTLE::MSG_FAILURE_HIT
  2347.     window_battlelog_display_failure_abe(target, item)
  2348.   end
  2349.   
  2350.   #--------------------------------------------------------------------------
  2351.   # alias method: display_critical
  2352.   #--------------------------------------------------------------------------
  2353.   alias window_battlelog_display_critical_abe display_critical
  2354.   def display_critical(target, item)
  2355.     return unless YEA::BATTLE::MSG_CRITICAL_HIT
  2356.     window_battlelog_display_critical_abe(target, item)
  2357.   end
  2358.   
  2359.   #--------------------------------------------------------------------------
  2360.   # alias method: display_miss
  2361.   #--------------------------------------------------------------------------
  2362.   alias window_battlelog_display_miss_abe display_miss
  2363.   def display_miss(target, item)
  2364.     return unless YEA::BATTLE::MSG_HIT_MISSED
  2365.     window_battlelog_display_miss_abe(target, item)
  2366.   end
  2367.   
  2368.   #--------------------------------------------------------------------------
  2369.   # alias method: display_evasion
  2370.   #--------------------------------------------------------------------------
  2371.   alias window_battlelog_display_evasion_abe display_evasion
  2372.   def display_evasion(target, item)
  2373.     if YEA::BATTLE::MSG_EVASION
  2374.       window_battlelog_display_evasion_abe(target, item)
  2375.     else
  2376.       if !item || item.physical?
  2377.         Sound.play_evasion
  2378.       else
  2379.         Sound.play_magic_evasion
  2380.       end
  2381.     end
  2382.   end
  2383.   
  2384.   #--------------------------------------------------------------------------
  2385.   # overwrite method: display_hp_damage
  2386.   #--------------------------------------------------------------------------
  2387.   def display_hp_damage(target, item)
  2388.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  2389.     if target.result.hp_damage > 0 && target.result.hp_drain == 0
  2390.       target.perform_damage_effect
  2391.     end
  2392.     Sound.play_recovery if target.result.hp_damage < 0
  2393.     return unless YEA::BATTLE::MSG_HP_DAMAGE
  2394.     add_text(target.result.hp_damage_text)
  2395.     wait
  2396.   end
  2397.   
  2398.   #--------------------------------------------------------------------------
  2399.   # overwrite method: display_mp_damage
  2400.   #--------------------------------------------------------------------------
  2401.   def display_mp_damage(target, item)
  2402.     return if target.dead? || target.result.mp_damage == 0
  2403.     Sound.play_recovery if target.result.mp_damage < 0
  2404.     return unless YEA::BATTLE::MSG_MP_DAMAGE
  2405.     add_text(target.result.mp_damage_text)
  2406.     wait
  2407.   end
  2408.   
  2409.   #--------------------------------------------------------------------------
  2410.   # overwrite method: display_tp_damage
  2411.   #--------------------------------------------------------------------------
  2412.   def display_tp_damage(target, item)
  2413.     return if target.dead? || target.result.tp_damage == 0
  2414.     Sound.play_recovery if target.result.tp_damage < 0
  2415.     return unless YEA::BATTLE::MSG_TP_DAMAGE
  2416.     add_text(target.result.tp_damage_text)
  2417.     wait
  2418.   end
  2419.   
  2420.   #--------------------------------------------------------------------------
  2421.   # alias method: display_added_states
  2422.   #--------------------------------------------------------------------------
  2423.   alias window_battlelog_display_added_states_abe display_added_states
  2424.   def display_added_states(target)
  2425.     return unless YEA::BATTLE::MSG_ADDED_STATES
  2426.     window_battlelog_display_added_states_abe(target)
  2427.   end
  2428.   
  2429.   #--------------------------------------------------------------------------
  2430.   # alias method: display_removed_states
  2431.   #--------------------------------------------------------------------------
  2432.   alias window_battlelog_display_removed_states_abe display_removed_states
  2433.   def display_removed_states(target)
  2434.     return unless YEA::BATTLE::MSG_REMOVED_STATES
  2435.     window_battlelog_display_removed_states_abe(target)
  2436.   end
  2437.   
  2438.   #--------------------------------------------------------------------------
  2439.   # alias method: display_changed_buffs
  2440.   #--------------------------------------------------------------------------
  2441.   alias window_battlelog_display_changed_buffs_abe display_changed_buffs
  2442.   def display_changed_buffs(target)
  2443.     return unless YEA::BATTLE::MSG_CHANGED_BUFFS
  2444.     window_battlelog_display_changed_buffs_abe(target)
  2445.   end
  2446.   
  2447. end # Window_BattleLog

  2448. #==============================================================================
  2449. # ¡ Window_SkillList
  2450. #==============================================================================

  2451. class Window_SkillList < Window_Selectable
  2452.   
  2453.   #--------------------------------------------------------------------------
  2454.   # overwrite method: spacing
  2455.   #--------------------------------------------------------------------------
  2456.   def spacing
  2457.     return 8 if $game_party.in_battle
  2458.     return super
  2459.   end
  2460.   
  2461. end # Window_SkillList

  2462. #==============================================================================
  2463. # ¡ Window_ItemList
  2464. #==============================================================================

  2465. class Window_ItemList < Window_Selectable
  2466.   
  2467.   #--------------------------------------------------------------------------
  2468.   # overwrite method: spacing
  2469.   #--------------------------------------------------------------------------
  2470.   def spacing
  2471.     return 8 if $game_party.in_battle
  2472.     return super
  2473.   end
  2474.   
  2475. end # Window_ItemList

  2476. #==============================================================================
  2477. # ¡ Scene_Battle
  2478. #==============================================================================

  2479. class Scene_Battle < Scene_Base
  2480.   
  2481.   #--------------------------------------------------------------------------
  2482.   # public instance variables
  2483.   #--------------------------------------------------------------------------
  2484.   attr_accessor :enemy_window
  2485.   attr_accessor :info_viewport
  2486.   attr_accessor :spriteset
  2487.   attr_accessor :status_window
  2488.   attr_accessor :status_aid_window
  2489.   attr_accessor :subject
  2490.   
  2491.   #--------------------------------------------------------------------------
  2492.   # alias method: create_spriteset
  2493.   #--------------------------------------------------------------------------
  2494.   alias scene_battle_create_spriteset_abe create_spriteset
  2495.   def create_spriteset
  2496.     BattleManager.init_battle_type
  2497.     scene_battle_create_spriteset_abe
  2498.   end
  2499.   
  2500.   #--------------------------------------------------------------------------
  2501.   # alias method: update_basic
  2502.   #--------------------------------------------------------------------------
  2503.   alias scene_battle_update_basic_abe update_basic
  2504.   def update_basic
  2505.     scene_battle_update_basic_abe
  2506.     update_debug
  2507.   end
  2508.   
  2509.   #--------------------------------------------------------------------------
  2510.   # new method: update_debug
  2511.   #--------------------------------------------------------------------------
  2512.   def update_debug
  2513.     return unless $TEST || $BTEST
  2514.     debug_heal_party if Input.trigger?(:F5)
  2515.     debug_damage_party if Input.trigger?(:F6)
  2516.     debug_fill_tp if Input.trigger?(:F7)
  2517.     debug_kill_all if Input.trigger?(:F8)
  2518.   end
  2519.   
  2520.   #--------------------------------------------------------------------------
  2521.   # new method: debug_heal_party
  2522.   #--------------------------------------------------------------------------
  2523.   def debug_heal_party
  2524.     Sound.play_recovery
  2525.     for member in $game_party.battle_members
  2526.       member.recover_all
  2527.     end
  2528.     @status_window.refresh
  2529.   end
  2530.   
  2531.   #--------------------------------------------------------------------------
  2532.   # new method: debug_damage_party
  2533.   #--------------------------------------------------------------------------
  2534.   def debug_damage_party
  2535.     Sound.play_actor_damage
  2536.     for member in $game_party.alive_members
  2537.       member.hp = 1
  2538.       member.mp = 0
  2539.       member.tp = 0
  2540.     end
  2541.     @status_window.refresh
  2542.   end
  2543.   
  2544.   #--------------------------------------------------------------------------
  2545.   # new method: debug_fill_tp
  2546.   #--------------------------------------------------------------------------
  2547.   def debug_fill_tp
  2548.     Sound.play_recovery
  2549.     for member in $game_party.alive_members
  2550.       member.tp = member.max_tp
  2551.     end
  2552.     @status_window.refresh
  2553.   end
  2554.   
  2555.   #--------------------------------------------------------------------------
  2556.   # new method: debug_kill_all
  2557.   #--------------------------------------------------------------------------
  2558.   def debug_kill_all
  2559.     for enemy in $game_troop.alive_members
  2560.       enemy.hp = 0
  2561.       enemy.perform_collapse_effect
  2562.     end
  2563.     BattleManager.judge_win_loss
  2564.     @log_window.wait
  2565.     @log_window.wait_for_effect
  2566.   end
  2567.   
  2568.   #--------------------------------------------------------------------------
  2569.   # alias method: create_all_windows
  2570.   #--------------------------------------------------------------------------
  2571.   alias scene_battle_create_all_windows_abe create_all_windows
  2572.   def create_all_windows
  2573.     scene_battle_create_all_windows_abe
  2574.     create_battle_status_aid_window
  2575.     set_help_window
  2576.   end
  2577.   
  2578.   #--------------------------------------------------------------------------
  2579.   # alias method: create_info_viewport
  2580.   #--------------------------------------------------------------------------
  2581.   alias scene_battle_create_info_viewport_abe create_info_viewport
  2582.   def create_info_viewport
  2583.     scene_battle_create_info_viewport_abe
  2584.     @status_window.refresh
  2585.   end
  2586.   
  2587.   #--------------------------------------------------------------------------
  2588.   # new method: create_battle_status_aid_window
  2589.   #--------------------------------------------------------------------------
  2590.   def create_battle_status_aid_window
  2591.     @status_aid_window = Window_BattleStatusAid.new
  2592.     @status_aid_window.status_window = @status_window
  2593.     @status_aid_window.x = Graphics.width - @status_aid_window.width
  2594.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  2595.   end
  2596.   
  2597.   #--------------------------------------------------------------------------
  2598.   # overwrite method: create_help_window
  2599.   #--------------------------------------------------------------------------
  2600.   def create_help_window
  2601.     @help_window = Window_BattleHelp.new
  2602.     @help_window.hide
  2603.   end
  2604.   
  2605.   #--------------------------------------------------------------------------
  2606.   # new method: set_help_window
  2607.   #--------------------------------------------------------------------------
  2608.   def set_help_window
  2609.     @help_window.actor_window = @actor_window
  2610.     @help_window.enemy_window = @enemy_window
  2611.   end
  2612.   
  2613.   #--------------------------------------------------------------------------
  2614.   # alias method: create_party_command_window
  2615.   #--------------------------------------------------------------------------
  2616.   alias scene_battle_create_party_command_window_abe create_party_command_window
  2617.   def create_party_command_window
  2618.     scene_battle_create_party_command_window_abe
  2619.     @party_command_window.set_handler(:dir6, method(:command_fight))
  2620.   end
  2621.   
  2622.   #--------------------------------------------------------------------------
  2623.   # alias method: create_actor_command_window
  2624.   #--------------------------------------------------------------------------
  2625.   alias scene_battle_create_actor_command_window_abe create_actor_command_window
  2626.   def create_actor_command_window
  2627.     scene_battle_create_actor_command_window_abe
  2628.     @actor_command_window.set_handler(:dir4, method(:prior_command))
  2629.     @actor_command_window.set_handler(:dir6, method(:next_command))
  2630.   end
  2631.   
  2632.   #--------------------------------------------------------------------------
  2633.   # alias method: create_skill_window
  2634.   #--------------------------------------------------------------------------
  2635.   alias scene_battle_create_skill_window_abe create_skill_window
  2636.   def create_skill_window
  2637.     scene_battle_create_skill_window_abe
  2638.     @skill_window.height = @info_viewport.rect.height
  2639.     @skill_window.width = Graphics.width - @actor_command_window.width
  2640.     @skill_window.y = Graphics.height - @skill_window.height
  2641.   end
  2642.   
  2643.   #--------------------------------------------------------------------------
  2644.   # alias method: create_item_window
  2645.   #--------------------------------------------------------------------------
  2646.   alias scene_battle_create_item_window_abe create_item_window
  2647.   def create_item_window
  2648.     scene_battle_create_item_window_abe
  2649.     @item_window.height = @skill_window.height
  2650.     @item_window.width = @skill_window.width
  2651.     @item_window.y = Graphics.height - @item_window.height
  2652.   end
  2653.   
  2654.   #--------------------------------------------------------------------------
  2655.   # alias method: show_fast?
  2656.   #--------------------------------------------------------------------------
  2657.   alias scene_battle_show_fast_abe show_fast?
  2658.   def show_fast?
  2659.     return true if YEA::BATTLE::AUTO_FAST
  2660.     return scene_battle_show_fast_abe
  2661.   end
  2662.   
  2663.   #--------------------------------------------------------------------------
  2664.   # alias method: next_command
  2665.   #--------------------------------------------------------------------------
  2666.   alias scene_battle_next_command_abe next_command
  2667.   def next_command
  2668.     @status_window.show
  2669.     redraw_current_status
  2670.     @actor_command_window.show
  2671.     @status_aid_window.hide
  2672.     scene_battle_next_command_abe
  2673.   end
  2674.   
  2675.   #--------------------------------------------------------------------------
  2676.   # alias method: prior_command
  2677.   #--------------------------------------------------------------------------
  2678.   alias scene_battle_prior_command_abe prior_command
  2679.   def prior_command
  2680.     redraw_current_status
  2681.     scene_battle_prior_command_abe
  2682.   end
  2683.   
  2684.   #--------------------------------------------------------------------------
  2685.   # new method: redraw_current_status
  2686.   #--------------------------------------------------------------------------
  2687.   def redraw_current_status
  2688.     return if @status_window.index < 0
  2689.     @status_window.draw_item(@status_window.index)
  2690.   end
  2691.   
  2692.   #--------------------------------------------------------------------------
  2693.   # alias method: command_attack
  2694.   #--------------------------------------------------------------------------
  2695.   alias scene_battle_command_attack_abe command_attack
  2696.   def command_attack
  2697.     $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
  2698.     scene_battle_command_attack_abe
  2699.   end
  2700.   
  2701.   #--------------------------------------------------------------------------
  2702.   # alias method: command_skill
  2703.   #--------------------------------------------------------------------------
  2704.   alias scene_battle_command_skill_abe command_skill
  2705.   def command_skill
  2706.     scene_battle_command_skill_abe
  2707.     @status_window.hide
  2708.     @actor_command_window.hide
  2709.     @status_aid_window.show
  2710.   end
  2711.   
  2712.   #--------------------------------------------------------------------------
  2713.   # alias method: command_item
  2714.   #--------------------------------------------------------------------------
  2715.   alias scene_battle_command_item_abe command_item
  2716.   def command_item
  2717.     scene_battle_command_item_abe
  2718.     @status_window.hide
  2719.     @actor_command_window.hide
  2720.     @status_aid_window.show
  2721.   end
  2722.   
  2723.   #--------------------------------------------------------------------------
  2724.   # overwrite method: on_skill_ok
  2725.   #--------------------------------------------------------------------------
  2726.   def on_skill_ok
  2727.     @skill = @skill_window.item
  2728.     $game_temp.battle_aid = @skill
  2729.     BattleManager.actor.input.set_skill(@skill.id)
  2730.     BattleManager.actor.last_skill.object = @skill
  2731.     if @skill.for_opponent?
  2732.       select_enemy_selection
  2733.     elsif @skill.for_friend?
  2734.       select_actor_selection
  2735.     else
  2736.       @skill_window.hide
  2737.       next_command
  2738.       $game_temp.battle_aid = nil
  2739.     end
  2740.   end
  2741.   
  2742.   #--------------------------------------------------------------------------
  2743.   # alias method: on_skill_cancel
  2744.   #--------------------------------------------------------------------------
  2745.   alias scene_battle_on_skill_cancel_abe on_skill_cancel
  2746.   def on_skill_cancel
  2747.     scene_battle_on_skill_cancel_abe
  2748.     @status_window.show
  2749.     @actor_command_window.show
  2750.     @status_aid_window.hide
  2751.   end
  2752.   
  2753.   #--------------------------------------------------------------------------
  2754.   # overwrite method: on_item_ok
  2755.   #--------------------------------------------------------------------------
  2756.   def on_item_ok
  2757.     @item = @item_window.item
  2758.     $game_temp.battle_aid = @item
  2759.     BattleManager.actor.input.set_item(@item.id)
  2760.     if @item.for_opponent?
  2761.       select_enemy_selection
  2762.     elsif @item.for_friend?
  2763.       select_actor_selection
  2764.     else
  2765.       @item_window.hide
  2766.       next_command
  2767.       $game_temp.battle_aid = nil
  2768.     end
  2769.     $game_party.last_item.object = @item
  2770.   end
  2771.   
  2772.   #--------------------------------------------------------------------------
  2773.   # alias method: on_item_cancel
  2774.   #--------------------------------------------------------------------------
  2775.   alias scene_battle_on_item_cancel_abe on_item_cancel
  2776.   def on_item_cancel
  2777.     scene_battle_on_item_cancel_abe
  2778.     @status_window.show
  2779.     @actor_command_window.show
  2780.     @status_aid_window.hide
  2781.   end
  2782.   
  2783.   #--------------------------------------------------------------------------
  2784.   # alias method: select_actor_selection
  2785.   #--------------------------------------------------------------------------
  2786.   alias scene_battle_select_actor_selection_abe select_actor_selection
  2787.   def select_actor_selection
  2788.     @status_aid_window.refresh
  2789.     scene_battle_select_actor_selection_abe
  2790.     @status_window.hide
  2791.     @skill_window.hide
  2792.     @item_window.hide
  2793.     @help_window.show
  2794.   end
  2795.   
  2796.   #--------------------------------------------------------------------------
  2797.   # alias method: on_actor_ok
  2798.   #--------------------------------------------------------------------------
  2799.   alias scene_battle_on_actor_ok_abe on_actor_ok
  2800.   def on_actor_ok
  2801.     $game_temp.battle_aid = nil
  2802.     scene_battle_on_actor_ok_abe
  2803.     @status_window.show
  2804.     if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
  2805.       @actor_command_window.visible = !@confirm_command_window.visible
  2806.     else
  2807.       @actor_command_window.show
  2808.     end
  2809.     @status_aid_window.hide
  2810.   end
  2811.   
  2812.   #--------------------------------------------------------------------------
  2813.   # alias method: on_actor_cancel
  2814.   #--------------------------------------------------------------------------
  2815.   alias scene_battle_on_actor_cancel_abe on_actor_cancel
  2816.   def on_actor_cancel
  2817.     BattleManager.actor.input.clear
  2818.     @status_aid_window.refresh
  2819.     $game_temp.battle_aid = nil
  2820.     scene_battle_on_actor_cancel_abe
  2821.     case @actor_command_window.current_symbol
  2822.     when :skill
  2823.       @skill_window.show
  2824.     when :item
  2825.       @item_window.show
  2826.     end
  2827.   end
  2828.   
  2829.   #--------------------------------------------------------------------------
  2830.   # alias method: select_enemy_selection
  2831.   #--------------------------------------------------------------------------
  2832.   alias scene_battle_select_enemy_selection_abe select_enemy_selection
  2833.   def select_enemy_selection
  2834.     @status_aid_window.refresh
  2835.     scene_battle_select_enemy_selection_abe
  2836.     @help_window.show
  2837.   end
  2838.   #--------------------------------------------------------------------------
  2839.   # alias method: on_enemy_ok
  2840.   #--------------------------------------------------------------------------
  2841.   alias scene_battle_on_enemy_ok_abe on_enemy_ok
  2842.   def on_enemy_ok
  2843.     $game_temp.battle_aid = nil
  2844.     scene_battle_on_enemy_ok_abe
  2845.   end
  2846.   
  2847.   #--------------------------------------------------------------------------
  2848.   # alias method: on_enemy_cancel
  2849.   #--------------------------------------------------------------------------
  2850.   alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
  2851.   def on_enemy_cancel
  2852.     BattleManager.actor.input.clear
  2853.     @status_aid_window.refresh
  2854.     $game_temp.battle_aid = nil
  2855.     scene_battle_on_enemy_cancel_abe
  2856.     if @skill_window.visible || @item_window.visible
  2857.       @help_window.show
  2858.     else
  2859.       @help_window.hide
  2860.     end
  2861.   end
  2862.   
  2863.   #--------------------------------------------------------------------------
  2864.   # alias method: battle_start
  2865.   #--------------------------------------------------------------------------
  2866.   alias scene_battle_battle_start_abe battle_start
  2867.   def battle_start
  2868.     scene_battle_battle_start_abe
  2869.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2870.     @party_command_window.deactivate
  2871.     if BattleManager.input_start
  2872.       command_fight
  2873.     else
  2874.       turn_start
  2875.     end
  2876.   end
  2877.   
  2878.   #--------------------------------------------------------------------------
  2879.   # overwrite method: turn_end
  2880.   #--------------------------------------------------------------------------
  2881.   def turn_end
  2882.     all_battle_members.each do |battler|
  2883.       battler.on_turn_end
  2884.       status_redraw_target(battler)
  2885.       @log_window.display_auto_affected_status(battler)
  2886.       @log_window.wait_and_clear
  2887.     end
  2888.     update_party_cooldowns if $imported["YEA-CommandParty"]
  2889.     BattleManager.turn_end
  2890.     process_event
  2891.     start_party_command_selection
  2892.     return if end_battle_conditions?
  2893.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2894.     if BattleManager.input_start
  2895.       @party_command_window.deactivate
  2896.       command_fight
  2897.     else
  2898.       @party_command_window.deactivate
  2899.       turn_start
  2900.     end
  2901.   end
  2902.   
  2903.   #--------------------------------------------------------------------------
  2904.   # new method: end_battle_conditions?
  2905.   #--------------------------------------------------------------------------
  2906.   def end_battle_conditions?
  2907.     return true if $game_party.members.empty?
  2908.     return true if $game_party.all_dead?
  2909.     return true if $game_troop.all_dead?
  2910.     return true if BattleManager.aborting?
  2911.     return false
  2912.   end
  2913.   
  2914.   #--------------------------------------------------------------------------
  2915.   # overwrite method: execute_action
  2916.   #--------------------------------------------------------------------------
  2917.   def execute_action
  2918.     @subject.sprite_effect_type = :whiten if YEA::BATTLE::FLASH_WHITE_EFFECT
  2919.     use_item
  2920.     @log_window.wait_and_clear
  2921.   end
  2922.   
  2923.   #--------------------------------------------------------------------------
  2924.   # overwrite method: apply_item_effects
  2925.   #--------------------------------------------------------------------------
  2926.   def apply_item_effects(target, item)
  2927.     if $imported["YEA-LunaticObjects"]
  2928.       lunatic_object_effect(:prepare, item, @subject, target)
  2929.     end
  2930.     target.item_apply(@subject, item)
  2931.     status_redraw_target(@subject)
  2932.     status_redraw_target(target) unless target == @subject
  2933.     @log_window.display_action_results(target, item)
  2934.     if $imported["YEA-LunaticObjects"]
  2935.       lunatic_object_effect(:during, item, @subject, target)
  2936.     end
  2937.     perform_collapse_check(target)
  2938.   end
  2939.   
  2940.   #--------------------------------------------------------------------------
  2941.   # overwite method: invoke_counter_attack
  2942.   #--------------------------------------------------------------------------
  2943.   def invoke_counter_attack(target, item)
  2944.     @log_window.display_counter(target, item)
  2945.     attack_skill = $data_skills[target.attack_skill_id]
  2946.     @subject.item_apply(target, attack_skill)
  2947.     status_redraw_target(@subject)
  2948.     status_redraw_target(target) unless target == @subject
  2949.     @log_window.display_action_results(@subject, attack_skill)
  2950.     perform_collapse_check(target)
  2951.     perform_collapse_check(@subject)
  2952.   end
  2953.   
  2954.   #--------------------------------------------------------------------------
  2955.   # new method: perform_collapse_check
  2956.   #--------------------------------------------------------------------------
  2957.   def perform_collapse_check(target)
  2958.     return if YEA::BATTLE::MSG_ADDED_STATES
  2959.     target.perform_collapse_effect if target.can_collapse?
  2960.     @log_window.wait
  2961.     @log_window.wait_for_effect
  2962.   end
  2963.   
  2964.   #--------------------------------------------------------------------------
  2965.   # overwrite method: show_attack_animation
  2966.   #--------------------------------------------------------------------------
  2967.   def show_attack_animation(targets)
  2968.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  2969.     wait_for_animation
  2970.     show_normal_animation(targets, @subject.atk_animation_id2, true)
  2971.   end
  2972.   
  2973.   #--------------------------------------------------------------------------
  2974.   # overwrite method: show_normal_animation
  2975.   #--------------------------------------------------------------------------
  2976.   def show_normal_animation(targets, animation_id, mirror = false)
  2977.     animation = $data_animations[animation_id]
  2978.     return if animation.nil?
  2979.     ani_check = false
  2980.     targets.each do |target|
  2981.       if ani_check && target.animation_id <= 0
  2982.         target.pseudo_ani_id = animation_id
  2983.       else
  2984.         target.animation_id = animation_id
  2985.       end
  2986.       target.animation_mirror = mirror
  2987.       ani_check = true if animation.to_screen?
  2988.     end
  2989.   end
  2990.   
  2991.   #--------------------------------------------------------------------------
  2992.   # overwrite method: process_action_end
  2993.   #--------------------------------------------------------------------------
  2994.   def process_action_end
  2995.     @subject.on_action_end
  2996.     status_redraw_target(@subject)
  2997.     @log_window.display_auto_affected_status(@subject)
  2998.     @log_window.wait_and_clear
  2999.     @log_window.display_current_state(@subject)
  3000.     @log_window.wait_and_clear
  3001.     BattleManager.judge_win_loss
  3002.   end
  3003.   
  3004.   #--------------------------------------------------------------------------
  3005.   # overwrite method: use_item
  3006.   #--------------------------------------------------------------------------
  3007.   def use_item
  3008.     item = @subject.current_action.item
  3009.     @log_window.display_use_item(@subject, item)
  3010.     @subject.use_item(item)
  3011.     status_redraw_target(@subject)
  3012.     if $imported["YEA-LunaticObjects"]
  3013.       lunatic_object_effect(:before, item, @subject, @subject)
  3014.     end
  3015.     process_casting_animation if $imported["YEA-CastAnimations"]
  3016.     targets = @subject.current_action.make_targets.compact rescue []
  3017.     show_animation(targets, item.animation_id) if show_all_animation?(item)
  3018.     targets.each {|target|
  3019.       if $imported["YEA-TargetManager"]
  3020.         target = alive_random_target(target, item) if item.for_random?
  3021.       end
  3022.       item.repeats.times { invoke_item(target, item) } }
  3023.     if $imported["YEA-LunaticObjects"]
  3024.       lunatic_object_effect(:after, item, @subject, @subject)
  3025.     end
  3026.   end
  3027.   
  3028.   #--------------------------------------------------------------------------
  3029.   # alias method: invoke_item
  3030.   #--------------------------------------------------------------------------
  3031.   alias scene_battle_invoke_item_abe invoke_item
  3032.   def invoke_item(target, item)
  3033.     show_animation([target], item.animation_id) if separate_ani?(target, item)
  3034.     if target.dead? != item.for_dead_friend?
  3035.       @subject.last_target_index = target.index
  3036.       return
  3037.     end
  3038.     scene_battle_invoke_item_abe(target, item)
  3039.   end
  3040.   
  3041.   #--------------------------------------------------------------------------
  3042.   # new method: show_all_animation?
  3043.   #--------------------------------------------------------------------------
  3044.   def show_all_animation?(item)
  3045.     return true if item.one_animation
  3046.     return false if $data_animations[item.animation_id].nil?
  3047.     return false unless $data_animations[item.animation_id].to_screen?
  3048.     return true
  3049.   end
  3050.   
  3051.   #--------------------------------------------------------------------------
  3052.   # new method: separate_ani?
  3053.   #--------------------------------------------------------------------------
  3054.   def separate_ani?(target, item)
  3055.     return false if item.one_animation
  3056.     return false if $data_animations[item.animation_id].nil?
  3057.     return false if $data_animations[item.animation_id].to_screen?
  3058.     return target.dead? == item.for_dead_friend?
  3059.   end
  3060.   
  3061.   #--------------------------------------------------------------------------
  3062.   # new method: status_redraw_target
  3063.   #--------------------------------------------------------------------------
  3064.   def status_redraw_target(target)
  3065.     return unless target.actor?
  3066.     @status_window.draw_item($game_party.battle_members.index(target))
  3067.   end
  3068.   
  3069.   #--------------------------------------------------------------------------
  3070.   # alias method: start_party_command_selection
  3071.   #--------------------------------------------------------------------------
  3072.   alias start_party_command_selection_abe start_party_command_selection
  3073.   def start_party_command_selection
  3074.     @status_window.refresh unless scene_changing?
  3075.     start_party_command_selection_abe
  3076.   end
  3077.   
  3078.   #--------------------------------------------------------------------------
  3079.   # overwrite method: refresh_status
  3080.   #--------------------------------------------------------------------------
  3081.   def refresh_status; return; end
  3082.   
  3083.   #--------------------------------------------------------------------------
  3084.   # new method: refresh_autobattler_status_window
  3085.   #--------------------------------------------------------------------------
  3086.   def refresh_autobattler_status_window
  3087.     for member in $game_party.battle_members
  3088.       next unless member.auto_battle?
  3089.       @status_window.draw_item(member.index)
  3090.     end
  3091.   end
  3092.   
  3093.   #--------------------------------------------------------------------------
  3094.   # new method: hide_extra_gauges
  3095.   #--------------------------------------------------------------------------
  3096.   def hide_extra_gauges
  3097.     # Made for compatibility
  3098.   end
  3099.   
  3100.   #--------------------------------------------------------------------------
  3101.   # new method: show_extra_gauges
  3102.   #--------------------------------------------------------------------------
  3103.   def show_extra_gauges
  3104.     # Made for compatibility
  3105.   end
  3106.   
  3107. end # Scene_Battle

  3108. #==============================================================================
  3109. #
  3110. # ¥ End of File
  3111. #
  3112. #==============================================================================
复制代码


老鹰

梦石
40
星屑
38049
在线时间
7128 小时
注册时间
2012-5-26
回帖
3306

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

发表于 2017-6-10 19:18:55 | 显示全部楼层
@stamina -= @actions[0].stamina_cost if @actions[0]
这样……?懒得看太懒了

点评

解决了_(:зゝ∠)_非常感谢!!!!!!!!!!  发表于 2017-6-10 20:57

评分

参与人数 1星屑 +250 收起 理由
RaidenInfinity + 250 认可答案

查看全部评分

回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部