赞 | 1 |
VIP | 0 |
好人卡 | 0 |
积分 | 6 |
经验 | 71075 |
最后登录 | 2017-9-1 |
在线时间 | 1752 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 575
- 在线时间
- 1752 小时
- 注册时间
- 2008-11-7
- 帖子
- 1431
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
- #==============================================================================
- # □ パーティ編成システム (for VX Ace)
- #------------------------------------------------------------------------------
- # Version : 1_20111229
- # by サリサ・タイクーン
- # http://www.tycoon812.com/rgss/
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported["CommandParty"] = true
- #==============================================================================
- # □ 素材スイッチ
- #==============================================================================
- $rgsslab = {} if $rgsslab == nil
- $rgsslab["队伍变更"] = true
- if $rgsslab["队伍变更"]
-
- #==============================================================================
- # ■ Scene_Menu 插入菜单指令
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- def command_formation
- SceneManager.call(Scene_Party_Organization_System)
- end
- end
- #==============================================================================
- # □ カスタマイズポイント
- #==============================================================================
- module RGSSLAB end
- module RGSSLAB::Party_Organization_System
- #--------------------------------------------------------------------------
- # ○ 待機メンバーのソート機能
- # trueにすると、待機メンバーの加入・離脱・パーティ編成システム画面において
- # 常にID順にソートされるようになります。
- #--------------------------------------------------------------------------
- SORT = true
- #--------------------------------------------------------------------------
- # ○ 強制フラグ
- # trueにすると、待機メンバーに加える際に、パーティメンバーにいる場合は
- # 強制的に待機メンバーへ移動させます。
- # (falseにすると、移動しない代わりに待機メンバーに加える事ができません)
- #--------------------------------------------------------------------------
- FORCE = true
- #--------------------------------------------------------------------------
- # ○ パーティ編成画面の一行辺りの待機メンバーの人数
- # 横に並べる際に、何人目で改行するのかを設定します。
- #
- # 空欄(それを選ぶと外れると言う意味)の分も含まれる為
- # 正確には、現在の待機メンバー+1の数で割り当てられる事に
- # ご注意下さい。
- #--------------------------------------------------------------------------
- COLUMN_MAX = 9
- #--------------------------------------------------------------------------
- # ○ 外す事のできないアクターの設定
- # IMPOSSIBLLITYに外す事のできないアクターIDを記述します。
- #
- # ここに記述されたアクターIDは、編成画面において
- # 選択する事ができなくなります。
- #
- # ・イベントコマンドのスクリプトでの変更方法
- # $game_system.rgsslab028.impossibillity = [アクターID, …]
- #--------------------------------------------------------------------------
- IMPOSSIBILLITY = []
- end
- # カスタマイズポイントは、ここまで
- #==============================================================================
- # □ RGSSLAB::Party_Organization_System [module]
- #==============================================================================
- module RGSSLAB::Party_Organization_System
- #--------------------------------------------------------------------------
- # ○ 素材設定用の定数定義
- #--------------------------------------------------------------------------
- MATERIAL_NAME = "队伍变更"
- VERSION = 1
- RELEASE = 20111229
- end
- #==============================================================================
- # ■ Game_System [class]
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :rgsslab028
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化 [エイリアス]
- #--------------------------------------------------------------------------
- alias party_organization_initialize initialize
- def initialize
- party_organization_initialize
- @rgsslab028 = RgssLab_028.new
- end
- end
- #==============================================================================
- # □ RgssLab_028 [class]
- #==============================================================================
- class RgssLab_028
- #--------------------------------------------------------------------------
- # ○ モジュールの設定
- #--------------------------------------------------------------------------
- RGSSLAB_028 = RGSSLAB::Party_Organization_System
- #--------------------------------------------------------------------------
- # ○ 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :impossibillity
- #--------------------------------------------------------------------------
- # ○ オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- @impossibillity = RGSSLAB_028::IMPOSSIBILLITY
- end
- end
- #==============================================================================
- # ■ Game_Party [class]
- #==============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # ○ モジュールの設定
- #--------------------------------------------------------------------------
- RGSSLAB_028 = RGSSLAB::Party_Organization_System
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :standby
- attr_reader :actors
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化 [エイリアス]
- #--------------------------------------------------------------------------
- alias party_organization_initialize initialize
- def initialize
- party_organization_initialize
- @standby = []
- end
- #--------------------------------------------------------------------------
- # ○ メンバーの入れ替え
- # new_members : 新しいパーティメンバーの配列
- #--------------------------------------------------------------------------
- def all_members=(new_members)
- @actors.clear
- count = 0
- for i in new_members
- @actors[count] = i
- count += 1
- end
- end
- #--------------------------------------------------------------------------
- # ○ 待機メンバーを加える
- # actor_id : アクター ID
- #--------------------------------------------------------------------------
- def add_actor_organization_system(actor_id)
- @standby.push(actor_id) unless @standby.include?(actor_id) && @actors.include?(actor_id)
- @standby.uniq!
- standby_sort
- $game_player.refresh
- setup_pos if $rgsslab["阵形导入"] && $rgsslab["阵形实施"]
- end
- #--------------------------------------------------------------------------
- # ○ 待機メンバーを外す
- # actor_id : アクター ID
- #--------------------------------------------------------------------------
- def remove_actor_organization_system(actor_id)
- @standby.delete(actor_id)
- standby_sort
- $game_player.refresh
- setup_pos if $rgsslab["阵形导入"] && $rgsslab["阵形实施"]
- end
- #--------------------------------------------------------------------------
- # ○ 待機メンバーのソート
- #--------------------------------------------------------------------------
- def standby_sort
- return unless RGSSLAB_028::SORT
- @standby.sort!{|a, b|
- a <=> b
- }
- end
- end
- #==============================================================================
- # ■ Game_Interpreter [class]
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # ○ モジュールの設定
- #--------------------------------------------------------------------------
- RGSSLAB_028 = RGSSLAB::Party_Organization_System
- #--------------------------------------------------------------------------
- # ○ 待機メンバーを加える
- # actor_id : アクターID
- #--------------------------------------------------------------------------
- def add_standby(actor_id)
- return if actor_id < 1
- $game_party.remove_actor(actor_id) if $game_party.actors.include?(actor_id) && RGSSLAB_028::FORCE && $game_party.actors.size > 1
- $game_party.add_actor_organization_system(actor_id)
- end
- #--------------------------------------------------------------------------
- # ○ 待機メンバーを外す
- # actor_id : アクターID
- # back : パーティ加入フラグ
- #--------------------------------------------------------------------------
- def remove_standby(actor_id, back = true)
- return if actor_id < 1
- $game_party.add_actor(actor_id) if back && $game_party.standby.include?(actor_id)
- $game_party.remove_actor_organization_system(actor_id)
- end
- #--------------------------------------------------------------------------
- # ○ パーティ編成システムの呼び出し
- #--------------------------------------------------------------------------
- def call_standby
- SceneManager.call(Scene_Party_Organization_System)
- Fiber.yield
- end
- end
- #==============================================================================
- # □ Window_Party_Organization_Help [class]
- #==============================================================================
- class Window_Party_Organization_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :text_index
- #--------------------------------------------------------------------------
- # ○ オブジェクト初期化 [オーバーライド]
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, Graphics.width, fitting_height(1))
- @text_index = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- case @text_index
- when 0
- str = "C按钮:决定 B按钮:编成终了"
- rect = contents.text_size(str)
- when 1
- str = "C按钮:决定 B按钮:取消"
- rect = contents.text_size(str)
- end
- contents.draw_text(4, 0, rect.width, line_height, str)
- end
- end
- #==============================================================================
- # □ Window_Party_Member
- #==============================================================================
- class Window_Party_Member < Window_Selectable
- #--------------------------------------------------------------------------
- # ○ オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- max = $game_party.all_members.size + 1
- @column_max = max
- @item_max = max
- super(0, 96, Graphics.width, 80)
- self.opacity = 0
- self.index = 0
- self.z = 101
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ 桁数の取得 [オーバーライド]
- #--------------------------------------------------------------------------
- def col_max
- return @column_max
- end
- #--------------------------------------------------------------------------
- # ○ 項目数の取得 [オーバーライド]
- #--------------------------------------------------------------------------
- def item_max
- return @item_max
- end
- #--------------------------------------------------------------------------
- # ○ リフレッシュ [オーバーライド]
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- for actor in $game_party.all_members do draw_actor(actor, actor.index) end
- end
- #--------------------------------------------------------------------------
- # ○ アクターグラフィックの描画
- # actor : アクター
- # index : 項目番号
- #--------------------------------------------------------------------------
- def draw_actor(actor, index)
- if $game_system.rgsslab028.impossibillity.include?(actor.id)
- draw_actor_graphic_impossibillity(actor, 16 + 48 * index, 40)
- else
- draw_actor_graphic(actor, 24 + 48 * index, 40)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 入れ替えのできないアクターの歩行グラフィック描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- #--------------------------------------------------------------------------
- def draw_actor_graphic_impossibillity(actor, x, y)
- return if actor.name == nil
- bitmap = Cache.character(actor.character_name)
- sign = actor.name[/^[\!\$]./]
- if sign != nil and sign.include?('$')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- n = actor.character_index
- src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, 64)
- end
- #--------------------------------------------------------------------------
- # ○ カーソルの更新 [オーバーライド]
- #--------------------------------------------------------------------------
- def update_cursor
- if @index < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(@index * 48, 0, 48, 48)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 最大値の再設定
- #--------------------------------------------------------------------------
- def max_reset
- @item_max = $game_party.members.size + 1
- end
- end
- #==============================================================================
- # □ Window_Standby_Member [class]
- #==============================================================================
- class Window_Standby_Member < Window_Selectable
- #--------------------------------------------------------------------------
- # ○ モジュールの設定
- #--------------------------------------------------------------------------
- RGSSLAB_028 = RGSSLAB::Party_Organization_System
- #--------------------------------------------------------------------------
- # ○ オブジェクト初期化 [オーバーライド]
- #--------------------------------------------------------------------------
- def initialize
- max = $game_party.standby.size
- if max == 0
- max = 1
- else
- max += 1
- end
- @column_max = RGSSLAB_028::COLUMN_MAX
- @item_max = max
- super(0, 208, Graphics.width, 128)
- self.opacity = 0
- self.index = -1
- self.active = false
- self.z = 101
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ 桁数の取得 [オーバーライド]
- #--------------------------------------------------------------------------
- def col_max
- return @column_max
- end
- #--------------------------------------------------------------------------
- # ○ 項目数の取得 [オーバーライド]
- #--------------------------------------------------------------------------
- def item_max
- return @item_max
- end
- #--------------------------------------------------------------------------
- # ○ リフレッシュ [オーバーライド]
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 48)
- end
- count = 0
- for actor in $game_party.standby
- draw_actor($game_actors[actor], count)
- count += 1
- end
- end
- #--------------------------------------------------------------------------
- # ○ アクターグラフィックの描画
- # actor : アクター
- # index : 項目番号
- #--------------------------------------------------------------------------
- def draw_actor(actor, index)
- draw_actor_graphic(actor, 24 + 48 * (index % @column_max), 40 + (index / @column_max * 48))
- end
- #--------------------------------------------------------------------------
- # ○ 先頭の行の取得 [オーバーライド]
- #--------------------------------------------------------------------------
- def top_row
- return self.oy / line_height
- end
- #--------------------------------------------------------------------------
- # ○ 先頭の行の設定 [オーバーライド]
- # row : 先頭に表示する行
- #--------------------------------------------------------------------------
- def top_row=(row)
- row = 0 if row < 0
- row = row_max - 1 if row > row_max - 1
- self.oy = row * line_height
- end
- #--------------------------------------------------------------------------
- # ○ 1 ページに表示できる行数の取得 [オーバーライド]
- #--------------------------------------------------------------------------
- def page_row_max
- #return (height - padding - padding_bottom) / line_height
- return height / line_height
- end
- #--------------------------------------------------------------------------
- # ○ カーソルの更新 [オーバーライド]
- #--------------------------------------------------------------------------
- def update_cursor
- if @index < 0
- self.cursor_rect.empty
- return
- end
- row = @index / @column_max
- if row < self.top_row
- self.top_row = row
- end
- if row > self.top_row + (self.page_row_max - 1)
- self.top_row = row - (self.page_row_max - 1)
- end
- x = @index % @column_max * 48
- y = @index / @column_max * 48 - self.oy
- self.cursor_rect.set(x, y, 48, 48)
- end
- #--------------------------------------------------------------------------
- # ○ 最大値の再設定
- #--------------------------------------------------------------------------
- def max_reset
- max = $game_party.standby.size
- if max == 0
- max = 1
- else
- max += 1
- end
- @item_max = max
- end
- end
- #==============================================================================
- # □ Window_Actor_Information [class]
- #==============================================================================
- class Window_Actor_Information < Window_Base
- #--------------------------------------------------------------------------
- # ○ オブジェクト初期化 [オーバーライド]
- # actor : 一番最初のアクター情報
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 322, Graphics.width, 78)
- refresh(actor)
- end
- #--------------------------------------------------------------------------
- # ○ リフレッシュ
- # actor : アクター情報
- #--------------------------------------------------------------------------
- def refresh(actor)
- contents.clear
- if actor != nil
- actor = $game_actors[actor] if actor.is_a?(Numeric)
- draw_actor_graphic(actor, 22, 48)
- draw_actor_name(actor, 64, 0)
- draw_actor_class(actor, 208, 0)
- draw_actor_level(actor, 64, 24)
- draw_actor_hp(actor, 208, 24)
- draw_actor_mp(actor, 336, 24)
- end
- end
- end
- #==============================================================================
- # □ Window_Party_Organization [class]
- #==============================================================================
- class Window_Party_Organization < Window_Base
- #--------------------------------------------------------------------------
- # ○ オブジェクト初期化 [オーバーライド]
- #--------------------------------------------------------------------------
- def initialize
- super(0, 48, Graphics.width, 274)
- self.opacity = 255
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- contents.draw_text(4, 0, 155, line_height, "作战成员")
- contents.draw_text(4, 112, 155, line_height, "待机" )
- end
- end
- #==============================================================================
- # □ Scene_Party_Organization_System [class]
- #==============================================================================
- class Scene_Party_Organization_System < Scene_Base
- #--------------------------------------------------------------------------
- # ○ モジュールの設定
- #--------------------------------------------------------------------------
- RGSSLAB_028 = RGSSLAB::Party_Organization_System
- #--------------------------------------------------------------------------
- # ○ 開始処理
- #--------------------------------------------------------------------------
- def start
- super
- create_windows
- @temporary_actor = nil
- end
- #--------------------------------------------------------------------------
- # ○ ウィンドウの作成
- #--------------------------------------------------------------------------
- def create_windows
- @help_window = Window_Party_Organization_Help.new
- @party_member_window = Window_Party_Member.new
- @standby_member_window = Window_Standby_Member.new
- @information_window = Window_Actor_Information.new($game_party.all_members[0])
- @organization_window = Window_Party_Organization.new
- @party_member_window.active = true
- end
- #--------------------------------------------------------------------------
- # ○ フレーム更新
- #--------------------------------------------------------------------------
- def update
- super
- if @party_member_window.active
- update_party_member_window
- return
- end
- if @standby_member_window.active
- update_standby_member_window
- return
- end
- end
- #--------------------------------------------------------------------------
- # ○ フレーム更新:パーティメンバーウィンドウ
- #--------------------------------------------------------------------------
- def update_party_member_window
- @information_window.refresh($game_party.members[@party_member_window.index])
- if Input.trigger?(Input::B)
- Sound.play_cancel
- SceneManager.return
- return
- end
- if Input.trigger?(Input::C)
- if $game_system.rgsslab028.impossibillity.include?($game_party.members[@party_member_window.index])
- Sound.play_buzzer
- return
- end
- Sound.play_ok
- @temporary_actor = $game_party.members[@party_member_window.index]
- @party_member_window.active = false
- @standby_member_window.active = true
- @standby_member_window.index = 0
- @help_window.text_index = 1
- @help_window.refresh
- return
- end
- end
- #--------------------------------------------------------------------------
- # ○ フレーム更新:待機メンバーウィンドウ
- #--------------------------------------------------------------------------
- def update_standby_member_window
- @information_window.refresh($game_party.standby[@standby_member_window.index])
- if Input.trigger?(Input::B)
- Sound.play_cancel
- return_party_member_process
- return
- end
- if Input.trigger?(Input::C)
- temp = $game_party.standby[@standby_member_window.index]
- if @temporary_actor != nil
- if $game_party.standby[@standby_member_window.index] != nil
- $game_party.standby[@standby_member_window.index] = @temporary_actor.id
- temp_members = []
- for i in $game_party.all_members
- temp_members.push(i.id)
- end
- temp_members[@party_member_window.index] = temp
- $game_party.all_members = temp_members
- else
- if $game_party.members.size == 1
- Sound.play_buzzer
- return
- end
- temp = $game_party.members[@party_member_window.index]
- $game_party.remove_actor($game_party.members[@party_member_window.index].id)
- $game_party.add_actor_organization_system(temp.id)
- end
- else
- if $game_party.standby[@standby_member_window.index] == nil
- Sound.play_buzzer
- return
- end
- $game_party.add_actor($game_party.standby[@standby_member_window.index])
- $game_party.remove_actor_organization_system($game_party.standby[@standby_member_window.index])
- end
- Sound.play_ok
- $game_party.standby_sort
- $game_player.refresh
- @party_member_window.refresh
- @standby_member_window.refresh
- return_party_member_process
- return
- end
- end
- #--------------------------------------------------------------------------
- # ○ パーティメンバーウィンドウ復帰処理
- #--------------------------------------------------------------------------
- def return_party_member_process
- @temporary_actor = nil
- @party_member_window.active = true
- @standby_member_window.active = false
- @standby_member_window.index = -1
- @party_member_window.max_reset
- @standby_member_window.max_reset
- @help_window.text_index = 0
- @help_window.refresh
- end
- end
- end
- class Game_Unit
- def battle_party_change?
- if $game_party.standby.size >= 1
- return true
- else
- return false
- end
- end
- end
- class Scene_Battle
- alias saba_kiseki_party_create_party_command_window create_party_command_window
- def create_party_command_window
- saba_kiseki_party_create_party_command_window
- @party_command_window.set_handler(:party, method(:command_party))
- end
-
- def command_party
- SceneManager.call(Scene_Party_Organization_System)
-
- end
-
- end
- class Window_PartyCommand
- alias saba_kiseki_party_make_command_list make_command_list
- def make_command_list
- saba_kiseki_party_make_command_list
- add_party_command
- end
-
- def add_party_command
- text="候补"
- add_command(text, :party, $game_party.battle_party_change?)
- end
- end
复制代码 |
|