All pastes #24079 Raw Edit

Untitled

public ruby v1 · immutable
#24079 ·published 2005-09-28 01:13 UTC
rendered paste body
  #--------------------------------------------------------------------------  # * Phase 1, Step 1 - Update Battler Counts, Create Index  #--------------------------------------------------------------------------  def phase1_step1    # Create an array of every battler    @battlers = $game_party.actors + $game_troop.enemies    # Define local variables    counts = []    index = []    # For each battler    for battler in @battlers      # If the battler is alive      unless battler.dead?        # Add counts until max to array        counts.push((10000.0 - battler.count) / battler.speed)      end    end    # For each battler    for i in 1...@battlers.size      # If the battler is alive      unless @battlers[i].dead?        # Count        @battlers[i].count += counts.min * @battlers[i].speed        # Add battler to index if it's active        index.push(i) if @battlers[i].count > 9999      end    end    # Sort index    @index = index.sort {|x,y| @battlers[x].count <=> @battlers[y].count }    # Go to step 2    @step = 2  end