All pastes #20137 Raw Edit

Someone

public ruby v1 · immutable
#20137 ·published 2005-08-16 06:22 UTC
rendered paste body
class Window_Base  def draw_actor_atb(actor, x, y, width = 146, height = 15)    bg = Color.new(  0,   0,   0, 160)    c1 = Color.new(255,   0,   0, 0)    c2 = Color.new(255, 255,   0, 160)    self.contents.fill_rect(x, y, width, height, bg)    width2 = width * actor.time / 10000    gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2)  endendclass Scene_Battle  alias atbv1_update update  def update    unless @atb_initialized      @atb = Game_ATB.new      @atb_initialized = true    end    @atb.update    atbv1_update  endendclass Game_Battler  attr_accessor :timeendclass Window_BattleStatus < Window_Base  alias atbv1_refresh refresh  def refresh    atbv1_refresh    for i in 0...$game_party.actors.size      actor = $game_party.actors[i]      actor_x = i * 160 + 4      actor.time = 10000 unless actor.time      draw_actor_atb(actor, actor_x, 96, 120)    end  endendclass Game_ATB  def initialize    @speed = 10    @last_time = 0  end  def update    time = Graphics.frame_count / (Graphics.frame_rate / @speed)    if @last_time < time      agi = 0      count = 0      for battler in  $game_troop.enemies + $game_party.actors        agi += battler.agi        count += 1      end      for battler in $game_troop.enemies + $game_party.actors        battler.time -= (battler.agi / (agi / count) * 100).to_i        if battler.time <= 0          # It's this battler's turn...          reset        end      end    end    @last_time = time  end  def reset    for battler in $game_troop.enemies + $game_party.actors      battler.time = 10000    end  endend