Advertisement
Fomar0153

Fomar0153 - Customisable ATB/Stamina Based Battle System 1.3

Mar 22nd, 2012
7,689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 25.11 KB | None | 0 0
  1. =begin
  2. Customisable ATB/Stamina Based Battle System Script
  3. by Fomar0153
  4. Version 1.3
  5. ----------------------
  6. Notes
  7. ----------------------
  8. No requirements
  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 Restored turn functionality and a glitch
  20.            related to message windows
  21. 1.1 -> 1.2 Added CTB related options
  22.            Added the ability to pass a turn
  23.            Fixed a bug which caused an error on maps
  24.            with no random battles
  25.            Added options for turn functionality to be based on time
  26.            or number of actions
  27.            Added the ability to change the bar colours based on states
  28. 1.2 -> 1.3 Fixed a bug when escaping using CTB mode
  29.            
  30. ----------------------
  31. Known bugs
  32. ----------------------
  33. None
  34. =end
  35. module CBS
  36.  
  37.   MAX_STAMINA = 1000
  38.   RESET_STAMINA = true
  39.  
  40.   # If ATB is set to false then the bars won't appear and
  41.   # the pauses where the bars would be filling up are removed
  42.   # effectively turning this into a CTB system
  43.   ATB = false
  44.   SAMINA_GAUGE_NAME = "ATB"
  45.   ENABLE_PASSING = true
  46.   PASSING_COST = 200
  47.  
  48.   # If seconds per turn is set to 0 then a turn length will be
  49.   # decided on number of actions
  50.   TURN_LENGTH = 4
  51.  
  52.   ESCAPE_COST = 500
  53.   # If reset stamina is set to true then all characters
  54.   # will start with a random amount of stamina capped at
  55.   # the percentage you set.
  56.   # If reset stamina is set to false then this just
  57.   # affects enemies.
  58.   STAMINA_START_PERCENT = 20
  59.  
  60.   # Default skill cost
  61.   # If you want to customise skill costs do it like this
  62.   # SKILL_COST[skill_id] = cost
  63.   SKILL_COST = []
  64.   SKILL_COST[0] = 1000
  65.   # Attack
  66.   SKILL_COST[1] = 1000
  67.   # Guard
  68.   SKILL_COST[2] = 500
  69.   ITEM_COST = 1000
  70.  
  71.   # If you prefer to have states handle agility buffs then set STATES_HANDLE_AGI to true
  72.   STATES_HANDLE_AGI = false
  73.   # In the following section mult means the amount you multiply stamina gains by
  74.   # if STATES_HANDLE_AGI is set to true then it is only used to determine bar color
  75.   # with debuffs taking precedence over buffs
  76.   STAMINA_STATES = []
  77.   # Default colour
  78.   STAMINA_STATES[0] = [1,31,32]
  79.   # in the form
  80.   # STAMINA_STATES[STATE_ID] = [MULT,FILL_COLOUR,EMPTY_COLOR]
  81.   # e.g. Haste
  82.   STAMINA_STATES[10] = [2,4,32]
  83.   # e.g. Stop  
  84.   STAMINA_STATES[11] = [0,8,32]
  85.   # e.g. Slow  
  86.   STAMINA_STATES[12] = [0.5,8,32]
  87.  
  88.   #--------------------------------------------------------------------------
  89.   # ● New Method stamina_gain
  90.   #--------------------------------------------------------------------------
  91.   def self.stamina_gain(battler)
  92.     return ((2 + [0, battler.agi / 10].max) * self.stamina_mult(battler)).to_i
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● New Method stamina_gain
  96.   #--------------------------------------------------------------------------
  97.   def self.stamina_mult(battler)
  98.     return 1 if STATES_HANDLE_AGI
  99.     mult = STAMINA_STATES[0][0]
  100.     for state in battler.states
  101.       unless STAMINA_STATES[state.id].nil?
  102.         mult *= STAMINA_STATES[state.id][0]
  103.       end
  104.     end
  105.     return mult
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● New Method stamina_gain
  109.   #--------------------------------------------------------------------------
  110.   def self.stamina_colors(battler)
  111.     colors = STAMINA_STATES[0]
  112.     for state in battler.states
  113.       unless STAMINA_STATES[state.id].nil?
  114.         if STAMINA_STATES[state.id][0] < colors[0] or colors[0] == 1
  115.           colors = STAMINA_STATES[state.id]
  116.         end
  117.       end
  118.     end
  119.     return colors
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● New Method stamina_start
  123.   #--------------------------------------------------------------------------
  124.   def self.stamina_start(battler)
  125.     battler.stamina = rand(MAX_STAMINA * STAMINA_START_PERCENT / 100)
  126.   end
  127. end
  128.  
  129. class Game_BattlerBase
  130.   #--------------------------------------------------------------------------
  131.   # ● New attr_accessor
  132.   #--------------------------------------------------------------------------
  133.   attr_accessor :stamina
  134.   #--------------------------------------------------------------------------
  135.   # ● Aliases initialize
  136.   #--------------------------------------------------------------------------
  137.   alias cbs_initialize initialize
  138.   def initialize
  139.     cbs_initialize
  140.     @stamina = 0
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● New Method stamina_rate
  144.   #--------------------------------------------------------------------------
  145.   def stamina_rate
  146.     @stamina.to_f / CBS::MAX_STAMINA
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● New Method stamina_rate
  150.   #--------------------------------------------------------------------------
  151.   def stamina_gain
  152.     return if not movable?
  153.     @stamina = [CBS::MAX_STAMINA, @stamina + CBS.stamina_gain(self)].min
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● New Method stamina_color
  157.   #--------------------------------------------------------------------------
  158.   def stamina_color
  159.     for state in @states
  160.       unless CBS::STAMINA_STATES[state].nil?
  161.         return STAMINA_STATES[state]
  162.       end
  163.     end
  164.     return STAMINA_STATES[0]
  165.   end
  166. end
  167.  
  168. #--------------------------------------------------------------------------
  169. # ● New Class Window_PartyHorzCommand
  170. #--------------------------------------------------------------------------
  171. class Window_PartyHorzCommand < Window_HorzCommand
  172.   #--------------------------------------------------------------------------
  173.   # ● New Method initialize
  174.   #--------------------------------------------------------------------------
  175.   def initialize
  176.     super(0, 0)
  177.     self.openness = 0
  178.     deactivate
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ● New Method window_width
  182.   #--------------------------------------------------------------------------
  183.   def window_width
  184.     return Graphics.width
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● New Method visible_line_number
  188.   #--------------------------------------------------------------------------
  189.   def visible_line_number
  190.     return 1
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ● New Method make_command_list
  194.   #--------------------------------------------------------------------------
  195.   def make_command_list
  196.     add_command(Vocab::fight,  :fight)
  197.     add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● New Method setup
  201.   #--------------------------------------------------------------------------
  202.   def setup
  203.     clear_command_list
  204.     make_command_list
  205.     refresh
  206.     select(0)
  207.     activate
  208.     open
  209.   end
  210. end
  211.  
  212. class Scene_Battle < Scene_Base
  213.   #--------------------------------------------------------------------------
  214.   # ● Rewrote update
  215.   #--------------------------------------------------------------------------
  216.   def update
  217.     super
  218.     if (CBS::ENABLE_PASSING and @actor_command_window.active) and Input.press?(:A)
  219.       command_pass
  220.     end
  221.     if BattleManager.in_turn? and !inputting?
  222.       while @subject.nil? and !CBS::ATB
  223.         process_stamina
  224.       end
  225.       if CBS::ATB
  226.         process_stamina
  227.       end
  228.       process_event
  229.       process_action
  230.     end
  231.     BattleManager.judge_win_loss
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # ● New Method inputting?
  235.   #--------------------------------------------------------------------------
  236.   def inputting?
  237.     return @actor_command_window.active || @skill_window.active ||
  238.       @item_window.active || @actor_window.active || @enemy_window.active
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● New Method process_stamina
  242.   #--------------------------------------------------------------------------
  243.   def process_stamina
  244.     @actor_command_window.close
  245.     return if @subject
  246.     BattleManager.advance_turn
  247.     all_battle_members.each do |battler|
  248.       battler.stamina_gain
  249.     end
  250.     @status_window.refresh
  251.     if @status_window.close?
  252.       @status_window.open
  253.     end
  254.     if BattleManager.escaping?
  255.       $game_party.battle_members.each do |battler|
  256.         if battler.stamina < CBS::MAX_STAMINA
  257.           $game_troop.members.each do |enemy|
  258.             if enemy.stamina == CBS::MAX_STAMINA
  259.               enemy.make_actions
  260.               @subject = enemy
  261.             end
  262.           end
  263.           return
  264.         end
  265.       end
  266.       unless BattleManager.process_escape
  267.         $game_party.battle_members.each do |actor|
  268.           actor.stamina -= CBS::ESCAPE_COST
  269.         end
  270.         BattleManager.set_escaping(false) unless CBS::ATB
  271.       end
  272.     end
  273.     all_battle_members.each do |battler|
  274.       if battler.stamina == CBS::MAX_STAMINA
  275.         battler.make_actions
  276.         @subject = battler
  277.         if @subject.inputable? and battler.is_a?(Game_Actor)
  278.           @actor_command_window.setup(@subject)
  279.           BattleManager.set_actor(battler)
  280.         end
  281.         return
  282.       end
  283.     end
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ● Rewrote create_info_viewport
  287.   #--------------------------------------------------------------------------
  288.   def create_info_viewport
  289.     @info_viewport = Viewport.new
  290.     @info_viewport.rect.y = Graphics.height - @status_window.height - 48
  291.     @info_viewport.rect.height = @status_window.height + 48
  292.     @info_viewport.z = 100
  293.     @info_viewport.ox = 0
  294.     @status_window.viewport = @info_viewport
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● Rewrote create_party_command_window
  298.   #--------------------------------------------------------------------------
  299.   def create_party_command_window
  300.     @party_command_window = Window_PartyHorzCommand.new
  301.     @party_command_window.viewport = @info_viewport
  302.     @party_command_window.set_handler(:fight,  method(:command_fight))
  303.     @party_command_window.set_handler(:escape, method(:command_escape))
  304.     @party_command_window.unselect
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # ● Rewrote create_status_window
  308.   #--------------------------------------------------------------------------
  309.   def create_status_window
  310.     @status_window = Window_BattleStatus.new
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ● Rewrote create_actor_command_window
  314.   #--------------------------------------------------------------------------
  315.   def create_actor_command_window
  316.     @actor_command_window = Window_ActorCommand.new
  317.     @actor_command_window.viewport = @info_viewport
  318.     @actor_command_window.set_handler(:attack, method(:command_attack))
  319.     @actor_command_window.set_handler(:skill,  method(:command_skill))
  320.     @actor_command_window.set_handler(:guard,  method(:command_guard))
  321.     @actor_command_window.set_handler(:item,   method(:command_item))
  322.     @actor_command_window.set_handler(:cancel, method(:prior_command))
  323.     @actor_command_window.x = Graphics.width - 128
  324.     @actor_command_window.y = 48
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● Destroyed update_info_viewport
  328.   #--------------------------------------------------------------------------
  329.   def update_info_viewport
  330.     # no thank you
  331.   end
  332. #--------------------------------------------------------------------------
  333.   # ● Rewrote start_party_command_selection
  334.   #--------------------------------------------------------------------------
  335.   def start_party_command_selection
  336.     unless scene_changing?
  337.       refresh_status
  338.       @status_window.unselect
  339.       @status_window.open
  340.       if BattleManager.input_start
  341.         @actor_command_window.close
  342.         @party_command_window.setup
  343.       else
  344.         @party_command_window.deactivate
  345.         turn_start
  346.       end
  347.     end
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # ● Rewrote start_actor_command_selection
  351.   #--------------------------------------------------------------------------
  352.   def start_actor_command_selection
  353.     @party_command_window.close
  354.     BattleManager.set_escaping(false)
  355.     turn_start
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # ● Rewrote prior_command
  359.   #--------------------------------------------------------------------------
  360.   def prior_command
  361.     start_party_command_selection
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ● Rewrote process_action
  365.   #--------------------------------------------------------------------------
  366.   def process_action
  367.     return if scene_changing?
  368.     if !@subject || !@subject.current_action
  369.       @subject = BattleManager.next_subject
  370.     end
  371.     if Input.trigger?(:B) and (@subject == nil)
  372.       start_party_command_selection
  373.     end
  374.     return unless @subject
  375.     if @subject.current_action
  376.       @subject.current_action.prepare
  377.       if @subject.current_action.valid?
  378.         @status_window.open
  379.         execute_action
  380.       end
  381.       @subject.remove_current_action
  382.       refresh_status
  383.       @log_window.display_auto_affected_status(@subject)
  384.       @log_window.wait_and_clear
  385.     end
  386.     process_action_end unless @subject.current_action
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # ● Aliases use_item
  390.   #--------------------------------------------------------------------------
  391.   alias cbs_use_item use_item
  392.   def use_item
  393.     cbs_use_item
  394.     @subject.stamina_loss
  395.   end
  396.   #--------------------------------------------------------------------------
  397.   # ● Rewrote turn_end
  398.   #--------------------------------------------------------------------------
  399.   def turn_end
  400.     all_battle_members.each do |battler|
  401.       battler.on_turn_end
  402.       refresh_status
  403.       @log_window.display_auto_affected_status(battler)
  404.       @log_window.wait_and_clear
  405.     end
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● Rewrote command_fight
  409.   #--------------------------------------------------------------------------
  410.   def command_fight
  411.     BattleManager.next_command
  412.     start_actor_command_selection
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● Rewrote command_escape
  416.   #--------------------------------------------------------------------------
  417.   def command_escape
  418.     @party_command_window.close
  419.     BattleManager.set_escaping(true)
  420.     turn_start
  421.   end
  422.   #--------------------------------------------------------------------------
  423.   # ● New method command_pass
  424.   #--------------------------------------------------------------------------
  425.   def command_pass
  426.     BattleManager.actor.stamina -= CBS::PASSING_COST
  427.     BattleManager.clear_actor
  428.     @subject = nil
  429.     turn_start
  430.     @actor_command_window.active = false
  431.     @actor_command_window.close
  432.   end
  433.   #--------------------------------------------------------------------------
  434.   # ● Destroyed next_command
  435.   #--------------------------------------------------------------------------
  436.   def next_command
  437.     # no thank you
  438.   end
  439. end
  440.  
  441. class Window_BattleStatus < Window_Selectable
  442.   #--------------------------------------------------------------------------
  443.   # ● Rewrote initialize
  444.   #--------------------------------------------------------------------------
  445.   def initialize
  446.     super(0, 48, Graphics.width, window_height) if CBS::ATB
  447.     super(0, 48, Graphics.width - 128, window_height) unless CBS::ATB
  448.     refresh
  449.     self.openness = 0
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ● Rewrote window_width
  453.   #--------------------------------------------------------------------------
  454.   def window_width
  455.     Graphics.width - 128
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # ● Rewrote refresh
  459.   #--------------------------------------------------------------------------
  460.   def refresh
  461.     contents.clear
  462.     draw_all_items
  463.   end
  464.   #--------------------------------------------------------------------------
  465.   # ● Rewrote draw_item
  466.   #--------------------------------------------------------------------------
  467.   def draw_item(index)
  468.     actor = $game_party.battle_members[index]
  469.     draw_basic_area(basic_area_rect(index), actor)
  470.     draw_gauge_area(gauge_area_rect(index), actor)
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● Rewrote basic_area_rect
  474.   #--------------------------------------------------------------------------
  475.   def basic_area_rect(index)
  476.     rect = item_rect_for_text(index)
  477.     rect.width -= gauge_area_width + 10
  478.     rect
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # ● Rewrote gauge_area_rect
  482.   #--------------------------------------------------------------------------
  483.   def gauge_area_rect(index)
  484.     rect = item_rect_for_text(index)
  485.     rect.x += rect.width - gauge_area_width #- 128 ####
  486.     rect.width = gauge_area_width
  487.     rect
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # ● Rewrote gauge_area_width
  491.   #--------------------------------------------------------------------------
  492.   def gauge_area_width
  493.     return 220 + 128 if CBS::ATB
  494.     return 220
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # ● Rewrote draw_gauge_area_with_tp
  498.   #--------------------------------------------------------------------------
  499.   def draw_gauge_area_with_tp(rect, actor)
  500.     draw_actor_hp(actor, rect.x + 0, rect.y, 72)
  501.     draw_actor_mp(actor, rect.x + 82, rect.y, 64)
  502.     draw_actor_tp(actor, rect.x + 156, rect.y, 64)
  503.     draw_actor_stamina(actor, rect.x + 240, rect.y, 108) if CBS::ATB
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● Rewrote draw_gauge_area_without_tp
  507.   #--------------------------------------------------------------------------
  508.   def draw_gauge_area_without_tp(rect, actor)
  509.     draw_actor_hp(actor, rect.x + 0, rect.y, 134)
  510.     draw_actor_mp(actor, rect.x + 144,  rect.y, 76)
  511.     draw_actor_stamina(actor, rect.x + 240, rect.y, 108) if CBS::ATB
  512.   end
  513.   #--------------------------------------------------------------------------
  514.   # ● New Method draw_actor_stamina
  515.   #--------------------------------------------------------------------------
  516.   def draw_actor_stamina(actor, x, y, width = 124)
  517.     draw_gauge(x, y, width, actor.stamina_rate, text_color(CBS.stamina_colors(actor)[2]),text_color(CBS.stamina_colors(actor)[1]))
  518.     change_color(system_color)
  519.     draw_text(x, y, 30, line_height, CBS::SAMINA_GAUGE_NAME)
  520.   end
  521. end
  522.  
  523. class Window_BattleSkill < Window_SkillList
  524.   #--------------------------------------------------------------------------
  525.   # ● Rewrote initialize
  526.   #--------------------------------------------------------------------------
  527.   def initialize(help_window, info_viewport)
  528.     y = help_window.height
  529.     super(0, y, Graphics.width, info_viewport.rect.y - y + 48)
  530.     self.visible = false
  531.     @help_window = help_window
  532.     @info_viewport = info_viewport
  533.   end
  534. end
  535.  
  536. class Window_BattleActor < Window_BattleStatus
  537.   #--------------------------------------------------------------------------
  538.   # ● Rewrote initialize
  539.   #--------------------------------------------------------------------------
  540.   def initialize(info_viewport)
  541.     super()
  542.     self.y = info_viewport.rect.y + 48
  543.     self.visible = false
  544.     self.openness = 255
  545.     @info_viewport = info_viewport
  546.   end
  547. end
  548.  
  549. class Window_BattleEnemy < Window_Selectable
  550.   # ● Rewrote initialize
  551.   #--------------------------------------------------------------------------
  552.   def initialize(info_viewport)
  553.     super(0, info_viewport.rect.y + 48, window_width, fitting_height(4))
  554.     refresh
  555.     self.visible = false
  556.     @info_viewport = info_viewport
  557.   end
  558. end
  559.  
  560. class Window_BattleItem < Window_ItemList
  561.   #--------------------------------------------------------------------------
  562.   # ● Rewrote initialize
  563.   #--------------------------------------------------------------------------
  564.   def initialize(help_window, info_viewport)
  565.     y = help_window.height
  566.     super(0, y, Graphics.width, info_viewport.rect.y - y + 48)
  567.     self.visible = false
  568.     @help_window = help_window
  569.     @info_viewport = info_viewport
  570.   end
  571. end
  572.  
  573. module BattleManager
  574.   #--------------------------------------------------------------------------
  575.   # ● Rewrote setup
  576.   #--------------------------------------------------------------------------
  577.   def self.setup(troop_id, can_escape = true, can_lose = false)
  578.     init_members
  579.     $game_troop.setup(troop_id)
  580.     @can_escape = can_escape
  581.     @can_lose = can_lose
  582.     make_escape_ratio
  583.     @escaping = false
  584.     @turn_counter = 0
  585.     @actions_per_turn = $game_party.members.size + $game_troop.members.size
  586.     ($game_party.members + $game_troop.members).each do |battler|
  587.       if battler.is_a?(Game_Enemy) or CBS::RESET_STAMINA
  588.         CBS.stamina_start(battler)
  589.       end
  590.     end
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # ● New Method set_escaping
  594.   #--------------------------------------------------------------------------
  595.   def self.set_escaping(escaping)
  596.     @escaping = escaping
  597.   end
  598.   #--------------------------------------------------------------------------
  599.   # ● New Method escaping?
  600.   #--------------------------------------------------------------------------
  601.   def self.escaping?
  602.     return @escaping
  603.   end
  604.   #--------------------------------------------------------------------------
  605.   # ● Rewrote turn_start
  606.   #--------------------------------------------------------------------------
  607.   def self.turn_start
  608.     @phase = :turn
  609.     clear_actor
  610.     $game_troop.increase_turn if $game_troop.turn_count == 0
  611.   end
  612.   #--------------------------------------------------------------------------
  613.   # ● New Method set_actor
  614.   #--------------------------------------------------------------------------
  615.   def self.set_actor(actor)
  616.     @actor_index = actor.index
  617.   end
  618.   #--------------------------------------------------------------------------
  619.   # ● New Increase action counter
  620.   #--------------------------------------------------------------------------
  621.   def self.add_action
  622.     return if @actions_per_turn.nil?
  623.     @turn_counter += 1
  624.     if @turn_counter == @actions_per_turn and CBS::TURN_LENGTH == 0
  625.       $game_troop.increase_turn
  626.       SceneManager.scene.turn_end
  627.       @turn_counter = 0
  628.     end
  629.   end
  630.   #--------------------------------------------------------------------------
  631.   # ● New Method advance_turn
  632.   #--------------------------------------------------------------------------
  633.   def self.advance_turn
  634.     return if CBS::TURN_LENGTH == 0
  635.     @turn_counter += 1
  636.     if @turn_counter == 60 * CBS::TURN_LENGTH
  637.       $game_troop.increase_turn
  638.       SceneManager.scene.turn_end
  639.       @turn_counter = 0
  640.     end
  641.   end
  642. end
  643.  
  644. class Game_Battler < Game_BattlerBase
  645.   #--------------------------------------------------------------------------
  646.   # ● Rewrote on_turn_end
  647.   #--------------------------------------------------------------------------
  648.   def on_turn_end
  649.     @result.clear
  650.     regenerate_all
  651.     update_state_turns
  652.     update_buff_turns
  653.     remove_states_auto(2)
  654.   end
  655.   #--------------------------------------------------------------------------
  656.   # ● New Method on_turn_end
  657.   #--------------------------------------------------------------------------
  658.   def stamina_loss
  659.     if self.actor?
  660.       @stamina -= input.stamina_cost
  661.     else
  662.       @stamina -= @actions[0].stamina_cost
  663.     end
  664.     BattleManager.add_action
  665.   end
  666. end
  667.  
  668. class Game_Actor < Game_Battler
  669.   #--------------------------------------------------------------------------
  670.   # ● Rewrote input
  671.   #--------------------------------------------------------------------------
  672.   def input
  673.     if @actions[@action_input_index] == nil
  674.       @actions[@action_input_index] = Game_Action.new(self)
  675.     end
  676.     return @actions[@action_input_index]
  677.   end
  678. end
  679.  
  680. class Game_Action
  681.   #--------------------------------------------------------------------------
  682.   # ● New Method stamina_cost
  683.   #--------------------------------------------------------------------------
  684.   def stamina_cost
  685.     if @item.is_skill?
  686.       return CBS::SKILL_COST[item.id] if CBS::SKILL_COST[item.id]
  687.       return CBS::SKILL_COST[0]
  688.     end
  689.     return CBS::ITEM_COST if @item.is_item?
  690.     return CBS::MAX_STAMINA
  691.   end
  692. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement