Guest User

rpg maker vx large party KGC

a guest
Jan 14th, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 97.91 KB | None | 0 0
  1. _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
  2. #_/    â—†     Party Expansion & Formation - KGC_LargeParty      â—† VX â—†
  3. #_/    â—‡                 Last Update: 2008/04/27                    â—‡
  4. #_/    â—†               Translation by Mr. Anonymous                 â—†
  5. #_/-----------------------------------------------------------------------------
  6. #_/  This script allows you more control over the default "party" system by
  7. #_/   removing the limitation of only having four actors to a party. These
  8. #_/   extra actors may behave just as any other actor during battle. In addition
  9. #_/   you may also have "standby" actors, who can be swapped out with the
  10. #_/   current party via a "Party Formation" screen, which may optionally be
  11. #_/   added into the main menu panel, and/or even called from pressing
  12. #_/   a specified button while on the main menu.
  13. #_/-----------------------------------------------------------------------------
  14. #_/                       â—† 2008/04/27 UPDATE [KGC] â—†          
  15. #_/             Updated for KGC_CursorAnimation compatibility.
  16. #_/=============================================================================
  17. #_/                    â—† Instructions For Usage â—†
  18. #_/                       â—† Script Commands â—†
  19. #_/  These commands are used in "Script" function in the third page of event
  20. #_/   commands under "Advanced".
  21. #_/
  22. #_/  * call_partyform
  23. #_/     Calls the Party Formation screen.
  24. #_/
  25. #_/  * set_max_battle_member_count(Value)
  26. #_/     Allows you to manually set the maximum amount of actors in the active
  27. #_/      party, i.e. the amount of party members who may participate in battle.
  28. #_/
  29. #_/  * party_full?
  30. #_/     Used for Conditional Branches. This allows you to determine wether the
  31. #_/      active party is full in accordance to MAX_BATTLE_MEMBERS or the above
  32. #_/      manual statement of set_max_battle_member_count(Value).
  33. #_/
  34. #_/  * permit_partyform(true/false)
  35. #_/     Allows you to enable or disable the Party Formation screen on the main
  36. #_/      command menu. This also actives or deactivates PARTYFORM_SWITCH.
  37. #_/
  38. #_/  * fix_actor(ActorID, true/false)
  39. #_/     Allows you to fix or force an actor into remaining in the active party
  40. #_/      and not be switched out with a standby actor. If the true/false
  41. #_/      argument is omitted, the statement is automatically considered true.
  42. #_/  
  43. #_/  * change_party_shift(index1, index2)
  44. #_/     This allows you to switch an actor in the position of index1 with the
  45. #_/      actor in the position of index2. This ignores the fix_actor function.
  46. #_/       Also of note is that the first actor in the party actually has an
  47. #_/       index of 0, second actor has an index of 1, and so on.
  48. #_/
  49. #_/  * sort_party_member(sort_type, true/false)
  50. #_/     This allows you to manually sort the actors by replacing sort_type with
  51. #_/      SORT_BY_ID, SORT_BY_NAME, or SORT_BY_LEVEL. If you set the second
  52. #_/      argument to true, the sorting order is reversed. If true, it is not.
  53. #_/      Also, if the second argument is omitted, it is automatically false.
  54. #_/
  55. #_/  * get_stand_by_member_ids
  56. #_/     This aquires the arrangement of the ActorIDs of the standby actors.
  57. #_/
  58. #_/  * stand_by_member?(ActorID)
  59. #_/     Used for Conditional Branches. This allows you to determine if the actor
  60. #_/      specified is a standby party member.
  61. #_/
  62. #_/  * add_battle_member(ActorID, index)
  63. #_/     Allows you to add an actor to the active party and place it in the
  64. #_/      desired position(index). If the second argument is omitted, the actor
  65. #_/      will automatically be placed at the end of the party. Also, if the
  66. #_/      active party is full, the actor will not be added.
  67. #_/
  68. #_/  * remove_battle_member(ActorID)
  69. #_/     Removes an actor from the active party. This cannot removed an actor
  70. #_/      who is fixed into place using fix_actor.
  71. #_/
  72. #_/  * remove_all_battle_member
  73. #_/     All actors other than fixed actors are removed from the active party.
  74. #_/      Note that this seems to unfix fixed characters, but not remove them.
  75. #_/      Also note that if there are no fixed actors, you must add a member
  76. #_/      back into the active party using add_battle_member BEFORE the player
  77. #_/      is allowed to open the menu or enter battle.
  78. #_/
  79. #_/  * random_launch
  80. #_/     Randomly sorts and replaces the active party with those from the standby
  81. #_/      party. Once again this does not effect fixed actors.
  82. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
  83. #_/ A special note from the translator: I'll be revising this translation for
  84. #_/  a more user-friendly approach and expanded functionality explainations
  85. #_/  when I have the time. If you don't understand something here now, fear not,
  86. #_/  as this is only a beta translation. As such, some things may be incorrect.
  87. #_/  however, it should work without a hitch, with the possible exception of
  88. #_/  SHOW_STAND_BY_MEMBER_NOT_IN_BATTLE, which I still cannot figure out.
  89. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
  90.  
  91. #==============================================================================#
  92. #                            â˜… Customization ★                                 #
  93. #==============================================================================#
  94.  
  95. module KGC
  96. module LargeParty
  97.  #                  â—† Party Formation In-Game Switch â—†
  98.  #  This allows you to assign an in-game Switch that allows you to enable or
  99.  #   disable the Party Formation screen on the main command menu.
  100.  PARTYFORM_SWITCH          = 99
  101.  #              â—† Party Formation In-Game Switch (In Combat) â—†
  102.  #  This allows you to assign an in-game Switch that allows you to enable or
  103.  #   disable the Party Formation screen during combat.
  104.  BATTLE_PARTYFORM_SWITCH   = 100
  105.  #            â—† Default Party Formation Switch Activation Toggle â—†
  106.  #  When "New Game" is selected, both party formation permission switches
  107.  #   automatically become active (ON) when this is set as true.
  108.  DEFAULT_PARTYFORM_ENABLED = true
  109.  
  110.  #                  â—† Maximum Party Members (In Combat) â—†
  111.  #  Allows you to choose how many actors may participate in a battle.
  112.  MAX_BATTLE_MEMBERS = 4
  113.  #                         â—† The Party Members â—†
  114.  #  Allows you to choose how many actors may be added to the party.
  115.  #   *Note: Game_Party::MAX_MEMBERS Is overwritten
  116.  #  When making this 100 or more, you'll receive an error.
  117.  MAX_MEMBERS = 14
  118.  
  119.  #                     â—† Fixed Party Member Sorting â—†
  120.  #  This toggle allows you to enable/disable automatic sorting of fixed(active)
  121.  #   party members.
  122.  #  true = Disable automatic sorting.
  123.  #  false = Enable automatic sorting.
  124.  FORBID_CHANGE_SHIFT_FIXED = false
  125.  
  126.  #  Standby Members Background Color
  127.  #   Default: Color.new(0, 0, 0, 0)
  128.  STAND_BY_COLOR = Color.new(0, 0, 0, 128)
  129.  # â—† Fixed Current Party Background Color
  130.  FIXED_COLOR    = Color.new(255, 128, 64, 96)
  131.  #  Background Color that shows when Members are selected.
  132.  SELECTED_COLOR = Color.new(64, 255, 128, 128)
  133.  
  134.  #                â—† Party Formation Command Menu Selection â—†
  135.  #  This allows you to change the key/button pressed in the menu screen to
  136.  #   pull up the Party Formation screen without actually highlighting and
  137.  #   selecting the Party Formation option.
  138.  #  If this is set as nil, this function is disabled.
  139.  MENU_PARTYFORM_BUTTON      = nil
  140.  #  This toggle allows you to enable/disable the Party Formation option on the
  141.  #   main command window.
  142.  # true = The option is enabled.
  143.  # false = The option is removed.
  144.  USE_MENU_PARTYFORM_COMMAND = true
  145.  #  This allows you to change the text displayed for the Party Formation option
  146.  #   in the main command window.
  147.  VOCAB_MENU_PARTYFORM       = "Grupo"
  148.  
  149.  #  This toggle allows you to enable/disable the Party Formation option while
  150.  #   in combat.
  151.  #   This option is added under the "Run" or "Escape" command.
  152.  USE_BATTLE_PARTYFORM   = false
  153.  #  This allows you to change the text displayed for the Party Formation option
  154.  #   while in combat under the "Run" or "Escape" command.
  155.  VOCAB_BATTLE_PARTYFORM = "Party"
  156.  
  157.  #           â—† Party Formation Screen Character Dimensions â—†
  158.  #  This allows you to change the width and height of the actors' placemarkers
  159.  #   on the Party Formation Screen.
  160.  #  You can rewrite this [x, y] in accordance to the size of your actor's
  161.  #   walking graphic.
  162.  PARTY_FORM_CHARACTER_SIZE   = [40, 58]
  163.  #  This allows you to change the text of the empty slots in the Party
  164.  #   Formation Screen.
  165.  BATTLE_MEMBER_BLANK_TEXT    = "Vacío"
  166.  # â—† Party Formation Screen Member Rows â—†
  167.  #  This allows you to change the amount of rows that in the "Standby"
  168.  #   box.
  169.  #  Adjust this value to 1 if the status window protrudes beyond the screen.
  170.  PARTY_MEMBER_WINDOW_ROW_MAX = 1
  171.  #                     â—† Current Party Member Display â—†
  172.  #  This toggle allows you to show/hide the current party members in the
  173.  #   "Standby" box.
  174.  #  true = Show them! These will be greyed out.
  175.  #  false = Hide them.
  176.  SHOW_BATTLE_MEMBER_IN_PARTY = false
  177.  #  This allows you to change the text displayed for empty slots on in the
  178.  #   "Current Party" box.
  179.  PARTY_MEMBER_BLANK_TEXT     = "vacío"
  180.  
  181.  # â—† Width of caption window on organization screen
  182.  CAPTION_WINDOW_WIDTH  = 192
  183.  # â—† Caption of combat member window on organization screen
  184.  BATTLE_MEMBER_CAPTION = "Grupo Actual"
  185.  
  186.  if SHOW_BATTLE_MEMBER_IN_PARTY
  187.    #  This allows you to change the text that appears on top of the Party
  188.    #   Formation box.
  189.    #  (When SHOW_BATTLE_MEMBER_IN_PARTY = true)
  190.    PARTY_MEMBER_CAPTION = "Formación"
  191.  else
  192.    #  This allows you to change the text that appears on top of the Standby
  193.    #    box.
  194.    #  (When SHOW_BATTLE_MEMBER_IN_PARTY = false)
  195.    PARTY_MEMBER_CAPTION = "Reserva"
  196.  end
  197.  
  198.  #                â—† Width of Formation Confirmation Window â—†
  199.  CONFIRM_WINDOW_WIDTH    = 160
  200.  #             â—† Vocab Strings for Formation Confirmation Window â—†
  201.  #  If the order of these commands are changed or something is removed, expect
  202.  #   an error.
  203.  CONFIRM_WINDOW_COMMANDS = ["Usar Grupo Actual", "Usar Grupo Antiguo", "Cancelar"]
  204.  
  205.  #                   â—† Equip Item Status Shop Scroll â—†
  206.  #  This allows you to change the key/button HELD DOWN while using the Up and
  207.  #   Down keys to scroll the attribute bonuses window (to the right) to view
  208.  #   the each individual unit's attribute bonuses. KCG_HelpExtension is
  209.  #   required for this function to work properly.
  210.  #  If you set this to nil, this function is disabled.
  211.  SHOP_STATUS_SCROLL_BUTTON = nil
  212.  
  213.  #               â—† Standby Members Experience Gain Percentage â—†
  214.  #  If you enter 500 in this, the actual EXP gained is 50.0%
  215.  #   You may also prevent standby units from gaining EXP by setting this is 0.
  216.  STAND_BY_EXP_RATE = 800
  217.  #                    â—† Standby Members Level-Up Message â—†
  218.  #  This toggle allows you to enable/disable the level-up messages displayed
  219.  #   for units on standby.
  220.  #  true = Show level-up messages for standby units.
  221.  #  false = Hide level-up messages for standby units.
  222.  SHOW_STAND_BY_LEVEL_UP = false
  223.  #                     â—† Standby Members Combat Display â—†
  224.  #  *Note: I cannot figure out what this actually does. It doesn't -seem- to
  225.  #    work as advertised, but I could be wrong. If anyone figures out what this
  226.  #    actually does, please let me know.
  227.  #  true  : All members are displayed during combat.
  228.  #  false : Exchanged standby members are not shown.
  229.  SHOW_STAND_BY_MEMBER_NOT_IN_BATTLE = false
  230.  end
  231. end
  232.  
  233. $imported = {} if $imported == nil
  234. $imported["LargeParty"] = true
  235.  
  236. #==============================================================================
  237. # â–¡ KGC::Commands
  238. #==============================================================================
  239.  
  240. module KGC::Commands
  241.  # メンバーのソート形式
  242.  SORT_BY_ID    = 0  # IDé †
  243.  SORT_BY_NAME  = 1  # åå‰é †
  244.  SORT_BY_LEVEL = 2  # ãƒ¬ãƒ™ãƒ«é †
  245.  
  246.  module_function
  247.  #--------------------------------------------------------------------------
  248.  # â—‹ パーティ編成画面の呼び出し
  249.  #--------------------------------------------------------------------------
  250.  def call_partyform
  251.    return if $game_temp.in_battle
  252.    $game_temp.next_scene = :partyform
  253.  end
  254.  #--------------------------------------------------------------------------
  255.  # â—‹ 戦闘メンバー最大数を設定
  256.  #     value : 人数 (çœç•¥ã—ãŸå ´åˆã¯ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆå€¤ã‚’ä½¿ç”¨)
  257.  #--------------------------------------------------------------------------
  258.  def set_max_battle_member_count(value = nil)
  259.    $game_party.max_battle_member_count = value
  260.  end
  261.  #--------------------------------------------------------------------------
  262.  # â—‹ パーティ人数が一杯か
  263.  #--------------------------------------------------------------------------
  264.  def party_full?
  265.    return $game_party.full?
  266.  end
  267.  #--------------------------------------------------------------------------
  268.  # â—‹ パーティ編成可否を設定
  269.  #     enabled : 有効フラグ (省略時 : true)
  270.  #--------------------------------------------------------------------------
  271.  def permit_partyform(enabled = true)
  272.    $game_switches[KGC::LargeParty::PARTYFORM_SWITCH] = enabled
  273.  end
  274.  #--------------------------------------------------------------------------
  275.  # â—‹ 戦闘中のパーティ編成可否を設定
  276.  #     enabled : 有効フラグ (省略時 : true)
  277.  #--------------------------------------------------------------------------
  278.  def permit_battle_partyform(enabled = true)
  279.    $game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH] = enabled
  280.  end
  281.  #--------------------------------------------------------------------------
  282.  # â—‹ アクターの固定状態を設定
  283.  #     actor_id : アクター ID
  284.  #     fixed    : 固定フラグ (省略時 : true)
  285.  #--------------------------------------------------------------------------
  286.  def fix_actor(actor_id, fixed = true)
  287.    $game_party.fix_actor(actor_id, fixed)
  288.  end
  289.  #--------------------------------------------------------------------------
  290.  # â—‹ 並び替え
  291.  #    ãƒ¡ãƒ³ãƒãƒ¼ã® index1 番目と index2 番目を入れ替える
  292.  #--------------------------------------------------------------------------
  293.  def change_party_shift(index1, index2)
  294.    $game_party.change_shift(index1, index2)
  295.  end
  296.  #--------------------------------------------------------------------------
  297.  # â—‹ メンバー整列 (æ˜‡é †)
  298.  #     sort_type : ソート形式 (SORT_BY_xxx)
  299.  #     reverse   : true ã ã¨é™é †
  300.  #--------------------------------------------------------------------------
  301.  def sort_party_member(sort_type = SORT_BY_ID, reverse = false)
  302.    $game_party.sort_member(sort_type, reverse)
  303.  end
  304.  #--------------------------------------------------------------------------
  305.  # â—‹ 待機メンバーの ID を取得
  306.  #--------------------------------------------------------------------------
  307.  def get_stand_by_member_ids
  308.    result = []
  309.    $game_party.stand_by_members.each { |actor| result << actor.id }
  310.    return result
  311.  end
  312.  #--------------------------------------------------------------------------
  313.  # â—‹ アクターが待機メンバーか
  314.  #     actor_id : アクター ID
  315.  #--------------------------------------------------------------------------
  316.  def stand_by_member?(actor_id)
  317.    return get_stand_by_member_ids.include?(actor_id)
  318.  end
  319.  #--------------------------------------------------------------------------
  320.  # â—‹ ã‚¢ã‚¯ã‚¿ãƒ¼ã‚’æˆ¦é—˜ãƒ¡ãƒ³ãƒãƒ¼ã«åŠ ãˆã‚‹
  321.  #     actor_id : アクター ID
  322.  #     index    : è¿½åŠ ä½ç½® (省略時は最後尾)
  323.  #--------------------------------------------------------------------------
  324.  def add_battle_member(actor_id, index = nil)
  325.    $game_party.add_battle_member(actor_id, index)
  326.  end
  327.  #--------------------------------------------------------------------------
  328.  # â—‹ アクターを戦闘メンバーから外す
  329.  #     actor_id : アクター ID
  330.  #--------------------------------------------------------------------------
  331.  def remove_battle_member(actor_id)
  332.    $game_party.remove_battle_member(actor_id)
  333.  end
  334.  #--------------------------------------------------------------------------
  335.  # â—‹ 固定アクター以外を戦闘メンバーから外す
  336.  #--------------------------------------------------------------------------
  337.  def remove_all_battle_member
  338.    $game_party.all_members.each { |actor|
  339.      $game_party.remove_battle_member(actor.id)
  340.    }
  341.  end
  342.  #--------------------------------------------------------------------------
  343.  # â—‹ ランダム出撃
  344.  #--------------------------------------------------------------------------
  345.  def random_launch
  346.    new_battle_members = $game_party.fixed_members
  347.    candidates = $game_party.all_members - new_battle_members
  348.    num = [$game_party.max_battle_member_count - new_battle_members.size,
  349.      candidates.size].min
  350.    return if num <= 0
  351.  
  352.    # ランダムに選ぶ
  353.    ary = (0...candidates.size).to_a.sort_by { rand }
  354.    ary[0...num].each { |i| new_battle_members << candidates[i] }
  355.    $game_party.set_battle_member(new_battle_members)
  356.  end
  357. end
  358.  
  359. class Game_Interpreter
  360.  include KGC::Commands
  361. end
  362.  
  363. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  364. #☆★☆★☆★
  365.  
  366. #==============================================================================
  367. # â–  Vocab
  368. #==============================================================================
  369.  
  370. module Vocab
  371.  # 「パーティ編成」コマンド名 (メニュー)
  372.  def self.partyform
  373.    return KGC::LargeParty::VOCAB_MENU_PARTYFORM
  374.  end
  375.  
  376.  # 「パーティ編成」コマンド名 (戦闘)
  377.  def self.partyform_battle
  378.    return KGC::LargeParty::VOCAB_BATTLE_PARTYFORM
  379.  end
  380. end
  381.  
  382. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  383. #☆★☆★☆★
  384.  
  385. #==============================================================================
  386. # â–  Game_Actor
  387. #==============================================================================
  388.  
  389. class Game_Actor < Game_Battler
  390.  #--------------------------------------------------------------------------
  391.  # â—‹ パーティ内インデックス取得
  392.  #--------------------------------------------------------------------------
  393.  def party_index
  394.    return $game_party.all_members.index(self)
  395.  end
  396.  #--------------------------------------------------------------------------
  397.  # â—‹ 戦闘メンバーか判定
  398.  #--------------------------------------------------------------------------
  399.  def battle_member?
  400.    return $game_party.battle_members.include?(self)
  401.  end
  402.  #--------------------------------------------------------------------------
  403.  # â—‹ 固定メンバーか判定
  404.  #--------------------------------------------------------------------------
  405.  def fixed_member?
  406.    return $game_party.fixed_members.include?(self)
  407.  end
  408. end
  409.  
  410. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  411. #☆★☆★☆★
  412.  
  413. #==============================================================================
  414. # â–  Game_Party
  415. #==============================================================================
  416.  
  417. class Game_Party
  418.  #--------------------------------------------------------------------------
  419.  # ● 定数
  420.  #--------------------------------------------------------------------------
  421.  MAX_MEMBERS = KGC::LargeParty::MAX_MEMBERS  # 最大パーティ人数
  422.  #--------------------------------------------------------------------------
  423.  # ● オブジェクト初期化
  424.  #--------------------------------------------------------------------------
  425.  alias initialize_KGC_LargeParty initialize
  426.  def initialize
  427.    initialize_KGC_LargeParty
  428.  
  429.    @max_battle_member_count = nil
  430.    @battle_member_count = 0
  431.    @fixed_actors = []
  432.  end
  433.  #--------------------------------------------------------------------------
  434.  # â—‹ 戦闘メンバー最大数取得
  435.  #--------------------------------------------------------------------------
  436.  def max_battle_member_count
  437.    if @max_battle_member_count == nil
  438.      return KGC::LargeParty::MAX_BATTLE_MEMBERS
  439.    else
  440.      return @max_battle_member_count
  441.    end
  442.  end
  443.  #--------------------------------------------------------------------------
  444.  # â—‹ 戦闘メンバー最大数変更
  445.  #--------------------------------------------------------------------------
  446.  def max_battle_member_count=(value)
  447.    if value.is_a?(Integer)
  448.      value = [value, 1].max
  449.    end
  450.    @max_battle_member_count = value
  451.  end
  452.  #--------------------------------------------------------------------------
  453.  # â—‹ 戦闘メンバー数取得
  454.  #--------------------------------------------------------------------------
  455.  def battle_member_count
  456.    if @battle_member_count == nil
  457.      @battle_member_count = @actors.size
  458.    end
  459.    @battle_member_count =
  460.      [@battle_member_count, @actors.size, max_battle_member_count].min
  461.    return @battle_member_count
  462.  end
  463.  #--------------------------------------------------------------------------
  464.  # â—‹ 戦闘メンバー数設定
  465.  #--------------------------------------------------------------------------
  466.  def battle_member_count=(value)
  467.    @battle_member_count = [[value, 0].max,
  468.      @actors.size, max_battle_member_count].min
  469.  end
  470.  #--------------------------------------------------------------------------
  471.  # ● メンバーの取得
  472.  #--------------------------------------------------------------------------
  473.  alias members_KGC_LargeParty members
  474.  def members
  475.    if $game_temp.in_battle ||
  476.        !KGC::LargeParty::SHOW_STAND_BY_MEMBER_NOT_IN_BATTLE
  477.      return battle_members
  478.    else
  479.      return members_KGC_LargeParty
  480.    end
  481.  end
  482.  #--------------------------------------------------------------------------
  483.  # â—‹ 全メンバーの取得
  484.  #--------------------------------------------------------------------------
  485.  def all_members
  486.    return members_KGC_LargeParty
  487.  end
  488.  #--------------------------------------------------------------------------
  489.  # â—‹ 戦闘メンバーの取得
  490.  #--------------------------------------------------------------------------
  491.  def battle_members
  492.    result = []
  493.    battle_member_count.times { |i| result << $game_actors[@actors[i]] }
  494.    return result
  495.  end
  496.  #--------------------------------------------------------------------------
  497.  # â—‹ 待機メンバーの取得
  498.  #--------------------------------------------------------------------------
  499.  def stand_by_members
  500.    return (all_members - battle_members)
  501.  end
  502.  #--------------------------------------------------------------------------
  503.  # â—‹ 固定メンバーの取得
  504.  #--------------------------------------------------------------------------
  505.  def fixed_members
  506.    result = []
  507.    @fixed_actors.each { |i| result << $game_actors[i] }
  508.    return result
  509.  end
  510.  #--------------------------------------------------------------------------
  511.  # ● 初期パーティのセットアップ
  512.  #--------------------------------------------------------------------------
  513.  alias setup_starting_members_KGC_LargeParty setup_starting_members
  514.  def setup_starting_members
  515.    setup_starting_members_KGC_LargeParty
  516.  
  517.    self.battle_member_count = @actors.size
  518.  end
  519.  #--------------------------------------------------------------------------
  520.  # ● 戦闘テスト用パーティのセットアップ
  521.  #--------------------------------------------------------------------------
  522.  alias setup_battle_test_members_KGC_LargeParty setup_battle_test_members
  523.  def setup_battle_test_members
  524.    setup_battle_test_members_KGC_LargeParty
  525.  
  526.    self.battle_member_count = @actors.size
  527.  end
  528.  #--------------------------------------------------------------------------
  529.  # â—‹ メンバーの新規設定
  530.  #     new_member : 新しいメンバー
  531.  #--------------------------------------------------------------------------
  532.  def set_member(new_member)
  533.    @actors = []
  534.    new_member.each { |actor| @actors << actor.id }
  535.  end
  536.  #--------------------------------------------------------------------------
  537.  # â—‹ 戦闘メンバーの新規設定
  538.  #     new_member : 新しい戦闘メンバー
  539.  #--------------------------------------------------------------------------
  540.  def set_battle_member(new_member)
  541.    new_battle_member = []
  542.    new_member.each { |actor|
  543.      @actors.delete(actor.id)
  544.      new_battle_member << actor.id
  545.    }
  546.    @actors = new_battle_member + @actors
  547.    self.battle_member_count = new_member.size
  548.  end
  549.  #--------------------------------------------------------------------------
  550.  # â—‹ パーティ編成を許可しているか判定
  551.  #--------------------------------------------------------------------------
  552.  def partyform_enable?
  553.    return $game_switches[KGC::LargeParty::PARTYFORM_SWITCH]
  554.  end
  555.  #--------------------------------------------------------------------------
  556.  # â—‹ 戦闘中のパーティ編成を許可しているか判定
  557.  #--------------------------------------------------------------------------
  558.  def battle_partyform_enable?
  559.    return false unless partyform_enable?
  560.    return $game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH]
  561.  end
  562.  #--------------------------------------------------------------------------
  563.  # â—‹ メンバーが一杯か判定
  564.  #--------------------------------------------------------------------------
  565.  def full?
  566.    return (@actors.size >= MAX_MEMBERS)
  567.  end
  568.  #--------------------------------------------------------------------------
  569.  # â—‹ 固定アクターか判定
  570.  #     actor_id : 判定するアクターの ID
  571.  #--------------------------------------------------------------------------
  572.  def actor_fixed?(actor_id)
  573.    return @fixed_actors.include?(actor_id)
  574.  end
  575.  #--------------------------------------------------------------------------
  576.  # ● ã‚¢ã‚¯ã‚¿ãƒ¼ã‚’åŠ ãˆã‚‹
  577.  #     actor_id : アクター ID
  578.  #--------------------------------------------------------------------------
  579.  alias add_actor_KGC_LargeParty add_actor
  580.  def add_actor(actor_id)
  581.    last_size = @actors.size
  582.  
  583.    add_actor_KGC_LargeParty(actor_id)
  584.  
  585.    if last_size < @actors.size
  586.      self.battle_member_count += 1
  587.    end
  588.  end
  589.  #--------------------------------------------------------------------------
  590.  # â—‹ ã‚¢ã‚¯ã‚¿ãƒ¼ã‚’æˆ¦é—˜ãƒ¡ãƒ³ãƒãƒ¼ã«åŠ ãˆã‚‹
  591.  #     actor_id : アクター ID
  592.  #     index    : è¿½åŠ ä½ç½® (省略時は最後尾)
  593.  #--------------------------------------------------------------------------
  594.  def add_battle_member(actor_id, index = nil)
  595.    return unless @actors.include?(actor_id)  # パーティにいない
  596.    if index == nil
  597.      return if battle_members.include?($game_actors[actor_id])  # 出撃済み
  598.      return if battle_member_count == max_battle_member_count   # 人数が最大
  599.      index = battle_member_count
  600.    end
  601.  
  602.    @actors.delete(actor_id)
  603.    @actors.insert(index, actor_id)
  604.    self.battle_member_count += 1
  605.  end
  606.  #--------------------------------------------------------------------------
  607.  # â—‹ アクターを戦闘メンバーから外す
  608.  #     actor_id : アクター ID
  609.  #--------------------------------------------------------------------------
  610.  def remove_battle_member(actor_id)
  611.    return unless @actors.include?(actor_id)  # パーティにいない
  612.    return if actor_fixed?(actor_id)          # 固定済み
  613.    return if stand_by_members.include?($game_actors[actor_id])  # 待機中
  614.  
  615.    @actors.delete(actor_id)
  616.    @actors.push(actor_id)
  617.    self.battle_member_count -= 1
  618.  end
  619.  #--------------------------------------------------------------------------
  620.  # â—‹ アクターの固定状態を設定
  621.  #     actor_id : アクター ID
  622.  #     fixed    : 固定フラグ (省略時 : false)
  623.  #--------------------------------------------------------------------------
  624.  def fix_actor(actor_id, fixed = false)
  625.    return unless @actors.include?(actor_id)  # パーティにいない
  626.  
  627.    if fixed
  628.      # 固定
  629.      unless @fixed_actors.include?(actor_id)
  630.        @fixed_actors << actor_id
  631.        unless battle_members.include?($game_actors[actor_id])
  632.          self.battle_member_count += 1
  633.        end
  634.      end
  635.      # 強制出撃
  636.      apply_force_launch
  637.    else
  638.      # 固定解除
  639.      @fixed_actors.delete(actor_id)
  640.    end
  641.    $game_player.refresh
  642.  end
  643.  #--------------------------------------------------------------------------
  644.  # â—‹ 強制出撃適用
  645.  #--------------------------------------------------------------------------
  646.  def apply_force_launch
  647.    while (fixed_members - battle_members).size > 0
  648.      # 固定状態でないメンバーを適当に持ってきて入れ替え
  649.      actor1 = stand_by_members.find { |a| @fixed_actors.include?(a.id) }
  650.      actor2 = battle_members.reverse.find { |a| !@fixed_actors.include?(a.id) }
  651.      index1 = @actors.index(actor1.id)
  652.      index2 = @actors.index(actor2.id)
  653.      @actors[index1], @actors[index2] = @actors[index2], @actors[index1]
  654.  
  655.      # 戦闘メンバーが全員固定されたら戻る (無限ループ防止)
  656.      all_fixed = true
  657.      battle_members.each { |actor|
  658.        unless actor.fixed_member?
  659.          all_fixed = false
  660.          break
  661.        end
  662.      }
  663.      break if all_fixed
  664.    end
  665.  end
  666.  #--------------------------------------------------------------------------
  667.  # â—‹ メンバー整列 (æ˜‡é †)
  668.  #     sort_type : ソート形式 (SORT_BY_xxx)
  669.  #     reverse   : true ã ã¨é™é †
  670.  #--------------------------------------------------------------------------
  671.  def sort_member(sort_type = KGC::Commands::SORT_BY_ID,
  672.                  reverse = false)
  673.    # バッファを準備
  674.    b_actors = battle_members
  675.    actors = all_members - b_actors
  676.    f_actors = fixed_members
  677.    # 固定キャラはソートしない
  678.    if KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED
  679.      actors -= f_actors
  680.      b_actors -= f_actors
  681.    end
  682.  
  683.    # ソート
  684.    case sort_type
  685.    when KGC::Commands::SORT_BY_ID     # IDé †
  686.      actors.sort!   { |a, b| a.id <=> b.id }
  687.      b_actors.sort! { |a, b| a.id <=> b.id }
  688.    when KGC::Commands::SORT_BY_NAME   # åå‰é †
  689.      actors.sort!   { |a, b| a.name <=> b.name }
  690.      b_actors.sort! { |a, b| a.name <=> b.name }
  691.    when KGC::Commands::SORT_BY_LEVEL  # ãƒ¬ãƒ™ãƒ«é †
  692.      actors.sort!   { |a, b| a.level <=> b.level }
  693.      b_actors.sort! { |a, b| a.level <=> b.level }
  694.    end
  695.    # 反転
  696.    if reverse
  697.      actors.reverse!
  698.      b_actors.reverse!
  699.    end
  700.  
  701.    # å›ºå®šã‚­ãƒ£ãƒ©ã‚’å…ˆé ­ã«æŒã£ã¦ãã‚‹
  702.    if KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED
  703.      actors = f_actors + actors
  704.      b_actors = f_actors + b_actors
  705.    end
  706.  
  707.    # 復帰
  708.    set_member(actors)
  709.    set_battle_member(b_actors)
  710.  
  711.    apply_force_launch
  712.    $game_player.refresh
  713.  end
  714.  #--------------------------------------------------------------------------
  715.  # â—‹ 並び替え
  716.  #    æˆ¦é—˜ãƒ¡ãƒ³ãƒãƒ¼ã® index1 番目と index2 番目を入れ替える
  717.  #--------------------------------------------------------------------------
  718.  def change_shift(index1, index2)
  719.    size = @actors.size
  720.    if index1 >= size || index2 >= size
  721.      return
  722.    end
  723.    buf = @actors[index1]
  724.    @actors[index1] = @actors[index2]
  725.    @actors[index2] = buf
  726.    $game_player.refresh
  727.  end
  728.  #--------------------------------------------------------------------------
  729.  # ● 戦闘用ステートの解除 (戦闘終了時に呼び出し)
  730.  #--------------------------------------------------------------------------
  731.  def remove_states_battle
  732.    for actor in all_members
  733.      actor.remove_states_battle
  734.    end
  735.  end
  736. end
  737.  
  738. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  739. #☆★☆★☆★
  740.  
  741. #==============================================================================
  742. # â–  Window_Command
  743. #==============================================================================
  744.  
  745. class Window_Command < Window_Selectable
  746.  unless method_defined?(:add_command)
  747.  #--------------------------------------------------------------------------
  748.  # â—‹ コマンドを追åŠ
  749.  #    è¿½åŠ した位置を返す
  750.  #--------------------------------------------------------------------------
  751.  def add_command(command)
  752.    @commands << command
  753.    @item_max = @commands.size
  754.    item_index = @item_max - 1
  755.    refresh_command
  756.    draw_item(item_index)
  757.    return item_index
  758.  end
  759.  #--------------------------------------------------------------------------
  760.  # â—‹ コマンドをリフレッシュ
  761.  #--------------------------------------------------------------------------
  762.  def refresh_command
  763.    buf = self.contents.clone
  764.    self.height = [self.height, row_max * WLH + 32].max
  765.    create_contents
  766.    self.contents.blt(0, 0, buf, buf.rect)
  767.    buf.dispose
  768.  end
  769.  #--------------------------------------------------------------------------
  770.  # â—‹ コマンドを挿入
  771.  #--------------------------------------------------------------------------
  772.  def insert_command(index, command)
  773.    @commands.insert(index, command)
  774.    @item_max = @commands.size
  775.    refresh_command
  776.    refresh
  777.  end
  778.  #--------------------------------------------------------------------------
  779.  # â—‹ コマンドを削除
  780.  #--------------------------------------------------------------------------
  781.  def remove_command(command)
  782.    @commands.delete(command)
  783.    @item_max = @commands.size
  784.    refresh
  785.  end
  786.  end
  787. end
  788.  
  789. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  790. #☆★☆★☆★
  791.  
  792. #==============================================================================
  793. # â–  Window_MenuStatus
  794. #==============================================================================
  795.  
  796. class Window_MenuStatus < Window_Selectable
  797.  #--------------------------------------------------------------------------
  798.  # ● 定数
  799.  #--------------------------------------------------------------------------
  800.  STATUS_HEIGHT = 56  # ステータス一人分の高さ
  801.  #--------------------------------------------------------------------------
  802.  # ● ウィンドウ内容の作成
  803.  #--------------------------------------------------------------------------
  804.  def create_contents
  805.    self.contents.dispose
  806.    self.contents = Bitmap.new(width - 32,
  807.      [height - 32, row_max * STATUS_HEIGHT].max)
  808.  end
  809.  #--------------------------------------------------------------------------
  810.  # ● å…ˆé ­ã®è¡Œã®å–å¾—
  811.  #--------------------------------------------------------------------------
  812.  def top_row
  813.    return self.oy / STATUS_HEIGHT
  814.  end
  815.  #--------------------------------------------------------------------------
  816.  # ● å…ˆé ­ã®è¡Œã®è¨­å®š
  817.  #     row : å…ˆé ­ã«è¡¨ç¤ºã™ã‚‹è¡Œ
  818.  #--------------------------------------------------------------------------
  819.  def top_row=(row)
  820.    super(row)
  821.    self.oy = self.oy / WLH * STATUS_HEIGHT
  822.  end
  823.  #--------------------------------------------------------------------------
  824.  # ● 1 ページに表示できる行数の取得
  825.  #--------------------------------------------------------------------------
  826.  def page_row_max
  827.    return (self.height - 32) / STATUS_HEIGHT
  828.  end
  829.  #--------------------------------------------------------------------------
  830.  # ● é …ç›®ã‚’æç”»ã™ã‚‹çŸ©å½¢ã®å–å¾—
  831.  #     index : é …ç›®ç•ªå·
  832.  #--------------------------------------------------------------------------
  833.  def item_rect(index)
  834.    rect = super(index)
  835.    rect.height = STATUS_HEIGHT
  836.    rect.y = index / @column_max * STATUS_HEIGHT
  837.    return rect
  838.  end
  839.  #--------------------------------------------------------------------------
  840.  # ● リフレッシュ
  841.  #--------------------------------------------------------------------------
  842.  def refresh
  843.    @item_max = $game_party.members.size
  844.    create_contents
  845.    fill_stand_by_background
  846.    draw_member
  847.  end
  848.  #--------------------------------------------------------------------------
  849.  # â—‹ パーティメンバー描画
  850.  #--------------------------------------------------------------------------
  851.  def draw_member
  852.    for actor in $game_party.members
  853.      draw_actor_face(actor, 2, actor.party_index * 56 - 2, 52)
  854.      x = 104
  855.      y = actor.party_index * 56 + WLH / 2
  856.      draw_actor_name(actor, x - 42, y - 15)
  857.      draw_actor_level2(actor, x + 120, y + WLH * 1 - 2)
  858.      draw_actor_state(actor, x + 64, y + WLH * 2)
  859.      draw_actor_hp(actor, x - 42, y - 1)
  860.      draw_actor_mp(actor, x - 42, y + WLH - 9)
  861.    end
  862.  end
  863.  #--------------------------------------------------------------------------
  864.  # â—‹ 待機メンバーの背景色を塗る
  865.  #--------------------------------------------------------------------------
  866.  def fill_stand_by_background
  867.    color = KGC::LargeParty::STAND_BY_COLOR
  868.    dy = STATUS_HEIGHT * $game_party.battle_members.size - 4
  869.    dh = STATUS_HEIGHT * $game_party.stand_by_members.size
  870.    if dh > 0
  871.      self.contents.fill_rect(0, dy, self.width - 32, dh, color)
  872.    end
  873.  end
  874.  #--------------------------------------------------------------------------
  875.  # ● カーソルの更新
  876.  #--------------------------------------------------------------------------
  877.  def update_cursor
  878.    if @index < 0               # カーソルなし
  879.      self.cursor_rect.empty
  880.    elsif @index < @item_max    # 通常
  881.      super
  882.    elsif @index >= 100         # 自分
  883.      self.cursor_rect.set(0, (@index - 100) * STATUS_HEIGHT,
  884.        contents.width, STATUS_HEIGHT)
  885.    else                        # 全体
  886.      self.cursor_rect.set(0, 0, contents.width, @item_max * STATUS_HEIGHT)
  887.    end
  888.  end
  889. end
  890.  
  891. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  892. #☆★☆★☆★#######
  893.  
  894. #==============================================================================
  895. # â–  Window_ShopStatus
  896. #==============================================================================
  897.  
  898. class Window_ShopStatus < Window_Base
  899.  #--------------------------------------------------------------------------
  900.  # ● ウィンドウ内容の作成
  901.  #--------------------------------------------------------------------------
  902.  def create_contents
  903.    self.contents.dispose
  904.    self.contents = Bitmap.new(width - 32,
  905.      WLH * ($game_party.members.size + 1) * 2)
  906.  end
  907. end
  908.  
  909. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  910. #☆★☆★☆★
  911.  
  912. #==============================================================================
  913. # â–  Window_BattleStatus
  914. #==============================================================================
  915.  
  916. class Window_BattleStatus < Window_Selectable
  917.  #--------------------------------------------------------------------------
  918.  # ● ウィンドウ内容の作成
  919.  #--------------------------------------------------------------------------
  920.  def create_contents
  921.    self.contents.dispose
  922.    self.contents = Bitmap.new(width - 32,
  923.      [WLH * $game_party.members.size, height - 32].max)
  924.  end
  925.  #--------------------------------------------------------------------------
  926.  # ● リフレッシュ
  927.  #--------------------------------------------------------------------------
  928.  alias refresh_KGC_LargeParty refresh
  929.  def refresh
  930.    create_contents
  931.  
  932.    refresh_KGC_LargeParty
  933.  end
  934. end
  935.  
  936. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  937. #☆★☆★☆★
  938.  
  939. #==============================================================================
  940. # â–¡ Window_PartyFormCaption
  941. #------------------------------------------------------------------------------
  942. #  パーティ編成画面でウィンドウのキャプションを表示するウィンドウでã
  943. #™ã€‚
  944. #==============================================================================
  945.  
  946. class Window_PartyFormCaption < Window_Base
  947.  #--------------------------------------------------------------------------
  948.  # ● オブジェクト初期化
  949.  #     caption : 表示するキャプション
  950.  #--------------------------------------------------------------------------
  951.  def initialize(caption = "")
  952.    super(0, 0, KGC::LargeParty::CAPTION_WINDOW_WIDTH, WLH + 32)
  953.    self.z = 1500
  954.    @caption = caption
  955.    refresh
  956.  end
  957.  #--------------------------------------------------------------------------
  958.  # ● リフレッシュ
  959.  #--------------------------------------------------------------------------
  960.  def refresh
  961.    self.contents.clear
  962.    self.contents.draw_text(0, 0, width - 32, WLH, @caption)
  963.  end
  964. end
  965.  
  966. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  967. #☆★☆★☆★
  968.  
  969. #==============================================================================
  970. # â–¡ Window_PartyFormMember
  971. #------------------------------------------------------------------------------
  972. #  パーティ編成画面でメンバーを表示するウィンドウです。
  973. #==============================================================================
  974.  
  975. class Window_PartyFormMember < Window_Selectable
  976.  #--------------------------------------------------------------------------
  977.  # â—‹ 定数
  978.  #--------------------------------------------------------------------------
  979.  DRAW_SIZE = KGC::LargeParty::PARTY_FORM_CHARACTER_SIZE
  980.  #--------------------------------------------------------------------------
  981.  # ● 公開インスタンス変数
  982.  #--------------------------------------------------------------------------
  983.  attr_accessor :selected_index           # 選択済みインデックス
  984.  #--------------------------------------------------------------------------
  985.  # ● オブジェクト初期化
  986.  #     x       : ウィンドウの X 座標
  987.  #     y       : ウィンドウの Y 座標
  988.  #     width   : ウィンドウの幅
  989.  #     height  : ウィンドウの高さ
  990.  #     spacing : æ¨ªã«é …ç›®ãŒä¸¦ã¶ã¨ãã®ç©ºç™½ã®å¹…
  991.  #--------------------------------------------------------------------------
  992.  def initialize(x, y, width, height, spacing = 8)
  993.    super(x, y, width, height, spacing)
  994.    self.z = 1000
  995.  end
  996.  #--------------------------------------------------------------------------
  997.  # ● ウィンドウ内容の作成
  998.  #--------------------------------------------------------------------------
  999.  def create_contents
  1000.    self.contents.dispose
  1001.    self.contents = Bitmap.new(width - 32,
  1002.      [height - 32, row_max * DRAW_SIZE[1]].max)
  1003.  end
  1004.  #--------------------------------------------------------------------------
  1005.  # ● å…ˆé ­ã®è¡Œã®å–å¾—
  1006.  #--------------------------------------------------------------------------
  1007.  def top_row
  1008.    return self.oy / DRAW_SIZE[1]
  1009.  end
  1010.  #--------------------------------------------------------------------------
  1011.  # ● å…ˆé ­ã®è¡Œã®è¨­å®š
  1012.  #     row : å…ˆé ­ã«è¡¨ç¤ºã™ã‚‹è¡Œ
  1013.  #--------------------------------------------------------------------------
  1014.  def top_row=(row)
  1015.    super(row)
  1016.    self.oy = self.oy / WLH * DRAW_SIZE[1]
  1017.  end
  1018.  #--------------------------------------------------------------------------
  1019.  # ● 1 ページに表示できる行数の取得
  1020.  #--------------------------------------------------------------------------
  1021.  def page_row_max
  1022.    return (self.height - 32) / DRAW_SIZE[1]
  1023.  end
  1024.  #--------------------------------------------------------------------------
  1025.  # ● é …ç›®ã‚’æç”»ã™ã‚‹çŸ©å½¢ã®å–å¾—
  1026.  #     index : é …ç›®ç•ªå·
  1027.  #--------------------------------------------------------------------------
  1028.  def item_rect(index)
  1029.    rect = super(index)
  1030.    rect.width = DRAW_SIZE[0]
  1031.    rect.height = DRAW_SIZE[1]
  1032.    rect.y = index / @column_max * DRAW_SIZE[1]
  1033.    return rect
  1034.  end
  1035.  #--------------------------------------------------------------------------
  1036.  # â—‹ 選択アクター取得
  1037.  #--------------------------------------------------------------------------
  1038.  def actor
  1039.    return @actors[self.index]
  1040.  end
  1041.  #--------------------------------------------------------------------------
  1042.  # ● リフレッシュ
  1043.  #--------------------------------------------------------------------------
  1044.  def refresh
  1045.    self.contents.clear
  1046.    restore_member_list
  1047.    draw_member
  1048.  end
  1049.  #--------------------------------------------------------------------------
  1050.  # â—‹ メンバーリスト修復
  1051.  #--------------------------------------------------------------------------
  1052.  def restore_member_list
  1053.    # 継承先で定義
  1054.  end
  1055.  #--------------------------------------------------------------------------
  1056.  # â—‹ メンバー描画
  1057.  #--------------------------------------------------------------------------
  1058.  def draw_member
  1059.    # 継承先で定義
  1060.  end
  1061.  #--------------------------------------------------------------------------
  1062.  # â—‹ 空欄アクター描画
  1063.  #     index : é …ç›®ç•ªå·
  1064.  #--------------------------------------------------------------------------
  1065.  def draw_empty_actor(index)
  1066.    # 継承先で定義
  1067.  end
  1068.  #--------------------------------------------------------------------------
  1069.  # â—‹ 固定キャラ背景描画
  1070.  #     index : é …ç›®ç•ªå·
  1071.  #--------------------------------------------------------------------------
  1072.  def draw_fixed_back(index)
  1073.    rect = item_rect(index)
  1074.    self.contents.fill_rect(rect, KGC::LargeParty::FIXED_COLOR)
  1075.  end
  1076.  #--------------------------------------------------------------------------
  1077.  # â—‹ 選択中キャラ背景描画
  1078.  #     index : é …ç›®ç•ªå·
  1079.  #--------------------------------------------------------------------------
  1080.  def draw_selected_back(index)
  1081.    rect = item_rect(index)
  1082.    self.contents.fill_rect(rect, KGC::LargeParty::SELECTED_COLOR)
  1083.  end
  1084. end
  1085.  
  1086. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1087. #☆★☆★☆★
  1088.  
  1089. #==============================================================================
  1090. # â–¡ Window_PartyFormBattleMember
  1091. #------------------------------------------------------------------------------
  1092. #  パーティ編成画面で戦闘メンバーを表示するウィンドウです。
  1093. #==============================================================================
  1094.  
  1095. class Window_PartyFormBattleMember < Window_PartyFormMember
  1096.  #--------------------------------------------------------------------------
  1097.  # ● 公開インスタンス変数
  1098.  #--------------------------------------------------------------------------
  1099.  attr_accessor :selected_index           # 選択済みインデックス
  1100.  #--------------------------------------------------------------------------
  1101.  # ● オブジェクト初期化
  1102.  #--------------------------------------------------------------------------
  1103.  def initialize
  1104.    super(0, 0, 64, DRAW_SIZE[1] + 32)
  1105.    column_width = DRAW_SIZE[0] + @spacing
  1106.    nw = [column_width * $game_party.max_battle_member_count + 32,
  1107.      Graphics.width].min
  1108.    self.width = nw
  1109.  
  1110.    @item_max = $game_party.max_battle_member_count
  1111.    @column_max = width / column_width
  1112.    @selected_index = nil
  1113.    create_contents
  1114.    refresh
  1115.    self.active = true
  1116.    self.index = 0
  1117.  end
  1118.  #--------------------------------------------------------------------------
  1119.  # â—‹ メンバーリスト修復
  1120.  #--------------------------------------------------------------------------
  1121.  def restore_member_list
  1122.    @actors = $game_party.battle_members
  1123.  end
  1124.  #--------------------------------------------------------------------------
  1125.  # â—‹ メンバー描画
  1126.  #--------------------------------------------------------------------------
  1127.  def draw_member
  1128.    @item_max.times { |i|
  1129.      actor = @actors[i]
  1130.      if actor == nil
  1131.        draw_empty_actor(i)
  1132.      else
  1133.        if i == @selected_index
  1134.          draw_selected_back(i)
  1135.        elsif $game_party.actor_fixed?(actor.id)
  1136.          draw_fixed_back(i)
  1137.        end
  1138.        rect = item_rect(i)
  1139.        draw_actor_graphic(actor,
  1140.          rect.x + DRAW_SIZE[0] / 2, # FACE
  1141.          rect.y + DRAW_SIZE[1] - 4)
  1142.      end
  1143.    }
  1144.  end
  1145.  #--------------------------------------------------------------------------
  1146.  # â—‹ 空欄アクター描画
  1147.  #     index : é …ç›®ç•ªå·
  1148.  #--------------------------------------------------------------------------
  1149.  def draw_empty_actor(index)
  1150.    rect = item_rect(index)
  1151.    self.contents.font.color = system_color
  1152.    self.contents.draw_text(rect, KGC::LargeParty::BATTLE_MEMBER_BLANK_TEXT, 1)
  1153.    self.contents.font.color = normal_color
  1154.  end
  1155. end
  1156.  
  1157. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1158. #☆★☆★☆★
  1159.  
  1160. #==============================================================================
  1161. # â–¡ Window_PartyFormAllMember
  1162. #------------------------------------------------------------------------------
  1163. #  パーティ編成画面で全メンバーを表示するウィンドウです。
  1164. #==============================================================================
  1165.  
  1166. class Window_PartyFormAllMember < Window_PartyFormMember
  1167.  #--------------------------------------------------------------------------
  1168.  # ● オブジェクト初期化
  1169.  #--------------------------------------------------------------------------
  1170.  def initialize
  1171.    super(0, 0, 64, 64)
  1172.    restore_member_list
  1173.    @item_max = $game_party.all_members.size
  1174.  
  1175.    # 各種サイズ計算
  1176.    column_width = DRAW_SIZE[0] + @spacing
  1177.    sw = [@item_max * column_width + 32, Graphics.width].min
  1178.    @column_max = (sw - 32) / column_width
  1179.    sh = ([@item_max - 1, 0].max / @column_max + 1) * DRAW_SIZE[1] + 32
  1180.    sh = [sh, DRAW_SIZE[1] * KGC::LargeParty::PARTY_MEMBER_WINDOW_ROW_MAX + 32].min
  1181.  
  1182.    # 座標・サイズ調整
  1183.    self.y += DRAW_SIZE[1] + 32
  1184.    self.width = sw
  1185.    self.height = sh
  1186.  
  1187.    create_contents
  1188.    refresh
  1189.    self.active = false
  1190.    self.index = 0
  1191.  end
  1192.  #--------------------------------------------------------------------------
  1193.  # â—‹ 選択しているアクターのインデックス取得
  1194.  #--------------------------------------------------------------------------
  1195.  def actor_index
  1196.    return @index_offset + self.index
  1197.  end
  1198.  #--------------------------------------------------------------------------
  1199.  # â—‹ メンバーリスト修復
  1200.  #--------------------------------------------------------------------------
  1201.  def restore_member_list
  1202.    if KGC::LargeParty::SHOW_BATTLE_MEMBER_IN_PARTY
  1203.      @actors = $game_party.all_members
  1204.      @index_offset = 0
  1205.    else
  1206.      @actors = $game_party.stand_by_members
  1207.      @index_offset = $game_party.battle_members.size
  1208.    end
  1209.  end
  1210.  #--------------------------------------------------------------------------
  1211.  # â—‹ メンバー描画
  1212.  #--------------------------------------------------------------------------
  1213.  def draw_member
  1214.    @item_max.times { |i|
  1215.      actor = @actors[i]
  1216.      if actor == nil
  1217.        draw_empty_actor(i)
  1218.        next
  1219.      end
  1220.  
  1221.      if $game_party.actor_fixed?(actor.id)
  1222.        draw_fixed_back(i)
  1223.      end
  1224.      rect = item_rect(i)
  1225.      opacity = ($game_party.battle_members.include?(actor) ? 96 : 255)
  1226.      draw_actor_graphic(actor,
  1227.        rect.x + DRAW_SIZE[0] / 2, # FACE
  1228.        rect.y + DRAW_SIZE[1] - 4,
  1229.        opacity)
  1230.    }
  1231.  end
  1232.  #--------------------------------------------------------------------------
  1233.  # ● アクターの歩行グラフィック描画
  1234.  #     actor   : アクター
  1235.  #     x       : 描画先 X 座標
  1236.  #     y       : 描画先 Y 座標
  1237.  #     opacity : 不透明度
  1238.  #--------------------------------------------------------------------------
  1239.  def draw_actor_graphic(actor, x, y, opacity = 255)
  1240.    draw_character(actor.character_name, actor.character_index, x, y, opacity)
  1241.  end
  1242.  #--------------------------------------------------------------------------
  1243.  # ● 歩行グラフィックの描画
  1244.  #     character_name  : 歩行グラフィック ファイル名
  1245.  #     character_index : 歩行グラフィック インデックス
  1246.  #     x               : 描画先 X 座標
  1247.  #     y               : 描画先 Y 座標
  1248.  #     opacity         : 不透明度
  1249.  #--------------------------------------------------------------------------
  1250.  def draw_character(character_name, character_index, x, y, opacity = 255)
  1251.    return if character_name == nil
  1252.    bitmap = Cache.character(character_name)
  1253.    sign = character_name[/^[\!\$]./]
  1254.    if sign != nil and sign.include?('$')
  1255.      cw = bitmap.width / 3
  1256.      ch = bitmap.height / 4
  1257.    else
  1258.      cw = bitmap.width / 12
  1259.      ch = bitmap.height / 8
  1260.    end
  1261.    n = character_index
  1262.    src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  1263.    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
  1264.  end
  1265.  #--------------------------------------------------------------------------
  1266.  # â—‹ 空欄アクター描画
  1267.  #     index : é …ç›®ç•ªå·
  1268.  #--------------------------------------------------------------------------
  1269.  def draw_empty_actor(index)
  1270.    rect = item_rect(index)
  1271.    self.contents.font.color = system_color
  1272.    self.contents.draw_text(rect, KGC::LargeParty::PARTY_MEMBER_BLANK_TEXT, 1)
  1273.    self.contents.font.color = normal_color
  1274.  end
  1275. end
  1276.  
  1277. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1278. #☆★☆★☆★
  1279.  
  1280. #==============================================================================
  1281. # â–¡ Window_PartyFormStatus
  1282. #------------------------------------------------------------------------------
  1283. #  パーティ編成画面でアクターのステータスを表示するウィンドウです。
  1284. #==============================================================================
  1285.  
  1286. class Window_PartyFormStatus < Window_Base
  1287.  #--------------------------------------------------------------------------
  1288.  # ● オブジェクト初期化
  1289.  #--------------------------------------------------------------------------
  1290.  def initialize
  1291.    super(0, 0, 384, 128)
  1292.    self.z = 1000
  1293.    @actor = nil
  1294.    refresh
  1295.  end
  1296.  #--------------------------------------------------------------------------
  1297.  # â—‹ アクター設定
  1298.  #--------------------------------------------------------------------------
  1299.  def set_actor(actor)
  1300.    if @actor != actor
  1301.      @actor = actor
  1302.      refresh
  1303.    end
  1304.  end
  1305.  #--------------------------------------------------------------------------
  1306.  # ● リフレッシュ
  1307.  #--------------------------------------------------------------------------
  1308.  def refresh
  1309.    self.contents.clear
  1310.    if @actor == nil
  1311.      return
  1312.    end
  1313.  
  1314.    draw_actor_face(@actor, 0, 0)
  1315.    dx = 104
  1316.    draw_actor_name(@actor, dx, 0)
  1317.    draw_actor_level(@actor, dx + 128, WLH * 1)
  1318.    draw_actor_hp(@actor, dx, WLH * 2)
  1319.    draw_actor_mp(@actor, dx, WLH * 3)
  1320.    draw_actor_class(@actor, dx + 128, WLH * 0)
  1321. #    draw_actor_nextexp_info(@actor, 128, y + WLH * 2)
  1322.    draw_actor_state(@actor, dx + 128, WLH * 3)
  1323.  end
  1324.  #--------------------------------------------------------------------------
  1325.  # ● 能力値の描画
  1326.  #     actor : アクター
  1327.  #     x     : 描画先 X 座標
  1328.  #     y     : 描画先 Y 座標
  1329.  #     type  : 能力値の種類 (0~3)
  1330.  #     width : 描画幅
  1331.  #--------------------------------------------------------------------------
  1332.  def draw_actor_parameter(actor, x, y, type, width = 156)
  1333.    case type
  1334.    when 0
  1335.      parameter_name = Vocab::atk
  1336.      parameter_value = actor.atk
  1337.    when 1
  1338.      parameter_name = Vocab::def
  1339.      parameter_value = actor.def
  1340.    when 2
  1341.      parameter_name = Vocab::spi
  1342.      parameter_value = actor.spi
  1343.    when 3
  1344.      parameter_name = Vocab::agi
  1345.      parameter_value = actor.agi
  1346.    end
  1347.    nw = width - 36
  1348.    self.contents.font.color = system_color
  1349.    self.contents.draw_text(x, y, nw, WLH, parameter_name)
  1350.    self.contents.font.color = normal_color
  1351.    self.contents.draw_text(x + nw, y, 36, WLH, parameter_value, 2)
  1352.  end
  1353. end
  1354.  
  1355. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1356. #☆★☆★☆★
  1357.  
  1358. #==============================================================================
  1359. # â–¡ Window_PartyFormControl
  1360. #------------------------------------------------------------------------------
  1361. #  パーティ編成画面で操作方法を表示するウィンドウです。
  1362. #==============================================================================
  1363.  
  1364. class Window_PartyFormControl < Window_Base
  1365.  #--------------------------------------------------------------------------
  1366.  # â—‹ 定数
  1367.  #--------------------------------------------------------------------------
  1368.  MODE_BATTLE_MEMBER = 0
  1369.  MODE_SHIFT_CHANGE  = 1
  1370.  MODE_PARTY_MEMBER  = 2
  1371.  #--------------------------------------------------------------------------
  1372.  # ● オブジェクト初期化
  1373.  #--------------------------------------------------------------------------
  1374.  def initialize
  1375.    super(0, 0, Graphics.width - 384, 128)
  1376.    self.z = 1000
  1377.    @mode = MODE_BATTLE_MEMBER
  1378.    refresh
  1379.  end
  1380.  #--------------------------------------------------------------------------
  1381.  # â—‹ モード変更
  1382.  #--------------------------------------------------------------------------
  1383.  def mode=(value)
  1384.    @mode = value
  1385.    refresh
  1386.  end
  1387.  #--------------------------------------------------------------------------
  1388.  # ● リフレッシュ
  1389.  #--------------------------------------------------------------------------
  1390.  def refresh
  1391.    self.contents.clear
  1392.    case @mode
  1393.    when MODE_BATTLE_MEMBER  # 戦闘メンバー
  1394.      buttons = [
  1395.        "<Z> Elegir",
  1396.        "<X> Cancelar",
  1397.        "<A> Cambiar",
  1398.        "<Shift> Remover",
  1399.      ]
  1400.    when MODE_SHIFT_CHANGE   # 並び替え
  1401.      buttons = [
  1402.        "<Z> Elegir",
  1403.        "<A> Elegir",
  1404.        "<X> Cancelar",
  1405.      ]
  1406.    when MODE_PARTY_MEMBER   # パーティメンバー
  1407.      buttons = [
  1408.        "<Z> Elegir",
  1409.        "<X> Cancelar",
  1410.      ]
  1411.    else
  1412.      return
  1413.    end
  1414.  
  1415.    buttons.each_with_index { |c, i|
  1416.      self.contents.draw_text(0, WLH * i, width - 32, WLH, c)
  1417.    }
  1418.  end
  1419. end
  1420.  
  1421. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1422. #☆★☆★☆★
  1423.  
  1424. #==============================================================================
  1425. # â–  Scene_Title
  1426. #==============================================================================
  1427.  
  1428. class Scene_Title < Scene_Base
  1429.  #--------------------------------------------------------------------------
  1430.  # ● 各種ゲームオブジェクトの作成
  1431.  #--------------------------------------------------------------------------
  1432.  alias create_game_objects_KGC_LargeParty create_game_objects
  1433.  def create_game_objects
  1434.    create_game_objects_KGC_LargeParty
  1435.  
  1436.    if KGC::LargeParty::DEFAULT_PARTYFORM_ENABLED
  1437.      $game_switches[KGC::LargeParty::PARTYFORM_SWITCH] = true
  1438.      $game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH] = true
  1439.    end
  1440.  end
  1441. end
  1442.  
  1443. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1444. #☆★☆★☆★
  1445.  
  1446. #==============================================================================
  1447. # â–  Scene_Map
  1448. #==============================================================================
  1449.  
  1450. class Scene_Map < Scene_Base
  1451.  #--------------------------------------------------------------------------
  1452.  # ● 画面切り替えの実行
  1453.  #--------------------------------------------------------------------------
  1454.  alias update_scene_change_KGC_LargeParty update_scene_change
  1455.  def update_scene_change
  1456.    return if $game_player.moving?    # プレイヤーの移動中?
  1457.  
  1458.    if $game_temp.next_scene == :partyform
  1459.      call_partyform
  1460.      return
  1461.    end
  1462.  
  1463.    update_scene_change_KGC_LargeParty
  1464.  end
  1465.  #--------------------------------------------------------------------------
  1466.  # â—‹ パーティ編成画面への切り替え
  1467.  #--------------------------------------------------------------------------
  1468.  def call_partyform
  1469.    $game_temp.next_scene = nil
  1470.    $scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_MAP)
  1471.  end
  1472. end
  1473.  
  1474. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1475. #☆★☆★☆★
  1476.  
  1477. #==============================================================================
  1478. # â–  Scene_Menu
  1479. #==============================================================================
  1480.  
  1481. class Scene_Menu < Scene_Base
  1482.  if KGC::LargeParty::USE_MENU_PARTYFORM_COMMAND
  1483.  #--------------------------------------------------------------------------
  1484.  # ● コマンドウィンドウの作成
  1485.  #--------------------------------------------------------------------------
  1486.  alias create_command_window_KGC_LargeParty create_command_window
  1487.  def create_command_window
  1488.    create_command_window_KGC_LargeParty
  1489.  
  1490.    return if $imported["CustomMenuCommand"]
  1491.  
  1492.    @__command_partyform_index =
  1493.      @command_window.add_command(Vocab.partyform)
  1494.    @command_window.draw_item(@__command_partyform_index,
  1495.      $game_party.partyform_enable?)
  1496.    if @command_window.oy > 0
  1497.      @command_window.oy -= Window_Base::WLH
  1498.    end
  1499.    @command_window.index = @menu_index
  1500.  end
  1501.  end
  1502.  #--------------------------------------------------------------------------
  1503.  # ● コマンド選択の更新
  1504.  #--------------------------------------------------------------------------
  1505.  alias update_command_selection_KGC_LargeParty update_command_selection
  1506.  def update_command_selection
  1507.    current_menu_index = @__command_partyform_index
  1508.    call_partyform_flag = false
  1509.  
  1510.    if Input.trigger?(Input::C)
  1511.      case @command_window.index
  1512.      when @__command_partyform_index  # パーティ編成
  1513.        call_partyform_flag = true
  1514.      end
  1515.    # パーティ編成ボタン押下
  1516.    elsif KGC::LargeParty::MENU_PARTYFORM_BUTTON != nil &&
  1517.        Input.trigger?(KGC::LargeParty::MENU_PARTYFORM_BUTTON)
  1518.      call_partyform_flag = true
  1519.      current_menu_index = @command_window.index if current_menu_index == nil
  1520.    end
  1521.  
  1522.    # パーティ編成画面に移行
  1523.    if call_partyform_flag
  1524.      if $game_party.members.size == 0 || !$game_party.partyform_enable?
  1525.        Sound.play_buzzer
  1526.        return
  1527.      end
  1528.      Sound.play_decision
  1529.      $scene = Scene_PartyForm.new(current_menu_index)
  1530.      return
  1531.    end
  1532.  
  1533.    update_command_selection_KGC_LargeParty
  1534.  end
  1535. end
  1536.  
  1537. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1538. #☆★☆★☆★
  1539.  
  1540. #==============================================================================
  1541. # â–¡ Scene_PartyForm
  1542. #------------------------------------------------------------------------------
  1543. #  パーティ編成画面の処理を行うクラスです。
  1544. #==============================================================================
  1545.  
  1546. class Scene_PartyForm < Scene_Base
  1547.  #--------------------------------------------------------------------------
  1548.  # â—‹ 定数
  1549.  #--------------------------------------------------------------------------
  1550.  CAPTION_OFFSET = 40  # キャプションウィンドウの位置補正
  1551.  HOST_MENU   = 0      # 呼び出し元 : メニュー
  1552.  HOST_MAP    = 1      # 呼び出し元 : マップ
  1553.  HOST_BATTLE = 2      # 呼び出し元 : 戦闘
  1554.  #--------------------------------------------------------------------------
  1555.  # ● オブジェクト初期化
  1556.  #     menu_index : コマンドのカーソル初期位置
  1557.  #     host_scene : 呼び出し元 (0..メニュー  1..マップ  2..戦闘)
  1558.  #--------------------------------------------------------------------------
  1559.  def initialize(menu_index = 0, host_scene = HOST_MENU)
  1560.    @menu_index = menu_index
  1561.    @host_scene = host_scene
  1562.  end
  1563.  #--------------------------------------------------------------------------
  1564.  # ● 開始処理
  1565.  #--------------------------------------------------------------------------
  1566.  def start
  1567.    super
  1568.    create_menu_background
  1569.  
  1570.    create_windows
  1571.    create_confirm_window
  1572.    adjust_window_location
  1573.  
  1574.    # 編成前のパーティを保存
  1575.    @battle_actors = $game_party.battle_members.dup
  1576.    @party_actors = $game_party.all_members.dup
  1577.  end
  1578.  #--------------------------------------------------------------------------
  1579.  # â—‹ ウィンドウの作成
  1580.  #--------------------------------------------------------------------------
  1581.  def create_windows
  1582.    # 編成用ウィンドウを作成
  1583.    @battle_member_window = Window_PartyFormBattleMember.new
  1584.    @party_member_window = Window_PartyFormAllMember.new
  1585.    @status_window = Window_PartyFormStatus.new
  1586.    @status_window.set_actor(@battle_member_window.actor)
  1587.  
  1588.    # その他のウィンドウを作成
  1589.    @battle_member_caption_window =
  1590.      Window_PartyFormCaption.new(KGC::LargeParty::BATTLE_MEMBER_CAPTION)
  1591.    @party_member_caption_window =
  1592.      Window_PartyFormCaption.new(KGC::LargeParty::PARTY_MEMBER_CAPTION)
  1593.    @control_window = Window_PartyFormControl.new
  1594.  end
  1595.  #--------------------------------------------------------------------------
  1596.  # â—‹ 確認ウィンドウの作成
  1597.  #--------------------------------------------------------------------------
  1598.  def create_confirm_window
  1599.    commands = KGC::LargeParty::CONFIRM_WINDOW_COMMANDS
  1600.    @confirm_window =
  1601.      Window_Command.new(KGC::LargeParty::CONFIRM_WINDOW_WIDTH, commands)
  1602.    @confirm_window.index = 0
  1603.    @confirm_window.x = (Graphics.width - @confirm_window.width) / 2
  1604.    @confirm_window.y = (Graphics.height - @confirm_window.height) / 2
  1605.    @confirm_window.z = 2000
  1606.    @confirm_window.openness = 0
  1607.    @confirm_window.active = false
  1608.  end
  1609.  #--------------------------------------------------------------------------
  1610.  # â—‹ ウィンドウの座標調整
  1611.  #--------------------------------------------------------------------------
  1612.  def adjust_window_location
  1613.    # 基準座標を計算
  1614.    base_x = [@battle_member_window.width, @party_member_window.width].max
  1615.    base_x = [(Graphics.width - base_x) / 2, 0].max
  1616.    base_y = @battle_member_window.height + @party_member_window.height +
  1617.      @status_window.height + CAPTION_OFFSET * 2
  1618.    base_y = [(Graphics.height - base_y) / 2, 0].max
  1619.  
  1620.    # 編成用ウィンドウの座標をセット
  1621.    @battle_member_window.x = base_x
  1622.    @battle_member_window.y = base_y + CAPTION_OFFSET
  1623.    @party_member_window.x = base_x
  1624.    @party_member_window.y = @battle_member_window.y +
  1625.      @battle_member_window.height + CAPTION_OFFSET
  1626.    @status_window.x = 0
  1627.    @status_window.y = @party_member_window.y + @party_member_window.height
  1628.  
  1629.    # その他のウィンドウの座標をセット
  1630.    @battle_member_caption_window.x = [base_x - 16, 0].max
  1631.    @battle_member_caption_window.y = @battle_member_window.y - CAPTION_OFFSET
  1632.    @party_member_caption_window.x = [base_x - 16, 0].max
  1633.    @party_member_caption_window.y = @party_member_window.y - CAPTION_OFFSET
  1634.    @control_window.x = @status_window.width
  1635.    @control_window.y = @status_window.y
  1636.  end
  1637.  #--------------------------------------------------------------------------
  1638.  # ● 終了処理
  1639.  #--------------------------------------------------------------------------
  1640.  def terminate
  1641.    super
  1642.    dispose_menu_background
  1643.    @battle_member_window.dispose
  1644.    @party_member_window.dispose
  1645.    @status_window.dispose
  1646.    @battle_member_caption_window.dispose
  1647.    @party_member_caption_window.dispose
  1648.    @control_window.dispose
  1649.    @confirm_window.dispose
  1650.  end
  1651.  #--------------------------------------------------------------------------
  1652.  # ● メニュー画面系の背景作成
  1653.  #--------------------------------------------------------------------------
  1654.  def create_menu_background
  1655.    super
  1656.    @menuback_sprite.z = 500
  1657.  end
  1658.  #--------------------------------------------------------------------------
  1659.  # ● 元の画面へ戻る
  1660.  #--------------------------------------------------------------------------
  1661.  def return_scene
  1662.    case @host_scene
  1663.    when HOST_MENU
  1664.      $scene = Scene_Menu.new(@menu_index)
  1665.    when HOST_MAP
  1666.      $scene = Scene_Map.new
  1667.    when HOST_BATTLE
  1668.      $scene = Scene_Battle.new
  1669.    end
  1670.    $game_player.refresh
  1671.  end
  1672.  #--------------------------------------------------------------------------
  1673.  # ● フレーム更新
  1674.  #--------------------------------------------------------------------------
  1675.  def update
  1676.    super
  1677.    update_menu_background
  1678.    update_window
  1679.    if @battle_member_window.active
  1680.      update_battle_member
  1681.    elsif @party_member_window.active
  1682.      update_party_member
  1683.    elsif @confirm_window.active
  1684.      update_confirm
  1685.    end
  1686.  end
  1687.  #--------------------------------------------------------------------------
  1688.  # â—‹ ウィンドウ更新
  1689.  #--------------------------------------------------------------------------
  1690.  def update_window
  1691.    @battle_member_window.update
  1692.    @party_member_window.update
  1693.    @status_window.update
  1694.    @battle_member_caption_window.update
  1695.    @party_member_caption_window.update
  1696.    @control_window.update
  1697.    @confirm_window.update
  1698.  end
  1699.  #--------------------------------------------------------------------------
  1700.  # â—‹ ウィンドウ再描画
  1701.  #--------------------------------------------------------------------------
  1702.  def refresh_window
  1703.    @battle_member_window.refresh
  1704.    @party_member_window.refresh
  1705.  end
  1706.  #--------------------------------------------------------------------------
  1707.  # â—‹ フレーム更新 (æˆ¦é—˜ãƒ¡ãƒ³ãƒãƒ¼ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ)
  1708.  #--------------------------------------------------------------------------
  1709.  def update_battle_member
  1710.    @status_window.set_actor(@battle_member_window.actor)
  1711.    if Input.trigger?(Input::A)
  1712.      if @battle_member_window.selected_index == nil  # 並び替え中でない
  1713.        actor = @battle_member_window.actor
  1714.        # ã‚¢ã‚¯ã‚¿ãƒ¼ã‚’å¤–ã›ãªã„å ´åˆ
  1715.        if actor == nil || $game_party.actor_fixed?(actor.id)
  1716.          Sound.play_buzzer
  1717.          return
  1718.        end
  1719.        # アクターを外す
  1720.        Sound.play_decision
  1721.        actors = $game_party.battle_members
  1722.        actors.delete_at(@battle_member_window.index)
  1723.        $game_party.set_battle_member(actors)
  1724.        refresh_window
  1725.      end
  1726.    elsif Input.trigger?(Input::B)
  1727.      if @battle_member_window.selected_index == nil  # 並び替え中でない
  1728.        # 確認ウィンドウに切り替え
  1729.        Sound.play_cancel
  1730.        show_confirm_window
  1731.      else                                            # 並び替え中
  1732.        # 並び替え解除
  1733.        Sound.play_cancel
  1734.        @battle_member_window.selected_index = nil
  1735.        @battle_member_window.refresh
  1736.        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
  1737.      end
  1738.    elsif Input.trigger?(Input::C)
  1739.      if @battle_member_window.selected_index == nil  # 並び替え中でない
  1740.        actor = @battle_member_window.actor
  1741.        # ã‚¢ã‚¯ã‚¿ãƒ¼ã‚’å¤–ã›ãªã„å ´åˆ
  1742.        if actor != nil && $game_party.actor_fixed?(actor.id)
  1743.          Sound.play_buzzer
  1744.          return
  1745.        end
  1746.        # パーティメンバーウィンドウに切り替え
  1747.        Sound.play_decision
  1748.        @battle_member_window.active = false
  1749.        @party_member_window.active = true
  1750.        @control_window.mode = Window_PartyFormControl::MODE_PARTY_MEMBER
  1751.      else                                            # 並び替え中
  1752.        unless can_change_shift?(@battle_member_window.actor)
  1753.          Sound.play_buzzer
  1754.          return
  1755.        end
  1756.        # 並び替え実行
  1757.        Sound.play_decision
  1758.        index1 = @battle_member_window.selected_index
  1759.        index2 = @battle_member_window.index
  1760.        change_shift(index1, index2)
  1761.        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
  1762.      end
  1763.    elsif Input.trigger?(Input::X)
  1764.      # ä¸¦ã³æ›¿ãˆä¸å¯èƒ½ãªå ´åˆ
  1765.      unless can_change_shift?(@battle_member_window.actor)
  1766.        Sound.play_buzzer
  1767.        return
  1768.      end
  1769.      if @battle_member_window.selected_index == nil  # 並び替え中でない
  1770.        # 並び替え開始
  1771.        Sound.play_decision
  1772.        @battle_member_window.selected_index = @battle_member_window.index
  1773.        @battle_member_window.refresh
  1774.        @control_window.mode = Window_PartyFormControl::MODE_SHIFT_CHANGE
  1775.      else                                            # 並び替え中
  1776.        # 並び替え実行
  1777.        Sound.play_decision
  1778.        index1 = @battle_member_window.selected_index
  1779.        index2 = @battle_member_window.index
  1780.        change_shift(index1, index2)
  1781.        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
  1782.      end
  1783.    end
  1784.  end
  1785.  #--------------------------------------------------------------------------
  1786.  # â—‹ 並び替え可否判定
  1787.  #--------------------------------------------------------------------------
  1788.  def can_change_shift?(actor)
  1789.    # é¸æŠžã—ãŸã‚¢ã‚¯ã‚¿ãƒ¼ãŒå­˜åœ¨ã—ãªã„ã€ã¾ãŸã¯ä¸¦ã³æ›¿ãˆä¸èƒ½ãªå ´åˆ
  1790.    if actor == nil ||
  1791.        (KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED &&
  1792.         $game_party.actor_fixed?(actor.id))
  1793.      return false
  1794.    end
  1795.    return true
  1796.  end
  1797.  #--------------------------------------------------------------------------
  1798.  # â—‹ 並び替え
  1799.  #--------------------------------------------------------------------------
  1800.  def change_shift(index1, index2)
  1801.    # 位置を入れ替え
  1802.    $game_party.change_shift(index1, index2)
  1803.    # 選択済みインデックスをクリア
  1804.    @battle_member_window.selected_index = nil
  1805.    refresh_window
  1806.  end
  1807.  #--------------------------------------------------------------------------
  1808.  # â—‹ フレーム更新 (ãƒ‘ãƒ¼ãƒ†ã‚£ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ)
  1809.  #--------------------------------------------------------------------------
  1810.  def update_party_member
  1811.    @status_window.set_actor(@party_member_window.actor)
  1812.    if Input.trigger?(Input::B)
  1813.      Sound.play_cancel
  1814.      # 戦闘メンバーウィンドウに切り替え
  1815.      @battle_member_window.active = true
  1816.      @party_member_window.active = false
  1817.        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
  1818.    elsif Input.trigger?(Input::C)
  1819.      actor = @party_member_window.actor
  1820.      # ã‚¢ã‚¯ã‚¿ãƒ¼ãŒæˆ¦é—˜ãƒ¡ãƒ³ãƒãƒ¼ã«å«ã¾ã‚Œã‚‹å ´åˆ
  1821.      if $game_party.battle_members.include?(actor)
  1822.        Sound.play_buzzer
  1823.        return
  1824.      end
  1825.      # アクターを入れ替え
  1826.      Sound.play_decision
  1827.      actors = $game_party.all_members
  1828.      battle_actors = $game_party.battle_members
  1829.      if @battle_member_window.actor != nil
  1830.        actors[@party_member_window.actor_index] = @battle_member_window.actor
  1831.        actors[@battle_member_window.index] = actor
  1832.        $game_party.set_member(actors.compact)
  1833.      end
  1834.      battle_actors[@battle_member_window.index] = actor
  1835.      $game_party.set_battle_member(battle_actors.compact)
  1836.      refresh_window
  1837.      # 戦闘メンバーウィンドウに切り替え
  1838.      @battle_member_window.active = true
  1839.      @party_member_window.active = false
  1840.      @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
  1841.    end
  1842.  end
  1843.  #--------------------------------------------------------------------------
  1844.  # â—‹ フレーム更新 (ç¢ºèªã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ)
  1845.  #--------------------------------------------------------------------------
  1846.  def update_confirm
  1847.    if Input.trigger?(Input::B)
  1848.      Sound.play_cancel
  1849.      hide_confirm_window
  1850.    elsif Input.trigger?(Input::C)
  1851.      case @confirm_window.index
  1852.      when 0  # 編成完了
  1853.        # ãƒ‘ãƒ¼ãƒ†ã‚£ãŒç„¡åŠ¹ã®å ´åˆ
  1854.        unless battle_member_valid?
  1855.          Sound.play_buzzer
  1856.          return
  1857.        end
  1858.        Sound.play_decision
  1859.        return_scene
  1860.      when 1  # 編成中断
  1861.        Sound.play_decision
  1862.        # パーティを編成前の状態に戻す
  1863.        $game_party.set_member(@party_actors)
  1864.        $game_party.set_battle_member(@battle_actors)
  1865.        return_scene
  1866.      when 2  # キャンセル
  1867.        Sound.play_cancel
  1868.        hide_confirm_window
  1869.      end
  1870.    end
  1871.  end
  1872.  #--------------------------------------------------------------------------
  1873.  # â—‹ 戦闘メンバー有効判定
  1874.  #--------------------------------------------------------------------------
  1875.  def battle_member_valid?
  1876.    return false if $game_party.battle_members.size == 0  # 戦闘メンバーが空
  1877.    $game_party.battle_members.each { |actor|
  1878.      return true if actor.exist?  # 生存者がいればOK
  1879.    }
  1880.    return false
  1881.  end
  1882.  #--------------------------------------------------------------------------
  1883.  # â—‹ 確認ウィンドウの表示
  1884.  #--------------------------------------------------------------------------
  1885.  def show_confirm_window
  1886.    if @battle_member_window.active
  1887.      @last_active_window = @battle_member_window
  1888.    else
  1889.      @last_active_window = @party_member_window
  1890.    end
  1891.    @battle_member_window.active = false
  1892.    @party_member_window.active = false
  1893.  
  1894.    @confirm_window.draw_item(0, battle_member_valid?)
  1895.    @confirm_window.open
  1896.    @confirm_window.active = true
  1897.  end
  1898.  #--------------------------------------------------------------------------
  1899.  # â—‹ 確認ウィンドウの非表示
  1900.  #--------------------------------------------------------------------------
  1901.  def hide_confirm_window
  1902.    @confirm_window.active = false
  1903.    @confirm_window.close
  1904.    @last_active_window.active = true
  1905.  end
  1906. end
  1907.  
  1908. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  1909. #☆★☆★☆★
  1910.  
  1911. #==============================================================================
  1912. # â–  Scene_Battle
  1913. #==============================================================================
  1914.  
  1915. class Scene_Battle < Scene_Base
  1916.  #--------------------------------------------------------------------------
  1917.  # ● メッセージ表示が終わるまでウェイト
  1918.  #--------------------------------------------------------------------------
  1919.  alias wait_for_message_KGC_LargeParty wait_for_message
  1920.  def wait_for_message
  1921.    return if @ignore_wait_for_message  # メッセージ終了までのウェイトを無視
  1922.  
  1923.    wait_for_message_KGC_LargeParty
  1924.  end
  1925.  #--------------------------------------------------------------------------
  1926.  # ● レベルアップの表示
  1927.  #--------------------------------------------------------------------------
  1928.  alias display_level_up_KGC_LargeParty display_level_up
  1929.  def display_level_up
  1930.    @ignore_wait_for_message = true
  1931.  
  1932.    display_level_up_KGC_LargeParty
  1933.  
  1934.    exp = $game_troop.exp_total * KGC::LargeParty::STAND_BY_EXP_RATE / 1000
  1935.    $game_party.stand_by_members.each { |actor|
  1936.    actor.gain_exp(exp, KGC::LargeParty::SHOW_STAND_BY_LEVEL_UP)
  1937.    }
  1938.    @ignore_wait_for_message = false
  1939.    wait_for_message
  1940.  end
  1941.  #--------------------------------------------------------------------------
  1942.  # ● パーティコマンド選択の開始
  1943.  #--------------------------------------------------------------------------
  1944.  alias start_party_command_selection_KGC_LargeParty start_party_command_selection
  1945.  def start_party_command_selection
  1946.    if $game_temp.in_battle
  1947.      @status_window.index = 0
  1948.    end
  1949.  
  1950.    start_party_command_selection_KGC_LargeParty
  1951.  end
  1952.  
  1953.  if KGC::LargeParty::USE_BATTLE_PARTYFORM
  1954.  #--------------------------------------------------------------------------
  1955.  # ● æƒ…å ±è¡¨ç¤ºãƒ“ãƒ¥ãƒ¼ãƒãƒ¼ãƒˆã®ä½œæˆ
  1956.  #--------------------------------------------------------------------------
  1957.  alias create_info_viewport_KGC_LargeParty create_info_viewport
  1958.  def create_info_viewport
  1959.    create_info_viewport_KGC_LargeParty
  1960.  
  1961.    @__command_partyform_index =
  1962.      @party_command_window.add_command(Vocab.partyform_battle)
  1963.    @party_command_window.draw_item(@__command_partyform_index,
  1964.      $game_party.battle_partyform_enable?)
  1965.  end
  1966.  #--------------------------------------------------------------------------
  1967.  # ● パーティコマンド選択の更新
  1968.  #--------------------------------------------------------------------------
  1969.  alias update_party_command_selection_KGC_LargeParty update_party_command_selection
  1970.  def update_party_command_selection
  1971.    if Input.trigger?(Input::C)
  1972.      case @party_command_window.index
  1973.      when @__command_partyform_index  # パーティ編成
  1974.        unless $game_party.battle_partyform_enable?
  1975.          Sound.play_buzzer
  1976.          return
  1977.        end
  1978.        Sound.play_decision
  1979.        process_partyform
  1980.        return
  1981.      end
  1982.    end
  1983.  
  1984.    update_party_command_selection_KGC_LargeParty
  1985.  end
  1986.  #--------------------------------------------------------------------------
  1987.  # â—‹ パーティ編成の処理
  1988.  #--------------------------------------------------------------------------
  1989.  def process_partyform
  1990.    Graphics.freeze
  1991.    snapshot_for_background
  1992.    $scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_BATTLE)
  1993.    $scene.main
  1994.    $scene = self
  1995.    @status_window.refresh
  1996.    perform_transition
  1997.  end
  1998.  end
  1999. end
  2000.  
  2001. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
  2002. #_/  The original untranslated version of this script can be found here:
  2003. # [url="http://f44.aaa.livedoor.jp/~ytomy/tkool/rpgtech/php/tech.php?tool=VX&cat=tech_vx/special_system&tech=large_party"]http://f44.aaa.livedoor.jp/~ytomy/tkool/rp...ech=large_party[/url]
  2004. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
Add Comment
Please, Sign In to add comment