질문과 답변

Extra Form

ATB.JPG <ㅡ 제가 이파일 입니다.(사이드뷰 되는 것)

 

여기서 ATB+Demo ㅡ> Graphics ㅡ> Battlers 들어가면 이미지들이 들어 있습니다.

암튼 제가 이걸 실행 보았습니다.

 94cb225576974212fda1c0d89b703102.JPG

배틀아면 사이드뷰 식으로 싸우게 됩니다.

 

글구 이게 스크립트 입니다

 

# Ccoa's side view battle system, with modified ATB from an unknown
# Japanese coder v1.0b
# For comments and bugs, please visit www.lrpgm.com/vb/

class Game_Battler
  attr_accessor :attack
  attr_accessor :skill
  attr_accessor :victory
  attr_accessor :item
 
  def initialize
    @battler_name = ""
    @battler_hue = 0
    @hp = 0
    @sp = 0
    @states = []
    @states_turn = {}
    @maxhp_plus = 0
    @maxsp_plus = 0
    @str_plus = 0
    @dex_plus = 0
    @agi_plus = 0
    @int_plus = 0
    @hidden = false
    @immortal = false
    @damage_pop = false
    @damage = nil
    @critical = false
    @animation_id = 0
    @animation_hit = false
    @white_flash = false
    @blink = false
    @current_action = Game_BattleAction.new
    @attack = false
    @skill = false
    @victory = false
    @item = false
  end
 
  # Is the battler's HP at 15% or less?
  def low_hp?
    return ((@hp * 100) / maxhp <= 15)
  end
end

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ? The X-coordinate of the battler
  #--------------------------------------------------------------------------
  def screen_x
    # ??????????? X ?????????
    if self.index != nil
      return self.index * 40 + 460
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # ? The Y-coordinate of the battler
  #--------------------------------------------------------------------------
  def screen_y
    return self.index * 45 + 175
  end
  #--------------------------------------------------------------------------
  # ? The Z "depth" of the battler
  #--------------------------------------------------------------------------
  def screen_z
    # ??????????? Z ?????????
    if self.index != nil
      return 0 + self.index
    else
      return 0
    end
  end
end

class Sprite_Battler < RPG::Sprite
  def initialize(viewport, battler = nil)
    super(viewport)
    @battler = battler
    @battler_visible = false
    @frame_num = 0
    @next_frame = 0
    if (@battler != nil)
      @picture_name = @battler.battler_name
    else
      @picture_name = ""
    end
    @victory = false
    @attacking = false
    @acting = false
    @update_speed = 7  # the higher this number, the slower the animation
    @stop_anime = false
    @num_of_frames = 4 # the total number of frames per animation
  end
 
  def update
    super
    # ????? nil ???
    if @battler == nil
      self.bitmap = nil
      loop_animation(nil)
      return
    end
    # ????????????????????
    if @battler.battler_name != @battler_name or
       @battler.battler_hue != @battler_hue
      # ????????????
      @battler_name = @battler.battler_name
      @battler_hue = @battler.battler_hue
      self.bitmap = RPG::Cache.battler(@battler_name + @frame_num.to_s,
                                         @battler_hue)
      @width = bitmap.width
      @height = bitmap.height
      self.ox = @width / 2
      self.oy = @height
      # ?????????????????? 0 ???
      if @battler.dead? or @battler.hidden
        self.opacity = 0
      end
    end
    # ??????? ID ????????????
    if @battler.damage == nil and
       @battler.state_animation_id != @state_animation_id
      @state_animation_id = @battler.state_animation_id
      loop_animation($data_animations[@state_animation_id])
    end
    # ??????????????
    if @battler_visible
      # ***ccoa***
      # update the animation every nth update
      if @next_frame == 0
        if @picture_name == ""
          @picture_name = @battler.battler_name
        end
       
        if @stop_anime
          self.bitmap = RPG::Cache.battler(@battler_name + "_victory" + (@num_of_frames - 1).to_s,
                                           @battler_hue)
        else
          self.bitmap = RPG::Cache.battler(@picture_name + @frame_num.to_s,
                                           @battler_hue)
        end
       
        @frame_num = (@frame_num + 1) % @num_of_frames
       
        if @reset_action
          @picture_name = @battler.battler_name
          @attacking = false
          @acting = false
          @battler.attack = false
          @battler.skill = false
          @battler.item = false
          @reset_action = false
        end
         
        if ((@attacking or @acting) and @frame_num == @num_of_frames - 1)
          @reset_action = true
        end
       
        if @victory and @frame_num == @num_of_frames - 1
          @stop_anime = true
        end
      end
     
      # update the frame every @update_speed time update is called,
      # or twice as fast when attacking
      @next_frame = (@next_frame + 1) % (@update_speed / (@attacking? 2 : 1))
     
      # ???????????????????????
      if $game_temp.battle_main_phase
        self.opacity += 3 if self.opacity < 255
      else
        self.opacity -= 3 if self.opacity > 207
      end
    end
   
    if
!@victory
      # ***ccoa*** Victory? Guarding?  Attacking? Using a skill?
      if @battler.victory
        @picture_name = @battler.battler_name + "_victory"
        @victory = true
        @battler.victory = false
        @update_speed = 8
      elsif @battler.guarding?
        @picture_name = @battler.battler_name + "_guard"
      elsif @battler.attack
        if @battler.is_a?(Game_Actor)
          # if the battler is armed, use that weapon's attack animation
          weapon = $data_weapons[@battler.weapon_id]
          if (weapon != nil)
            @picture_name = @battler.battler_name + "_attack_" +
                            weapon.name.gsub(' ', '_')
          else
            @picture_name = @battler.battler_name + "_attack"
          end
        else
          @picture_name = @battler.battler_name + "_attack"
        end
        if !@attacking
          @attacking = true
          @frame_num = 0
        end
      elsif @battler.skill
        @picture_name = @battler.battler_name + "_skill"
        if !@acting
          @acting = true
          @frame_num = 0
        end
      elsif @battler.item and @battler.is_a?(Game_Actor)
        @picture_name = @battler.battler_name + "_item"
        if !@acting
          @acting = true
          @frame_num = 0
        end
      elsif @battler.is_a?(Game_Actor) and @battler.low_hp?
        @picture_name = @battler.battler_name + "_lowhp"
      else
        @picture_name = @battler.battler_name
      end
    end
    # ??
    if @battler.blink
      blink_on
    else
      blink_off
    end
    # ??????
    unless @battler_visible
      # ??
      if not @battler.hidden and not @battler.dead? and
         (@battler.damage == nil or @battler.damage_pop)
        appear
        @battler_visible = true
      end
    end
    # ?????
    if @battler_visible
      # ??
      if @battler.hidden
        $game_system.se_play($data_system.escape_se)
        escape
        @battler_visible = false
      end
      # ***ccoa***
      # hit and miss animations
      if @battler.damage != nil
        if !(@battler.damage.is_a?(String) and @battler.damage = "Miss") and
           @battler.damage > 0
          self.bitmap = RPG::Cache.battler(@battler.battler_name + "_hit",
                                           @battler_hue)
        elsif @battler.damage.is_a?(String) and @battler.damage = "Miss" and
              @battler.is_a?(Game_Actor)
          self.bitmap = RPG::Cache.battler(@battler.battler_name + "_miss",
                                           @battler_hue)
        end
        @next_frame = 0
        @battler.animation_hit = false
      end
      # ??????
      if @battler.white_flash
        whiten
        @battler.white_flash = false
      end
      # ???????
      if @battler.animation_id != 0
        animation = $data_animations[@battler.animation_id]
        animation(animation, @battler.animation_hit)
        @battler.animation_id = 0
      end
      # ????
      if @battler.damage_pop
        damage(@battler.damage, @battler.critical)
        @battler.damage = nil
        @battler.critical = false
        @battler.damage_pop = false
      end
      # ????
      if @battler.damage == nil and @battler.dead?
        if @battler.is_a?(Game_Enemy)
          $game_system.se_play($data_system.enemy_collapse_se)
          collapse
          @battler_visible = false
        else
          $game_system.se_play($data_system.actor_collapse_se)
          self.bitmap = RPG::Cache.battler(@battler.battler_name + "_dead",
                                           @battler_hue)
        end
      end
    end
    # ???????????
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.z = @battler.screen_z
  end
end

class Window_BattleResult < Window_Base
  def initialize(exp, gold, treasures)
    @exp = exp
    @gold = gold
    @treasures = treasures
    super(160, 0, 320, @treasures.size * 32 + 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    self.y = 160 - height / 2
    self.z = 6000
    self.back_opacity = 160
    self.visible = false
    refresh
  end
end


#^EƒAƒNƒeƒBƒuƒ^ƒCƒ€ƒoƒgƒ‹ Ver 0.999q(l’Œƒo[ƒWƒ‡ƒ“)

class Scene_Battle
  #--------------------------------------------------------------------------
  # œ ŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”
  #--------------------------------------------------------------------------
  attr_reader   :status_window            # ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE
  attr_accessor :force                    # ƒAƒNƒVƒ‡ƒ“‹­§“x
  #--------------------------------------------------------------------------
  # œ ATBŠî‘bƒZƒbƒgƒAƒbƒv
  #--------------------------------------------------------------------------
  def atb_setup
    # ATB‰Šú‰»
    # speed   : ƒoƒgƒ‹ƒXƒs[ƒhŒˆ’èB’l‚ª¬‚³‚¢‚Ù‚Ç‘‚¢
    # @active : ƒAƒNƒeƒBƒu“xÝ’è
    #   3:í‚ɃAƒNƒeƒBƒuó‘Ô
    #   2:ƒXƒLƒ‹EƒAƒCƒeƒ€‘I‘𒆂̂݃AƒNƒeƒBƒuƒQ[ƒW‚ªŽ~‚Ü‚é
    #   1:2‚̏ó‘ԂɉÁ‚¦Aƒ^[ƒQƒbƒg‘I‘ðŽž‚àƒEƒFƒCƒg‚ªŠ|‚©‚é
    #   0:1‚̏ó‘ԂɉÁ‚¦AƒRƒ}ƒ“ƒh“ü—ÍŽž‚É‚àƒEƒFƒCƒg‚ªŠ|‚©‚é
    # @anime_wait : true‚É‚·‚é‚ƃoƒgƒ‹ƒAƒjƒFƒ_ƒ[ƒW•Ž¦’†‚̓EƒFƒCƒg‚ªŠ|‚©‚é
    # @damage_wait : ƒ_ƒ[ƒW•Ž¦ŽžŠÔi’PˆÊ‚̓tƒŒ[ƒ€j
    # @force : ‹­§ƒAƒNƒVƒ‡ƒ“‚ŃXƒLƒ‹Žg—pŽž‚Ì‹­§‹ï‡
    #   2:ƒXƒLƒ‹‚Í‘S‚ĉr¥‚¹‚¸A•K‚¸‘¦ŽžŽÀs
    #   1:’P“ƃXƒLƒ‹‚͉r¥‚µA˜AŒgƒXƒLƒ‹‚Ì‚Ý‘¦ŽžŽÀs
    #   0:‘SƒXƒLƒ‹‰r¥‚ðs‚¤‚¾‚¯
    # ($scene.force = x ‚Æ‚·‚邱‚Æ‚É‚æ‚èA’ʏíƒCƒxƒ“ƒg‚̃XƒNƒŠƒvƒg‚©‚ç•ÏX‰Â”j
    speed = 200
    @active = 3
    @anime_wait = false
    @damage_wait = 20
    @force = 2
    @escape == false
    @max = 0
    @turn_cnt = 0
    @action_battlers = []
    @synthe = []
    @spell_p = {}
    @spell_e = {}
    @command_a = false
    @command = []
    @party = false
    @phase4_step = 1
    $game_troop.setup(@troop_id)
    for battler in $game_party.actors + $game_troop.enemies
      battler.at = battler.agi * rand(speed / 2)
      if battler.is_a?(Game_Actor)
        @max += battler.agi
      end
      spell_reset(battler)
    end
    @max *= speed
    @max /= $game_party.actors.size
    for battler in $game_party.actors + $game_troop.enemies
      battler.atp = 100 * battler.at / @max
    end
  end
end

class Window_Base < Window
  #--------------------------------------------------------------------------
  # œ ATG ‚Ì•`‰æ
  #     actor : ƒAƒNƒ^[
  #     x     : •`‰ææ X À•W
  #     y     : •`‰ææ Y À•W
  #     width : •`‰ææ‚Ì•
  #--------------------------------------------------------------------------
  def draw_actor_atg(actor, x, y, width = 144)
    # •Ï”at‚É•`‰æ‚·‚éƒQ[ƒW‚Ì•‚ð‘ã“ü
    if actor.rtp == 0
      at = width * actor.atp / 100
    else
      at = width * actor.rt / actor.rtp
    end
    if at > width
      at = width
    end
    # •Ï”rate‚ÉŒ»Ý‚ÌATƒQ[ƒW‚ÌŠ„‡‚ð‘ã“ü
    rate = at.to_f / width
    # ˜g•`‰æ
    self.contents.fill_rect(x - 2, y + 8, width + 4, 16,
                            Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x - 1, y + 9, width + 2, 14,
                            Color.new(255, 255, 192, 255))
    # ‹óƒQ[ƒW‚̐FÝ’è color1:ƒXƒ^[ƒgƒJƒ‰[color2:ƒGƒ“ƒhƒJƒ‰[
    color1 = Color.new(0, 0, 64, 192)
    color2 = Color.new(0, 0, 0, 192)
    # ‹óƒQ[ƒW‚Ì•`‰æˆ— c‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“
    self.contents.gradation_rect(x, y + 10, width, 12,
                                          color1, color2, 1)
    # ƒQ[ƒW‚Ì•`‰æˆ—
    if at == width
      # ƒQ[ƒW‚ªMAX‚ÌŽž‚̐FÝ’è
      color1 = Color.new(0, 80, 0)
      color2 = Color.new(0, 80 + 160 * rate, 0)
    else
      if actor.rtp == 0
        # ’ʏ펞‚̐FÝ’è
        color1 = Color.new(0, 64, 80)
        color2 = Color.new(0, 64 + 128 * rate, 80 + 160 * rate)
      else
        if actor.spell == true
          # ˜AŒgƒXƒLƒ‹Žg—pŽž‚̐FÝ’è
          color1 = Color.new(80, 64, 32)
          color2 = Color.new(80 + 160 * rate, 64 + 128 * rate, 32 + 64 * rate)
        else
          # ƒXƒLƒ‹‰r¥Žž‚̐FÝ’è
          color1 = Color.new(80, 0, 64)
          color2 = Color.new(80 + 160 * rate, 0, 64 + 128 * rate)
        end
      end
    end
    # ATƒQ[ƒW‚Ì•`‰æˆ— ‰¡‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“
    self.contents.gradation_rect(x, y + 10, at, 12, color1, color2)
  end
end

#==============================================================================
# ¡ Scene_Battle (•ªŠ„’è‹` 1)
#------------------------------------------------------------------------------
# @ƒoƒgƒ‹‰æ–ʂ̏ˆ—‚ðs‚¤ƒNƒ‰ƒX‚Å‚·B
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # œ ƒƒCƒ“ˆ—
  #--------------------------------------------------------------------------
  def main
    # í“¬—p‚ÌŠeŽíˆêŽžƒf[ƒ^‚ð‰Šú‰»
    $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
    # ƒoƒgƒ‹ƒCƒxƒ“ƒg—pƒCƒ“ƒ^ƒvƒŠƒ^‚ð‰Šú‰»
    $game_system.battle_interpreter.setup(nil, 0)
    # ƒgƒ‹[ƒv‚ð€”õ
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    atb_setup
    # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚ðì¬
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # ‚»‚Ì‘¼‚̃EƒBƒ“ƒhƒE‚ðì¬
    @party_command_window = Window_PartyCommand.new
    @help_window = Window_Help.new
    @help_window.back_opacity = 160
    @help_window.visible = false
    @status_window = Window_BattleStatus.new
    @message_window = Window_Message.new
    # ƒXƒvƒ‰ƒCƒgƒZƒbƒg‚ðì¬
    @spriteset = Spriteset_Battle.new
    # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ð‰Šú‰»
    @wait_count = 0
    # ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“ŽÀs
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    # ƒvƒŒƒoƒgƒ‹ƒtƒF[ƒYŠJŽn
    start_phase1
    # ƒƒCƒ“ƒ‹[ƒv
    loop do
      # ƒQ[ƒ€‰æ–Ê‚ðXV
      Graphics.update
      # “ü—͏î•ñ‚ðXV
      Input.update
      # ƒtƒŒ[ƒ€XV
      update
      # ‰æ–Ê‚ªØ‚è‘Ö‚í‚Á‚½‚烋[ƒv‚ð’†’f
      if $scene != self
        break
      end
    end
    # ƒ}ƒbƒv‚ðƒŠƒtƒŒƒbƒVƒ…
    $game_map.refresh
    # ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“€”õ
    Graphics.freeze
    # ƒEƒBƒ“ƒhƒE‚ð‰ð•ú
    @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
    # ƒXƒvƒ‰ƒCƒgƒZƒbƒg‚ð‰ð•ú
    @spriteset.dispose
    # ƒ^ƒCƒgƒ‹‰æ–ʂɐ؂è‘Ö‚¦’†‚̏ꍇ
    if $scene.is_a?(Scene_Title)
      # ‰æ–Ê‚ðƒtƒF[ƒhƒAƒEƒg
      Graphics.transition
      Graphics.freeze
    end
    # í“¬ƒeƒXƒg‚©‚çƒQ[ƒ€ƒI[ƒo[‰æ–ʈȊO‚ɐ؂è‘Ö‚¦’†‚̏ꍇ
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV
  #--------------------------------------------------------------------------
  def update
    # ƒoƒgƒ‹ƒCƒxƒ“ƒgŽÀs’†‚̏ꍇ
    if $game_system.battle_interpreter.running?
      if @command.size > 0
        @command_a = false
        @command = []
        command_delete
      end
      @status_window.at_refresh
      # ƒCƒ“ƒ^ƒvƒŠƒ^‚ðXV
      $game_system.battle_interpreter.update
      # ƒAƒNƒVƒ‡ƒ“‚ð‹­§‚³‚ê‚Ä‚¢‚éƒoƒgƒ‰[‚ª‘¶Ý‚µ‚È‚¢ê‡
      if $game_temp.forcing_battler == nil
        # ƒoƒgƒ‹ƒCƒxƒ“ƒg‚ÌŽÀs‚ªI‚í‚Á‚½ê‡
        unless $game_system.battle_interpreter.running?
          # í“¬Œp‘±‚̏ꍇAƒoƒgƒ‹ƒCƒxƒ“ƒg‚̃ZƒbƒgƒAƒbƒv‚ðÄŽÀs
          unless judge
            @status_window.refresh
            setup_battle_event
          end
        end
      end
    end
    # ƒVƒXƒeƒ€ (ƒ^ƒCƒ}[)A‰æ–Ê‚ðXV
    $game_system.update
    $game_screen.update
    # ƒ^ƒCƒ}[‚ª 0 ‚É‚È‚Á‚½ê‡
    if $game_system.timer_working and $game_system.timer == 0
      # ƒoƒgƒ‹’†’f
      $game_temp.battle_abort = true
    end
    # ƒEƒBƒ“ƒhƒE‚ðXV
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @message_window.update
    # ƒXƒvƒ‰ƒCƒgƒZƒbƒg‚ðXV
    @spriteset.update
    # ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“ˆ—’†‚̏ꍇ
    if $game_temp.transition_processing
      # ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“ˆ—’†ƒtƒ‰ƒO‚ðƒNƒŠƒA
      $game_temp.transition_processing = false
      # ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“ŽÀs
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # ƒƒbƒZ[ƒWƒEƒBƒ“ƒhƒE•Ž¦’†‚̏ꍇ
    if $game_temp.message_window_showing
      return
    end
    # ƒQ[ƒ€ƒI[ƒo[‚̏ꍇ
    if $game_temp.gameover
      # ƒQ[ƒ€ƒI[ƒo[‰æ–ʂɐ؂è‘Ö‚¦
      $scene = Scene_Gameover.new
      return
    end
    # ƒ^ƒCƒgƒ‹‰æ–Ê‚É–ß‚·ê‡
    if $game_temp.to_title
      # ƒ^ƒCƒgƒ‹‰æ–ʂɐ؂è‘Ö‚¦
      $scene = Scene_Title.new
      return
    end
    # ƒoƒgƒ‹’†’f‚̏ꍇ
    if $game_temp.battle_abort
      # ƒoƒgƒ‹ŠJŽn‘O‚Ì BGM ‚É–ß‚·
      $game_system.bgm_play($game_temp.map_bgm)
      # ƒoƒgƒ‹I—¹
      battle_end(1)
      return
    end
    # ƒtƒF[ƒY‚É‚æ‚Á‚Ä•ªŠò
    case @phase
    when 0  # ATƒQ[ƒWXVƒtƒF[ƒY
      if anime_wait_return
        update_phase0
      end
    when 1  # ƒvƒŒƒoƒgƒ‹ƒtƒF[ƒY
      update_phase1
      return
    when 2  # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒtƒF[ƒY
      update_phase2
      return
    when 5  # ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒY
      update_phase5
      return
    end
    if $scene != self
      return
    end
    if @phase == 0
      if @command.size != 0  # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY
        if @command_a == false
          start_phase3
        end
        update_phase3
      end
      # ƒEƒFƒCƒg’†‚̏ꍇ
      if @wait_count > 0
        # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ðŒ¸‚ç‚·
        @wait_count -= 1
        return
      end
      update_phase4
    end
  end
 
#==============================================================================
# ¡ Scene_Battle (•ªŠ„’è‹` 2)
#------------------------------------------------------------------------------
# @ƒoƒgƒ‹‰æ–ʂ̏ˆ—‚ðs‚¤ƒNƒ‰ƒX‚Å‚·B
#==============================================================================

  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ATƒQ[ƒWXVƒtƒF[ƒY)
  #--------------------------------------------------------------------------
  def update_phase0
    if $game_temp.battle_turn == 0
      $game_temp.battle_turn = 1
    end
    # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if @command_a == false and @party == false
      if Input.trigger?(Input::B)
        # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
        $game_system.se_play($data_system.cancel_se)
        @party = true
      end
    end
    if @party == true and @phase4_step == 1
      # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒtƒF[ƒY‚Ö
      start_phase2
      return
    end
    # ATƒQ[ƒW‘‰Áˆ—
    cnt = 0
    for battler in $game_party.actors + $game_troop.enemies
      active?(battler)
      if battler.rtp == 0
        if battler.at >= @max
          if battler.is_a?(Game_Actor)
            if battler.inputable?
              unless @action_battlers.include?(battler) or
                  @command.include?(battler) or @escape == true
                if battler.current_action.forcing
                  @action_battlers.push(battler)
                else
                  @command.push(battler)
                end
              end
            else
              unless @action_battlers.include?(battler) or
                  battler == @command[0]
                battler.current_action.clear
                @command.delete(battler)
                @action_battlers.push(battler)
              end
            end
          else
            unless @action_battlers.include?(battler)
              number = cnt - $game_party.actors.size
              enemy_action(number)
            end
          end
        else
          battler.at += battler.agi
          if battler.guarding?
            battler.at += battler.agi
          end
          if battler.movable?
            battler.atp = 100 * battler.at / @max
          end
        end
      else
        if battler.rt >= battler.rtp
          speller = synthe?(battler)
          if speller != nil
            battler = speller[0]
          end
          unless @action_battlers.include?(battler)
            battler.rt = battler.rtp
            @action_battlers.push(battler)
          end
        else
          battler.rt += battler.agi
          speller = synthe?(battler)
          if speller != nil
            for spell in speller
              if spell != battler
                spell.rt += battler.agi
              end
            end
          end
        end
      end
      cnt += 1
    end
    # ATƒQ[ƒW‚ðƒŠƒtƒŒƒbƒVƒ…
    @status_window.at_refresh
    # “¦‘–ˆ—
    if @escape == true and @phase4_step == 1
      temp = false
      for battler in $game_party.actors
        if battler.inputable?
          temp = true
        end
      end
      if temp == true
        for battler in $game_party.actors
          if battler.at < @max and battler.inputable?
            temp = false
            break
          end
        end
        if temp == true
          @escape = false
          for battler in $game_party.actors
            battler.at %= @max
          end
          $game_temp.battle_main_phase = false
          update_phase2_escape
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒtƒF[ƒYŠJŽn
  #--------------------------------------------------------------------------
  def start_phase2
    # ƒtƒF[ƒY 2 ‚Ɉڍs
    @phase = 2
    @party = false
    # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚ð—LŒø‰»
    @party_command_window.active = true
    @party_command_window.visible = true
    # ƒAƒNƒ^[‚ð”ñ‘I‘ðó‘Ԃɐݒè
    @actor_index = -1
    # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
    @actor_command_window.active = false
    @actor_command_window.visible = false
    if @command.size != 0
      # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
      if @active_actor != nil
        @active_actor.blink = false
      end
    end
    # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒNƒŠƒA
    $game_temp.battle_main_phase = false
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒtƒF[ƒY)
  #--------------------------------------------------------------------------
  def update_phase2
    # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::C)
      # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚̃J[ƒƒ‹ˆÊ’u‚Å•ªŠò
      case @party_command_window.index
      when 0  # í‚¤
        # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
        @party_command_window.active = false
        @party_command_window.visible = false
        # Œˆ’è SE ‚ð‰‰‘t
        $game_system.se_play($data_system.decision_se)
        @escape = false
        @phase = 0
        if $game_temp.battle_turn == 0
         $game_temp.battle_turn = 1
        end
        if @command_a == true
          # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒYŠJŽn
          start_phase3
        else
          $game_temp.battle_main_phase = true
        end
      when 1  # “¦‚°‚é
        # “¦‘–‰Â”‚Å‚Í‚È‚¢ê‡
        if $game_temp.battle_can_escape == false
          # ƒuƒU[ SE ‚ð‰‰‘t
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Œˆ’è SE ‚ð‰‰‘t
        $game_system.se_play($data_system.decision_se)
        @phase = 0
        # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
        @party_command_window.active = false
        @party_command_window.visible = false
        $game_temp.battle_main_phase = true
        if $game_temp.battle_turn == 0
          update_phase2_escape
          $game_temp.battle_turn = 1
          for battler in $game_party.actors
            battler.at -= @max / 2
          end
          return
        end
        # Œˆ’è SE ‚ð‰‰‘t
        $game_system.se_play($data_system.decision_se)
        @escape = true
        for battler in $game_party.actors
          @command_a = false
          @command.delete(battler)
          @action_battlers.delete(battler)
          skill_reset(battler)
        end
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒYŠJŽn
  #--------------------------------------------------------------------------
  def start_phase5
    for actor in $game_party.actors
      actor.victory = true
    end
    # ƒtƒF[ƒY 5 ‚Ɉڍs
    @phase = 5
    # ƒoƒgƒ‹I—¹ ME ‚ð‰‰‘t
    $game_system.me_play($game_system.battle_end_me)
    # ƒoƒgƒ‹ŠJŽn‘O‚Ì BGM ‚É–ß‚·
    $game_system.bgm_play($game_temp.map_bgm)
    # EXPAƒS[ƒ‹ƒhAƒgƒŒƒWƒƒ[‚ð‰Šú‰»
    exp = 0
    gold = 0
    treasures = []
    if @active_actor != nil
      @active_actor.blink = false
    end
    # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒZƒbƒg
    $game_temp.battle_main_phase = true
    # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
    @party_command_window.active = false
    @party_command_window.visible = false
    # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
    @actor_command_window.active = false
    @actor_command_window.visible = false
    if @skill_window != nil
      # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ð‰ð•ú
      @skill_window.dispose
      @skill_window = nil
    end
    if @item_window != nil
      # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ð‰ð•ú
      @item_window.dispose
      @item_window = nil
    end
    # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚ð‰B‚·
    @help_window.visible = false
    # ƒ‹[ƒv
    for enemy in $game_troop.enemies
      # ƒGƒlƒ~[‚ª‰B‚êó‘Ô‚Å‚È‚¢ê‡
      unless enemy.hidden
        # Šl“¾ EXPAƒS[ƒ‹ƒh‚ð’ljÁ
        exp += enemy.exp
        gold += enemy.gold
        # ƒgƒŒƒWƒƒ[oŒ»”»’è
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    # ƒgƒŒƒWƒƒ[‚̐”‚ð 6 ŒÂ‚Ü‚Å‚ÉŒÀ’è
    treasures = treasures[0..5]
    # EXP Šl“¾
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    # ƒS[ƒ‹ƒhŠl“¾
    $game_party.gain_gold(gold)
    # ƒgƒŒƒWƒƒ[Šl“¾
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # ƒoƒgƒ‹ƒŠƒUƒ‹ƒgƒEƒBƒ“ƒhƒE‚ðì¬
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ðÝ’è
    @phase5_wait_count = 100
  end

#==============================================================================
# ¡ Scene_Battle (•ªŠ„’è‹` 3)
#------------------------------------------------------------------------------
# @ƒoƒgƒ‹‰æ–ʂ̏ˆ—‚ðs‚¤ƒNƒ‰ƒX‚Å‚·B
#==============================================================================

  #--------------------------------------------------------------------------
  # œ ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒYŠJŽn
  #--------------------------------------------------------------------------
  def start_phase3
    # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒNƒŠƒA
    $game_temp.battle_main_phase = false
    @command_a = true
    @active_actor = @command[0]
    cnt = 0
    for actor in $game_party.actors
      if actor == @active_actor
        @actor_index = cnt
      end
      cnt += 1
    end
    @active_actor.blink = true
    unless @active_actor.inputable?
      @active_actor.current_action.clear
      phase3_next_actor
      return
    end
    phase3_setup_command_window
  end
  #--------------------------------------------------------------------------
  # œ ƒAƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—͏I—¹
  #--------------------------------------------------------------------------
  def phase3_next_actor
    @command.shift
    @command_a = false
    # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒZƒbƒg
    $game_temp.battle_main_phase = true
    # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
    if @active_actor != nil
      @active_actor.blink = false
    end
    @action_battlers.push(@active_actor)
    return
  end
  #--------------------------------------------------------------------------
  # œ ƒGƒlƒ~[ƒAƒNƒVƒ‡ƒ“ì¬
  #--------------------------------------------------------------------------
  def enemy_action(number)
    enemy = $game_troop.enemies[number]
    unless enemy.current_action.forcing
      enemy.make_action
    end
    @action_battlers.push(enemy)
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY : Šî–{ƒRƒ}ƒ“ƒh)
  #--------------------------------------------------------------------------
  def update_phase3_basic_command
    unless @active_actor.inputable?
      @active_actor.current_action.clear
      phase3_next_actor
      return
    end
    # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::B) and @party == false
      # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
      $game_system.se_play($data_system.cancel_se)
      @party = true
    end
    if @party == true and @phase4_step == 1
      # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒtƒF[ƒY‚Ö
      start_phase2
      return
    end
    # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::C)
      @party = false
      # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚̃J[ƒƒ‹ˆÊ’u‚Å•ªŠò
      case @actor_command_window.index
      when 0  # UŒ‚
        if fin?
          # ƒuƒU[ SE ‚ð‰‰‘t
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Œˆ’è SE ‚ð‰‰‘t
        $game_system.se_play($data_system.decision_se)
        # ƒGƒlƒ~[‚Ì‘I‘ð‚ðŠJŽn
        start_enemy_select
      when 1  # ƒXƒLƒ‹
        # Œˆ’è SE ‚ð‰‰‘t
        $game_system.se_play($data_system.decision_se)
        # ƒXƒLƒ‹‚Ì‘I‘ð‚ðŠJŽn
        start_skill_select
      when 2  # –hŒä
        # Œˆ’è SE ‚ð‰‰‘t
        $game_system.se_play($data_system.decision_se)
        # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
        @active_actor.current_action.kind = 0
        @active_actor.current_action.basic = 1
        # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
        phase3_next_actor
      when 3  # ƒAƒCƒeƒ€
        # Œˆ’è SE ‚ð‰‰‘t
        $game_system.se_play($data_system.decision_se)
        # ƒAƒCƒeƒ€‚Ì‘I‘ð‚ðŠJŽn
        start_item_select
      end
      return
    end
    # R ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      @party = false
      # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
      if @active_actor != nil
        @active_actor.blink = false
      end
      @command.push(@command[0])
      @command.shift
      @command_a = false
      # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒZƒbƒg
      $game_temp.battle_main_phase = true
      # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
      @actor_command_window.active = false
      @actor_command_window.visible = false
    end
    # L ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::L)
      $game_system.se_play($data_system.cursor_se)
      @party = false
      # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
      if @active_actor != nil
        @active_actor.blink = false
      end
      @command.unshift(@command[@command.size - 1])
      @command.delete_at(@command.size - 1)
      @command_a = false
      # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒZƒbƒg
      $game_temp.battle_main_phase = true
      # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
      @actor_command_window.active = false
      @actor_command_window.visible = false
    end
    # ‰E ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @party = false
      # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
      if @active_actor != nil
        @active_actor.blink = false
      end
      actor = $game_party.actors[@actor_index]
      while actor == @command[0] or (not @command.include?(actor))
        @actor_index += 1
        actor = $game_party.actors[@actor_index]
        if actor == nil
          @actor_index = 0
          actor = $game_party.actors[@actor_index]
        end
        if actor == @command[0]
          break
        end
      end
      while actor != @command[0]
        @command.push(@command[0])
        @command.shift
      end
      @command_a = false
      # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒZƒbƒg
      $game_temp.battle_main_phase = true
      # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
      @actor_command_window.active = false
      @actor_command_window.visible = false
    end
    # ¶ ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @party = false
      # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
      if @active_actor != nil
        @active_actor.blink = false
      end
      actor = $game_party.actors[@actor_index]
      while actor == @command[0] or (not @command.include?(actor))
        @actor_index -= 1
        actor = $game_party.actors[@actor_index]
        if actor == nil
          @actor_index = $game_party.actors.size - 1
          actor = $game_party.actors[@actor_index]
        end
        if actor == @command[0]
          break
        end
      end
      while actor != @command[0]
        @command.push(@command[0])
        @command.shift
      end
      @command_a = false
      # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒZƒbƒg
      $game_temp.battle_main_phase = true
      # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
      @actor_command_window.active = false
      @actor_command_window.visible = false
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY : ƒXƒLƒ‹‘I‘ð)
  #--------------------------------------------------------------------------
  def update_phase3_skill_select
    # ƒRƒ}ƒ“ƒh‘I‘𒆂ɍs“®•s”‚É‚È‚Á‚½ê‡
    unless @active_actor.inputable?
      @active_actor.current_action.clear
      command_delete
      # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
      phase3_next_actor
      return
    end
    # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ð‰ÂŽ‹ó‘Ô‚É‚·‚é
    @skill_window.visible = true
    # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ðXV
    @skill_window.update
    # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::B)
      # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
      $game_system.se_play($data_system.cancel_se)
      # ƒXƒLƒ‹‚Ì‘I‘ð‚ðI—¹
      end_skill_select
      return
    end
    # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::C)
      # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ÅŒ»Ý‘I‘ð‚³‚ê‚Ä‚¢‚éƒf[ƒ^‚ðŽæ“¾
      @skill = @skill_window.skill
      # Žg—p‚Å‚«‚È‚¢ê‡
      if @skill == nil or not @active_actor.skill_can_use?(@skill.id)
        # ƒuƒU[ SE ‚ð‰‰‘t
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @skill.scope == 1 or @skill.scope == 2
        if fin?
          # ƒuƒU[ SE ‚ð‰‰‘t
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      end       
      # Œˆ’è SE ‚ð‰‰‘t
      $game_system.se_play($data_system.decision_se)
      # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
      @active_actor.current_action.skill_id = @skill.id
      # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ð•s‰ÂŽ‹ó‘Ô‚É‚·‚é
      @skill_window.visible = false
      # Œø‰Ê”͈͂ª“G’P‘̂̏ꍇ
      if @skill.scope == 1
        # ƒGƒlƒ~[‚Ì‘I‘ð‚ðŠJŽn
        start_enemy_select
      # Œø‰Ê”͈͂ª–¡•û’P‘̂̏ꍇ
      elsif @skill.scope == 3 or @skill.scope == 5
        # ƒAƒNƒ^[‚Ì‘I‘ð‚ðŠJŽn
        start_actor_select
      # Œø‰Ê”͈͂ª’P‘Ì‚Å‚Í‚È‚¢ê‡
      else
        # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
        @active_actor.current_action.kind = 1
        # ƒXƒLƒ‹‚Ì‘I‘ð‚ðI—¹
        end_skill_select
        # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY : ƒAƒCƒeƒ€‘I‘ð)
  #--------------------------------------------------------------------------
  def update_phase3_item_select
    # ƒRƒ}ƒ“ƒh‘I‘𒆂ɍs“®•s”‚É‚È‚Á‚½ê‡
    unless @active_actor.inputable?
      @active_actor.current_action.clear
      command_delete
      # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
      phase3_next_actor
      return
    end
    # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ð‰ÂŽ‹ó‘Ô‚É‚·‚é
    @item_window.visible = true
    # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ðXV
    @item_window.update
    # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::B)
      # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
      $game_system.se_play($data_system.cancel_se)
      # ƒAƒCƒeƒ€‚Ì‘I‘ð‚ðI—¹
      end_item_select
      return
    end
    # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::C)
      # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ÅŒ»Ý‘I‘ð‚³‚ê‚Ä‚¢‚éƒf[ƒ^‚ðŽæ“¾
      @item = @item_window.item
      # Žg—p‚Å‚«‚È‚¢ê‡
      unless $game_party.item_can_use?(@item.id)
        # ƒuƒU[ SE ‚ð‰‰‘t
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @item.scope == 1 or @item.scope == 2
        if fin?
          # ƒuƒU[ SE ‚ð‰‰‘t
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      end
      # Œˆ’è SE ‚ð‰‰‘t
      $game_system.se_play($data_system.decision_se)
      # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
      @active_actor.current_action.item_id = @item.id
      # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ð•s‰ÂŽ‹ó‘Ô‚É‚·‚é
      @item_window.visible = false
      # Œø‰Ê”͈͂ª“G’P‘̂̏ꍇ
      if @item.scope == 1
        # ƒGƒlƒ~[‚Ì‘I‘ð‚ðŠJŽn
        start_enemy_select
      # Œø‰Ê”͈͂ª–¡•û’P‘̂̏ꍇ
      elsif @item.scope == 3 or @item.scope == 5
        # ƒAƒNƒ^[‚Ì‘I‘ð‚ðŠJŽn
        start_actor_select
      # Œø‰Ê”͈͂ª’P‘Ì‚Å‚Í‚È‚¢ê‡
      else
        # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
        @active_actor.current_action.kind = 2
        # ƒAƒCƒeƒ€‚Ì‘I‘ð‚ðI—¹
        end_item_select
        # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY : ƒGƒlƒ~[‘I‘ð)
  #--------------------------------------------------------------------------
  def update_phase3_enemy_select
    if fin?
      # ƒGƒlƒ~[‚Ì‘I‘ð‚ðI—¹
      end_enemy_select
      return
    end
    # ƒRƒ}ƒ“ƒh‘I‘𒆂ɍs“®•s”‚É‚È‚Á‚½ê‡
    unless @active_actor.inputable?
      @active_actor.current_action.clear
      command_delete
      # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
      phase3_next_actor
      return
    end
    # ƒGƒlƒ~[ƒAƒ[‚ðXV
    @enemy_arrow.update
    # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::B)
      # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
      $game_system.se_play($data_system.cancel_se)
      # ƒGƒlƒ~[‚Ì‘I‘ð‚ðI—¹
      end_enemy_select
      return
    end
    # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::C)
      # Œˆ’è SE ‚ð‰‰‘t
      $game_system.se_play($data_system.decision_se)
      # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
      @active_actor.current_action.kind = 0
      @active_actor.current_action.basic = 0
      @active_actor.current_action.target_index = @enemy_arrow.index
      # ƒGƒlƒ~[‚Ì‘I‘ð‚ðI—¹
      end_enemy_select
      # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE•Ž¦’†‚̏ꍇ
      if @skill_window != nil
        # ƒAƒNƒVƒ‡ƒ“‚ðÄÝ’è
        @active_actor.current_action.kind = 1
        # ƒXƒLƒ‹‚Ì‘I‘ð‚ðI—¹
        end_skill_select
      end
      # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE•Ž¦’†‚̏ꍇ
      if @item_window != nil
        # ƒAƒNƒVƒ‡ƒ“‚ðÄÝ’è
        @active_actor.current_action.kind = 2
        # ƒAƒCƒeƒ€‚Ì‘I‘ð‚ðI—¹
        end_item_select
      end
      # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
      phase3_next_actor
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY : ƒAƒNƒ^[‘I‘ð)
  #--------------------------------------------------------------------------
  def update_phase3_actor_select
    # ƒRƒ}ƒ“ƒh‘I‘𒆂ɍs“®•s”‚É‚È‚Á‚½ê‡
    unless @active_actor.inputable?
      @active_actor.current_action.clear
      command_delete
      # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
      phase3_next_actor
      return
    end
    # ƒAƒNƒ^[ƒAƒ[‚ðXV
    @actor_arrow.update
    # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::B)
      # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
      $game_system.se_play($data_system.cancel_se)
      # ƒAƒNƒ^[‚Ì‘I‘ð‚ðI—¹
      end_actor_select
      return
    end
    # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::C)
      # Œˆ’è SE ‚ð‰‰‘t
      $game_system.se_play($data_system.decision_se)
      # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
      @active_actor.current_action.kind = 0
      @active_actor.current_action.basic = 0
      @active_actor.current_action.target_index = @actor_arrow.index
      # ƒAƒNƒ^[‚Ì‘I‘ð‚ðI—¹
      end_actor_select
      # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE•Ž¦’†‚̏ꍇ
      if @skill_window != nil
        # ƒAƒNƒVƒ‡ƒ“‚ðÄÝ’è
        @active_actor.current_action.kind = 1
        # ƒXƒLƒ‹‚Ì‘I‘ð‚ðI—¹
        end_skill_select
      end
      # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE•Ž¦’†‚̏ꍇ
      if @item_window != nil
        # ƒAƒNƒVƒ‡ƒ“‚ðÄÝ’è
        @active_actor.current_action.kind = 2
        # ƒAƒCƒeƒ€‚Ì‘I‘ð‚ðI—¹
        end_item_select
      end
      # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
      phase3_next_actor
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒXƒLƒ‹‘I‘ðŠJŽn
  #--------------------------------------------------------------------------
  def start_skill_select
    # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ðì¬
    @skill_window = Window_Skill.new(@active_actor)
    # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚ðŠÖ˜A•t‚¯
    @skill_window.help_window = @help_window
    # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end

#==============================================================================
# ¡ Scene_Battle (•ªŠ„’è‹` 4)
#------------------------------------------------------------------------------
# @ƒoƒgƒ‹‰æ–ʂ̏ˆ—‚ðs‚¤ƒNƒ‰ƒX‚Å‚·B
#==============================================================================

  #--------------------------------------------------------------------------
  # œ ƒƒCƒ“ƒtƒF[ƒYŠJŽn
  #--------------------------------------------------------------------------
  def start_phase4
    $game_temp.battle_main_phase = true
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 1 : ƒAƒNƒVƒ‡ƒ“€”õ)
  #--------------------------------------------------------------------------
  def update_phase4_step1
    # Ÿ”s”»’è
    if judge
      # Ÿ—˜‚Ü‚½‚Í”s–k‚̏ꍇ : ƒƒƒbƒhI—¹
      return
    end
    # ƒAƒNƒVƒ‡ƒ“‚ð‹­§‚³‚ê‚Ä‚¢‚éƒoƒgƒ‰[‚ª‘¶Ý‚µ‚È‚¢ê‡
    if $game_temp.forcing_battler == nil
      # ƒoƒgƒ‹ƒCƒxƒ“ƒg‚ðƒZƒbƒgƒAƒbƒv
      setup_battle_event
      # ƒoƒgƒ‹ƒCƒxƒ“ƒgŽÀs’†‚̏ꍇ
      if $game_system.battle_interpreter.running?
        return
      end
    end
    # ƒAƒNƒVƒ‡ƒ“‚ð‹­§‚³‚ê‚Ä‚¢‚éƒoƒgƒ‰[‚ª‘¶Ý‚·‚éê‡
    if $game_temp.forcing_battler != nil
      # æ“ª‚ɒljÁ‚Ü‚½‚͈ړ®
      battler = $game_temp.forcing_battler
      @action_battlers.delete(battler)
      @action_battlers.unshift(battler)
      battler.at = @max
      battler.atp = 100 * battler.at / @max
    end
    # –¢s“®ƒoƒgƒ‰[‚ª‘¶Ý‚µ‚È‚¢ê‡ (‘Sˆõs“®‚µ‚½)
    if @action_battlers.size == 0
      return
    end
    # ƒAƒjƒ[ƒVƒ‡ƒ“ ID ‚¨‚æ‚уRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ð‰Šú‰»
    @animation1_id = 0
    @animation2_id = 0
    @common_event_id = 0
    # –¢s“®ƒoƒgƒ‰[”z—ñ‚̐擪‚©‚çƒVƒtƒg
    @active_battler = @action_battlers[0]
    # ‚·‚łɐ퓬‚©‚çŠO‚³‚ê‚Ä‚¢‚éê‡
    if @active_battler.index == nil
      @action_battlers.shift
      anime_wait_return
      return
    end
    # s“®‰Â”‚©‚Ç‚¤‚©”»’è
    unless active?(@active_battler)
      unless @active_battler.inputable?
        @phase4_step = 6
        return
      end
    end
    # ƒXƒLƒ‹Žg—pŽžA‰r¥ŽžŠÔÝ’è
    # ‹­§ƒAƒNƒVƒ‡ƒ“‚©‚ @force ‚ª 2 ‚ÌŽž‚̓XƒLƒ‹‚𑦎ž”­“®
    if @active_battler.current_action.kind == 1 and
      (not @active_battler.current_action.forcing or @force < 2)
      if @active_battler.rtp == 0
        # ƒXƒLƒ‹‰r¥’†‚È‚ç‚΁A‰ðœ
        skill_reset(@active_battler)
        # ƒXƒLƒ‹‰r¥ŽžŠÔÝ’è
        recite_time(@active_battler)
        # ’P“ƂŃXƒLƒ‹‚ð‰r¥‚·‚éê‡ƒAƒNƒVƒ‡ƒ“‚©‚çƒoƒgƒ‰[‚ðÁ‹Ž
        if @active_battler.rtp > 0
          @action_battlers.shift
        end
        # ˜AŒg‹ZÝ’è
        synthe_spell(@active_battler)
        # ƒXƒLƒ‹‚ð‰r¥‚·‚éê‡
        # ‹­§ƒAƒNƒVƒ‡ƒ“‚©‚ @force ‚ª 1 ‚ÌŽž‚͘AŒgƒXƒLƒ‹‚Ì‚Ý‘¦Žž”­“®
        if @active_battler.rtp > 0 and
            (not @active_battler.current_action.forcing or
            (@force < 1 or not synthe?(@active_battler)))
          @active_battler.blink = true
          anime_wait_return
          if @active_battler.current_action.forcing
            $game_temp.forcing_battler = nil
            @active_battler.current_action.forcing = false
          end
          return
        end
      end
    end
    # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
    if @active_battler != nil
      @active_battler.blink = false
    end
    # ƒXƒeƒbƒv 2 ‚Ɉڍs
    @phase4_step = 2
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 2 : ƒAƒNƒVƒ‡ƒ“ŠJŽn)
  #--------------------------------------------------------------------------
  def update_phase4_step2
    # ‹­§ƒAƒNƒVƒ‡ƒ“‚Å‚È‚¯‚ê‚Î
    unless @active_battler.current_action.forcing
      # §–ñ‚ª [“G‚ð’ʏíUŒ‚‚·‚é] ‚© [–¡•û‚ð’ʏíUŒ‚‚·‚é] ‚̏ꍇ
      if @active_battler.restriction == 2 or @active_battler.restriction == 3
        # ƒAƒNƒVƒ‡ƒ“‚ɍUŒ‚‚ðÝ’è
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 0
      end
    end
    # ‘Ώۃoƒgƒ‰[‚ðƒNƒŠƒA
    @target_battlers = []
    # ƒAƒNƒVƒ‡ƒ“‚ÌŽí•Ê‚Å•ªŠò
    case @active_battler.current_action.kind
    when 0  # Šî–{
      make_basic_action_result
    when 1  # ƒXƒLƒ‹
      make_skill_action_result
    when 2  # ƒAƒCƒeƒ€
      make_item_action_result
    end
    # ƒXƒeƒbƒv 3 ‚Ɉڍs
    if @phase4_step == 2
      @phase4_step = 3
    end
  end
  #--------------------------------------------------------------------------
  # œ Šî–{ƒAƒNƒVƒ‡ƒ“ Œ‹‰Êì¬
  #--------------------------------------------------------------------------
  def make_basic_action_result
    # UŒ‚‚̏ꍇ
    if @active_battler.current_action.basic == 0
      # ƒAƒjƒ[ƒVƒ‡ƒ“ ID ‚ðÝ’è
      @animation1_id = @active_battler.animation1_id
      @animation2_id = @active_battler.animation2_id
      # s“®‘¤ƒoƒgƒ‰[‚ªƒGƒlƒ~[‚̏ꍇ
      if @active_battler.is_a?(Game_Enemy)
        if @active_battler.restriction == 3
          target = $game_troop.random_target_enemy
        elsif @active_battler.restriction == 2
          target = $game_party.random_target_actor
        else
          index = @active_battler.current_action.target_index
          target = $game_party.smooth_target_actor(index)
        end
      end
      # s“®‘¤ƒoƒgƒ‰[‚ªƒAƒNƒ^[‚̏ꍇ
      if @active_battler.is_a?(Game_Actor)
        if @active_battler.restriction == 3
          target = $game_party.random_target_actor
        elsif @active_battler.restriction == 2
          target = $game_troop.random_target_enemy
        else
          index = @active_battler.current_action.target_index
          target = $game_troop.smooth_target_enemy(index)
        end
      end
      # ‘Ώۑ¤ƒoƒgƒ‰[‚Ì”z—ñ‚ðÝ’è
      @target_battlers = [target]
      # ’ʏíUŒ‚‚ÌŒø‰Ê‚ð“K—p
      for target in @target_battlers
        target.attack_effect(@active_battler)
      end
      return
    end
    # –hŒä‚̏ꍇ
    if @active_battler.current_action.basic == 1
      # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚É "–hŒä" ‚𕎦
      @help_window.set_text($data_system.words.guard, 1)
      return
    end
    # “¦‚°‚é‚̏ꍇ
    if @active_battler.is_a?(Game_Enemy) and
       @active_battler.current_action.basic == 2
      # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚É "“¦‚°‚é" ‚𕎦
      @help_window.set_text("“¦‚°‚é", 1)
      # “¦‚°‚é
      @active_battler.escape
      return
    end
    # ‰½‚à‚µ‚È‚¢‚̏ꍇ
    if @active_battler.current_action.basic == 3
      # ƒAƒNƒVƒ‡ƒ“‹­§‘Ώۂ̃oƒgƒ‰[‚ðƒNƒŠƒA
      $game_temp.forcing_battler = nil
      # ƒXƒeƒbƒv 6 ‚Ɉڍs
      @phase4_step = 6
      return
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒXƒLƒ‹ƒAƒNƒVƒ‡ƒ“ Œ‹‰Êì¬
  #--------------------------------------------------------------------------
  def make_skill_action_result
    # ƒXƒLƒ‹‚ðŽæ“¾
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # ˜AŒgƒXƒLƒ‹‚Å‚ ‚é‚©‚Ç‚¤‚©Šm”F
    speller = synthe?(@active_battler)
    # ‹­§ƒAƒNƒVƒ‡ƒ“‚Å‚È‚¯‚ê‚Î
    unless @active_battler.current_action.forcing
      # SP Ø‚ê‚È‚Ç‚ÅŽg—p‚Å‚«‚È‚­‚È‚Á‚½ê‡
      if speller != nil
        for battler in speller
          if battler.current_action.spell_id == 0
            unless battler.skill_can_use?(@skill.id)
              $game_temp.forcing_battler = nil
              @phase4_step = 6
              return
            end
          else
            unless battler.skill_can_use?(battler.current_action.spell_id)
              $game_temp.forcing_battler = nil
              @phase4_step = 6
              return
            end
          end
        end
      else
        unless @active_battler.skill_can_use?(@skill.id)
          # ƒAƒNƒVƒ‡ƒ“‹­§‘Ώۂ̃oƒgƒ‰[‚ðƒNƒŠƒA
          $game_temp.forcing_battler = nil
          # ƒXƒeƒbƒv 6 ‚Ɉڍs
          @phase4_step = 6
         return
        end
      end
    end
    # SP Á”ï
    temp = false
    if speller != nil
      for battler in speller
        if battler.current_action.spell_id == 0
          battler.sp -= @skill.sp_cost
        else
          battler.sp -= $data_skills[battler.current_action.spell_id].sp_cost
        end
      end
    else
      @active_battler.sp -= @skill.sp_cost
    end
    # ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE‚ðƒŠƒtƒŒƒbƒVƒ…
    @status_window.refresh
    # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚ɃXƒLƒ‹–¼‚𕎦
    @help_window.set_text(@skill.name, 1)
    # ƒAƒjƒ[ƒVƒ‡ƒ“ ID ‚ðÝ’è
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ðÝ’è
    @common_event_id = @skill.common_event_id
    # ‘Ώۑ¤ƒoƒgƒ‰[‚ðÝ’è
    set_target_battlers(@skill.scope)
    # ƒXƒLƒ‹‚ÌŒø‰Ê‚ð“K—p
    for target in @target_battlers
      if speller != nil
        damage = 0
        effective = false
        for battler in speller
          if battler.current_action.spell_id != 0
            @skill = $data_skills[battler.current_action.spell_id]
          end
          effective |= target.skill_effect(battler, @skill)
          if target.damage.class != String
            damage += target.damage
          elsif effective == true
            effect = target.damage
          end
        end
        if damage != 0
          target.damage = damage
        elsif effective = true
          target.damage = effect
        end
      else
        target.skill_effect(@active_battler, @skill)
      end
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒAƒCƒeƒ€ƒAƒNƒVƒ‡ƒ“ Œ‹‰Êì¬
  #--------------------------------------------------------------------------
  def make_item_action_result
    # ƒAƒCƒeƒ€‚ðŽæ“¾
    @item = $data_items[@active_battler.current_action.item_id]
    # ƒAƒCƒeƒ€Ø‚ê‚È‚Ç‚ÅŽg—p‚Å‚«‚È‚­‚È‚Á‚½ê‡
    unless $game_party.item_can_use?(@item.id)
      # ƒXƒeƒbƒv 6 ‚Ɉڍs
      @phase4_step = 6
      return
    end
    # Á–Õ•i‚̏ꍇ
    if @item.consumable
      # Žg—p‚µ‚½ƒAƒCƒeƒ€‚ð 1 Œ¸‚ç‚·
      $game_party.lose_item(@item.id, 1)
    end
    # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚ɃAƒCƒeƒ€–¼‚𕎦
    @help_window.set_text(@item.name, 1)
    # ƒAƒjƒ[ƒVƒ‡ƒ“ ID ‚ðÝ’è
    @animation1_id = @item.animation1_id
    @animation2_id = @item.animation2_id
    # ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ðÝ’è
    @common_event_id = @item.common_event_id
    # ‘ÎÛ‚ðŒˆ’è
    index = @active_battler.current_action.target_index
    target = $game_party.smooth_target_actor(index)
    # ‘Ώۑ¤ƒoƒgƒ‰[‚ðÝ’è
    set_target_battlers(@item.scope)
    # ƒAƒCƒeƒ€‚ÌŒø‰Ê‚ð“K—p
    for target in @target_battlers
      target.item_effect(@item)
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 3 : s“®‘¤ƒAƒjƒ[ƒVƒ‡ƒ“)
  #--------------------------------------------------------------------------
  def update_phase4_step3
    # s“®‘¤ƒAƒjƒ[ƒVƒ‡ƒ“ (ID ‚ª 0 ‚̏ꍇ‚Í”’ƒtƒ‰ƒbƒVƒ…)
    if @animation1_id == 0
      if (@active_battler.current_action.basic == 0) and
         (@active_battler.current_action.kind == 0)
        @active_battler.attack = true
      end
      @wait_count = 5
    else
      if (@active_battler.current_action.basic == 0) and
         (@active_battler.current_action.kind == 0)
        @active_battler.attack = true
      elsif @active_battler.current_action.kind == 2
        @active_battler.item = true
      else
        @active_battler.skill = true
      end
      @active_battler.animation_id = @animation1_id
      @active_battler.animation_hit = true
      speller = synthe?(@active_battler)
      if speller != nil
        for battler in speller
          if battler != @active_battler
            if battler.current_action.spell_id == 0
              battler.animation_id = @animation1_id
              battler.animation_hit = true
            else
              spell = battler.current_action.spell_id
              battler.animation_id = $data_skills[spell].animation1_id
              battler.animation_hit = true
              battler.current_action.spell_id = 0
            end
          end
        end
      end
      @wait_count = 2 * $data_animations[@animation1_id].frame_max - 10
    end
    # ƒXƒeƒbƒv 4 ‚Ɉڍs
    @phase4_step = 4
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 4 : ‘Ώۑ¤ƒAƒjƒ[ƒVƒ‡ƒ“)
  #--------------------------------------------------------------------------
  def update_phase4_step4
    # ‘Ώۑ¤ƒAƒjƒ[ƒVƒ‡ƒ“
    for target in @target_battlers
      target.animation_id = @animation2_id
      target.animation_hit = (target.damage != "Miss")
      unless @animation2_id == 0
        @wait_count = 2 * $data_animations[@animation2_id].frame_max - 10
      end
    end
    # ƒXƒeƒbƒv 5 ‚Ɉڍs
    @phase4_step = 5
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 5 : ƒ_ƒ[ƒW•Ž¦)
  #--------------------------------------------------------------------------
  def update_phase4_step5
    # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚ð‰B‚·
    @help_window.visible = false
    # ƒ_ƒ[ƒW•Ž¦
    for target in @target_battlers
      if target.damage != nil
        target.damage_pop = true
        target.damage_effect(@active_battler.current_action.kind)
        @wait_count = @damage_wait
      end
    end
    # ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE‚ðƒŠƒtƒŒƒbƒVƒ…
    @status_window.refresh
    # ƒXƒeƒbƒv 6 ‚Ɉڍs
    @phase4_step = 6
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 6 : ƒŠƒtƒŒƒbƒVƒ…)
  #--------------------------------------------------------------------------
  def update_phase4_step6
    # ƒAƒNƒVƒ‡ƒ“‹­§‘Ώۂ̃oƒgƒ‰[‚ðƒNƒŠƒA
    $game_temp.forcing_battler = nil
    @active_battler.current_action.forcing = false
    refresh_phase(@active_battler)
    @action_battlers.shift
    unless @active_battler.movable?
      # ƒXƒeƒbƒv 1 ‚Ɉڍs
      @phase4_step = 1
      return
    end
    speller = synthe?(@active_battler)
    if speller != nil
      for battler in speller
        if battler != @active_battler
          refresh_phase(battler)
        end
      end
      synthe_delete(speller)
    end
    # ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE‚ðƒŠƒtƒŒƒbƒVƒ…
    @status_window.refresh
    # ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ª—LŒø‚̏ꍇ
    if @common_event_id > 0
      # ƒCƒxƒ“ƒg‚ðƒZƒbƒgƒAƒbƒv
      common_event = $data_common_events[@common_event_id]
      $game_system.battle_interpreter.setup(common_event.list, 0)
    end
    act = 0
    for battler in $game_party.actors + $game_troop.enemies
      if battler.movable?
        act += 1
      end
    end
    if @turn_cnt >= act
      @turn_cnt %= act
      $game_temp.battle_turn += 1
      # ƒoƒgƒ‹ƒCƒxƒ“ƒg‚Ì‘Sƒy[ƒW‚ðŒŸõ
      for index in 0...$data_troops[@troop_id].pages.size
        # ƒCƒxƒ“ƒgƒy[ƒW‚ðŽæ“¾
        page = $data_troops[@troop_id].pages[index]
        # ‚±‚̃y[ƒW‚̃Xƒpƒ“‚ª [ƒ^[ƒ“] ‚̏ꍇ
        if page.span == 1
          # ŽÀsÏ‚݃tƒ‰ƒO‚ðƒNƒŠƒA
          $game_temp.battle_event_flags[index] = false
        end
      end
    end
    # ƒXƒeƒbƒv 1 ‚Ɉڍs
    @phase4_step = 1
  end
  #--------------------------------------------------------------------------
  # œ ƒŠƒtƒŒƒbƒVƒ…
  #--------------------------------------------------------------------------
  def refresh_phase(battler)
    battler.at %= @max
    if battler.movable?
      battler.atp = 100 * @active_battler.at / @max
    end
    spell_reset(battler)
    # ƒXƒŠƒbƒvƒ_ƒ[ƒW
    if battler.hp > 0 and battler.slip_damage?
      battler.slip_damage_effect
      battler.damage_pop = true
    end
    # ƒXƒe[ƒgŽ©‘R‰ðœ
    battler.remove_states_auto
    unless battler.movable?
      return
    end
    # ƒ^[ƒ“”ƒJƒEƒ“ƒg
    @turn_cnt += 1
  end
  #--------------------------------------------------------------------------
  # œ ƒAƒjƒƒEƒFƒCƒg”»’fˆ—
  #--------------------------------------------------------------------------
  def anime_wait_return
    if (@action_battlers.size == 0 or @anime_wait == false) and
        not $game_system.battle_interpreter.running?
      # ƒGƒlƒ~[ƒAƒ[‚ª—LŒø‚̏ꍇ
      if @enemy_arrow != nil
        return [@active - 2, 0].min == 0
      # ƒAƒNƒ^[ƒAƒ[‚ª—LŒø‚̏ꍇ
      elsif @actor_arrow != nil
        return [@active - 2, 0].min == 0
      # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
      elsif @skill_window != nil
        return [@active - 3, 0].min == 0
      # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
      elsif @item_window != nil
        return [@active - 3, 0].min == 0
      # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
      elsif @actor_command_window.active
        return [@active - 1, 0].min == 0
      else
        return true
      end
    else
      return false
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒAƒNƒ^[ƒRƒ}ƒ“ƒhÁ‹Ž”»’f
  #--------------------------------------------------------------------------
  def command_delete
    # ƒGƒlƒ~[ƒAƒ[‚ª—LŒø‚̏ꍇ
    if @enemy_arrow != nil
      end_enemy_select
    # ƒAƒNƒ^[ƒAƒ[‚ª—LŒø‚̏ꍇ
    elsif @actor_arrow != nil
      end_actor_select
    end
    # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
    if @skill_window != nil
      end_skill_select
    # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
    elsif @item_window != nil
      end_item_select
    end
    # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
    if @actor_command_window.active
      @command.shift
      @command_a = false
      # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒZƒbƒg
      $game_temp.battle_main_phase = true
      # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
      @actor_command_window.active = false
      @actor_command_window.visible = false
      # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
      if @active_actor != nil
        @active_actor.blink = false
      end
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒXƒLƒ‹‰r¥ƒ^ƒCƒ€ì¬
  #--------------------------------------------------------------------------
  def recite_time(battler)
  end
  #--------------------------------------------------------------------------
  # œ ‡¬ƒXƒLƒ‹”»•Ê
  #--------------------------------------------------------------------------
  def synthe_spell(battler)
  end
  #--------------------------------------------------------------------------
  # œ s“®‰Â””»’è
  #--------------------------------------------------------------------------
  def active?(battler)
    speller = synthe?(battler)
    if speller != nil
      if synthe_delete?(speller)
        return false
      end
    else
      unless battler.inputable?
        spell_reset(battler)
        unless battler.movable?
          battler.atp = 0
          return false
        end
      end
      if battler.current_action.forcing
        spell_reset(battler)
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # œ ‡¬ƒXƒLƒ‹‰r¥’†‚©H
  #--------------------------------------------------------------------------
  def synthe?(battler)
    for speller in @synthe
      if speller.include?(battler)
        return speller
      end
    end
    return nil
  end
  #--------------------------------------------------------------------------
  # œ ‡¬ƒXƒLƒ‹Á‹Ž”»’f
  #--------------------------------------------------------------------------
  def synthe_delete?(speller)
    for battler in speller
      unless battler.inputable?
        synthe_delete(speller)
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # œ ‡¬ƒXƒLƒ‹Á‹Ž
  #--------------------------------------------------------------------------
  def synthe_delete(speller)
    for battler in speller
      spell_reset(battler)
      @action_battlers.delete(battler)
    end
    @synthe.delete(speller)
  end
  #--------------------------------------------------------------------------
  # œ ˜AŒgŠÜ‚ÞƒXƒLƒ‹‰r¥‰ðœ
  #--------------------------------------------------------------------------
  def skill_reset(battler)
    speller = synthe?(battler)
    if speller != nil
      synthe_delete(speller)
    else
      spell_reset(battler)
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒXƒLƒ‹‰r¥‰ðœ
  #--------------------------------------------------------------------------
  def spell_reset(battler)
    battler.rt = 0
    battler.rtp = 0
    battler.blink = false
    battler.spell = false
    battler.current_action.spell_id = 0
    @spell_p.delete(battler)
    @spell_e.delete(battler)
  end
  #--------------------------------------------------------------------------
  # œ “G‘S–Å”»’è
  #--------------------------------------------------------------------------
  def fin?
    for battler in $game_troop.enemies
      if battler.hp != 0
        return false
      end
    end
    return true
  end
end

#==============================================================================
# ¡ Game_Battler (•ªŠ„’è‹` 1)
#------------------------------------------------------------------------------
# @ƒoƒgƒ‰[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_Actor ƒNƒ‰ƒX‚Æ Game_Enemy ƒNƒ‰
# ƒX‚̃X[ƒp[ƒNƒ‰ƒX‚Æ‚µ‚ÄŽg—p‚³‚ê‚Ü‚·B
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # œ ŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”’ljÁ
  #--------------------------------------------------------------------------
  attr_accessor :at                        # ATiƒ^ƒCƒ€ƒQ[ƒWj
  attr_accessor :atp                       # ATi•Ž¦—pj
  attr_accessor :rt                        # RPi‰r¥ƒQ[ƒWj
  attr_accessor :rtp                       # RPi‰r¥•K—v—ʁj
  attr_accessor :spell                     # ‡¬ƒXƒLƒ‹”­“®’†
  attr_accessor :recover_hp                # HP‰ñ•œ—Ê
  attr_accessor :recover_sp                # SP‰ñ•œ—Ê
  attr_accessor :state_p                   # ƒXƒe[ƒ^ƒXˆÙí”z—ñ
  attr_accessor :state_m                   # ƒXƒe[ƒ^ƒXˆÙí”z—ñ
  #--------------------------------------------------------------------------
  # œ ƒXƒe[ƒg‚̉ðœ
  #     state_id : ƒXƒe[ƒg ID
  #     force    : ‹­§‰ðœƒtƒ‰ƒO (ƒI[ƒgƒXƒe[ƒg‚̏ˆ—‚ÅŽg—p)
  #--------------------------------------------------------------------------
  def remove_state(state_id, force = false)
    # ‚±‚̃Xƒe[ƒg‚ª•t‰Á‚³‚ê‚Ä‚¢‚éê‡
    if state?(state_id)
      # ‹­§•t‰Á‚³‚ꂽƒXƒe[ƒg‚ŁA‚©‚Â‰ðœ‚ª‹­§‚Å‚Í‚È‚¢ê‡
      if @states_turn[state_id] == -1 and not force
        # ƒƒƒbƒhI—¹
        return
      end
      # Œ»Ý‚Ì HP ‚ª 0 ‚©‚ ƒIƒvƒVƒ‡ƒ“ [HP 0 ‚̏ó‘Ô‚Æ‚Ý‚È‚·] ‚ª—LŒø‚̏ꍇ
      if @hp == 0 and $data_states[state_id].zero_hp
        # ‚Ù‚©‚É [HP 0 ‚̏ó‘Ô‚Æ‚Ý‚È‚·] ƒXƒe[ƒg‚ª‚ ‚é‚©‚Ç‚¤‚©”»’è
        zero_hp = false
        for i in @states
          if i != state_id and $data_states[i].zero_hp
            zero_hp = true
          end
        end
        # í“¬•s”‚ð‰ðœ‚µ‚Ă悯‚ê‚΁AHP ‚ð 1 ‚ɕύX
        if zero_hp == false
          @hp = 1
        end
      end
      unless self.movable?
        # ƒXƒe[ƒg ID ‚ð @states ”z—ñ‚¨‚æ‚Ñ @states_turn ƒnƒbƒVƒ…‚©‚çíœ
        @states.delete(state_id)
        @states_turn.delete(state_id)
        if self.movable?
          self.at = 0
        end
      else
        # ƒXƒe[ƒg ID ‚ð @states ”z—ñ‚¨‚æ‚Ñ @states_turn ƒnƒbƒVƒ…‚©‚çíœ
        @states.delete(state_id)
        @states_turn.delete(state_id)
      end
    end
    # HP ‚¨‚æ‚Ñ SP ‚̍őå’lƒ`ƒFƒbƒN
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
  #--------------------------------------------------------------------------
  # œ ’ʏíUŒ‚‚ÌŒø‰Ê“K—p
  #     attacker : UŒ‚ŽÒ (ƒoƒgƒ‰[)
  #--------------------------------------------------------------------------
  def attack_effect(attacker)
    # ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
    self.critical = false
    self.state_p = []
    self.state_m = []
    # ‘æˆê–½’†”»’è
    hit_result = (rand(100) < attacker.hit)
    # –½’†‚̏ꍇ
    if hit_result == true
      # Šî–{ƒ_ƒ[ƒW‚ðŒvŽZ
      atk = [attacker.atk - self.pdef / 2, 0].max
      self.damage = atk * (20 + attacker.str) / 20
      # ‘®«C³
      self.damage *= elements_correct(attacker.element_set)
      self.damage /= 100
      # ƒ_ƒ[ƒW‚Ì•„†‚ª³‚̏ꍇ
      if self.damage > 0
        # ƒNƒŠƒeƒBƒJƒ‹C³
        if rand(100) < 4 * attacker.dex / self.agi
          self.damage *= 2
          self.critical = true
        end
        # –hŒäC³
        if self.guarding?
          self.damage /= 2
        end
      end
      # •ªŽU
      if self.damage.abs > 0
        amp = [self.damage.abs * 15 / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # ‘æ“ñ–½’†”»’è
      eva = 8 * self.agi / attacker.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
    end
    # –½’†‚̏ꍇ
    if hit_result == true
      # ƒXƒe[ƒgÕŒ‚‰ðœ
      remove_states_shock
      # HP ‚©‚çƒ_ƒ[ƒW‚ðŒ¸ŽZ
      # ƒXƒe[ƒg•Ï‰»
      @state_changed = false
      states_plus(attacker.plus_state_set)
      states_minus(attacker.minus_state_set)
    # ƒ~ƒX‚̏ꍇ
    else
      # ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
      self.damage = "Miss"
      # ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
      self.critical = false
    end
    # ƒƒƒbƒhI—¹
    return true
  end
  #--------------------------------------------------------------------------
  # œ ƒXƒLƒ‹‚ÌŒø‰Ê“K—p
  #     user  : ƒXƒLƒ‹‚ÌŽg—pŽÒ (ƒoƒgƒ‰[)
  #     skill : ƒXƒLƒ‹
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    # ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
    self.critical = false
    self.state_p = []
    self.state_m = []
    # ƒXƒLƒ‹‚ÌŒø‰Ê”͈͂ª HP 1 ˆÈã‚Ì–¡•û‚ŁAŽ©•ª‚Ì HP ‚ª 0A
    # ‚Ü‚½‚̓XƒLƒ‹‚ÌŒø‰Ê”͈͂ª HP 0 ‚Ì–¡•û‚ŁAŽ©•ª‚Ì HP ‚ª 1 ˆÈã‚̏ꍇ
    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
       ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
      # ƒƒƒbƒhI—¹
      return false
    end
    # —LŒøƒtƒ‰ƒO‚ðƒNƒŠƒA
    effective = false
    # ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ª—LŒø‚̏ꍇ‚Í—LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
    effective |= skill.common_event_id > 0
    # ‘æˆê–½’†”»’è
    hit = skill.hit
    if skill.atk_f > 0
      hit *= user.hit / 100
    end
    hit_result = (rand(100) < hit)
    # •sŠmŽÀ‚ȃXƒLƒ‹‚̏ꍇ‚Í—LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
    effective |= hit < 100
    # –½’†‚̏ꍇ
    if hit_result == true
      # ˆÐ—Í‚ðŒvŽZ
      power = skill.power + user.atk * skill.atk_f / 100
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      # ”{—¦‚ðŒvŽZ
      rate = 20
      rate += (user.str * skill.str_f / 100)
      rate += (user.dex * skill.dex_f / 100)
      rate += (user.agi * skill.agi_f / 100)
      rate += (user.int * skill.int_f / 100)
      # Šî–{ƒ_ƒ[ƒW‚ðŒvŽZ
      self.damage = power * rate / 20
      # ‘®«C³
      self.damage *= elements_correct(skill.element_set)
      self.damage /= 100
      # ƒ_ƒ[ƒW‚Ì•„†‚ª³‚̏ꍇ
      if self.damage > 0
        # –hŒäC³
        if self.guarding?
          self.damage /= 2
        end
      end
      # •ªŽU
      if skill.variance > 0 and self.damage.abs > 0
        amp = [self.damage.abs * skill.variance / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # ‘æ“ñ–½’†”»’è
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
      # •sŠmŽÀ‚ȃXƒLƒ‹‚̏ꍇ‚Í—LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
      effective |= hit < 100
    end
    # –½’†‚̏ꍇ
    if hit_result == true
      # ˆÐ—Í 0 ˆÈŠO‚Ì•¨—UŒ‚‚̏ꍇ
      if skill.power != 0 and skill.atk_f > 0
        # ƒXƒe[ƒgÕŒ‚‰ðœ
        remove_states_shock
        # —LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
        effective = true
      end
      # HP ‚Ì•Ï“®”»’è
      last_hp = [[self.hp - self.damage, self.maxhp].min, 0].max
      # Œø‰Ê”»’è
      effective |= self.hp != last_hp
      # ƒXƒe[ƒg•Ï‰»
      @state_changed = false
      effective |= states_plus(skill.plus_state_set)
      effective |= states_minus(skill.minus_state_set)
      unless $game_temp.in_battle
        self.damage_effect(1)
      end
      # ˆÐ—Í‚ª 0 ‚̏ꍇ
      if skill.power == 0
        # ƒ_ƒ[ƒW‚ɋ󕶎š—ñ‚ðÝ’è
        self.damage = ""
        # ƒXƒe[ƒg‚ɕω»‚ª‚È‚¢ê‡
        unless @state_changed
          # ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
          self.damage = "Miss"
        end
      end
    # ƒ~ƒX‚̏ꍇ
    else
      # ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
      self.damage = "Miss"
    end
    # í“¬’†‚Å‚È‚¢ê‡
    unless $game_temp.in_battle
      # ƒ_ƒ[ƒW‚É nil ‚ðÝ’è
      self.damage = nil
    end
    # ƒƒƒbƒhI—¹
    return effective
  end
  #--------------------------------------------------------------------------
  # œ ƒAƒCƒeƒ€‚ÌŒø‰Ê“K—p
  #     item : ƒAƒCƒeƒ€
  #--------------------------------------------------------------------------
  def item_effect(item)
    # ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
    self.critical = false
    self.state_p = []
    self.state_m = []
    # ƒAƒCƒeƒ€‚ÌŒø‰Ê”͈͂ª HP 1 ˆÈã‚Ì–¡•û‚ŁAŽ©•ª‚Ì HP ‚ª 0A
    # ‚Ü‚½‚̓AƒCƒeƒ€‚ÌŒø‰Ê”͈͂ª HP 0 ‚Ì–¡•û‚ŁAŽ©•ª‚Ì HP ‚ª 1 ˆÈã‚̏ꍇ
    if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
       ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
      # ƒƒƒbƒhI—¹
      return false
    end
    # —LŒøƒtƒ‰ƒO‚ðƒNƒŠƒA
    effective = false
    # ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ª—LŒø‚̏ꍇ‚Í—LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
    effective |= item.common_event_id > 0
    # –½’†”»’è
    hit_result = (rand(100) < item.hit)
    # •sŠmŽÀ‚ȃXƒLƒ‹‚̏ꍇ‚Í—LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
    effective |= item.hit < 100
    # –½’†‚̏ꍇ
    if hit_result == true
      # ‰ñ•œ—Ê‚ðŒvŽZ
      self.recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
      self.recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
      if self.recover_hp < 0
        self.recover_hp += self.pdef * item.pdef_f / 20
        self.recover_hp += self.mdef * item.mdef_f / 20
        self.recover_hp = [recover_hp, 0].min
      end
      # ‘®«C³
      self.recover_hp *= elements_correct(item.element_set)
      self.recover_hp /= 100
      self.recover_sp *= elements_correct(item.element_set)
      self.recover_sp /= 100
      # •ªŽU
      if item.variance > 0 and self.recover_hp.abs > 0
        amp = [self.recover_hp.abs * item.variance / 100, 1].max
        self.recover_hp += rand(amp+1) + rand(amp+1) - amp
      end
      if item.variance > 0 and self.recover_sp.abs > 0
        amp = [self.recover_sp.abs * item.variance / 100, 1].max
        self.recover_sp += rand(amp+1) + rand(amp+1) - amp
      end
      # ‰ñ•œ—Ê‚Ì•„†‚ª•‰‚̏ꍇ
      if self.recover_hp < 0
        # –hŒäC³
        if self.guarding?
          self.recover_hp /= 2
        end
      end
      # HP ‰ñ•œ—Ê‚Ì•„†‚𔽓]‚µAƒ_ƒ[ƒW‚Ì’l‚ɐݒè
      self.damage = -self.recover_hp
      # HP ‚¨‚æ‚Ñ SP ‚Ì•Ï“®”»’è
      last_hp = [[self.hp + self.recover_hp, self.maxhp].min, 0].max
      last_sp = [[self.sp + self.recover_sp, self.maxsp].min, 0].max
      effective |= self.hp != last_hp
      effective |= self.sp != last_sp
      # ƒXƒe[ƒg•Ï‰»
      @state_changed = false
      effective |= states_plus(item.plus_state_set)
      effective |= states_minus(item.minus_state_set)
      unless $game_temp.in_battle
        self.damage_effect(2)
      end
      # ƒpƒ‰ƒ[ƒ^ã¸’l‚ª—LŒø‚̏ꍇ
      if item.parameter_type > 0 and item.parameter_points != 0
        # ƒpƒ‰ƒ[ƒ^‚Å•ªŠò
        case item.parameter_type
        when 1  # MaxHP
          @maxhp_plus += item.parameter_points
        when 2  # MaxSP
          @maxsp_plus += item.parameter_points
        when 3  # ˜r—Í
          @str_plus += item.parameter_points
        when 4  # Ší—p‚³
          @dex_plus += item.parameter_points
        when 5  # ‘f‘‚³
          @agi_plus += item.parameter_points
        when 6  # –‚—Í
          @int_plus += item.parameter_points
        end
        # —LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
        effective = true
      end
      # HP ‰ñ•œ—¦‚Ɖñ•œ—Ê‚ª 0 ‚̏ꍇ
      if item.recover_hp_rate == 0 and item.recover_hp == 0
        # ƒ_ƒ[ƒW‚ɋ󕶎š—ñ‚ðÝ’è
        self.damage = ""
        # SP ‰ñ•œ—¦‚Ɖñ•œ—Ê‚ª 0Aƒpƒ‰ƒ[ƒ^ã¸’l‚ª–³Œø‚̏ꍇ
        if item.recover_sp_rate == 0 and item.recover_sp == 0 and
           (item.parameter_type == 0 or item.parameter_points == 0)
          # ƒXƒe[ƒg‚ɕω»‚ª‚È‚¢ê‡
          unless @state_changed
            # ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
            self.damage = "Miss"
          end
        end
      end
    # ƒ~ƒX‚̏ꍇ
    else
      # ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
      self.damage = "Miss"
    end
    # í“¬’†‚Å‚È‚¢ê‡
    unless $game_temp.in_battle
      # ƒ_ƒ[ƒW‚É nil ‚ðÝ’è
      self.damage = nil
    end
    # ƒƒƒbƒhI—¹
    return effective
  end
  #--------------------------------------------------------------------------
  # œ ƒXƒe[ƒg•Ï‰» (+) ‚Ì“K—p
  #     plus_state_set  : ƒXƒe[ƒg•Ï‰» (+)
  #--------------------------------------------------------------------------
  def states_plus(plus_state_set)
    # —LŒøƒtƒ‰ƒO‚ðƒNƒŠƒA
    effective = false
    # ƒ‹[ƒv (•t‰Á‚·‚éƒXƒe[ƒg)
    for i in plus_state_set
      # ‚±‚̃Xƒe[ƒg‚ª–hŒä‚³‚ê‚Ä‚¢‚È‚¢ê‡
      unless self.state_guard?(i)
        # ‚±‚̃Xƒe[ƒg‚ªƒtƒ‹‚Å‚È‚¯‚ê‚ΗLŒøƒtƒ‰ƒO‚ðƒZƒbƒg
        effective |= self.state_full?(i) == false
        # ƒXƒe[ƒg‚ª [’ïR‚µ‚È‚¢] ‚̏ꍇ
        if $data_states[i].nonresistance
          # ƒXƒe[ƒg•Ï‰»ƒtƒ‰ƒO‚ðƒZƒbƒg
          @state_changed = true
          # ƒXƒe[ƒg‚ð•t‰Á
          add_state(i)
        # ‚±‚̃Xƒe[ƒg‚ªƒtƒ‹‚Å‚Í‚È‚¢ê‡
        elsif self.state_full?(i) == false
          # ƒXƒe[ƒg—LŒø“x‚ðŠm—¦‚É•ÏŠ·‚µA—”‚Æ”äŠr
          if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]
            # ƒXƒe[ƒg•Ï‰»ƒtƒ‰ƒO‚ðƒZƒbƒg
            @state_changed = true
            # ƒXƒe[ƒg‚ð•t‰Á
            self.state_p.push(i)
          end
        end
      end
    end
    # ƒƒƒbƒhI—¹
    return effective
  end
  #--------------------------------------------------------------------------
  # œ ƒXƒe[ƒg•Ï‰» (-) ‚Ì“K—p
  #     minus_state_set : ƒXƒe[ƒg•Ï‰» (-)
  #--------------------------------------------------------------------------
  def states_minus(minus_state_set)
    # —LŒøƒtƒ‰ƒO‚ðƒNƒŠƒA
    effective = false
    # ƒ‹[ƒv (‰ðœ‚·‚éƒXƒe[ƒg)
    for i in minus_state_set
      # ‚±‚̃Xƒe[ƒg‚ª•t‰Á‚³‚ê‚Ä‚¢‚ê‚ΗLŒøƒtƒ‰ƒO‚ðƒZƒbƒg
      effective |= self.state?(i)
      # ƒXƒe[ƒg•Ï‰»ƒtƒ‰ƒO‚ðƒZƒbƒg
      @state_changed = true
      # ƒXƒe[ƒg‚ð‰ðœ
      self.state_m.push(i)
    end
    # ƒƒƒbƒhI—¹
    return effective
  end
  #--------------------------------------------------------------------------
  # œ ƒ_ƒ[ƒW‰‰ŽZ
  #--------------------------------------------------------------------------
  def damage_effect(item)
    if item == 2
      self.hp += self.recover_hp
      self.sp += self.recover_sp
    else
      if self.damage.class != String
        self.hp -= self.damage
      end
    end
    for i in self.state_p
      add_state(i)
    end
    for i in self.state_m
      remove_state(i)
    end
  end
end

#==============================================================================
# ¡ Game_BattleAction
#------------------------------------------------------------------------------
# @ƒAƒNƒVƒ‡ƒ“ (í“¬’†‚̍s“®) ‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_Battler ƒNƒ‰
# ƒX‚Ì“à•”‚ÅŽg—p‚³‚ê‚Ü‚·B
#==============================================================================

class Game_BattleAction
  #--------------------------------------------------------------------------
  # œ ŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”
  #--------------------------------------------------------------------------
  attr_accessor :spell_id                 # ‡‘Ì–‚–@—pƒXƒLƒ‹ ID
end

#==============================================================================
# ¡ Game_Actor
#------------------------------------------------------------------------------
# @ƒAƒNƒ^[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_Actors ƒNƒ‰ƒX ($game_actors)
# ‚Ì“à•”‚ÅŽg—p‚³‚êAGame_Party ƒNƒ‰ƒX ($game_party) ‚©‚ç‚àŽQÆ‚³‚ê‚Ü‚·B
#==============================================================================

class Game_Actor < Game_Battler
  def skill_can_use?(skill_id)
    return super
  end
end

#==============================================================================
# ¡ Game_Enemy
#------------------------------------------------------------------------------
# @ƒGƒlƒ~[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_Troop ƒNƒ‰ƒX ($game_troop) ‚Ì
# “à•”‚ÅŽg—p‚³‚ê‚Ü‚·B
#==============================================================================

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # œ ƒAƒNƒVƒ‡ƒ“ì¬
  #--------------------------------------------------------------------------
  def make_action
    # ƒJƒŒƒ“ƒgƒAƒNƒVƒ‡ƒ“‚ðƒNƒŠƒA
    self.current_action.clear
    # “®‚¯‚È‚¢ê‡
    unless self.inputable?
      # ƒƒƒbƒhI—¹
      return
    end
    # Œ»Ý—LŒø‚ȃAƒNƒVƒ‡ƒ“‚𒊏o
    available_actions = []
    rating_max = 0
    for action in self.actions
      # ƒ^[ƒ“ ðŒŠm”F
      n = $game_temp.battle_turn
      a = action.condition_turn_a
      b = action.condition_turn_b
      if (b == 0 and n != a) or
         (b > 0 and (n < 1 or n < a or n % b != a % b))
        next
      end
      # HP ðŒŠm”F
      if self.hp * 100.0 / self.maxhp > action.condition_hp
        next
      end
      # ƒŒƒxƒ‹ ðŒŠm”F
      if $game_party.max_level < action.condition_level
        next
      end
      # ƒXƒCƒbƒ` ðŒŠm”F
      switch_id = action.condition_switch_id
      if switch_id > 0 and $game_switches[switch_id] == false
        next
      end
      # ƒXƒLƒ‹Žg—p‰Â” ðŒŠm”F
      if action.kind == 1
        unless self.skill_can_use?(action.skill_id)
          next
        end
      end
      # ðŒ‚ÉŠY“– : ‚±‚̃AƒNƒVƒ‡ƒ“‚ð’ljÁ
      available_actions.push(action)
      if action.rating > rating_max
        rating_max = action.rating
      end
    end
    # Å‘å‚̃Œ[ƒeƒBƒ“ƒO’l‚ð 3 ‚Æ‚µ‚č‡Œv‚ðŒvŽZ (0 ˆÈ‰º‚͏œŠO)
    ratings_total = 0
    for action in available_actions
      if action.rating > rating_max - 3
        ratings_total += action.rating - (rating_max - 3)
      end
    end
    # ƒŒ[ƒeƒBƒ“ƒO‚̍‡Œv‚ª 0 ‚Å‚Í‚È‚¢ê‡
    if ratings_total > 0
      # —”‚ðì¬
      value = rand(ratings_total)
      # ì¬‚µ‚½—”‚ɑΉž‚·‚é‚à‚Ì‚ðƒJƒŒƒ“ƒgƒAƒNƒVƒ‡ƒ“‚ɐݒè
      for action in available_actions
        if action.rating > rating_max - 3
          if value < action.rating - (rating_max - 3)
            self.current_action.kind = action.kind
            self.current_action.basic = action.basic
            self.current_action.skill_id = action.skill_id
            self.current_action.decide_random_target_for_enemy
            return
          else
            value -= action.rating - (rating_max - 3)
          end
        end
      end
    end
  end
end

#==============================================================================
# ¡ Window_BattleStatus
#------------------------------------------------------------------------------
# @ƒoƒgƒ‹‰æ–ʂŃp[ƒeƒBƒƒ“ƒo[‚̃Xƒe[ƒ^ƒX‚𕎦‚·‚éƒEƒBƒ“ƒhƒE‚Å‚·B
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # œ ƒŠƒtƒŒƒbƒVƒ…
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160 + 4
      draw_actor_name(actor, actor_x, 0)
      draw_actor_hp(actor, actor_x, 26, 120)
      draw_actor_sp(actor, actor_x, 52, 120)
      draw_actor_atg(actor, actor_x, 104, 120)
      if @level_up_flags[i]
        self.contents.font.color = normal_color
        self.contents.draw_text(actor_x, 78, 120, 32, "LEVEL UP!")
      else
        draw_actor_state(actor, actor_x, 78)
      end
    end
  end
  #--------------------------------------------------------------------------
  # œ ATƒQ[ƒWƒŠƒtƒŒƒbƒVƒ…
  #--------------------------------------------------------------------------
  def at_refresh
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160 + 4
      draw_actor_atg(actor, actor_x, 104, 120)
    end
  end
end

#==============================================================================
# ¡ Interpreter
#------------------------------------------------------------------------------
# @ƒCƒxƒ“ƒgƒRƒ}ƒ“ƒh‚ðŽÀs‚·‚éƒCƒ“ƒ^ƒvƒŠƒ^‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_System ƒNƒ‰
# ƒX‚â Game_Event ƒNƒ‰ƒX‚Ì“à•”‚ÅŽg—p‚³‚ê‚Ü‚·B
#==============================================================================

class Interpreter
  #--------------------------------------------------------------------------
  # œ ƒAƒNƒ^[‚Ì“ü‚ê‘Ö‚¦
  #--------------------------------------------------------------------------
  def command_129
    # ƒAƒNƒ^[‚ðŽæ“¾
    actor = $game_actors[@parameters[0]]
    # ƒAƒNƒ^[‚ª—LŒø‚̏ꍇ
    if actor != nil
      # ‘€ì‚Å•ªŠò
      if @parameters[1] == 0
        if @parameters[2] == 1
          $game_actors[@parameters[0]].setup(@parameters[0])
        end
        $game_party.add_actor(@parameters[0])
        $game_actors[@parameters[0]].at = 0
        $game_actors[@parameters[0]].atp = 0
        $game_actors[@parameters[0]].rt = 0
        $game_actors[@parameters[0]].rtp = 0
        $game_actors[@parameters[0]].spell = false
        $game_actors[@parameters[0]].current_action.spell_id = 0
      else
        $game_party.remove_actor(@parameters[0])
      end
    end
    # Œp‘±
    return true
  end
  #--------------------------------------------------------------------------
  # œ HP ‚Ì‘Œ¸
  #--------------------------------------------------------------------------
  alias :command_311_original :command_311
  def command_311
    command_311_original
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # œ SP ‚Ì‘Œ¸
  #--------------------------------------------------------------------------
  alias :command_312_original :command_312
  def command_312
    command_312_original
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒXƒe[ƒg‚̕ύX
  #--------------------------------------------------------------------------
  alias :command_313_original :command_313
  def command_313
    command_313_original
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # œ ‘S‰ñ•œ
  #--------------------------------------------------------------------------
  alias :command_314_original :command_314
  def command_314
    command_314_original
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # œ EXP ‚Ì‘Œ¸
  #--------------------------------------------------------------------------
  alias :command_315_original :command_315
  def command_315
    command_315_original
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒŒƒxƒ‹‚Ì‘Œ¸
  #--------------------------------------------------------------------------
  alias :command_316_original :command_316
  def command_316
    command_316_original
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒpƒ‰ƒ[ƒ^‚Ì‘Œ¸
  #--------------------------------------------------------------------------
  alias :command_317_original :command_317
  def command_317
    command_317_original
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # œ ‘•”õ‚̕ύX
  #--------------------------------------------------------------------------
  alias :command_319_original :command_319
  def command_319
    command_319_original
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒAƒNƒ^[‚Ì–¼‘O•ÏX
  #--------------------------------------------------------------------------
  alias :command_320_original :command_320
  def command_320
    command_320_original
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒAƒNƒ^[‚̃Nƒ‰ƒX•ÏX
  #--------------------------------------------------------------------------
  alias :command_321_original :command_321
  def command_321
    command_321_original
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒ_ƒ[ƒW‚̏ˆ—
  #--------------------------------------------------------------------------
  alias :command_338_original :command_338
  def command_338
    command_338_original
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
end

#==============================================================================
# ¡ BitmapŠg’£ƒNƒ‰ƒX
#------------------------------------------------------------------------------
# @BitmapƒNƒ‰ƒX‚ɐV‚½‚È‹@”‚ð’ljÁ‚µ‚Ü‚·B
#==============================================================================

class Bitmap
  #--------------------------------------------------------------------------
  # œ ‹éŒ`‚ðƒOƒ‰ƒf[ƒVƒ‡ƒ“•Ž¦
  #     color1 : ƒXƒ^[ƒgƒJƒ‰[
  #     color2 : ƒGƒ“ƒhƒJƒ‰[
  #     align  :  0:‰¡‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“
  #               1:c‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“
  #--------------------------------------------------------------------------
  def gradation_rect(x, y, width, height, color1, color2, align = 0)
    if align == 0
      for i in x...x + width
        red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
        green = color1.green + (color2.green - color1.green) * (i - x) / (width - 1)
        blue  = color1.blue + (color2.blue - color1.blue) * (i - x) / (width - 1)
        alpha = color1.alpha + (color2.alpha - color1.alpha) * (i - x) / (width - 1)
        color = Color.new(red, green, blue, alpha)
        fill_rect(i, y, 1, height, color)
      end
    elsif align == 1
      for i in y...y + height
        red   = color1.red +
                (color2.red - color1.red) * (i - y) / (height - 1)
        green = color1.green +
                (color2.green - color1.green) * (i - y) / (height - 1)
        blue  = color1.blue +
                (color2.blue - color1.blue) * (i - y) / (height - 1)
        alpha = color1.alpha +
                (color2.alpha - color1.alpha) * (i - y) / (height - 1)
        color = Color.new(red, green, blue, alpha)
        fill_rect(x, i, width, 1, color)
      end
    end
  end
end

제가 이 스크립트 복사해서 새로 만들어 시크립트 에디터에 이걸 복사해 만들 었습니다.

 

그리고 똑같이 배틀을 했습니다. 그런데 몹을 죽이면  zzzzz.JPG

 이라고 뜨면서 창이 꺼집니다. 왜 이러는 건가요? 똑 같이 복사 해서 한건데 ㅠㅠ

Comment '2'
  • profile
    슈팅스타* 2011.10.05 21:10

    중간중간에 뭐가 함숫값 기호처럼 보이는 문자가 있긴 한데 그것때문은 아닐거고

    306줄에 에러가 났다는 이야기네요

    306줄을 뽑아서 올릴 수 있으신지?

  • ?
    마우리 2011.10.06 09:02

    306줄에 이렇게 써 있습니다.

     

        self.contents.font.size = $fontsize


List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12387
RMVX 이벤트로 모든걸 할려그러면 렉이 얼마나 심해지나요? 5 타빙 2011.10.07 2077
GM 게임을 만드는데 어떻게 해야 되죠?? 5 똘운지 2011.10.07 1645
RMXP 몹을 한대 치면 몹 체력 변수의 값을 띄워주기? 돗토리 2011.10.07 1950
RMVX 몬스터 출현에 대해 라스트루마 2011.10.07 1006
RMXP 몬스터 칩 사자 구해 주시거나 만들어 주실 분을 찾습니다. 류칼 2011.10.06 1781
RMVX SRPG스크립트에 내장되어 있던 스킬CP제 관련으로 도움을 요청합니다 액셀 2011.10.06 1158
RM2k 디아블로 타운포탈 시스템 (이벤트 위치 설정) 3 뮤리온。 2011.10.06 2501
RMVX vampyr SBABS-Requiem ABS 9 변수의조작 오류,, 2 file 이런게상세 2011.10.05 1581
RMXP 질문 있습니다.(급합니다 도와 주세요. ㅠㅠ)ATB사이드뷰 2 file 마우리 2011.10.05 1614
RMVX 게임 실행 문제에요 ㅠㅠ 4 czF 2011.10.03 1612
라이선스 기타 자료실의 모든 자료들은 저작권에 위배되지 않는 거겠죠? 6 유토피아라 2011.10.03 1249
RMVX vampyr SBABS-Requiem ABS 9 이벤트오류 3 file 이런게상세 2011.10.03 1790
RMXP 투명색지정을 어떻게하는 거죠??? 1 snci 2011.10.03 2079
RMXP 게임 시작 하면 캐릭이 안움직여져요 2 후야여 2011.10.03 1870
RMXP 이런 로봇칩들 제작하던 사이트아시는분 ... 급해요 부탁드립니다 2 file 라이네크 2011.10.02 2804
RMXP 이벤트 머리좋게하는 법은 2 CJYG* 2011.10.02 1669
RMXP 어이없는 파일이 자꾸 생기네요 .. 3 DN 2011.10.02 1989
RMVX Window_BattleFaceStatus Ver.1.01 스크립트 사용 질문입니다. 2 니노미야 2011.10.01 1505
RMVX 오프닝후 게임진행에 대한 질문입니다. 2 김만들기 2011.10.01 1472
RMXP rpg xp질문이요 1 우왕- 2011.09.30 1822
Board Pagination Prev 1 ... 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 ... 516 Next
/ 516