Advertisement
Fomar0153

Fomar0153 - Customisable ATB/Stamina Based Battle System

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