조회 수 648 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
제가 FF시리즈와 같은 전투방식인 리얼타임 엑티브 배틀 스크립트를 구했는데요.... 자꾸 오류가 나내요...
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_reader   :status_window            # 스테이터스 윈도우
  attr_reader   :spriteset                # 배틀 스프라이트
  attr_reader   :scroll_time              # 스크린 이동 기본 시간
  attr_reader   :zoom_rate                # 적 버틀러 기본 위치
  attr_reader   :drive                    # 카메라 구동
  attr_accessor :force                    # 액션 강제도
  attr_accessor :camera                   # 현재의 카메라 소지자
  #--------------------------------------------------------------------------
  # ● ATB기초 셋업
  #--------------------------------------------------------------------------
  def atb_setup
    # ATB초기화
    # speed   : 배틀 스피드 결정. 값이 작을 정도 빠른
    # @active : 액티브도 설정
    #           3 : 항상 액티브 상태
    #           2 : 스킬·아이템 선택중만 액티브 게이지가 멈추는
    #           1 : 2상태에 가세해 타겟 선택시도 웨이트가 걸리는
    #           0 : 1상태에 가세해 커멘드 입력시에도 웨이트가 걸리는
    # @action : 타인이 행동중에 자신도 행동을 일으키는 것을 허락할까
    #           3 : 자신이 행동 불능이 아닌 한 한정해 허락하는
    #           2 : 자신이 데미지를 받지 않은 한 허락하는
    #           1 : 2상태에 가세해 타겟이 행동하고 있지 않는 한 허락하는
    #           0 : 행동을 허락하지 않는다. 차례로 행동 끝마칠 때까지 기다리는
    # @anime_wait : true으로 하면(자) 배틀 애니메이션·데미지 표시중은 웨이트가 걸리는
    # @damage_wait : 데미지 표시 대기 시간(단위는 프레임)
    # @after_wait : 아군·적 전멸시 , 다음의 처리로 옮길 때까지의 대기 시간
    #               [a, b] a 은 아군 전멸시 ,b 는 적 전멸시(단위는 프레임)
    # @enemy_speed : 적의 사고 속도. 1(이)라면 즉시 행동.
    #                1프레임마다 ,1/@enemy_speed의 확률로 행동을 일으키는
    # @force : 강제 액션으로 스킬 사용시의 강제 상태
    #          2:스킬은 모두 영창 하지 않고 , 반드시 즉시 실행
    #          1:단독 스킬은 영창 해 , 제휴 스킬만 즉시 실행
    #          0:전 스킬 영창을 실시할 뿐(만큼)
    # ($scene.force = x 과 하는 것으로써 , 통상 이벤트의 스크립트로부터 변경 가능)
    # @drive : 카메라 구동ON/OFF. true그리고 구동ON,false그리고 구동OFF
    # @scroll_time : 스크린 이동에 필요로 하는 기본 시간
    # @zoom_rate = [i, j] : 에너미의 줌율
    #                       i 이 화면 최상부에 배치했을 때의 확대율
    #                       j 이 화면 최하부에 배치했을 때의 확대율
    #                       1 배로 하고 싶을 때도 ,1.0 라고 반드시 소수로 설정하는 것
    speed = 150
    @active = 1
    @action = 2
    @anime_wait = false
    @damage_wait = 10
    @after_wait = [80, 0]
    @enemy_speed = 40
    @force = 2
    @drive = true
    @scroll_time = 15
    @zoom_rate = [0.2, 1.0]
    @help_time = 40
    @escape == false
    @camera = nil
    @max = 0
    @turn_cnt = 0
    @help_wait = 0
    @action_battlers = []
    @synthe = []
    @spell_p = {}
    @spell_e = {}
    @command_a = false
    @command = []
    @party = false
    for battler in $game_party.actors + $game_troop.enemies
      spell_reset(battler)
      battler.at = battler.agi * rand(speed / 2)
      battler.damage_pop = {}
      battler.damage = {}
      battler.damage_sp = {}
      battler.critical = {}
      battler.recover_hp = {}
      battler.recover_sp = {}
      battler.state_p = {}
      battler.state_m = {}
      battler.animation = []
      if battler.is_a?(Game_Actor)
        @max += battler.agi
      end
    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
  #--------------------------------------------------------------------------
  # ● AT게이지Max시SE
  #--------------------------------------------------------------------------
  def fullat_se
    Audio.se_play("Audio/SE/033-switch02", 80, 100)
  end
  #--------------------------------------------------------------------------
  # ● 레벨업SE
  #--------------------------------------------------------------------------
  def levelup_se
    Audio.se_play("Audio/SE/056-Right02", 80, 100)
  end
  #--------------------------------------------------------------------------
  # ● 스킬 습득SE
  #--------------------------------------------------------------------------
  def skill_se
    Audio.se_play("Audio/SE/056-Right02", 80, 150)
  end
end

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● ATG 의 묘화
  #     actor : 엑터
  #     x     : 묘화처 X 좌표
  #     y     : 묘화처 Y 좌표
  #     width : 묘화처의 폭
  #--------------------------------------------------------------------------
  def draw_actor_atg(actor, x, y, width = 144)
    if @at_gauge == nil
      # plus_x:X좌표의 위치 보정 rate_x:X좌표의 위치 보정(%) plus_y:Y좌표의 위치 보정
      # plus_width:폭의 보정 rate_width:폭의 보정(%) height:세로폭
      # align1:묘화 타입1 0:왼쪽 막혀라 1:centering 2:right justify
      # align2:묘화 타입2 0:카미츠메째 1:centering 2:하막혀라
      # align3:게이지 타입 0:왼쪽 막혀라 1:right justify
      @plus_x = 0
      @rate_x = 0
      @plus_y = 16
      @plus_width = 0
      @rate_width = 100
      @width = @plus_width + width * @rate_width / 100
      @height = 16
      @align1 = 0
      @align2 = 1
      @align3 = 0
      # 그라데이션 설정 grade1:하늘 게이지 grade2:열매 게이지
      # (0:옆에 그라데이션 1:세로에 그라데이션 2:비스듬하게 그라데이션)
      grade1 = 1
      grade2 = 0
      # 색 설정. color1:최외측선 ,color2:중범위
      # color3:공범위 다크 칼라 ,color4:공범위 라이트 칼라
      color1 = Color.new(0, 0, 0)
      color2 = Color.new(255, 255, 192)
      color3 = Color.new(0, 0, 0, 192)
      color4 = Color.new(0, 0, 64, 192)
      # 게이지의 색 설정
      # 통상시의 색 설정
      color5 = Color.new(0, 64, 80)
      color6 = Color.new(0, 128, 160)
      # 게이지가MAX의 때의 색 설정
      color7 = Color.new(80, 0, 0)
      color8 = Color.new(240, 0, 0)
      # 제휴 스킬 사용시의 색 설정
      color9 = Color.new(80, 64, 32)
      color10 = Color.new(240, 192, 96)
      # 스킬 영창시의 색 설정
      color11 = Color.new(80, 0, 64)
      color12 = Color.new(240, 0, 192)
      # 게이지의 묘화
      gauge_rect_at(@width, @height, @align3, color1, color2,
                  color3, color4, color5, color6, color7, color8,
                  color9, color10, color11, color12, grade1, grade2)
    end
    # 변수at에 묘화 하는 게이지의 폭을 대입
    if actor.rtp == 0
      at = (width + @plus_width) * actor.atp * @rate_width / 10000
    else
      at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
    end
    if at > width
      at = width
    end
    # 게이지의 좌힐·중앙 짓고 등 의 보정
    case @align1
    when 1
      x += (@rect_width - width) / 2
    when 2
      x += @rect_width - width
    end
    case @align2
    when 1
      y -= @height / 2
    when 2
      y -= @height
    end
    self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
                      @at_gauge, Rect.new(0, 0, @width, @height))
    if @align3 == 0
      rect_x = 0
    else
      x += @width - at - 1
      rect_x = @width - at - 1
    end
    # 게이지의 색 설정
    if at == width
        # MAX시의 게이지 묘화
      self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                        @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
    else
      if actor.rtp == 0
        # 통상시의 게이지 묘화
        self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                          @at_gauge, Rect.new(rect_x, @height, at, @height))
      else
        if actor.spell == true
          # 제휴 스킬 사용시의 게이지 묘화
          self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                        @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
        else
          # 스킬 영창시의 게이지 묘화
          self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                        @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
        end
      end
    end
  end
end

#==============================================================================
# ■ Scene_Battle (분할 정의 1)
#------------------------------------------------------------------------------
#  배틀 화면의 처리를 실시하는 클래스입니다.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 메인 처리
  #--------------------------------------------------------------------------
  def main
    # 전투용의 각종 일시 데이터를 초기화
    $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
    # 배틀 이벤트용 interpreter를 초기화
    $game_system.battle_interpreter.setup(nil, 0)
    # 무리를 준비
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    atb_setup
    # 엑터 커멘드 윈도우를 작성
    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
    # 그 외의 윈도우를 작성
    @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
    # 스프라이트 세트를 작성
    @spriteset = Spriteset_Battle.new
    # 웨이트 카운트를 초기화
    @wait_count = 0
    # 트란지션 실행
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    # 프레바트르페즈 개시
    start_phase1
    # 메인 루프
    loop do
      # 게임 화면을 갱신
      Graphics.update
      # 입력 정보를 갱신
      Input.update
      # 프레임 갱신
      update
      # 화면이 바뀌면(자) 루프를 중단
      if $scene != self
        break
      end
    end
    # 맵을 리프레쉬
    $game_map.refresh
    # 트란지션 준비
    Graphics.freeze
    # 윈도우를 해방
    @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
    # 스프라이트 세트를 해방
    @spriteset.dispose
    # 타이틀 화면으로 전환하고 안의 경우
    if $scene.is_a?(Scene_Title)
      # 화면을 페이드아웃
      Graphics.transition
      Graphics.freeze
    end
    # 전투 테스트로부터 게임 오버 화면 이외에 바꾸고 안의 경우
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # ● 승패 판정
  #--------------------------------------------------------------------------
  def judge
    # 전멸 판정이 진 , 또는 파티 인원수가 0 사람의 경우
    if $game_party.all_dead? or $game_party.actors.size == 0
      # 패배 가능의 경우
      if $game_temp.battle_can_lose
        # 배틀 개시전의 것 BGM 에 되돌리는
        $game_system.bgm_play($game_temp.map_bgm)
        # 배틀 종료
        battle_end(2)
        # true 를 돌려주는
        return true
      end
      # 게임 오버 플래그를 세트
      $game_temp.gameover = true
      # true 를 돌려주는
      return true
    end
    # 에너미가 1 몸에서도 존재하면 false 을 돌려주는
    for enemy in $game_troop.enemies
      if enemy.exist?
        return false
      end
    end
    # 애프터 배틀 국면 개시 (승리)
    start_phase5
    # true 를 돌려주는
    return true
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    # 배틀 이벤트 실행중의 경우
    if $game_system.battle_interpreter.running?
      if @command.size > 0
        @command_a = false
        @command = []
        command_delete
      end
      @status_window.at_refresh
      # interpreter를 갱신
      $game_system.battle_interpreter.update
      # 액션을 강제당하고 있는 버틀러가 존재하지 않는 경우
      if $game_temp.forcing_battler == nil
        # 배틀 이벤트의 실행이 끝났을 경우
        unless $game_system.battle_interpreter.running?
          # 배틀 이벤트의 셋업을 재실행
          @status_window.refresh
          setup_battle_event
        end
      end
    end
    # 시스템 (타이머), 화면을 갱신
    $game_system.update
    $game_screen.update
    # 타이머가 0 가 되었을 경우
    if $game_system.timer_working and $game_system.timer == 0
      # 배틀 중단
      $game_temp.battle_abort = true
    end
    # 윈도우를 갱신
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @message_window.update
    # 스프라이트 세트를 갱신
    @spriteset.update
    # 트란지션 처리중의 경우
    if $game_temp.transition_processing
      # 트란지션 처리중 플래그를 클리어
      $game_temp.transition_processing = false
      # 트란지션 실행
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # 메세지 윈도우 표시중의 경우
    if $game_temp.message_window_showing
      return
    end
    # 게임 오버의 경우
    if $game_temp.gameover
      # 게임 오버 화면으로 전환하고
      $scene = Scene_Gameover.new
      return
    end
    # 타이틀 화면에 되돌리는 경우
    if $game_temp.to_title
      # 타이틀 화면으로 전환하고
      $scene = Scene_Title.new
      return
    end
    # 배틀 중단의 경우
    if $game_temp.battle_abort
      # 배틀 개시전의 것 BGM 에 되돌리는
      $game_system.bgm_play($game_temp.map_bgm)
      # 배틀 종료
      battle_end(1)
      return
    end
    # 헬프 윈도우 표시중의 경우
    if @help_wait > 0
      @help_wait -= 1
      if @help_wait == 0
        # 헬프 윈도우를 숨기는
        @help_window.visible = false
      end
    end
    # 국면에 의해 분기
    case @phase
    when 0  # AT게이지 갱신 국면
      if anime_wait_return
        update_phase0
      end
    when 1  # 프레바트르페즈
      update_phase1
      return
    when 2  # 파티 커멘드 국면
      update_phase2
      return
    when 5  # 애프터 배틀 국면
      update_phase5
      return
    end
    if $scene != self
      return
    end
    if @phase == 0
      if @command.size != 0  # 엑터 커멘드 국면
        if @command_a == false
          start_phase3
        end
        update_phase3
      end
      # 웨이트중의 경우
      if @wait_count > 0
        # 웨이트 카운트를 줄이는
        @wait_count -= 1
        return
      end
      update_phase4
    end
  end

#==============================================================================
# ■ Scene_Battle (분할 정의 2)
#------------------------------------------------------------------------------
#  배틀 화면의 처리를 실시하는 클래스입니다.
#==============================================================================

  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (AT게이지 갱신 국면)
  #--------------------------------------------------------------------------
  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)
        # 캔슬 SE 을 연주
        $game_system.se_play($data_system.cancel_se)
        @party = true
      end
    end
    if @party == true and
        ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
        (@action_battlers.empty? or @action_battlers[0].phase == 1)))
      # 파티 커멘드 국면에
      start_phase2
      return
    end
    # AT게이지 증가 처리
    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
                  fullat_se
                  force_action(battler)
                  action_start(battler)
                else
                  fullat_se
                  @command.push(battler)
                end
              end
            else
              unless @action_battlers.include?(battler) or
                      battler == @command[0]
                battler.current_action.clear
                if @command.include?(battler)
                  @command.delete(battler)
                else
                  if battler.movable?
                    fullat_se
                  end
                end
                action_start(battler)
              end
            end
          else
            unless @action_battlers.include?(battler)
              if battler.current_action.forcing
                force_action(battler)
                action_start(battler)
              else
                if @enemy_speed != 0
                  if rand(@enemy_speed) == 0
                    number = cnt - $game_party.actors.size
                    enemy_action(number)
                  end
                else
                  number = cnt - $game_party.actors.size
                  enemy_action(number)
                end
              end
            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)
            if battler.is_a?(Game_Actor)
              fullat_se
            end
            battler.rt = battler.rtp
            action_start(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게이지를 리프레쉬
    @status_window.at_refresh
    # 도주 처리
    if @escape == true and
        ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
        (@action_battlers.empty? or @action_battlers[0].phase == 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
  #--------------------------------------------------------------------------
  # ● 파티 커멘드 국면 개시
  #--------------------------------------------------------------------------
  def start_phase2
    # 국면 2 에 이행
    @phase = 2
    @party = false
    # 파티 커멘드 윈도우를 유효화
    @party_command_window.active = true
    @party_command_window.visible = true
    # 엑터를 비선택 상태로 설정
    @actor_index = -1
    # 엑터 커멘드 윈도우를 무효화
    @actor_command_window.active = false
    @actor_command_window.visible = false
    if @command.size != 0
      # 엑터의 명 멸망 효과 OFF
      if @active_actor != nil
        @active_actor.blink = false
      end
    end
    # 카메라 세트
    @camera == "party"
    @spriteset.screen_target(0, 0, 1)
    # 메인 국면 플래그를 클리어
    $game_temp.battle_main_phase = false
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (파티 커멘드 국면)
  #--------------------------------------------------------------------------
  def update_phase2
    # C 버튼이 밀렸을 경우
    if Input.trigger?(Input::C)
      # 파티 커멘드 윈도우의 커서 위치에서 분기
      case @party_command_window.index
      when 0  # 싸우는
        # 파티 커멘드 윈도우를 무효화
        @party_command_window.active = false
        @party_command_window.visible = false
        # 결정 SE 을 연주
        $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
          # 엑터 커멘드 국면 개시
          start_phase3
        else
          $game_temp.battle_main_phase = true
        end
      when 1  # 도망치는
        # 도주 가능하지 않는 경우
        if $game_temp.battle_can_escape == false
          # 버저 SE 를 연주
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 결정 SE 을 연주
        $game_system.se_play($data_system.decision_se)
        @phase = 0
        # 파티 커멘드 윈도우를 무효화
        @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 을 연주
        $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
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (파티 커멘드 국면 : 도망치는)
  #--------------------------------------------------------------------------
  def update_phase2_escape
    # 에너미의 민첩함 평균치를 계산
    enemies_agi = 0
    enemies_number = 0
    for enemy in $game_troop.enemies
      if enemy.exist?
        enemies_agi += enemy.agi
        enemies_number += 1
      end
    end
    if enemies_number > 0
      enemies_agi /= enemies_number
    end
    # 엑터의 민첩함 평균치를 계산
    actors_agi = 0
    actors_number = 0
    for actor in $game_party.actors
      if actor.exist?
        actors_agi += actor.agi
        actors_number += 1
      end
    end
    if actors_number > 0
      actors_agi /= actors_number
    end
    # 도주 성공 판정
    success = rand(100) < 50 * actors_agi / enemies_agi
    # 도주 성공의 경우
    if success
      # 도주 SE 를 연주
      $game_system.se_play($data_system.escape_se)
      # 배틀 개시전의 것 BGM 에 되돌리는
      $game_system.bgm_play($game_temp.map_bgm)
      # 배틀 종료
      battle_end(1)
    # 도주 실패의 경우
    else
      @help_window.set_text("도주 실패", 1)
      @help_wait = @help_time
      # 파티 전원의 액션을 클리어
      $game_party.clear_actions
      # 메인 국면 개시
      start_phase4
    end
  end
  #--------------------------------------------------------------------------
  # ● 애프터 배틀 국면 개시
  #--------------------------------------------------------------------------
  def start_phase5
    # 국면 5 에 이행
    @phase = 5
    # 배틀 종료 ME 를 연주
    $game_system.me_play($game_system.battle_end_me)
    # 배틀 개시전의 것 BGM 에 되돌리는
    $game_system.bgm_play($game_temp.map_bgm)
    # EXP, 골드 , 트레이닝 전기밥통을 초기화
    exp = 0
    gold = 0
    treasures = []
    if @active_actor != nil
      @active_actor.blink = false
    end
    # 메인 국면 플래그를 세트
    $game_temp.battle_main_phase = true
    # 파티 커멘드 윈도우를 무효화
    @party_command_window.active = false
    @party_command_window.visible = false
    # 엑터 커멘드 윈도우를 무효화
    @actor_command_window.active = false
    @actor_command_window.visible = false
    if @skill_window != nil
      # 스킬 윈도우를 해방
      @skill_window.dispose
      @skill_window = nil
    end
    if @item_window != nil
      # 아이템 윈도우를 해방
      @item_window.dispose
      @item_window = nil
    end
    # 헬프 윈도우를 숨기는
    @help_window.visible = false
    # 루프
    for enemy in $game_troop.enemies
      # 에너미가 숨고 상태가 아닌 경우
      unless enemy.hidden
        # 획득 EXP, 골드를 추가
        exp += enemy.exp
        gold += enemy.gold
        # 트레이닝 전기밥통 출현 판정
        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
    # 트레이닝 전기밥통의 수를 6 개까지 한정
    treasures = treasures[0..5]
    # EXP 획득
    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)
          actor.damage[[actor, -1]] = "Level up!"
          actor.up_level = actor.level - last_level
        end
      end
    end
    # 골드 획득
    $game_party.gain_gold(gold)
    # 트레이닝 전기밥통 획득
    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
    # 배틀 결과 윈도우를 작성
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # 웨이트 카운트를 설정
    @phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (애프터 배틀 국면)
  #--------------------------------------------------------------------------
  def update_phase5
    # 웨이트 카운트가 0 보다 큰 경우
    if @phase5_wait_count > 0
      # 웨이트 카운트를 줄이는
      @phase5_wait_count -= 1
      # 웨이트 카운트가 0 가 되었을 경우
      if @phase5_wait_count == 0
        # 결과 윈도우를 표시
        @result_window.visible = true
        # 메인 국면 플래그를 클리어
        $game_temp.battle_main_phase = false
        # 스테이터스 윈도우를 리프레쉬
        @status_window.refresh
        for actor in $game_party.actors
          if actor.damage.include?([actor, 0])
            @phase5_wait_count = 20
            actor.damage_pop[[actor, 0]] = true
          end
          if actor.damage.include?([actor, -1])
            @phase5_wait_count = 20
            actor.damage_pop[[actor, -1]] = true
            for level in actor.level - actor.up_level + 1..actor.level
              for skill in $data_classes[actor.class_id].learnings
                if level == skill.level and not actor.skill_learn?(skill.id)
                  actor.damage[[actor, 0]] = "New Skill!"
                  break
                end
              end
            end
          end
        end
      end
      return
    end
    # C 버튼이 밀렸을 경우
    if Input.trigger?(Input::C)
      # 배틀 종료
      battle_end(0)
    end
  end

#==============================================================================
# ■ Scene_Battle (분할 정의 3)
#------------------------------------------------------------------------------
#  배틀 화면의 처리를 실시하는 클래스입니다.
#==============================================================================

  #--------------------------------------------------------------------------
  # ● 엑터 커멘드 국면 개시
  #--------------------------------------------------------------------------
  def start_phase3
    if victory?
      return
    end
    # 메인 국면 플래그를 클리어
    $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
    # 카메라의 설정
    @camera = "command"
    plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
    y = [(plus.abs - 1.5) * 10 , 0].min
    @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  end
  #--------------------------------------------------------------------------
  # ● 엑터의 커멘드 입력 종료
  #--------------------------------------------------------------------------
  def phase3_next_actor
    @command.shift
    @command_a = false
    # 메인 국면 플래그를 세트
    $game_temp.battle_main_phase = true
    # 엑터 커멘드 윈도우를 무효화
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # 엑터의 명 멸망 효과 OFF
    if @active_actor != nil
      @active_actor.blink = false
    end
    action_start(@active_actor)
    # 카메라를 바탕으로 되돌리는
    if @camera == "command"
      @spriteset.screen_target(0, 0, 1)
    end
    return
  end
  #--------------------------------------------------------------------------
  # ● 엑터 커멘드 윈도우의 셋업
  #--------------------------------------------------------------------------
  def phase3_setup_command_window
    # 파티 커멘드 윈도우를 무효화
    @party_command_window.active = false
    @party_command_window.visible = false
    # 엑터 커멘드 윈도우를 유효화
    @actor_command_window.active = true
    @actor_command_window.visible = true
    # 엑터 커멘드 윈도우의 위치를 설정
    @actor_command_window.x = @actor_index * 160 +
                              (4 - $game_party.actors.size) * 80
    # 인덱스를 0 로 설정
    @actor_command_window.index = 0
  end
  #--------------------------------------------------------------------------
  # ● 에너미 액션 작성
  #--------------------------------------------------------------------------
  def enemy_action(number)
    enemy = $game_troop.enemies[number]
    unless enemy.current_action.forcing
      enemy.make_action
    end
    action_start(enemy)
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (엑터 커멘드 국면)
  #--------------------------------------------------------------------------
  def update_phase3
    if victory? and @command_a
      command_delete
      @command.push(@active_actor)
      return
    end
    # 에네미아로가 유효의 경우
    if @enemy_arrow != nil
      update_phase3_enemy_select
    # 아크타아로가 유효의 경우
    elsif @actor_arrow != nil
      update_phase3_actor_select
    # 스킬 윈도우가 유효의 경우
    elsif @skill_window != nil
      update_phase3_skill_select
    # 아이템 윈도우가 유효의 경우
    elsif @item_window != nil
      update_phase3_item_select
    # 엑터 커멘드 윈도우가 유효의 경우
    elsif @actor_command_window.active
      update_phase3_basic_command
    end
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (엑터 커멘드 국면 : 기본 커멘드)
  #--------------------------------------------------------------------------
  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
      # 캔슬 SE 을 연주
      $game_system.se_play($data_system.cancel_se)
      @party = true
    end
    if @party == true and
        ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
&n
?

List of Articles
번호 제목 글쓴이 날짜 조회 수
3507 픽쳐 좌표구하는 프로그램 file MiNi'M' 2006.04.05 188
3506 픽쳐 좌표구하는 프로그램 크레시스 2006.04.05 228
3505 픽쳐 좌표구하는 프로그램 Santiago 2006.04.05 291
3504 메뉴만들기에 대해서. file 모래선비 2006.04.04 193
3503 전투중아이템사용에대해서;;(xp사용중) 짱돌z 2006.04.04 155
3502 코러스 하는법좀. 상혁군 2006.04.04 366
3501 여러분 이것점 올려주세요[강좌](해주시면 100%감사) 다크아머 2006.04.03 158
3500 여러분 이것점 올려주세요[강좌](해주시면 100%감사) 이실로드vv 2006.04.03 274
3499 액알에대해서 다크아머 2006.04.03 235
3498 액알에대해서 cksgml 2006.04.03 270
3497 메뉴만들기에 대해서. 『덩키동크』 2006.04.03 154
3496 RPG2000과RPG2003 어떻게 해야하나요?? 친절한알피쥐 2006.04.02 461
3495 만약에 RPG2003게임을 하고 싶다면... 친절한알피쥐 2006.04.01 591
3494 알만툴2003의 전투방식을 xp로.. 한가지방법 2006.04.01 326
3493 알만툴2003의 전투방식을 xp로.. 냥-냥 2006.04.01 449
3492 rpgxp 런타임패키지 알거엄서 2006.03.30 799
» RPG xp 리얼타임 엑티브 배틀 스크립트에 대하여... 냥-냥 2006.03.30 648
3490 병렬처리에 대한 질문입니다.. [예제 첨부] 다크아머 2006.03.30 213
3489 병렬처리에 대한 질문입니다.. [예제 첨부] 파파 곤잘레스 2006.03.30 239
3488 RPG2000과RPG2003 어떻게 해야하나요?? 로안 2006.03.30 429
Board Pagination Prev 1 ... 262 263 264 265 266 267 268 269 270 271 ... 442 Next
/ 442


[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)