Advertisement
cari974

KGC_LargeParty

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