Potrzebuję pomocy z systemem walki
Aktualny czas: 28-04-26, 23:08 Witaj! Przejdź do zakładki Logowanie lub Rejestracja


Wątek zamknięty 
[XP] Potrzebuję pomocy z systemem walki
michalek318 Offline
*


Liczba postów: 14
Dołączył: 30-11-15

Pomógł: 1



Post: #1
Potrzebuję pomocy z systemem walki

http://rmrk.net/index.php?topic=35253.0 - Asan'Tear Battle System
Mam problem z tymi animacjami. Chciałbym, żeby nie było tych napisów, ani efektów na postaci np. gdy nie żyje.
Bardzo proszę o pomoc.
01-12-15 01:00
Znajdź wszystkie posty użytkownika
"Pomógł" przyznał(a):
Ayene Offline
*


Liczba postów: 758
Dołączył: 09-04-13

Pomógł: 112



Post: #2
RE: Potrzebuję pomocy z systemem walki

Podmień cały skrypt na poniższy:
#=============================================================================
#
# ** Asan'Tear Battle System
#
#-----------------------------------------------------------------------------
#
# By Ryex
# V 1.25
#
#-----------------------------------------------------------------------------
#
# Features
#
#  * New lay out for the DBS
#  * Easy to use battler animation for actors and enemies
#  * Animated windows
#  * New staus bar with Hp/Sp bars
#
#-----------------------------------------------------------------------------
#
# Instructions
#
# Place in a new script above main then fill out the Configuration.
#
# To use the Animated Battlers Feature simply place the pictures you want
# to use in the Battlers folder they should be named like so
#
# IDLE POSE #the standing there pose that is shown the vast majority of the time
# <Ballter name>.png #or JPG   frame 0
# <Ballter name>1.png #or JPG  frame 1
# <Ballter name>2.png #or JPG  frame 2
# <Ballter name>3.png #or JPG  frame 3
#
#  and so on for how ever many frames you want for the idle state
#  for the other states simply add a suffix befor the frame number like so
#
# ATTACK POSE
# <Ballter name>_atk.png #or JPG   frame 0
# <Ballter name>_atk1.png #or JPG  frame 1
# <Ballter name>_atk2.png #or JPG  frame 2
# <Ballter name>_atk3.png #or JPG  frame 3
# ECT.
#
# SKILL POSE
# <Ballter name>_skl.png #or JPG   frame 0
# <Ballter name>_skl1.png #or JPG  frame 1
# <Ballter name>_skl2.png #or JPG  frame 2
# <Ballter name>_skl3.png #or JPG  frame 3
# ECT.
#
# ITEM POSE
# <Ballter name>_itm.png #or JPG   frame 0
# ECT.
#
# DEFEND POSE
# <Ballter name>_def.png #or JPG   frame 0
# ECT.
#
#==============================================================================
# Global indicating that AnTBS is installed
$antbs = true

module RyexCFG
  BATTLE_MENU_ICONS = []
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

  # To change the icons in the actor command window change the names below
  BATTLE_MENU_ICONS[1] = "Attack" #Icon name for the Attack option on the battle menu
  BATTLE_MENU_ICONS[2] = "Skill" #Icon name for the Skill option on the battle menu
  BATTLE_MENU_ICONS[3] = "Defend"#Icon name for the Defend option on the battle menu
  BATTLE_MENU_ICONS[4] = "BattleItem" #Icon name for the Item option on the battle menu

  # how many REAL frames that should be skipped before updating the battlers while
  # in idle mode, note that using anything below 2 is not recommended and that
  # using low values can increase lag dramatically

  B_SPEED = 8

  BATTLE_NAMES_FONT = 'Papyrus'
  BATTLE_HP_SP_FONT = 'Geometrix'

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end


#==============================================================================
#  New methods added to Bitmap
#==============================================================================
class Bitmap
  def draw_bar_ryex(x, y, w, h, p, c)
    gray = Color.new(100, 100, 100)
    white = Color.new(255, 255, 255)
    fill_rect(x, y, w, h, Color.new(0, 0, 0))
    for i in 0...(h - 1)
      gr = gray.red * i / (h - 1)
      gg = gray.green * i / (h - 1)
      gb = gray.blue * i / (h - 1)
      fill_rect(x + 1, y + h - i - 1, w - 2, 1, Color.new(gr, gg, gb))
    end
    for i in 0...(h / 2)
      r = c.red * i / (h / 2)
      g = c.green * i / (h / 2)
      b = c.blue * i / (h / 2)
      fill_rect(x + 1, y + h - i - 1, p * (w - 2), 1, Color.new(r, g, b))
    end
    for i in 0...(h / 2 - 1)
      r = c.red + (white.red - c.red) * i / (h / 2 - 1)
      g = c.green + (white.green - c.green) * i / (h / 2 - 1)
      b = c.blue + (white.blue - c.blue) * i / (h / 2 - 1)
      fill_rect(x + 1, y + (h / 2 - 1) - i, p * (w - 2), 1, Color.new(r, g, b))
    end
  end
end

class Sprite
  #--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
alias moving_sprite_init initialize
def initialize(viewport = nil)
   moving_sprite_init(viewport)
   @dest_x, @dest_y = self.x, self.y
   @tot_x = @tot_y = 0
  end
  #--------------------------------------------------------------------------
  # * moving? - checks if the window needs moving
  #--------------------------------------------------------------------------
  def moving?
    return self.x != @dest_x || self.y != @dest_y
  end
  #--------------------------------------------------------------------------
  # * Move - prepares variables and sets off the moving process
  #--------------------------------------------------------------------------  
  def move(dest_x, dest_y)
    @dest_x = dest_x
    @dest_y = dest_y
    @tot_x = (dest_x - self.x).abs
    @tot_y = (dest_y - self.y).abs
  end
  #--------------------------------------------------------------------------
  # Move Windows - the actual processing of movement
  #--------------------------------------------------------------------------  
  def move_sprite
    x = self.x
    y = self.y
    dist_x = [((@dest_x-x).abs/3.0).ceil, (@tot_x/3.0).ceil].min
    dist_y = [((@dest_y-y).abs/3.0).ceil, (@tot_y/3.0).ceil].min
    @dest_x > x ? self.x += dist_x : self.x -= dist_x
    @dest_y > y ? self.y += dist_y : self.y -= dist_y
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias upd_sprite_move update
  def update
    move_sprite if moving?
    upd_sprite_move
  end
  #--------------------------------------------------------------------------
  # * Get Normal Text Color
  #--------------------------------------------------------------------------
  def normal_color
    return Color.new(255, 255, 255, 255)
  end
  #--------------------------------------------------------------------------
  # * Get Disabled Text Color
  #--------------------------------------------------------------------------
  def disabled_color
    return Color.new(255, 255, 255, 128)
  end
  #--------------------------------------------------------------------------
  # * Get System Text Color
  #--------------------------------------------------------------------------
  def system_color
    return Color.new(192, 224, 255, 255)
  end
  #--------------------------------------------------------------------------
  # * Get Crisis Text Color
  #--------------------------------------------------------------------------
  def crisis_color
    return Color.new(255, 255, 64, 255)
  end
  #--------------------------------------------------------------------------
  # * Get Knockout Text Color
  #--------------------------------------------------------------------------
  def knockout_color
    return Color.new(255, 64, 0)
  end
  def draw_actor_graphic(actor, x, y)
    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
    cw = bitmap.width / 4
    ch = bitmap.height / 4
    src_rect = Rect.new(0, 0, cw, ch)
    self.bitmap.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
  #--------------------------------------------------------------------------
  # * Draw Name
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_name(actor, x, y)
    self.bitmap.font.color = normal_color
    self.bitmap.draw_text(x, y, 120, 32, actor.name)
  end
  #--------------------------------------------------------------------------
  # * Draw Class
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_class(actor, x, y)
    self.bitmap.font.color = normal_color
    self.bitmap.draw_text(x, y, 236, 32, actor.class_name)
  end
  #--------------------------------------------------------------------------
  # * Draw Level
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_level(actor, x, y)
    self.bitmap.font.color = system_color
    self.bitmap.draw_text(x, y, 32, 32, "Lv")
    self.bitmap.font.color = normal_color
    self.bitmap.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Make State Text String for Drawing
  #     actor       : actor
  #     width       : draw spot width
  #     need_normal : Whether or not [normal] is needed (true / false)
  #--------------------------------------------------------------------------
  def make_battler_state_text(battler, width, need_normal)
    # Get width of brackets
    brackets_width = self.bitmap.text_size("[]").width
    # Make text string for state names
    text = ""
    for i in battler.states
      if $data_states[i].rating >= 1
        if text == ""
          text = $data_states[i].name
        else
          new_text = text + "/" + $data_states[i].name
          text_width = self.bitmap.text_size(new_text).width
          if text_width > width - brackets_width
            break
          end
          text = new_text
        end
      end
    end
    # If text string for state names is empty, make it [normal]
    if text == ""
      if need_normal
        text = "[Normal]"
      end
    else
      # Attach brackets
      text = "[" + text + "]"
    end
    # Return completed text string
    return text
  end
  #--------------------------------------------------------------------------
  # * Draw State
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_state(actor, x, y, width = 120)
    text = make_battler_state_text(actor, width, true)
    self.bitmap.font.color = actor.hp == 0 ? knockout_color : normal_color
    self.bitmap.draw_text(x, y, width, 32, text)
  end
  #--------------------------------------------------------------------------
  # * Draw EXP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_exp(actor, x, y)
    self.bitmap.font.color = system_color
    self.bitmap.draw_text(x, y, 24, 32, "E")
    self.bitmap.font.color = normal_color
    self.bitmap.draw_text(x + 24, y, 84, 32, actor.exp_s, 2)
    self.bitmap.draw_text(x + 108, y, 12, 32, "/", 1)
    self.bitmap.draw_text(x + 120, y, 84, 32, actor.next_exp_s)
  end
  #--------------------------------------------------------------------------
  # * Draw HP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_hp(actor, x, y, width = 144)
    # Draw "HP" text string
    self.bitmap.font.color = system_color
    self.bitmap.draw_text(x, y, 32, 32, $data_system.words.hp)
    # Calculate if there is draw space for MaxHP
    if width - 32 >= 108
      hp_x = x + width - 108
      flag = true
    elsif width - 32 >= 48
      hp_x = x + width - 48
      flag = false
    end
    # Draw HP
    self.bitmap.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
    self.bitmap.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
    # Draw MaxHP
    if flag
      self.bitmap.font.color = normal_color
      self.bitmap.draw_text(hp_x + 48, y, 12, 32, "/", 1)
      self.bitmap.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw SP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_sp(actor, x, y, width = 144)
    # Draw "SP" text string
    self.bitmap.font.color = system_color
    self.bitmap.draw_text(x, y, 32, 32, $data_system.words.sp)
    # Calculate if there is draw space for MaxHP
    if width - 32 >= 108
      sp_x = x + width - 108
      flag = true
    elsif width - 32 >= 48
      sp_x = x + width - 48
      flag = false
    end
    # Draw SP
    self.bitmap.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    self.bitmap.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
    # Draw MaxSP
    if flag
      self.bitmap.font.color = normal_color
      self.bitmap.draw_text(sp_x + 48, y, 12, 32, "/", 1)
      self.bitmap.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
    end
  end
  #----------------------------------------------------------------------------
  # * Draws a gradiant bar fo the actor's HP
  #----------------------------------------------------------------------------
  def draw_actor_hp_bar_ryex(x, y, m, actor)
    h = 12
    p = actor.hp.to_f / actor.maxhp
    c = Color.new(255, 0, 0)
    self.bitmap.draw_bar_ryex(x, y, m, h, p, c)
  end
  #----------------------------------------------------------------------------
  # * Draws a gradiant bar fo the actor's SP
  #----------------------------------------------------------------------------
  def draw_actor_sp_bar_ryex(x, y, m, actor)
    h = 12
    p = actor.sp.to_f / actor.maxsp
    c = Color.new(0, 0, 255)
    self.bitmap.draw_bar_ryex(x, y, m, h, p, c)
  end
  #----------------------------------------------------------------------------
  # * Draws a gradiant bar fo the actor's EXP
  #----------------------------------------------------------------------------
  def draw_actor_exp_bar_ryex(x, y, m, actor)
    h = 12
    p = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
    c = Color.new(255, 255, 0)
    self.bitmap.draw_bar_ryex(x, y, m, h, p, c)
  end
  #--------------------------------------------------------------------------
  # * Draw HP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_hp_Ryex(actor, x, y, width = 144)
    # Draw "HP" text string
    self.bitmap.font.color = Color.new(0, 0, 0, 255)
    self.bitmap.draw_text(x-1, y-1, 32, 32, $data_system.words.hp)
    self.bitmap.draw_text(x+1, y-1, 32, 32, $data_system.words.hp)
    self.bitmap.draw_text(x-1, y+1, 32, 32, $data_system.words.hp)
    self.bitmap.draw_text(x+1, y+1, 32, 32, $data_system.words.hp)
    self.bitmap.font.color = system_color
    self.bitmap.draw_text(x, y, 32, 32, $data_system.words.hp)
    hp_x = x + width - 108
    # Draw HP
    self.bitmap.font.color = Color.new(0, 0, 0, 255)
    self.bitmap.draw_text(hp_x + 60 - 1, y - 1, 48, 32, actor.hp.to_s, 2)
    self.bitmap.draw_text(hp_x + 60 + 1, y - 1, 48, 32, actor.hp.to_s, 2)
    self.bitmap.draw_text(hp_x + 60 - 1, y + 1, 48, 32, actor.hp.to_s, 2)
    self.bitmap.draw_text(hp_x + 60 + 1, y + 1, 48, 32, actor.hp.to_s, 2)
    self.bitmap.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
    self.bitmap.draw_text(hp_x + 60, y, 48, 32, actor.hp.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Draw SP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_sp_Ryex(actor, x, y, width = 144)
    # Draw "SP" text string
    self.bitmap.font.color = Color.new(0, 0, 0, 255)
    self.bitmap.draw_text(x - 1, y - 1, 32, 32, $data_system.words.sp)
    self.bitmap.draw_text(x + 1, y - 1, 32, 32, $data_system.words.sp)
    self.bitmap.draw_text(x - 1, y + 1, 32, 32, $data_system.words.sp)
    self.bitmap.draw_text(x + 1, y + 1, 32, 32, $data_system.words.sp)
    self.bitmap.font.color = system_color
    self.bitmap.draw_text(x, y, 32, 32, $data_system.words.sp)
    sp_x = x + width - 108
    # Draw SP
    self.bitmap.font.color = Color.new(0, 0, 0, 255)
    self.bitmap.draw_text(sp_x + 60 - 1, y - 1, 48, 32, actor.sp.to_s, 2)
    self.bitmap.draw_text(sp_x + 60 + 1, y - 1, 48, 32, actor.sp.to_s, 2)
    self.bitmap.draw_text(sp_x + 60 - 1, y + 1, 48, 32, actor.sp.to_s, 2)
    self.bitmap.draw_text(sp_x + 60 + 1, y + 1, 48, 32, actor.sp.to_s, 2)
    self.bitmap.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    self.bitmap.draw_text(sp_x + 60, y, 48, 32, actor.sp.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Get Up Text Color
  #--------------------------------------------------------------------------
  def up_color
    return Color.new(0, 255, 0 )
  end
  #--------------------------------------------------------------------------
  # * Get Down Text Color
  #--------------------------------------------------------------------------
  def down_color
    return Color.new(255, 0, 0)
  end
end

#==============================================================================
# Moving windows (Alpha 2)
# by Fantasist
#------------------------------------------------------------------------------
#  This adds the 'move' function to windows. Syntax is
#    @window.move(dest_x, dest_y)
#  where
#       @window :The window you want to move
#       dest_x    :Destination x coordinate
#       dest_y    :Destination y coordinate
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
alias moving_win_base_init initialize
def initialize(x, y, w, h)
   moving_win_base_init(x, y, w, h)
   @dest_x, @dest_y = x, y
   @tot_x = @tot_y = 0
  end
  #--------------------------------------------------------------------------
  # * moving? - checks if the window needs moving
  #--------------------------------------------------------------------------
  def moving?
    return self.x != @dest_x || self.y != @dest_y
  end
  #--------------------------------------------------------------------------
  # * Move - prepares variables and sets off the moving process
  #--------------------------------------------------------------------------  
  def move(dest_x, dest_y)
    @dest_x = dest_x
    @dest_y = dest_y
    @tot_x = (dest_x - self.x).abs
    @tot_y = (dest_y - self.y).abs
  end
  #--------------------------------------------------------------------------
  # Move Windows - the actual processing of movement
  #--------------------------------------------------------------------------  
  def move_wins
    x = self.x
    y = self.y
    dist_x = [((@dest_x-x).abs/3.0).ceil, (@tot_x/3.0).ceil].min
    dist_y = [((@dest_y-y).abs/3.0).ceil, (@tot_y/3.0).ceil].min
    @dest_x > x ? self.x += dist_x : self.x -= dist_x
    @dest_y > y ? self.y += dist_y : self.y -= dist_y
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias upd_win_base_move update
  def update
    upd_win_base_move
    move_wins if moving?
  end
end


class Sprite_BattleStatus_Ryex_AnTeBS < RPG::Sprite
  attr_accessor :actor
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, actor_id, recreate_flag = false)
    super(nil)
    self.x = x
    self.y = y
    self.bitmap = Bitmap.new(150, 74)
    @level_up_flag = false
    @actor = $game_party.actors[actor_id]
    @box_number = actor_id
    refresh
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    super
  end
  #--------------------------------------------------------------------------
  # * Set Level Up Flag
  #     actor_index : actor index
  #--------------------------------------------------------------------------
  def level_up
    @level_up_flag = true
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.bitmap.clear
    draw_background
    self.bitmap.font.name, self.bitmap.font.size = RyexCFG::BATTLE_NAMES_FONT, 22
    self.bitmap.font.italic, self.bitmap.font.bold = true, true
    draw_actor_name(@actor, 15, 0)
    self.bitmap.font.italic, self.bitmap.font.bold = false, false
    self.bitmap.font.name, self.bitmap.font.size = RyexCFG::BATTLE_HP_SP_FONT, 20
    draw_actor_hp_bar_ryex(15, 24, 120, @actor)
    draw_actor_hp_Ryex(@actor, 15, 14, 120)
    draw_actor_sp_bar_ryex(15, 38, 120, @actor)
    draw_actor_sp_Ryex(@actor, 15, 28, 120)
    if @level_up_flag
      self.bitmap.font.color = normal_color
      self.bitmap.draw_text(15, 42, 120, 32, 'LEVEL UP!')
    else
      draw_actor_state(@actor, 15, 42)
    end
    self.bitmap.font.name, self.bitmap.font.size = 'Arial', 22
  end
  #--------------------------------------------------------------------------
  # * Draw Background
  #--------------------------------------------------------------------------
  def draw_background
    back_color = Color.new(75, 75, 75)
    74.times do |i|
      bcr = back_color.red * i / 74
      bcg = back_color.green * i / 74
      bcb = back_color.blue * i / 74
      self.bitmap.fill_rect(0, 74 - i - 1, 150, 1, Color.new(bcr, bcg, bcb, 200))
    end
    case @box_number
    when 0
      if $game_party.actors.size == 1
        self.bitmap.fill_rect(149, 0, 1, 74, Color.new(0, 0, 0, 200))
      end
      self.bitmap.fill_rect(0, 0, 1, 74, Color.new(0, 0, 0, 200))
    when ($game_party.actors.size - 1)
      self.bitmap.fill_rect(149, 0, 1, 74, Color.new(0, 0, 0, 200))
    end
    self.bitmap.fill_rect(0, 0, 150, 1, Color.new(0, 0, 0, 200))
    self.bitmap.fill_rect(0, 73, 150, 1, Color.new(0, 0, 0, 200))
  end
end

class Battle_Status_Bar_Ryex_AnTeBS
  attr_accessor :actor_status_boxs
  def initialize(x, y)
    @actor_status_boxs = []
    @party_size = $game_party.actors.size
    (0...$game_party.actors.size).each do |i|
      @actor_status_boxs.push(Sprite_BattleStatus_Ryex_AnTeBS.new(x + (i * 150), y, i))
    end
    @actor_status_boxs.each do |status_box|
      status_box.z = 300
    end
  end
  def level_up(actor_index)
    @actor_status_boxs[actor_index].level_up
  end
  def dispose
    @actor_status_boxs.each do |status_box|
      status_box.dispose
    end
  end
  def refresh(actor_index = nil)
    if @party_size != $game_party.actors.size
      @actor_status_boxs.each do |status_box|
        status_box.dispose
      end
      @actor_status_boxs = []
      @party_size = $game_party.actors.size
      (0...$game_party.actors.size).each do |i|
        @actor_status_boxs.push(Sprite_BattleStatus_Ryex_AnTeBS.new(0 + (i * 150), 0, i, true))
      end
    else
      (0...$game_party.actors.size).each do |i|
        actor = $game_party.actors[i]
        @actor_status_boxs[i].actor = actor unless actor == nil
      end
      unless actor_index == nil
        @actor_status_boxs[actor_index].refresh
      else
        @actor_status_boxs.each do |status_box|
          status_box.refresh
        end
      end
    end
  end
  def update
    @actor_status_boxs.each do |status_box|
      status_box.update
    end
  end
  def move(x, y)
    (0...$game_party.actors.size).each do |i|
      @actor_status_boxs[i].move(x + (i * 150), y)
    end
  end
  def x
    return @actor_status_boxs[0].x
  end
  def y
    return @actor_status_boxs[0].y
  end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays items in possession on the item and battle screens.
#==============================================================================

class Window_Item_Battle_Ryex < Window_Item
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super
    self.x, self.y, self.width, self.height, self.z = -305, 96, 304, 320, 300
    @column_max = 1
    self.index = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if item.is_a?(RPG::Item) and
       $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 224, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 240, y, 24, 32, number.to_s, 2)
  end
end

#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
#  This window displays usable skills on the skill and battle screens.
#==============================================================================

class Window_Skill_Battle_Ryex < Window_Skill
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor : actor
  #--------------------------------------------------------------------------
  def initialize(actor)
    super
    self.x, self.y, self.width, self.height, self.z = -305, 96, 304, 320, 300
    @actor = actor
    @column_max = 1
    self.index = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    self.contents.draw_text(x + 200, y, 48, 32, skill.sp_cost.to_s, 2)
  end
end

#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
#  This window shows skill and item explanations along with actor status.
#==============================================================================

class Window_Help_Battle_Ryex < Window_Help
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #  text  : text string displayed in window
  #  align : alignment (0..flush left, 1..center, 2..flush right)
  #--------------------------------------------------------------------------
  def set_text(text, align = 0)
    super(text, align)
    self.move(self.x, 416)
  end
  #--------------------------------------------------------------------------
  # * Set Actor
  #     actor : status displaying actor
  #--------------------------------------------------------------------------
  def set_actor(actor)
    super(actor)
    self.move(self.x, 416)
  end
  #--------------------------------------------------------------------------
  # * Set Enemy
  #     enemy : name and status displaying enemy
  #--------------------------------------------------------------------------
  def set_enemy(enemy)
    text = enemy.name
    state_text = make_battler_state_text(enemy, 112, false)
    if state_text != ""
      text += "  " + state_text
    end
    set_text(text, 1)
  end
end

#==============================================================================
# ** Window_HCommand_WI Modified from Blizzard's Window_HCommand By Ryex
#------------------------------------------------------------------------------
#  This window deals with general command choices, but the display is
#  horizontal.
#==============================================================================

class Window_HCommand_WI_Battle < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     width    : window width
  #     commands : command text string array
  #--------------------------------------------------------------------------
  def initialize(width, commands)
    super(0, 0, width, 64)
    self.width, self.height = width, 64
    @commands = commands
    @item_max = commands.size
    @column_max = commands.size
    self.contents = Bitmap.new( @item_max * 152, self.height - 32)
    refresh
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #     color : text color
  #--------------------------------------------------------------------------
  def draw_item(i, color)
    self.contents.font.color = color
    w = 152
    x = i * 152
    rect = Rect.new(x, 0, w, 32)
    #self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[i][1], 1)
    self.contents.blt(x + 4, 4, RPG::Cache.icon(@commands[i][0]),
          Rect.new(0, 0, 24, 24))
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #     index : item number
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
  #--------------------------------------------------------------------------
  # * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # If cursor position is less than 0
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # Get current row
    row = @index
    # If current row is before top row
    if row < self.top_row
      # Scroll so that current row becomes top row
      self.top_row = row
    end
    # If current row is more to back than back row
    if row > self.top_row + (self.page_row_max - 1)
      # Scroll so that current row becomes back row
      self.top_row = row - (self.page_row_max - 1)
    end
    # Calculate cursor width
    cursor_width = 152
    # Calculate cursor coordinates
    x = @index * 152 - self.ox
    # Update cursor rectangle
    self.cursor_rect.set(x, 0, cursor_width, 32)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # If cursor is movable
    if self.active and @item_max > 0 and @index >= 0
      # If the right directional button was pressed
      if Input.repeat?(Input::RIGHT)
        # If column count is 2 or more, and cursor position is closer to front
        # than (item count -1)
        if @column_max >= 2 and @index < @item_max - 1
          # Move cursor right
          $game_system.se_play($data_system.cursor_se)
          @index = (@index + @column_max) % @item_max
        end
      end
      # If the left directional button was pressed
      if Input.repeat?(Input::LEFT)
        # If column count is 2 or more, and cursor position is more back than 0
        if @column_max >= 2 and @index > 0
          # Move cursor left
          $game_system.se_play($data_system.cursor_se)
          @index = (@index - @column_max + @item_max) % @item_max
        end
      end
    end
    # Update help text (update_help is defined by the subclasses)
    if self.active and @help_window != nil
      update_help
    end
    # Update cursor rectangle
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # * Update Help Window
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(@commands[self.index][1])
  end
end


class Spriteset_Battle
  def update
    if @viewport0 == nil
      @weather.dispose
      @viewport0 = Viewport.new(0, 0, 640, 480)
      @viewport0.z = @viewport1.z - 1
      @weather = RPG::Weather.new(@viewport2)
    end
    if @battleback_name != $game_temp.battleback_name
      @battleback_name = $game_temp.battleback_name
      @battleback_sprite.dispose
      @battleback_sprite = Sprite.new(@viewport0)
      @battleback_sprite.bitmap = Bitmap.new(640, 480)
      @battleback_sprite.bitmap.stretch_blt(Rect.new(0, 0, 640, 480),
      RPG::Cache.battleback(@battleback_name), Rect.new(0, 0, 640, 320))
    end
    # Update actor sprite contents (corresponds with actor switching)
    @actor_sprites[0].battler = $game_party.actors[0]
    @actor_sprites[1].battler = $game_party.actors[1]
    @actor_sprites[2].battler = $game_party.actors[2]
    @actor_sprites[3].battler = $game_party.actors[3]
    # If battleback file name is different from current one
    if @battleback_name != $game_temp.battleback_name
      @battleback_name = $game_temp.battleback_name
      if @battleback_sprite.bitmap != nil
        @battleback_sprite.bitmap.dispose
      end
      @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
      @battleback_sprite.src_rect.set(0, 0, 640, 320)
    end
    # Update battler sprites
    for sprite in @enemy_sprites + @actor_sprites
      sprite.update
    end
    # Update weather graphic
    @weather.type = $game_screen.weather_type
    @weather.max = $game_screen.weather_max
    @weather.update
    # Update picture sprites
    for sprite in @picture_sprites
      sprite.update
    end
    # Update timer sprite
    @timer_sprite.update
    # Set screen color tone and shake position
    @viewport2.tone = $game_screen.tone
    @viewport2.ox = $game_screen.shake
    @viewport0.ox = $game_screen.shake
    @viewport1.ox = $game_screen.shake
    # Set screen flash color
    @viewport4.color = $game_screen.flash_color
    # Update viewports
    @viewport1.update
    @viewport2.update
    @viewport4.update
    @viewport0.update
  end

  alias ryex_AnTBS_SpBattle_dispose_later dispose
  def dispose
    ryex_AnTBS_SpBattle_dispose_later
    @viewport0.dispose
  end
end

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Initialize each kind of temporary battle data
    $game_temp.in_battle = true
    $game_temp.battle_turn = 0
    $game_temp.battle_event_flags.clear
    $game_temp.battle_abort = false
    $game_temp.battle_main_phase = false
    $game_temp.battleback_name = $game_map.battleback_name
    $game_temp.forcing_battler = nil
    # Initialize battle event interpreter
    $game_system.battle_interpreter.setup(nil, 0)
    # Prepare troop
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    # Make actor command window
    commands = [[RyexCFG::BATTLE_MENU_ICONS[1], $data_system.words.attack],
      [RyexCFG::BATTLE_MENU_ICONS[2], $data_system.words.skill],
      [RyexCFG::BATTLE_MENU_ICONS[3], $data_system.words.guard],
      [RyexCFG::BATTLE_MENU_ICONS[4], $data_system.words.item]]
    @actor_command_window = Window_HCommand_WI_Battle.new(640, commands)
    @actor_command_window.y = 481
    @actor_command_window.z = 300
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    # Make other windows
    @party_command_window = Window_PartyCommand.new
    @party_command_window.y, @party_command_window.z = 481, 300
    @party_command_window.visible = true
    @help_window = Window_Help_Battle_Ryex.new
    @help_window.y, @help_window.back_opacity, @help_window.z = 481, 160, 400
    @help_window.visible = true
    @status_window = Battle_Status_Bar_Ryex_AnTeBS.new(20, -75)
    @message_window = Window_Message.new
    # Make sprite set
    @spriteset = Spriteset_Battle.new
    # Initialize wait count
    @wait_count = 0
    # Execute transition
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    # Start pre-battle phase
    start_phase1
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Refresh map
    $game_map.refresh
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @actor_command_window.dispose
    @party_command_window.dispose
    @help_window.dispose
    @status_window.dispose
    @message_window.dispose
    if @skill_window != nil
      @skill_window.dispose
    end
    if @item_window != nil
      @item_window.dispose
    end
    if @result_window != nil
      @result_window.dispose
    end
    # Dispose of sprite set
    @spriteset.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
    # If switching from battle test to any screen other than game over screen
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If battle event is running
    if $game_system.battle_interpreter.running?
      # Update interpreter
      $game_system.battle_interpreter.update
      # If a battler which is forcing actions doesn't exist
      if $game_temp.forcing_battler == nil
        # If battle event has finished running
        unless $game_system.battle_interpreter.running?
          # Rerun battle event set up if battle continues
          unless judge
            setup_battle_event
          end
        end
        # If not after battle phase
        if @phase != 5
          # Refresh status window
          @status_window.refresh
        end
      end
    end
    # Update system (timer) and screen
    $game_system.update
    $game_screen.update
    # If timer has reached 0
    if $game_system.timer_working and $game_system.timer == 0
      # Abort battle
      $game_temp.battle_abort = true
    end
    # Update windows
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @message_window.update
    # Update sprite set
    @spriteset.update
    # If transition is processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # If message window is showing
    if $game_temp.message_window_showing
      return
    end
    # If effect is showing
    if @spriteset.effect?
      return
    end
    # If game over
    if $game_temp.gameover
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Switch to title screen
      $scene = Scene_Title.new
      return
    end
    # If battle is aborted
    if $game_temp.battle_abort
      # Return to BGM used before battle started
      $game_system.bgm_play($game_temp.map_bgm)
      # Battle ends
      battle_end(1)
      return
    end
    # If waiting
    if @wait_count > 0
      # Decrease wait count
      @wait_count -= 1
      return
    end
    # If battler forcing an action doesn't exist,
    # and battle event is running
    if $game_temp.forcing_battler == nil and
       $game_system.battle_interpreter.running?
      return
    end
    # Branch according to phase
    case @phase
    when 1  # pre-battle phase
      update_phase1
    when 2  # party command phase
      update_phase2
    when 3  # actor command phase
      update_phase3
    when 4  # main phase
      update_phase4
    when 5  # after battle phase
      update_phase5
    end
  end
  #--------------------------------------------------------------------------
  # * Start Party Command Phase
  #--------------------------------------------------------------------------
  def start_phase2
    # Shift to phase 2
    @phase = 2
    # Set actor to non-selecting
    @actor_index = -1
    @active_battler = nil
    # move windows into position
    @status_window.move(@status_window.x, 0)
    @party_command_window.move(@party_command_window.x, 416)
    # Enable party command window
    @party_command_window.active = true
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.move(@actor_command_window.x, 481)
    #@info_window.move(@info_window.x, 481)
    # Clear main phase flag
    $game_temp.battle_main_phase = false
    # Clear all party member actions
    $game_party.clear_actions
    # If impossible to input command
    unless $game_party.inputable?
      # Start main phase
      start_phase4
    end
  end
  #--------------------------------------------------------------------------
  # * Go to Command Input for Next Actor
  #--------------------------------------------------------------------------
  def phase3_next_actor
    # Loop
    begin
      # Actor blink effect OFF
      if @active_battler != nil
        @active_battler.blink = false
        @status_window.actor_status_boxs[@actor_index].blink_off
      end
      # If last actor
      if @actor_index == $game_party.actors.size-1
        # Start main phase
        start_phase4
        return
      end
      # Advance actor index
      @actor_index += 1
      @active_battler = $game_party.actors[@actor_index]
      @active_battler.blink = true
      @status_window.actor_status_boxs[@actor_index].blink_on
    # Once more if actor refuses command input
    end until @active_battler.inputable?
    # Set up actor command window
    phase3_setup_command_window
  end
  #--------------------------------------------------------------------------
  # * Go to Command Input of Previous Actor
  #--------------------------------------------------------------------------
  def phase3_prior_actor
    # Loop
    begin
      # Actor blink effect OFF
      if @active_battler != nil
        @active_battler.blink = false
        @status_window.actor_status_boxs[@actor_index].blink_off
      end
      # If first actor
      if @actor_index == 0
        # Start party command phase
        start_phase2
        return
      end
      # Return to actor index
      @actor_index -= 1
      @active_battler = $game_party.actors[@actor_index]
      @active_battler.blink = true
      @status_window.actor_status_boxs[@actor_index].blink_on
    # Once more if actor refuses command input
    end until @active_battler.inputable?
    # Set up actor command window
    phase3_setup_command_window
  end
  #--------------------------------------------------------------------------
  # * Actor Command Window Setup
  #--------------------------------------------------------------------------
  def phase3_setup_command_window
    # Disable party command window
    @party_command_window.active = false
    @party_command_window.move(@party_command_window.x, 481)
    # Enable actor command window
    @actor_command_window.active = true
    @actor_command_window.move(@actor_command_window.x, 416)
    #@info_window.move(@info_window.x, 416)
    # Set index to 0
    @actor_command_window.index = 0
  end
  #--------------------------------------------------------------------------
  # * Start Enemy Selection
  #--------------------------------------------------------------------------
  def start_enemy_select
    # Make enemy arrow
    @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
    # Associate help window
    @enemy_arrow.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    #@info_window.move(@info_window.x, 481)
    @actor_command_window.move(@actor_command_window.x, 481)
  end
  #--------------------------------------------------------------------------
  # * End Enemy Selection
  #--------------------------------------------------------------------------
  def end_enemy_select
    # Dispose of enemy arrow
    @enemy_arrow.dispose
    @enemy_arrow = nil
    # If command is [fight]
    if @actor_command_window.index == 0
      # Enable actor command window
      @actor_command_window.active = true
      #@info_window.move(@info_window.x, 416)
      @actor_command_window.move(@actor_command_window.x, 416)
      # Hide help window
      @help_window.move(@help_window.x, 481)
    end
  end
  #--------------------------------------------------------------------------
  # * Start Actor Selection
  #--------------------------------------------------------------------------
  def start_actor_select
    # Make actor arrow
    @actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
    @actor_arrow.index = @actor_index
    # Associate help window
    @actor_arrow.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    #@info_window.move(@info_window.x, 481)
    @actor_command_window.move(@actor_command_window.x,481)
  end
  #--------------------------------------------------------------------------
  # * End Actor Selection
  #--------------------------------------------------------------------------
  def end_actor_select
    # Dispose of actor arrow
    @actor_arrow.dispose
    @actor_arrow = nil
  end
  #--------------------------------------------------------------------------
  # * Start Skill Selection
  #--------------------------------------------------------------------------
  def start_skill_select
    # Make skill window
    @skill_window = Window_Skill_Battle_Ryex.new(@active_battler)
    @skill_window.move(0, @skill_window.y)
    # Associate help window
    @skill_window.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    #@info_window.move(@info_window.x, 481)
    @actor_command_window.move(@actor_command_window.x, 481)
  end
  #--------------------------------------------------------------------------
  # * End Skill Selection
  #--------------------------------------------------------------------------
  def end_skill_select
    # Dispose of skill window
    @skill_window.dispose
    @skill_window = nil
    # Hide help window
    @help_window.move(@help_window.x, 481)
    # Enable actor command window
    @actor_command_window.active = true
    #@info_window.move(@info_window.x, 416)
    @actor_command_window.move(@actor_command_window.x, 416)
  end
  #--------------------------------------------------------------------------
  # * Start Item Selection
  #--------------------------------------------------------------------------
  def start_item_select
    # Make item window
    @item_window = Window_Item_Battle_Ryex.new
    @item_window.move(0, @item_window.y)
    # Associate help window
    @item_window.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    #@info_window.move(@info_window.x, 481)
    @actor_command_window.move(@actor_command_window.x, 481)
  end
  #--------------------------------------------------------------------------
  # * End Item Selection
  #--------------------------------------------------------------------------
  def end_item_select
    # Dispose of item window
    @item_window.dispose
    @item_window = nil
    # Hide help window
    @help_window.move(@help_window.x, 481)
    # Enable actor command window
    @actor_command_window.active = true
    #@info_window.move(@info_window.x, 416)
    @actor_command_window.move(@actor_command_window.x, 416)
  end
  #--------------------------------------------------------------------------
  # * Start Main Phase
  #--------------------------------------------------------------------------
  def start_phase4
    # Shift to phase 4
    @phase = 4
    # Turn count
    $game_temp.battle_turn += 1
    # Search all battle event pages
    for index in 0...$data_troops[@troop_id].pages.size
      # Get event page
      page = $data_troops[@troop_id].pages[index]
      # If this page span is [turn]
      if page.span == 1
        # Clear action completed flags
        $game_temp.battle_event_flags[index] = false
      end
    end
    # Set actor as unselectable
    @actor_index = -1
    @active_battler = nil
    # Enable party command window
    @party_command_window.active = false
    @party_command_window.move(@party_command_window.x, 481)
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.move(@actor_command_window.x,  481)
    #@info_window.move(@info_window.x, 481)
    # Set main phase flag
    $game_temp.battle_main_phase = true
    # Make enemy action
    for enemy in $game_troop.enemies
      enemy.make_action
    end
    # Make action orders
    make_action_orders
    # Shift to step 1
    @phase4_step = 1
  end
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 1 : action preparation)
  #--------------------------------------------------------------------------
  def update_phase4_step1
    # Hide help window
    @help_window.move(@help_window.x, 481)
    # Determine win/loss
    if judge
      # If won, or if lost : end method
      return
    end
    # If an action forcing battler doesn't exist
    if $game_temp.forcing_battler == nil
      # Set up battle event
      setup_battle_event
      # If battle event is running
      if $game_system.battle_interpreter.running?
        return
      end
    end
    # If an action forcing battler exists
    if $game_temp.forcing_battler != nil
      # Add to head, or move
      @action_battlers.delete($game_temp.forcing_battler)
      @action_battlers.unshift($game_temp.forcing_battler)
    end
    # If no actionless battlers exist (all have performed an action)
    if @action_battlers.size == 0
      # Start party command phase
      start_phase2
      return
    end
    # Initialize animation ID and common event ID
    @animation1_id = 0
    @animation2_id = 0
    @common_event_id = 0
    # Shift from head of actionless battlers
    @active_battler = @action_battlers.shift
    # If already removed from battle
    if @active_battler.index == nil
      return
    end
    # Slip damage
    if @active_battler.hp > 0 and @active_battler.slip_damage?
      @active_battler.slip_damage_effect
      @active_battler.damage_pop = true
    end
    # Natural removal of states
    @active_battler.remove_states_auto
    # Refresh status window
    @status_window.refresh
    # Shift to step 2
    @phase4_step = 2
  end
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 5 : damage display)
  #--------------------------------------------------------------------------
  def update_phase4_step5
    # Hide help window
    @help_window.move(@help_window.x, 481)
    # Refresh status window
    @status_window.refresh
    # Display damage
    for target in @target_battlers
      if target.damage != nil
        target.damage_pop = true
      end
    end
    # Shift to step 6
    @phase4_step = 6
  end
end

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler

  attr_accessor :frame
  attr_accessor :allow_state_change
  attr_accessor :allow_death_change
  attr_accessor :force_idle
  attr_accessor :reset_frame
  attr_accessor :action_state
  attr_accessor :max_frame_idle
  attr_accessor :max_frame_attack
  attr_accessor :max_frame_skill
  attr_accessor :max_frame_item
  attr_accessor :max_frame_defend
  attr_accessor :max_frame_death
  attr_accessor :origin_name
  attr_accessor :battler_name
  attr_accessor :force_death

end

#==============================================================================
# Sprite_Battler
#==============================================================================

class Sprite_Battler

  alias ryex_AnTBS_initialize_later initialize
  def initialize(viewport, battler = nil)
    ryex_AnTBS_initialize_later(viewport, battler)
    @is_dead = false
    @appeared = false
    @time2 = false
    @collapsed = false
  end


  alias upd_animated_battlers_AnTBS_later update
  def update
    if @battler != nil
      if @battler.origin_name != @battler.battler_name
        setup_battler_AnTBS
      end
      set_action_state
      if Graphics.frame_count % RyexCFG::B_SPEED == 0
        case @battler.action_state
        when 0 # Idle state
          if @battler.max_frame_idle > 0
            @battler.frame = (@battler.frame + 1) % @battler.max_frame_idle
          end
        when 1 # Attack state
          if @battler.max_frame_attack > 0
            @battler.frame = (@battler.frame + 1) % @battler.max_frame_attack
          end
        when 2 # Skill state
          if @battler.max_frame_skill > 0
            @battler.frame = (@battler.frame + 1) % @battler.max_frame_skill
          end
        when 3 # Item state
          if @battler.max_frame_item > 0
            @battler.frame = (@battler.frame + 1) % @battler.max_frame_item
          end
        when 4 # Defend state
          if @battler.max_frame_defend > 0
            @battler.frame = (@battler.frame + 1) % @battler.max_frame_defend
          end
        when 5 # Death state
          if @battler.max_frame_death > 0
            @battler.frame = (@battler.frame + 1) % @battler.max_frame_death
          end
        end
      end
      if @battler.reset_frame == true
        @battler.frame = 0
        @battler.reset_frame = false
      end
    end
    upd_animated_battlers_AnTBS_later
    if @battler != nil
      if @battler.allow_death_change && @battler.dead? &&
        @collapsed && (@_collapse_duration == 0)
        @collapsed = false
        @battler.allow_death_change = false
        @battler.action_state = 5
        if @battler.max_frame_death > 0
          appear
        end
      end
    end
  end

  def collapse
    super
    @battler.allow_death_change = true
    @battler.allow_state_change = true
    @collapsed = true
    @is_dead = true
    set_action_state
  end

  def appear
    super
    @battler.allow_state_change = true
    if @is_dead
      if @time2
        @appeared = true
        @time2 = false
        set_action_state
        return
      end
      @time2 = true
      set_action_state
    end
  end

  def set_action_state
    if @battler.force_death
      @battler.action_state = 5
      @battler.allow_death_change = true
      @battler.allow_state_change = true
      @is_dead = true
      @collapsed = true
      flag = true
      @battler.force_death = false
    end
    flag = false
    if @is_dead
      flag = true
      if @appeared && (@_appear_duration == 0)
        flag = false
        @appeared = false
        @is_dead = false
      end
    end
    if @battler.force_idle
      unless @battler.dead? || @is_dead
        @battler.action_state = 0
        @battler.allow_state_change = false
        @battler.force_idle = false
        @battler.reset_frame = true
      end
    end
    unless @battler.allow_state_change
      if @battler.action_state == nil
        @battler.action_state = 0
      end
    else
      if @battler.dead?
        @battler.action_state = 5
        @is_dead = true
      else
        unless flag
          @battler.reset_frame = true        
          case @battler.current_action.kind
          when 0  # basic
            case @battler.current_action.basic
            when 0 # attack
              @battler.action_state = 1
            when 1 # guard
              @battler.action_state = 4
            when 2 # exscape
              @battler.action_state = 0
            when 3 # do nothing
              @battler.action_state = 0
            end
          when 1  # skill
            @battler.action_state = 2
          when 2  # item
            @battler.action_state = 3
          end
          @battler.allow_state_change = false
        end
      end
    end
    return
  end

  def setup_battler_AnTBS
    if @battler.dead?
      @battler.force_death = true
    end
    @battler.origin_name = @battler.battler_name
    @battler.frame = @frame = 0
    @battler.max_frame_idle = 0
    @battler.max_frame_attack = 0
    @battler.max_frame_skill = 0
    @battler.max_frame_item = 0
    @battler.max_frame_defend = 0
    @battler.max_frame_death = 0
    loop do
      name = @battler.origin_name
      name += @battler.max_frame_idle.to_s if @battler.max_frame_idle > 0
      if FileTest.exist?("Graphics/Battlers/#{name}.jpg") ||
         FileTest.exist?("Graphics/Battlers/#{name}.png")
         @battler.max_frame_idle += 1
      else
        break
      end
    end
    loop do
      name = @battler.origin_name + '_atk'
      name += @battler.max_frame_attack.to_s if @battler.max_frame_attack > 0
      if FileTest.exist?("Graphics/Battlers/#{name}.jpg") ||
         FileTest.exist?("Graphics/Battlers/#{name}.png")
        @battler.max_frame_attack += 1
      else
        break
      end
    end
    loop do
      name = @battler.origin_name + '_skl'
      name += @battler.max_frame_skill.to_s if @battler.max_frame_skill > 0
      if FileTest.exist?("Graphics/Battlers/#{name}.jpg") ||
         FileTest.exist?("Graphics/Battlers/#{name}.png")
        @battler.max_frame_skill += 1
      else
        break
      end
    end
    loop do
      name = @battler.origin_name + '_itm'
      name += @battler.max_frame_item.to_s if @battler.max_frame_item> 0
      if FileTest.exist?("Graphics/Battlers/#{name}.jpg") ||
         FileTest.exist?("Graphics/Battlers/#{name}.png")
        @battler.max_frame_item += 1
      else
        break
      end
    end
    loop do
      name = @battler.origin_name + '_def'
      name += @battler.max_frame_defend.to_s if @battler.max_frame_defend > 0
      if FileTest.exist?("Graphics/Battlers/#{name}.jpg") ||
         FileTest.exist?("Graphics/Battlers/#{name}.png")
        @battler.max_frame_defend += 1
      else
        break
      end
    end
    return
  end
end

class Scene_Battle

  alias ryex_AnTBS_SBattle_update_phase4_step3_later update_phase4_step3
  def update_phase4_step3
    @active_battler.allow_state_change = true
    ryex_AnTBS_SBattle_update_phase4_step3_later
  end

  alias ryex_AnTBS_SBattle_update_phase4_step6_later update_phase4_step6
  def update_phase4_step6
    ryex_AnTBS_SBattle_update_phase4_step6_later
  end

  alias ryex_AnTBS_SBattle_start_phase2_later start_phase2
  def start_phase2
    for actor in $game_party.actors
      actor.force_idle = true
    end
    
    ryex_AnTBS_SBattle_start_phase2_later
  end

end

[Obrazek: aye_furniture_pres.png]
01-12-15 14:06
Znajdź wszystkie posty użytkownika
"Pomógł" przyznał(a): michalek318
Wątek zamknięty 


Skocz do:


Użytkownicy przeglądający ten wątek: 1 gości

Kontakt | Ultima Forum | Wróć do góry | Wróć do forów | Wersja bez grafiki | RSS
Powered By MyBB. © 2013 MyBB Group. All Rights Reserved.
Skórka by Ayene.