질문과 답변

Extra Form

하나는 STR 11 xp 스타일 전투고 다른 하나는 KGC 파티편성입니다. 뭐가 문제냐면 STR 11 xp 스타일 전투 스크립트를 쓰면 전투할 때 파티 교체가 뜨지 않아서 파티가 8명이여도 전투는 4명밖에 못하고 끝나는데... STR 11 xp 스타일 전투 스크립트에 

싸우다, 도망치다 말고 교체를 만들어서 교체를 선택하면 KGC 파티편성 창이 뜨며 파티를 바꿔가며 전투할 수 있었으며 좋겠습니다. 그리고 4명이 전부 죽으면 나머지 파티원 4명이 저절로 전투에 나왔으면 좋겠습니다.


제 어휘력이 부족해서 설명이 이상해졌는데 쉽게 말하면 동방마환상 전투입니다.


+11a, 11b, 11cv2, 11dv2는 STR 11xp 스타일 전투 스크립트




_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆ 많은 사람 파티 - KGC_LargeParty ◆ VX ◆
#_/    ◇ Last update : 2008/04/27 ◇
#_/----------------------------------------------------------------------------
#_/  5명 이상의 대규모 파티를 구축 가능하게 합니다.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ 커스터마이즈 항목 - Customize ★
#==============================================================================

module KGC
module LargeParty
  # ◆ 파티 편성 허가를 나타내는 스윗치 번호
  #  이 스윗치의 ON/OFF 그리고 파티 편성의 허가/불허가 (을)를 바꿉니다.
  PARTYFORM_SWITCH          = 3
  # ◆ 전투중의 파티 편성 허가를 나타내는 스윗치 번호
  #  ↑(와)과 다른 번호를 지정하면, 전투중만의 교체 가부를 설정할 수 있습니다.
  BATTLE_PARTYFORM_SWITCH   = 4
  # ◆ 디폴트의 편성 허가 플래그
  #  true (으)로 하면, 「뉴 게임」선택시에 양쪽 모두의 파티 편성 허가 스윗치가
  #  자동적으로 ON (이)가 됩니다.
  DEFAULT_PARTYFORM_ENABLED = true

  # ◆ 전투 멤버 최대수 (디폴트치)
  #  5 이상으로 하면, 전투 화면의 스테이터스가 약간 봐 괴로워집니다.
  MAX_BATTLE_MEMBERS = 4
  # ◆ 파티 멤버 최대수
  #  Game_Party::MAX_MEMBERS (을)를 덧쓰기합니다.
  #  100 이상으로 하면 [Window_MenuStatus] 하지만 버그.
  MAX_MEMBERS = 20

  # ◆ 고정 멤버의 줄서 바꾸어를 금지
  #  스크립트로부터의 조작 이외에서는 줄서 바꾸어 할 수 없게 됩니다.
  FORBID_CHANGE_SHIFT_FIXED = false

  # ◆ 대기 멤버의 배경색
  #  색을 바꾸지 않는 경우는  Color.new(0, 0, 0, 0)
  STAND_BY_COLOR = Color.new(0, 0, 0, 128)
  # ◆ 고정 멤버의 배경색
  FIXED_COLOR    = Color.new(255, 128, 64, 96)
  # ◆ 줄서 바꾸어 때의 배경색
  SELECTED_COLOR = Color.new(64, 255, 128, 128)

  # ◆ 파티 편성 버튼 (메뉴 화면용)
  #  메뉴 화면에서 이 버튼을 누르면, 파티 편성 화면으로 이행합니다.
  #  사용하지 않는 경우는 nil
  MENU_PARTYFORM_BUTTON      = nil #Input::A
  # ◆ 메뉴 화면에 파티 편성 커멘드를 추가한다
  #  추가하는 장소는, 메뉴 커멘드의 최하부입니다.
  #  다른 부분에 추가하고 싶으면,≪커스텀 메뉴 커멘드≫ (을)를 이용하십시오.
  USE_MENU_PARTYFORM_COMMAND = false
  # ◆ 메뉴 화면의 파티 편성 커멘드의 명칭
  VOCAB_MENU_PARTYFORM       = "파티 편성"

  # ◆ 전투중에 파티 편성 커멘드를 사용한다
  #  추가하는 장소는, 파티 커멘드의 최하부( 「도망친다」의 아래)입니다.
  USE_BATTLE_PARTYFORM   = false
  # ◆ 전투중의 파티 편성 커멘드의 명칭
  VOCAB_BATTLE_PARTYFORM = "교체"

  # ◆ 편성 화면의 캐릭터 묘화 사이즈 [폭, 높이]
  #  액터의 보행 그래픽의 사이즈에 따라 고쳐 써 주세요.
  PARTY_FORM_CHARACTER_SIZE   = [40, 48]
  # ◆ 편성 화면의 전투 멤버 윈도우의 공난에 표시하는 텍스트
  BATTLE_MEMBER_BLANK_TEXT    = "EMPTY"
  # ◆ 편성 화면의 파티 멤버 윈도우의 최대행수
  #  스테이터스 윈도우가 화면에서는 봐 나오는 경우는,
  #  이 값을 1 (으)로 해 주세요.
  PARTY_MEMBER_WINDOW_ROW_MAX = 2
  # ◆ 편성 화면의 파티 멤버 윈도우에 전투 멤버를 표시한다
  SHOW_BATTLE_MEMBER_IN_PARTY = true
  # ◆ 편성 화면의 파티 멤버 윈도우의 공난에 표시하는 텍스트
  PARTY_MEMBER_BLANK_TEXT     = ""

  # ◆ 편성 화면의 캡션 윈도우의 폭
  CAPTION_WINDOW_WIDTH  = 192
  # ◆ 편성 화면의 전투 멤버 윈도우의 캡션
  BATTLE_MEMBER_CAPTION = "전투 멤버"

  if SHOW_BATTLE_MEMBER_IN_PARTY
    # ◆ 편성 화면의 파티 멤버 윈도우의 캡션
    #  SHOW_BATTLE_MEMBER_IN_PARTY = true 때
    PARTY_MEMBER_CAPTION = "파티 멤버"
  else
    # ◆ 편성 화면의 파티 멤버 윈도우의 캡션
    #  SHOW_BATTLE_MEMBER_IN_PARTY = false 때
    PARTY_MEMBER_CAPTION = "대기 멤버"
  end

  # ◆ 편성 확인 윈도우의 폭
  CONFIRM_WINDOW_WIDTH    = 160
  # ◆ 편성 확인 윈도우의 문자열
  #  ※커멘드수·차례를 변경하면 버그.
  CONFIRM_WINDOW_COMMANDS = ["편성 완료", "편성 중지", "캔슬"]

  # ◆ 숍 화면의 스테이터스 윈도우 스크롤시에 사용하는 버튼
  #  이 버튼을 누르고 있는 동안, 상하 버튼으로 스크롤 할 수 있습니다.
  #  스크롤을 무효로 하는 경우는 nil (을)를 지정.
  #  ≪헬프 윈도우 기능확장≫병용시는, 위에 도입한 것을 우선.
  SHOP_STATUS_SCROLL_BUTTON = Input::A

  # ◆ 대기 멤버 획득 경험치 비율【단위:‰(천분율 1‰=0.1%)】
  #  500 (이)라면 50.0% 입니다.
  STAND_BY_EXP_RATE = 500
  # ◆ 결과 화면에서 대기 멤버의 레벨업을 표시한다
  #  false (으)로 하면, 전투 멤버만 표시합니다.
  SHOW_STAND_BY_LEVEL_UP = true
  # ◆ 전투 이외에도 대기 멤버를 표시한다
  #  true  : 전투 이외에서는 항상 전원을 표시.
  #  false : 교체시 이외는, 대기 멤버를 없는 것으로서 취급한다.
  SHOW_STAND_BY_MEMBER_NOT_IN_BATTLE = true
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["LargeParty"] = true

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ KGC::Commands
#==============================================================================

module KGC
module Commands
  # 멤버의 소트 형식
  SORT_BY_ID    = 0  # ID순
  SORT_BY_NAME  = 1  # 이름순
  SORT_BY_LEVEL = 2  # 레벨순서

  module_function
  #--------------------------------------------------------------------------
  # ○ 파티 편성 화면의 호출
  #--------------------------------------------------------------------------
  def call_partyform
    return if $game_temp.in_battle
    $game_temp.next_scene = :partyform
  end
  #--------------------------------------------------------------------------
  # ○ 전투 멤버 최대수를 설정
  #     value : 인원수 (생략 했을 경우는 디폴트치를 사용)
  #--------------------------------------------------------------------------
  def set_max_battle_member_count(value = nil)
    $game_party.max_battle_member_count = value
  end
  #--------------------------------------------------------------------------
  # ○ 파티 인원수가 가득한가
  #--------------------------------------------------------------------------
  def party_full?
    return $game_party.full?
  end
  #--------------------------------------------------------------------------
  # ○ 파티 편성 가부를 설정
  #     enabled : 유효 플래그 (생략시 : true) 
  #--------------------------------------------------------------------------
  def permit_partyform(enabled = true)
    $game_switches[KGC::LargeParty::PARTYFORM_SWITCH] = enabled
  end
  #--------------------------------------------------------------------------
  # ○ 전투중의 파티 편성 가부를 설정
  #     enabled : 유효 플래그 (생략시 : true) 
  #--------------------------------------------------------------------------
  def permit_battle_partyform(enabled = true)
    $game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH] = enabled
  end
  #--------------------------------------------------------------------------
  # ○ 액터의 고정 상태를 설정
  #     actor_id : 액터 ID
  #     fixed    : 고정 플래그 (생략시 : true) 
  #--------------------------------------------------------------------------
  def fix_actor(actor_id, fixed = true)
    $game_party.fix_actor(actor_id, fixed)
  end
  #--------------------------------------------------------------------------
  # ○ 줄대체
  #    멤버의 index1 번째와 index2 번째를 바꿔 넣는다
  #--------------------------------------------------------------------------
  def change_party_shift(index1, index2)
    $game_party.change_shift(index1, index2)
  end
  #--------------------------------------------------------------------------
  # ○ 멤버 정렬 (승순)
  #     sort_type : 소트 형식 (SORT_BY_xxx)
  #     reverse   : true (이)라면 내림차순
  #--------------------------------------------------------------------------
  def sort_party_member(sort_type = SORT_BY_ID, reverse = false)
    $game_party.sort_member(sort_type, reverse)
  end
  #--------------------------------------------------------------------------
  # ○ 대기 멤버의 ID (을)를 취득
  #--------------------------------------------------------------------------
  def get_stand_by_member_ids
    result = []
    $game_party.stand_by_members.each { |actor| result << actor.id }
    return result
  end
  #--------------------------------------------------------------------------
  # ○ 액터가 대기 멤버인가
  #     actor_id : 액터 ID
  #--------------------------------------------------------------------------
  def stand_by_member?(actor_id)
    return get_stand_by_member_ids.include?(actor_id)
  end
  #--------------------------------------------------------------------------
  # ○ 액터를 전투 멤버에 가세한다
  #     actor_id : 액터 ID
  #     index    : 추가 위치 (생략시는 최후미)
  #--------------------------------------------------------------------------
  def add_battle_member(actor_id, index = nil)
    $game_party.add_battle_member(actor_id, index)
  end
  #--------------------------------------------------------------------------
  # ○ 액터를 전투 멤버로부터 제외한다
  #     actor_id : 액터 ID
  #--------------------------------------------------------------------------
  def remove_battle_member(actor_id)
    $game_party.remove_battle_member(actor_id)
  end
  #--------------------------------------------------------------------------
  # ○ 고정 액터 이외를 전투 멤버로부터 제외한다
  #--------------------------------------------------------------------------
  def remove_all_battle_member
    $game_party.all_members.each { |actor|
      $game_party.remove_battle_member(actor.id)
    }
  end
  #--------------------------------------------------------------------------
  # ○ 랜덤 출격
  #--------------------------------------------------------------------------
  def random_launch
    new_battle_members = $game_party.fixed_members
    candidates = $game_party.all_members - new_battle_members
    num = [$game_party.max_battle_member_count - new_battle_members.size,
      candidates.size].min
    return if num <= 0

    # 랜덤에 선택한다
    ary = (0...candidates.size).to_a.sort_by { rand }
    ary[0...num].each { |i| new_battle_members << candidates[i] }
    $game_party.set_battle_member(new_battle_members)
  end
end
end

class Game_Interpreter
  include KGC::Commands
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Vocab
#==============================================================================

module Vocab
  # 「파티 편성」커멘드명 (메뉴)
  def self.partyform
    return KGC::LargeParty::VOCAB_MENU_PARTYFORM
  end

  # 「파티 편성」커멘드명 (전투)
  def self.partyform_battle
    return KGC::LargeParty::VOCAB_BATTLE_PARTYFORM
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ○ 파티내 인덱스 취득
  #--------------------------------------------------------------------------
  def party_index
    return $game_party.all_members.index(self)
  end
  #--------------------------------------------------------------------------
  # ○ 전투 멤버나 판정
  #--------------------------------------------------------------------------
  def battle_member?
    return $game_party.battle_members.include?(self)
  end
  #--------------------------------------------------------------------------
  # ○ 고정 멤버나 판정
  #--------------------------------------------------------------------------
  def fixed_member?
    return $game_party.fixed_members.include?(self)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Party
#==============================================================================

class Game_Party
  #--------------------------------------------------------------------------
  # ● 정수
  #--------------------------------------------------------------------------
  MAX_MEMBERS = KGC::LargeParty::MAX_MEMBERS  # 최대 파티 인원수
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  alias initialize_KGC_LargeParty initialize
  def initialize
    initialize_KGC_LargeParty

    @max_battle_member_count = nil
    @battle_member_count = 0
    @fixed_actors = []
  end
  #--------------------------------------------------------------------------
  # ○ 전투 멤버 최대수취득
  #--------------------------------------------------------------------------
  def max_battle_member_count
    if @max_battle_member_count == nil
      return KGC::LargeParty::MAX_BATTLE_MEMBERS
    else
      return @max_battle_member_count
    end
  end
  #--------------------------------------------------------------------------
  # ○ 전투 멤버 최대수변경
  #--------------------------------------------------------------------------
  def max_battle_member_count=(value)
    if value.is_a?(Integer)
      value = [value, 1].max
    end
    @max_battle_member_count = value
  end
  #--------------------------------------------------------------------------
  # ○ 전투 멤버수취득
  #--------------------------------------------------------------------------
  def battle_member_count
    if @battle_member_count == nil
      @battle_member_count = @actors.size
    end
    @battle_member_count =
      [@battle_member_count, @actors.size, max_battle_member_count].min
    return @battle_member_count
  end
  #--------------------------------------------------------------------------
  # ○ 전투 멤버수설정
  #--------------------------------------------------------------------------
  def battle_member_count=(value)
    @battle_member_count = [[value, 0].max,
      @actors.size, max_battle_member_count].min
  end
  #--------------------------------------------------------------------------
  # ● 멤버의 취득
  #--------------------------------------------------------------------------
  alias members_KGC_LargeParty members
  def members
    if $game_temp.in_battle ||
        !KGC::LargeParty::SHOW_STAND_BY_MEMBER_NOT_IN_BATTLE
      return battle_members
    else
      return members_KGC_LargeParty
    end
  end
  #--------------------------------------------------------------------------
  # ○ 전멤버의 취득
  #--------------------------------------------------------------------------
  def all_members
    return members_KGC_LargeParty
  end
  #--------------------------------------------------------------------------
  # ○ 전투 멤버의 취득
  #--------------------------------------------------------------------------
  def battle_members
    result = []
    battle_member_count.times { |i| result << $game_actors[@actors[i]] }
    return result
  end
  #--------------------------------------------------------------------------
  # ○ 대기 멤버의 취득
  #--------------------------------------------------------------------------
  def stand_by_members
    return (all_members - battle_members)
  end
  #--------------------------------------------------------------------------
  # ○ 고정 멤버의 취득
  #--------------------------------------------------------------------------
  def fixed_members
    result = []
    @fixed_actors.each { |i| result << $game_actors[i] }
    return result
  end
  #--------------------------------------------------------------------------
  # ● 초기 파티의 셋업
  #--------------------------------------------------------------------------
  alias setup_starting_members_KGC_LargeParty setup_starting_members
  def setup_starting_members
    setup_starting_members_KGC_LargeParty

    self.battle_member_count = @actors.size
  end
  #--------------------------------------------------------------------------
  # ● 전투 테스트용 파티의 셋업
  #--------------------------------------------------------------------------
  alias setup_battle_test_members_KGC_LargeParty setup_battle_test_members
  def setup_battle_test_members
    setup_battle_test_members_KGC_LargeParty

    self.battle_member_count = @actors.size
  end
  #--------------------------------------------------------------------------
  # ○ 멤버의 신규 설정
  #     new_member : 새로운 멤버
  #--------------------------------------------------------------------------
  def set_member(new_member)
    @actors = []
    new_member.each { |actor| @actors << actor.id }
  end
  #--------------------------------------------------------------------------
  # ○ 전투 멤버의 신규 설정
  #     new_member : 새로운 전투 멤버
  #--------------------------------------------------------------------------
  def set_battle_member(new_member)
    new_battle_member = []
    new_member.each { |actor|
      @actors.delete(actor.id)
      new_battle_member << actor.id
    }
    @actors = new_battle_member + @actors
    self.battle_member_count = new_member.size
  end
  #--------------------------------------------------------------------------
  # ○ 파티 편성을 허가하고 있을까 판정
  #--------------------------------------------------------------------------
  def partyform_enable?
    return $game_switches[KGC::LargeParty::PARTYFORM_SWITCH]
  end
  #--------------------------------------------------------------------------
  # ○ 전투중의 파티 편성을 허가하고 있을까 판정
  #--------------------------------------------------------------------------
  def battle_partyform_enable?
    return false unless partyform_enable?
    return $game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH]
  end
  #--------------------------------------------------------------------------
  # ○ 멤버가 가득한가 판정
  #--------------------------------------------------------------------------
  def full?
    return (@actors.size >= MAX_MEMBERS)
  end
  #--------------------------------------------------------------------------
  # ○ 고정 액터나 판정
  #     actor_id : 판정하는 액터의 ID
  #--------------------------------------------------------------------------
  def actor_fixed?(actor_id)
    return @fixed_actors.include?(actor_id)
  end
  #--------------------------------------------------------------------------
  # ● 액터를 가세한다
  #     actor_id : 액터 ID
  #--------------------------------------------------------------------------
  alias add_actor_KGC_LargeParty add_actor
  def add_actor(actor_id)
    last_size = @actors.size

    add_actor_KGC_LargeParty(actor_id)

    if last_size < @actors.size
      self.battle_member_count += 1
    end
  end
  #--------------------------------------------------------------------------
  # ○ 액터를 전투 멤버에 가세한다
  #     actor_id : 액터 ID
  #     index    : 추가 위치 (생략시는 최후미)
  #--------------------------------------------------------------------------
  def add_battle_member(actor_id, index = nil)
    return unless @actors.include?(actor_id)  # 파티에 없다
    if index == nil
      return if battle_members.include?($game_actors[actor_id])  # 출격이 끝난 상태
      return if battle_member_count == max_battle_member_count   # 인원수가 최대
      index = battle_member_count
    end

    @actors.delete(actor_id)
    @actors.insert(index, actor_id)
    self.battle_member_count += 1
  end
  #--------------------------------------------------------------------------
  # ○ 액터를 전투 멤버로부터 제외한다
  #     actor_id : 액터 ID
  #--------------------------------------------------------------------------
  def remove_battle_member(actor_id)
    return unless @actors.include?(actor_id)  # 파티에 없다
    return if actor_fixed?(actor_id)          # 고정이 끝난 상태
    return if stand_by_members.include?($game_actors[actor_id])  # 대기중

    @actors.delete(actor_id)
    @actors.push(actor_id)
    self.battle_member_count -= 1
  end
  #--------------------------------------------------------------------------
  # ○ 액터의 고정 상태를 설정
  #     actor_id : 액터 ID
  #     fixed    : 고정 플래그 (생략시 : false) 
  #--------------------------------------------------------------------------
  def fix_actor(actor_id, fixed = false)
    return unless @actors.include?(actor_id)  # 파티에 없다

    if fixed
      # 고정
      unless @fixed_actors.include?(actor_id)
        @fixed_actors << actor_id
        unless battle_members.include?($game_actors[actor_id])
          self.battle_member_count += 1
        end
      end
      # 강제 출격
      apply_force_launch
    else
      # 고정 해제
      @fixed_actors.delete(actor_id)
    end
    $game_player.refresh
  end
  #--------------------------------------------------------------------------
  # ○ 강제 출격 적용
  #--------------------------------------------------------------------------
  def apply_force_launch
    while (fixed_members - battle_members).size > 0
      # 고정 상태가 아닌 멤버를 적당하게 가져와 교체
      actor1 = stand_by_members.find { |a| @fixed_actors.include?(a.id) }
      actor2 = battle_members.reverse.find { |a| !@fixed_actors.include?(a.id) }
      index1 = @actors.index(actor1.id)
      index2 = @actors.index(actor2.id)
      @actors[index1], @actors[index2] = @actors[index2], @actors[index1]

      # 전투 멤버가 전원 고정되면 돌아온다 (엔들레스 루프 방지)
      all_fixed = true
      battle_members.each { |actor|
        unless actor.fixed_member?
          all_fixed = false
          break
        end
      }
      break if all_fixed
    end
  end
  #--------------------------------------------------------------------------
  # ○ 멤버 정렬 (승순)
  #     sort_type : 소트 형식 (SORT_BY_xxx)
  #     reverse   : true (이)라면 내림차순
  #--------------------------------------------------------------------------
  def sort_member(sort_type = KGC::Commands::SORT_BY_ID,
                  reverse = false)
    # 버퍼를 준비
    b_actors = battle_members
    actors = all_members - b_actors
    f_actors = fixed_members
    # 고정 캐릭터는 소트 하지 않는다
    if KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED
      actors -= f_actors
      b_actors -= f_actors
    end

    # 소트
    case sort_type
    when KGC::Commands::SORT_BY_ID     # ID순
      actors.sort!   { |a, b| a.id <=> b.id }
      b_actors.sort! { |a, b| a.id <=> b.id }
    when KGC::Commands::SORT_BY_NAME   # 이름순
      actors.sort!   { |a, b| a.name <=> b.name }
      b_actors.sort! { |a, b| a.name <=> b.name }
    when KGC::Commands::SORT_BY_LEVEL  # 레벨순서
      actors.sort!   { |a, b| a.level <=> b.level }
      b_actors.sort! { |a, b| a.level <=> b.level }
    end
    # 반전
    if reverse
      actors.reverse!
      b_actors.reverse!
    end

    # 고정 캐릭터를 선두에 가져온다
    if KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED
      actors = f_actors + actors
      b_actors = f_actors + b_actors
    end

    # 복귀
    set_member(actors)
    set_battle_member(b_actors)

    apply_force_launch
    $game_player.refresh
  end
  #--------------------------------------------------------------------------
  # ○ 줄대체
  #    전투 멤버의 index1 번째와 index2 번째를 바꿔 넣는다
  #--------------------------------------------------------------------------
  def change_shift(index1, index2)
    size = @actors.size
    if index1 >= size || index2 >= size
      return
    end
    buf = @actors[index1]
    @actors[index1] = @actors[index2]
    @actors[index2] = buf
    $game_player.refresh
  end
  #--------------------------------------------------------------------------
  # ● 전투용 스테이트의 해제 (전투 종료시에 호출해)
  #--------------------------------------------------------------------------
  def remove_states_battle
    for actor in all_members
      actor.remove_states_battle
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Command
#==============================================================================

class Window_Command < Window_Selectable
  unless method_defined?(:add_command)
  #--------------------------------------------------------------------------
  # ○ 커멘드를 추가
  #    추가한 위치를 돌려준다
  #--------------------------------------------------------------------------
  def add_command(command)
    @commands << command
    @item_max = @commands.size
    item_index = @item_max - 1
    refresh_command
    draw_item(item_index)
    return item_index
  end
  #--------------------------------------------------------------------------
  # ○ 커멘드를 리프레쉬
  #--------------------------------------------------------------------------
  def refresh_command
    buf = self.contents.clone
    self.height = [self.height, row_max * WLH + 32].max
    create_contents
    self.contents.blt(0, 0, buf, buf.rect)
    buf.dispose
  end
  #--------------------------------------------------------------------------
  # ○ 커멘드를 삽입
  #--------------------------------------------------------------------------
  def insert_command(index, command)
    @commands.insert(index, command)
    @item_max = @commands.size
    refresh_command
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ 커멘드를 삭제
  #--------------------------------------------------------------------------
  def remove_command(command)
    @commands.delete(command)
    @item_max = @commands.size
    refresh
  end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_MenuStatus
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 정수
  #--------------------------------------------------------------------------
  STATUS_HEIGHT = 48  # 스테이터스 일인분의 높이
  #--------------------------------------------------------------------------
  # ● 윈도우 내용의 작성
  #--------------------------------------------------------------------------
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - 32, [height - 32, row_max * STATUS_HEIGHT].max)
  end
  #--------------------------------------------------------------------------
  # ● 선두의 행의 취득
  #--------------------------------------------------------------------------
  def top_row
    return self.oy / STATUS_HEIGHT
  end
  #--------------------------------------------------------------------------
  # ● 선두의 행의 설정
  #     row : 선두에 표시하는 행
  #--------------------------------------------------------------------------
  def top_row=(row)
    super(row)
    self.oy = self.oy / WLH * STATUS_HEIGHT
  end
  #--------------------------------------------------------------------------
  # ● 1 페이지에 표시할 수 있는 행수의 취득
  #--------------------------------------------------------------------------
  def page_row_max
    return (self.height - 32) / STATUS_HEIGHT
  end
  #--------------------------------------------------------------------------
  # ● 항목을 묘화 하는 구형의 취득
  #     index : 항목 번호
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = super(index)
    rect.height = STATUS_HEIGHT
    rect.y = index / @column_max * STATUS_HEIGHT
    return rect
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    @item_max = $game_party.members.size
    create_contents
    fill_stand_by_background
    draw_member
  end
  #--------------------------------------------------------------------------
  # ○ 파티 멤버 묘화
  #--------------------------------------------------------------------------
  def draw_member
    for actor in $game_party.members
#      draw_actor_face(actor, 2, actor.party_index * 96 + 2, 92)
#      x = 104
      x = 2
      y = actor.party_index * 48 + WLH / 2 
      draw_actor_graphic(actor, x + 15, y + 25)
      draw_actor_name(actor, x + 35, y)
      draw_actor_class(actor, x + 145, y)
      draw_actor_level(actor, x + 255, y)
#      draw_actor_class(actor, x + 120, y)
#      draw_actor_level(actor, x + 25, y + WLH * 1)
#      draw_actor_state(actor, x + 25, y + WLH * 2)
#      draw_actor_hp(actor, x + 120, y + WLH * 1)
#      draw_actor_mp(actor, x + 120, y + WLH * 2)
    end
  end
  #--------------------------------------------------------------------------
  # ○ 대기 멤버의 배경색을 바른다
  #--------------------------------------------------------------------------
  def fill_stand_by_background
    color = KGC::LargeParty::STAND_BY_COLOR
    dy = STATUS_HEIGHT * $game_party.battle_members.size
    dh = STATUS_HEIGHT * $game_party.stand_by_members.size
    if dh > 0
      self.contents.fill_rect(0, dy, self.width - 32, dh, color)
    end
  end
  #--------------------------------------------------------------------------
  # ● 커서의 갱신
  #--------------------------------------------------------------------------
  def update_cursor
    if @index < 0               # 커서 없음
      self.cursor_rect.empty
    elsif @index < @item_max    # 통상
      super
    elsif @index >= 100         # 자신
      self.cursor_rect.set(0, (@index - 100) * STATUS_HEIGHT,
        contents.width, STATUS_HEIGHT)
    else                        # 전체
      self.cursor_rect.set(0, 0, contents.width, @item_max * STATUS_HEIGHT)
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_ShopStatus
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 윈도우 내용의 작성
  #--------------------------------------------------------------------------
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - 32,
      WLH * ($game_party.members.size + 1) * 2)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 윈도우 내용의 작성
  #--------------------------------------------------------------------------
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - 32,
      [WLH * $game_party.members.size, height - 32].max)
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  alias refresh_KGC_LargeParty refresh
  def refresh
    create_contents

    refresh_KGC_LargeParty
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_PartyFormCaption
#------------------------------------------------------------------------------
#  파티 편성 화면에서 윈도우의 캡션을 표시하는 윈도우입니다.
#==============================================================================

class Window_PartyFormCaption < Window_Base
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #     caption : 표시하는 캡션
  #--------------------------------------------------------------------------
  def initialize(caption = "")
    super(0, 0, KGC::LargeParty::CAPTION_WINDOW_WIDTH, WLH + 32)
    @caption = caption
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.draw_text(0, 0, width - 32, WLH, @caption)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_PartyFormMember
#------------------------------------------------------------------------------
#  파티 편성 화면에서 멤버를 표시하는 윈도우입니다.
#==============================================================================

class Window_PartyFormMember < Window_Selectable
  #--------------------------------------------------------------------------
  # ○ 정수
  #--------------------------------------------------------------------------
  DRAW_SIZE = KGC::LargeParty::PARTY_FORM_CHARACTER_SIZE
  #--------------------------------------------------------------------------
  # ● 공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_accessor :selected_index           # 선택이 끝난 인덱스
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #     x       : 윈도우의 X 좌표
  #     y       : 윈도우의 Y 좌표
  #     width   : 윈도우의 폭
  #     height  : 윈도우의 높이
  #     spacing : 옆에 항목이 줄설 때의 공백의 폭
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, spacing = 8)
    super(x, y, width, height, spacing)
  end
  #--------------------------------------------------------------------------
  # ● 윈도우 내용의 작성
  #--------------------------------------------------------------------------
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - 32,
      [height - 32, row_max * DRAW_SIZE[1]].max)
  end
  #--------------------------------------------------------------------------
  # ● 선두의 행의 취득
  #--------------------------------------------------------------------------
  def top_row
    return self.oy / DRAW_SIZE[1]
  end
  #--------------------------------------------------------------------------
  # ● 선두의 행의 설정
  #     row : 선두에 표시하는 행
  #--------------------------------------------------------------------------
  def top_row=(row)
    super(row)
    self.oy = self.oy / WLH * DRAW_SIZE[1]
  end
  #--------------------------------------------------------------------------
  # ● 1 페이지에 표시할 수 있는 행수의 취득
  #--------------------------------------------------------------------------
  def page_row_max
    return (self.height - 32) / DRAW_SIZE[1]
  end
  #--------------------------------------------------------------------------
  # ● 항목을 묘화 하는 구형의 취득
  #     index : 항목 번호
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = super(index)
    rect.width = DRAW_SIZE[0]
    rect.height = DRAW_SIZE[1]
    rect.y = index / @column_max * DRAW_SIZE[1]
    return rect
  end
  #--------------------------------------------------------------------------
  # ○ 선택 액터 취득
  #--------------------------------------------------------------------------
  def actor
    return @actors[self.index]
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    restore_member_list
    draw_member
  end
  #--------------------------------------------------------------------------
  # ○ 멤버 리스트 수복
  #--------------------------------------------------------------------------
  def restore_member_list
    # 계승처에서 정의
  end
  #--------------------------------------------------------------------------
  # ○ 멤버 묘화
  #--------------------------------------------------------------------------
  def draw_member
    # 계승처에서 정의
  end
  #--------------------------------------------------------------------------
  # ○ 공난 액터 묘화
  #     index : 항목 번호
  #--------------------------------------------------------------------------
  def draw_empty_actor(index)
    # 계승처에서 정의
  end
  #--------------------------------------------------------------------------
  # ○ 고정 캐릭터 배경 묘화
  #     index : 항목 번호
  #--------------------------------------------------------------------------
  def draw_fixed_back(index)
    rect = item_rect(index)
    self.contents.fill_rect(rect, KGC::LargeParty::FIXED_COLOR)
  end
  #--------------------------------------------------------------------------
  # ○ 선택중 캐릭터 배경 묘화
  #     index : 항목 번호
  #--------------------------------------------------------------------------
  def draw_selected_back(index)
    rect = item_rect(index)
    self.contents.fill_rect(rect, KGC::LargeParty::SELECTED_COLOR)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_PartyFormBattleMember
#------------------------------------------------------------------------------
#  파티 편성 화면에서 전투 멤버를 표시하는 윈도우입니다.
#==============================================================================

class Window_PartyFormBattleMember < Window_PartyFormMember
  #--------------------------------------------------------------------------
  # ● 공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_accessor :selected_index           # 선택이 끝난 인덱스
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 64, DRAW_SIZE[1] + 32)
    column_width = DRAW_SIZE[0] + @spacing
    nw = [column_width * $game_party.max_battle_member_count + 32,
      Graphics.width].min
    self.width = nw

    @item_max = $game_party.max_battle_member_count
    @column_max = width / column_width
    @selected_index = nil
    create_contents
    refresh
    self.active = true
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ○ 멤버 리스트 수복
  #--------------------------------------------------------------------------
  def restore_member_list
    @actors = $game_party.battle_members
  end
  #--------------------------------------------------------------------------
  # ○ 멤버 묘화
  #--------------------------------------------------------------------------
  def draw_member
    @item_max.times { |i|
      actor = @actors[i]
      if actor == nil
        draw_empty_actor(i)
      else
        if i == @selected_index
          draw_selected_back(i)
        elsif $game_party.actor_fixed?(actor.id)
          draw_fixed_back(i)
        end
        rect = item_rect(i)
        draw_actor_graphic(actor,
          rect.x + DRAW_SIZE[0] / 2,
          rect.y + DRAW_SIZE[1] - 4)
      end
    }
  end
  #--------------------------------------------------------------------------
  # ○ 공난 액터 묘화
  #     index : 항목 번호
  #--------------------------------------------------------------------------
  def draw_empty_actor(index)
    rect = item_rect(index)
    self.contents.font.color = system_color
    self.contents.draw_text(rect, KGC::LargeParty::BATTLE_MEMBER_BLANK_TEXT, 1)
    self.contents.font.color = normal_color
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_PartyFormAllMember
#------------------------------------------------------------------------------
#  파티 편성 화면에서 전멤버를 표시하는 윈도우입니다.
#==============================================================================

class Window_PartyFormAllMember < Window_PartyFormMember
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 64, 64)
    restore_member_list
    @item_max = $game_party.all_members.size

    # 각종 사이즈 계산
    column_width = DRAW_SIZE[0] + @spacing
    sw = [@item_max * column_width + 32, Graphics.width].min
    @column_max = (sw - 32) / column_width
    sh = ([@item_max - 1, 0].max / @column_max + 1) * DRAW_SIZE[1] + 32
    sh = [sh, DRAW_SIZE[1] * KGC::LargeParty::PARTY_MEMBER_WINDOW_ROW_MAX + 32].min

    # 좌표·사이즈 조정
    self.y += DRAW_SIZE[1] + 32
    self.width = sw
    self.height = sh

    create_contents
    refresh
    self.active = false
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ○ 선택하고 있는 액터의 인덱스 취득
  #--------------------------------------------------------------------------
  def actor_index
    return @index_offset + self.index
  end
  #--------------------------------------------------------------------------
  # ○ 멤버 리스트 수복
  #--------------------------------------------------------------------------
  def restore_member_list
    if KGC::LargeParty::SHOW_BATTLE_MEMBER_IN_PARTY
      @actors = $game_party.all_members
      @index_offset = 0
    else
      @actors = $game_party.stand_by_members
      @index_offset = $game_party.battle_members.size
    end
  end
  #--------------------------------------------------------------------------
  # ○ 멤버 묘화
  #--------------------------------------------------------------------------
  def draw_member
    @item_max.times { |i|
      actor = @actors[i]
      if actor == nil
        draw_empty_actor(i)
        next
      end

      if $game_party.actor_fixed?(actor.id)
        draw_fixed_back(i)
      end
      rect = item_rect(i)
      opacity = ($game_party.battle_members.include?(actor) ? 96 : 255)
      draw_actor_graphic(actor,
        rect.x + DRAW_SIZE[0] / 2,
        rect.y + DRAW_SIZE[1] - 4,
        opacity)
    }
  end
  #--------------------------------------------------------------------------
  # ● 액터의 보행 그래픽 묘화
  #     actor   : 액터
  #     x       : 묘화처 X 좌표
  #     y       : 묘화처 Y 좌표
  #     opacity : 불투명도
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y, opacity = 255)
    draw_character(actor.character_name, actor.character_index, x, y, opacity)
  end
  #--------------------------------------------------------------------------
  # ● 보행 그래픽의 묘화
  #     character_name  : 보행 그래픽 파일명
  #     character_index : 보행 그래픽 인덱스
  #     x               : 묘화처 X 좌표
  #     y               : 묘화처 Y 좌표
  #     opacity         : 불투명도
  #--------------------------------------------------------------------------
  def draw_character(character_name, character_index, x, y, opacity = 255)
    return if character_name == nil
    bitmap = Cache.character(character_name)
    sign = character_name[/^[!$]./]
    if sign != nil and sign.include?('$')
      cw = bitmap.width / 3
      ch = bitmap.height / 4
    else
      cw = bitmap.width / 12
      ch = bitmap.height / 8
    end
    n = character_index
    src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
  end
  #--------------------------------------------------------------------------
  # ○ 공난 액터 묘화
  #     index : 항목 번호
  #--------------------------------------------------------------------------
  def draw_empty_actor(index)
    rect = item_rect(index)
    self.contents.font.color = system_color
    self.contents.draw_text(rect, KGC::LargeParty::PARTY_MEMBER_BLANK_TEXT, 1)
    self.contents.font.color = normal_color
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_PartyFormStatus
#------------------------------------------------------------------------------
#  파티 편성 화면에서 액터의 스테이터스를 표시하는 윈도우입니다.
#==============================================================================

class Window_PartyFormStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 384, 128)
    self.z = 1000
    @actor = nil
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ 액터 설정
  #--------------------------------------------------------------------------
  def set_actor(actor)
    if @actor != actor
      @actor = actor
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if @actor == nil
      return
    end

    draw_actor_face(@actor, 0, 0)
    dx = 104
    draw_actor_name(@actor, dx, 0)
    draw_actor_level(@actor, dx, WLH * 1)
    draw_actor_hp(@actor, dx, WLH * 2)
    draw_actor_mp(@actor, dx, WLH * 3)
    4.times { |i|
      draw_actor_parameter(@actor, dx + 128, WLH * i, i, 120)
    }
  end
  #--------------------------------------------------------------------------
  # ● 능력치의 묘화
  #     actor : 액터
  #     x     : 묘화처 X 좌표
  #     y     : 묘화처 Y 좌표
  #     type  : 능력치의 종류 (03)
  #     width : 묘화폭
  #--------------------------------------------------------------------------
  def draw_actor_parameter(actor, x, y, type, width = 156)
    case type
    when 0
      parameter_name = Vocab::atk
      parameter_value = actor.atk
    when 1
      parameter_name = Vocab::def
      parameter_value = actor.def
    when 2
      parameter_name = Vocab::spi
      parameter_value = actor.spi
    when 3
      parameter_name = Vocab::agi
      parameter_value = actor.agi
    end
    nw = width - 36
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, nw, WLH, parameter_name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + nw, y, 36, WLH, parameter_value, 2)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_PartyFormControl
#------------------------------------------------------------------------------
#  파티 편성 화면에서 조작 방법을 표시하는 윈도우입니다.
#==============================================================================

class Window_PartyFormControl < Window_Base
  #--------------------------------------------------------------------------
  # ○ 정수
  #--------------------------------------------------------------------------
  MODE_BATTLE_MEMBER = 0
  MODE_SHIFT_CHANGE  = 1
  MODE_PARTY_MEMBER  = 2
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, Graphics.width - 384, 128)
    self.z = 1000
    @mode = MODE_BATTLE_MEMBER
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ 모드 변경
  #--------------------------------------------------------------------------
  def mode=(value)
    @mode = value
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    case @mode
    when MODE_BATTLE_MEMBER  # 전투 멤버
      buttons = [
        "A: 제외한다",
        "B: 종료",
        "C: 결정",
        "X: 줄대체"
      ]
    when MODE_SHIFT_CHANGE   # 줄대체
      buttons = [
        "B: 캔슬",
        "C: 결정",
        "X: 결정"
      ]
    when MODE_PARTY_MEMBER   # 파티 멤버
      buttons = [
        "B: 캔슬",
        "C: 결정"
      ]
    else
      return
    end

    buttons.each_with_index { |c, i|
      self.contents.draw_text(0, WLH * i, width - 32, WLH, c)
    }
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Title
#==============================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # ● 각종 게임 오브젝트의 작성
  #--------------------------------------------------------------------------
  alias create_game_objects_KGC_LargeParty create_game_objects
  def create_game_objects
    create_game_objects_KGC_LargeParty

    if KGC::LargeParty::DEFAULT_PARTYFORM_ENABLED
      $game_switches[KGC::LargeParty::PARTYFORM_SWITCH] = true
      $game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH] = true
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● 화면 변환의 실행
  #--------------------------------------------------------------------------
  alias update_scene_change_KGC_LargeParty update_scene_change
  def update_scene_change
    return if $game_player.moving?    # 플레이어의 이동중?

    if $game_temp.next_scene == :partyform
      call_partyform
      return
    end

    update_scene_change_KGC_LargeParty
  end
  #--------------------------------------------------------------------------
  # ○ 파티 편성 화면에의 변환
  #--------------------------------------------------------------------------
  def call_partyform
    $game_temp.next_scene = nil
    $scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_MAP)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Menu
#==============================================================================

class Scene_Menu < Scene_Base
  if KGC::LargeParty::USE_MENU_PARTYFORM_COMMAND
  #--------------------------------------------------------------------------
  # ● 커멘드 윈도우의 작성
  #--------------------------------------------------------------------------
  alias create_command_window_KGC_LargeParty create_command_window
  def create_command_window
    create_command_window_KGC_LargeParty

    return if $imported["CustomMenuCommand"]

    @__command_partyform_index =
      @command_window.add_command(Vocab.partyform)
    @command_window.draw_item(@__command_partyform_index,
      $game_party.partyform_enable?)
    if @command_window.oy > 0
      @command_window.oy -= Window_Base::WLH
    end
    @command_window.index = @menu_index
  end
  end
  #--------------------------------------------------------------------------
  # ● 커멘드 선택의 갱신
  #--------------------------------------------------------------------------
  alias update_command_selection_KGC_LargeParty update_command_selection
  def update_command_selection
    current_menu_index = @__command_partyform_index
    call_partyform_flag = false

    if Input.trigger?(Input::C)
      case @command_window.index
      when @__command_partyform_index  # 파티 편성
        call_partyform_flag = true
      end
    # 파티 편성 버튼 압하
    elsif KGC::LargeParty::MENU_PARTYFORM_BUTTON != nil &&
        Input.trigger?(KGC::LargeParty::MENU_PARTYFORM_BUTTON)
      call_partyform_flag = true
      current_menu_index = @command_window.index if current_menu_index == nil
    end

    # 파티 편성 화면에 이행
    if call_partyform_flag
      if $game_party.members.size == 0 || !$game_party.partyform_enable?
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      $scene = Scene_PartyForm.new(current_menu_index)
      return
    end

    update_command_selection_KGC_LargeParty
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Shop
#==============================================================================

unless $imported["HelpExtension"]
class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  alias udpate_KGC_LargeParty update
  def update
    # 스크롤 판정
    if !@command_window.active &&
        KGC::LargeParty::SHOP_STATUS_SCROLL_BUTTON != nil &&
        Input.press?(KGC::LargeParty::SHOP_STATUS_SCROLL_BUTTON)
      super
      update_menu_background
      update_scroll_status
      return
    else
      @status_window.cursor_rect.empty
    end

    udpate_KGC_LargeParty
  end
  #--------------------------------------------------------------------------
  # ○ 스테이터스 윈도우의 스크롤 처리
  #--------------------------------------------------------------------------
  def update_scroll_status
    # 스테이터스 윈도우에 커서를 표시
    @status_window.cursor_rect.width = @status_window.contents.width
    @status_window.cursor_rect.height = @status_window.height - 32
    @status_window.update

    if Input.press?(Input::UP)
      @status_window.oy = [@status_window.oy - 4, 0].max
    elsif Input.press?(Input::DOWN)
      max_pos = [@status_window.contents.height -
        (@status_window.height - 32), 0].max
      @status_window.oy = [@status_window.oy + 4, max_pos].min
    end
  end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Scene_PartyForm
#------------------------------------------------------------------------------
#  파티 편성 화면의 처리를 실시하는 클래스입니다.
#==============================================================================

class Scene_PartyForm < Scene_Base
  #--------------------------------------------------------------------------
  # ○ 정수
  #--------------------------------------------------------------------------
  CAPTION_OFFSET = 40  # 캡션 윈도우의 위치 보정
  HOST_MENU   = 0      # 호출원 : 메뉴
  HOST_MAP    = 1      # 호출원 : 맵
  HOST_BATTLE = 2      # 호출원 : 전투
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #     menu_index : 커멘드의 커서 초기 위치
  #     host_scene : 호출원 (0..메뉴  1..맵  2..전투)
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0, host_scene = HOST_MENU)
    @menu_index = menu_index
    @host_scene = host_scene
  end
  #--------------------------------------------------------------------------
  # ● 개시 처리
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background

    create_windows
    create_confirm_window
    adjust_window_location

    # 편성전의 파티를 보존
    @battle_actors = $game_party.battle_members.dup
    @party_actors = $game_party.all_members.dup
  end
  #--------------------------------------------------------------------------
  # ○ 윈도우의 작성
  #--------------------------------------------------------------------------
  def create_windows
    # 편성용 윈도우를 작성
    @battle_member_window = Window_PartyFormBattleMember.new
    @party_member_window = Window_PartyFormAllMember.new
    @status_window = Window_PartyFormStatus.new
    @status_window.set_actor(@battle_member_window.actor)

    # 그 외의 윈도우를 작성
    @battle_member_caption_window =
      Window_PartyFormCaption.new(KGC::LargeParty::BATTLE_MEMBER_CAPTION)
    @party_member_caption_window =
      Window_PartyFormCaption.new(KGC::LargeParty::PARTY_MEMBER_CAPTION)
    @control_window = Window_PartyFormControl.new
  end
  #--------------------------------------------------------------------------
  # ○ 확인 윈도우의 작성
  #--------------------------------------------------------------------------
  def create_confirm_window
    commands = KGC::LargeParty::CONFIRM_WINDOW_COMMANDS
    @confirm_window =
      Window_Command.new(KGC::LargeParty::CONFIRM_WINDOW_WIDTH, commands)
    @confirm_window.index = 0
    @confirm_window.openness = 0
    @confirm_window.active = false
  end
  #--------------------------------------------------------------------------
  # ○ 윈도우의 좌표 조정
  #--------------------------------------------------------------------------
  def adjust_window_location
    # 기준 좌표를 계산
    base_x = [@battle_member_window.width, @party_member_window.width].max
    base_x = [(Graphics.width - base_x) / 2, 0].max
    base_y = @battle_member_window.height + @party_member_window.height +
      @status_window.height + CAPTION_OFFSET * 2
    base_y = [(Graphics.height - base_y) / 2, 0].max
    base_z = @menuback_sprite.z + 1000

    # 편성용 윈도우의 좌표를 세트
    @battle_member_window.x = base_x
    @battle_member_window.y = base_y + CAPTION_OFFSET
    @battle_member_window.z = base_z
    @party_member_window.x = base_x
    @party_member_window.y = @battle_member_window.y +
      @battle_member_window.height + CAPTION_OFFSET
    @party_member_window.z = base_z
    @status_window.x = 0
    @status_window.y = @party_member_window.y + @party_member_window.height
    @status_window.z = base_z

    # 그 외의 윈도우의 좌표를 세트
    @battle_member_caption_window.x = [base_x - 16, 0].max
    @battle_member_caption_window.y = @battle_member_window.y - CAPTION_OFFSET
    @battle_member_caption_window.z = base_z + 500
    @party_member_caption_window.x = [base_x - 16, 0].max
    @party_member_caption_window.y = @party_member_window.y - CAPTION_OFFSET
    @party_member_caption_window.z = base_z + 500
    @control_window.x = @status_window.width
    @control_window.y = @status_window.y
    @control_window.z = base_z

    @confirm_window.x = (Graphics.width - @confirm_window.width) / 2
    @confirm_window.y = (Graphics.height - @confirm_window.height) / 2
    @confirm_window.z = base_z + 1000
  end
  #--------------------------------------------------------------------------
  # ● 종료 처리
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @battle_member_window.dispose
    @party_member_window.dispose
    @status_window.dispose
    @battle_member_caption_window.dispose
    @party_member_caption_window.dispose
    @control_window.dispose
    @confirm_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 메뉴 화면계의 배경 작성
  #--------------------------------------------------------------------------
  def create_menu_background
    super
    @menuback_sprite.z = 20000
  end
  #--------------------------------------------------------------------------
  # ● 원래의 화면에 돌아온다
  #--------------------------------------------------------------------------
  def return_scene
    case @host_scene
    when HOST_MENU
      $scene = Scene_Menu.new(@menu_index)
    when HOST_MAP
      $scene = Scene_Map.new
    when HOST_BATTLE
      $scene = Scene_Battle.new
    end
    $game_player.refresh
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    update_window
    if @battle_member_window.active
      update_battle_member
    elsif @party_member_window.active
      update_party_member
    elsif @confirm_window.active
      update_confirm
    end
  end
  #--------------------------------------------------------------------------
  # ○ 윈도우 갱신
  #--------------------------------------------------------------------------
  def update_window
    @battle_member_window.update
    @party_member_window.update
    @status_window.update
    @battle_member_caption_window.update
    @party_member_caption_window.update
    @control_window.update
    @confirm_window.update
  end
  #--------------------------------------------------------------------------
  # ○ 윈도우재묘화
  #--------------------------------------------------------------------------
  def refresh_window
    @battle_member_window.refresh
    @party_member_window.refresh
  end
  #--------------------------------------------------------------------------
  # ○ 프레임 갱신 (전투 멤버 윈도우가 액티브의 경우)
  #--------------------------------------------------------------------------
  def update_battle_member
    @status_window.set_actor(@battle_member_window.actor)
    if Input.trigger?(Input::A)
      if @battle_member_window.selected_index == nil  # 줄서 바꾸어 안이 아니다
        actor = @battle_member_window.actor
        # 액터를 제외할 수 없는 경우
        if actor == nil || $game_party.actor_fixed?(actor.id)
          Sound.play_buzzer
          return
        end
        # 액터를 제외한다
        Sound.play_decision
        actors = $game_party.battle_members
        actors.delete_at(@battle_member_window.index)
        $game_party.set_battle_member(actors)
        refresh_window
      end
    elsif Input.trigger?(Input::B)
      if @battle_member_window.selected_index == nil  # 줄서 바꾸어 안이 아니다
        # 확인 윈도우로 전환해
        Sound.play_cancel
        show_confirm_window
      else                                            # 줄서 바꾸어 안
        # 줄서 바꾸어 해제
        Sound.play_cancel
        @battle_member_window.selected_index = nil
        @battle_member_window.refresh
        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
      end
    elsif Input.trigger?(Input::C)
      if @battle_member_window.selected_index == nil  # 줄서 바꾸어 안이 아니다
        actor = @battle_member_window.actor
        # 액터를 제외할 수 없는 경우
        if actor != nil && $game_party.actor_fixed?(actor.id)
          Sound.play_buzzer
          return
        end
        # 파티 멤버 윈도우로 전환해
        Sound.play_decision
        @battle_member_window.active = false
        @party_member_window.active = true
        @control_window.mode = Window_PartyFormControl::MODE_PARTY_MEMBER
      else                                            # 줄서 바꾸어 안
        unless can_change_shift?(@battle_member_window.actor)
          Sound.play_buzzer
          return
        end
        # 줄서 바꾸어 실행
        Sound.play_decision
        index1 = @battle_member_window.selected_index
        index2 = @battle_member_window.index
        change_shift(index1, index2)
        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
      end
    elsif Input.trigger?(Input::X)
      # 줄서 바꾸어 불가능한 경우
      unless can_change_shift?(@battle_member_window.actor)
        Sound.play_buzzer
        return
      end
      if @battle_member_window.selected_index == nil  # 줄서 바꾸어 안이 아니다
        # 줄서 바꾸어 개시
        Sound.play_decision
        @battle_member_window.selected_index = @battle_member_window.index
        @battle_member_window.refresh
        @control_window.mode = Window_PartyFormControl::MODE_SHIFT_CHANGE
      else                                            # 줄서 바꾸어 안
        # 줄서 바꾸어 실행
        Sound.play_decision
        index1 = @battle_member_window.selected_index
        index2 = @battle_member_window.index
        change_shift(index1, index2)
        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
      end
    end
  end
  #--------------------------------------------------------------------------
  # ○ 줄서 바꾸어 가부 판정
  #--------------------------------------------------------------------------
  def can_change_shift?(actor)
    # 선택한 액터가 존재하지 않는, 또는 줄서 바꾸어 불능인 경우
    if actor == nil ||
        (KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED &&
         $game_party.actor_fixed?(actor.id))
      return false
    end
    return true
  end
  #--------------------------------------------------------------------------
  # ○ 줄대체
  #--------------------------------------------------------------------------
  def change_shift(index1, index2)
    # 위치를 교체
    $game_party.change_shift(index1, index2)
    # 선택이 끝난 인덱스를 클리어
    @battle_member_window.selected_index = nil
    refresh_window
  end
  #--------------------------------------------------------------------------
  # ○ 프레임 갱신 (파티 윈도우가 액티브의 경우)
  #--------------------------------------------------------------------------
  def update_party_member
    @status_window.set_actor(@party_member_window.actor)
    if Input.trigger?(Input::B)
      Sound.play_cancel
      # 전투 멤버 윈도우로 전환해
      @battle_member_window.active = true
      @party_member_window.active = false
        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
    elsif Input.trigger?(Input::C)
      actor = @party_member_window.actor
      # 액터가 전투 멤버에게 포함되는 경우
      if $game_party.battle_members.include?(actor)
        Sound.play_buzzer
        return
      end
      # 액터를 교체
      Sound.play_decision
      actors = $game_party.all_members
      battle_actors = $game_party.battle_members
      if @battle_member_window.actor != nil
        actors[@party_member_window.actor_index] = @battle_member_window.actor
        actors[@battle_member_window.index] = actor
        $game_party.set_member(actors.compact)
      end
      battle_actors[@battle_member_window.index] = actor
      $game_party.set_battle_member(battle_actors.compact)
      refresh_window
      # 전투 멤버 윈도우로 전환해
      @battle_member_window.active = true
      @party_member_window.active = false
      @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
    end
  end
  #--------------------------------------------------------------------------
  # ○ 프레임 갱신 (확인 윈도우가 액티브의 경우)
  #--------------------------------------------------------------------------
  def update_confirm
    if Input.trigger?(Input::B)
      Sound.play_cancel
      hide_confirm_window
    elsif Input.trigger?(Input::C)
      case @confirm_window.index
      when 0  # 편성 완료
        # 파티가 무효의 경우
        unless battle_member_valid?
          Sound.play_buzzer
          return
        end
        Sound.play_decision
        return_scene
      when 1  # 편성 중단
        Sound.play_decision
        # 파티를 편성전 상태에 되돌린다
        $game_party.set_member(@party_actors)
        $game_party.set_battle_member(@battle_actors)
        return_scene
      when 2  # 캔슬
        Sound.play_cancel
        hide_confirm_window
      end
    end
  end
  #--------------------------------------------------------------------------
  # ○ 전투 멤버 유효 판정
  #--------------------------------------------------------------------------
  def battle_member_valid?
    return false if $game_party.battle_members.size == 0  # 전투 멤버가 하늘
    $game_party.battle_members.each { |actor|
      return true if actor.exist?  # 생존자가 있으면OK
    }
    return false
  end
  #--------------------------------------------------------------------------
  # ○ 확인 윈도우의 표시
  #--------------------------------------------------------------------------
  def show_confirm_window
    if @battle_member_window.active
      @last_active_window = @battle_member_window
    else
      @last_active_window = @party_member_window
    end
    @battle_member_window.active = false
    @party_member_window.active = false

    @confirm_window.draw_item(0, battle_member_valid?)
    @confirm_window.open
    @confirm_window.active = true
  end
  #--------------------------------------------------------------------------
  # ○ 확인 윈도우의 비표시
  #--------------------------------------------------------------------------
  def hide_confirm_window
    @confirm_window.active = false
    @confirm_window.close
    @last_active_window.active = true
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● 메세지 표시가 끝날 때까지 웨이트
  #--------------------------------------------------------------------------
  alias wait_for_message_KGC_LargeParty wait_for_message
  def wait_for_message
    return if @ignore_wait_for_message  # 메세지 종료까지의 웨이트를 무시

    wait_for_message_KGC_LargeParty
  end
  #--------------------------------------------------------------------------
  # ● 레벨업의 표시
  #--------------------------------------------------------------------------
  alias display_level_up_KGC_LargeParty display_level_up
  def display_level_up
    @ignore_wait_for_message = true

    display_level_up_KGC_LargeParty

    exp = $game_troop.exp_total * KGC::LargeParty::STAND_BY_EXP_RATE / 1000
    $game_party.stand_by_members.each { |actor|
      if actor.exist?
        actor.gain_exp(exp, KGC::LargeParty::SHOW_STAND_BY_LEVEL_UP)
      end
    }
    @ignore_wait_for_message = false
    wait_for_message
  end
  #--------------------------------------------------------------------------
  # ● 파티 커멘드 선택의 개시
  #--------------------------------------------------------------------------
  alias start_party_command_selection_KGC_LargeParty start_party_command_selection
  def start_party_command_selection
    if $game_temp.in_battle
      @status_window.index = 0
    end

    start_party_command_selection_KGC_LargeParty
  end

  if KGC::LargeParty::USE_BATTLE_PARTYFORM
  #--------------------------------------------------------------------------
  # ● 정보 표시 뷰포트의 작성
  #--------------------------------------------------------------------------
  alias create_info_viewport_KGC_LargeParty create_info_viewport
  def create_info_viewport
    create_info_viewport_KGC_LargeParty

    @__command_partyform_index =
      @party_command_window.add_command(Vocab.partyform_battle)
    @party_command_window.draw_item(@__command_partyform_index,
      $game_party.battle_partyform_enable?)
  end
  #--------------------------------------------------------------------------
  # ● 파티 커멘드 선택의 갱신
  #--------------------------------------------------------------------------
  alias update_party_command_selection_KGC_LargeParty update_party_command_selection
  def update_party_command_selection
    if Input.trigger?(Input::C)
      case @party_command_window.index
      when @__command_partyform_index  # 파티 편성
        unless $game_party.battle_partyform_enable?
          Sound.play_buzzer
          return
        end
        Sound.play_decision
        process_partyform
        return
      end
    end

    update_party_command_selection_KGC_LargeParty
  end
  #--------------------------------------------------------------------------
  # ○ 파티 편성의 처리
  #--------------------------------------------------------------------------
  def process_partyform
    Graphics.freeze
    snapshot_for_background
    $scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_BATTLE)
    $scene.main
    $scene = self
    @status_window.refresh
    perform_transition
  end
  end
end


이건 KGC large party


List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12398
RMVX 아오오니 AI... 5 하드웰 2013.11.27 1323
RMVXA 폰트가 깨져서 나오네요... %#$@$언어랑 네모언어로... 2 file 요툰헤임 2013.11.27 1857
RMVXA 플레이어 뒤에 이벤트가 따라붙게 하고싶어요. 4 Virtus 2013.11.27 1183
RMVXA 이벤트가 사라지게 하고싶습니다ㅜㅜ 2 file Virtus 2013.11.26 871
RMVX 캐릭터 주위에 불빛 나는 거 어떻게 하나요? 8 file cityhall 2013.11.26 1289
RMVX 이 두 개의 스크립트를 합쳤으면 합니다 1 file IU[아이유] 2013.11.26 676
RMVXA RPG VX ACE 를 이용해서 총 게임을 만들고 싶습니다.. 1 Erudito 2013.11.26 1087
RMVX 적 캐릭터가 스킬을 하나밖에 사용 못하네요 1 IU[아이유] 2013.11.26 772
기타 스크립트 오류 해결좀해주실분 1 sakuragi 2013.11.26 927
RMVX 불빛이 대화를 하면 꺼져버려요.. (light) 10 onicole 2013.11.25 1078
RMVXA 이벤트로 캐릭터를 만들었는데 계속해서 걷는 모션을 넣고싶어요. 2 Virtus 2013.11.25 999
RMVX 캐릭터 키 질문 2 file 뉴리키 2013.11.25 1012
사이트 이용 rpg vx 캐릭터칩 만들기 어케 해요? 2 최고가될거야 2013.11.25 1711
RMVX SE가 자동 반복되요.. 2 onicole 2013.11.25 874
기타 이런 스크립트 없나요? 4 강G군 2013.11.25 865
RMXP 메세지창 가운데정렬은 어떻게하나요? 2 박남우 2013.11.25 1024
RMVXA 툴 작업창을 늘릴수는 없나요? 2 file boogi505 2013.11.25 921
RMVXA 스크립트 질문합니다 1 Rebiart 2013.11.24 671
RMVXA 이 스크립트에서 폰트 크기를 제어하려면 어떻게 해야하나요? 4 file 수이스 2013.11.24 916
RMVXA 스크립트 사용하는 법 기초적이고 간단한 질문드려요... 4 수이스 2013.11.24 743
Board Pagination Prev 1 ... 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 ... 516 Next
/ 516