Advertisement
QuasiXi

[GTBS] Atb Changes

Feb 12th, 2014
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.71 KB | None | 0 0
  1. =begin
  2.  Changes to [GTBS] Scene_Battle / [GTBS] Game_Battler
  3.  ATB Update 1.0
  4.  Change list:
  5.  - Changed how skill cast time works, now it waits a specific amount of turns that pass
  6.    example: a skill cast time set to 1, would activate after the next battlers turn
  7.             while a skill with cast time 5, would w8 until the next 5 battlers pass.
  8.  
  9.    setup skill_wait with, see more in [GTBS] Skill Setup
  10.    skill_wait[Cast_time, ATB_recover, End_Turn]
  11.  - Haven't tested if enemies cast time works.
  12.    
  13.  - Added haste/slow into atb math
  14.    haste speeds up atb and slow slows it down.
  15.    Look at [GTBS] General Settings for HASTE_ID and SLOW_ID
  16.    
  17.   By Quasi (http://quasixi.wordpress.com/)
  18.   - 2/12/14
  19. =end
  20. module Quasi
  21.   # Change values to the speed to increase/decrease while they have
  22.   # Haste or Slow
  23.   ATB_HASTE   = 1.5
  24.   ATB_SLOW    = 0.5
  25. end
  26.  
  27.  
  28. class Scene_Battle_TBS
  29.   @atb_updated = false
  30.  
  31.   #----------------------------------------------------------------------------
  32.   # Process Battlers - Main battler update thread
  33.   #----------------------------------------------------------------------------
  34.   def process_atb
  35.     while @active_battler == nil
  36.       process_forced_action
  37.       for battler in tactics_all
  38.         battler.check_casting
  39.       end
  40.       return if @using_skill
  41.       @use_spell = next_wait_skill(tactics_all)
  42.       return unless @use_spell.empty?
  43.       next_battler = next_atb_battler(tactics_all)
  44.       if next_battler
  45.         next_battler.reset_atb
  46.         set_active_battler(next_battler)
  47.         @atb_updated = false
  48.         #return
  49.       else
  50.         update_atb(tactics_all)
  51.       end
  52.     end
  53.   end
  54.  
  55.   #--------------------------------------------------------------------------
  56.   #* update_atb
  57.   #-------------------------------------------------------------------------
  58.   def update_atb(list_battlers)
  59.     @scasting = [] if @scasting == nil
  60.     for battler in list_battlers
  61.       next if battler.paralyzed? or battler.sleeping? or battler.knocked_out? or battler.hidden?
  62.       battler.atb_update
  63.       if battler.casting? and !battler.muted?
  64.         if battler.enemy?
  65.           id = 10 + battler.index #enemies start at array index 10+
  66.         else
  67.           id = battler.id
  68.         end
  69.         if @scasting[id] == nil or @scasting[battler.id] < 0
  70.           @scasting[id] = GTBS::skill_wait(battler.skill_cast[0].id)[0]
  71.         end
  72.         if @scasting[id] <= 0
  73.           battler.up_cast(false, 0)
  74.         end
  75.         if @atb_updated == false
  76.           battler.up_cast(false, @scasting[id])
  77.           @scasting[id] -= 1
  78.           @atb_updated = true
  79.         end
  80.       end
  81.     end
  82.   end
  83. end
  84.  
  85. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  86. # GTBS Game Battler edits - Part 1 (New/revised variables/methods)
  87. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
  88. class Game_Battler < Game_BattlerBase
  89.   #--------------------------------------------------------------------------
  90.   # * Updates current casting time, or resets it
  91.   #--------------------------------------------------------------------------
  92.   def up_cast(reset = false, cast = 0)
  93.     if cast > 0
  94.       @skillcasting = cast
  95.     else
  96.       @skillcasting = 0
  97.     end
  98.   end
  99.  
  100.   #--------------------------------------------------------------------------
  101.   # Update ATB using AGI for the actor
  102.   #--------------------------------------------------------------------------
  103.   def promptness
  104.     agi = self.agi
  105.     cast = casting? ? GTBS.skill_wait(@skill_cast[0].id)[1] / 100.0 : 1.0
  106.     slow = is_slow? ? Quasi::ATB_SLOW : 1.0
  107.     haste = is_haste? ? Quasi::ATB_HASTE : 1.0
  108.     atb = agi * cast * slow * haste
  109.     return atb
  110.   end
  111. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement