battle-maiden-mizuki/Scripts/_.8.rb
2025-06-19 00:08:10 -05:00

581 lines
No EOL
22 KiB
Ruby
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#==============================================================================
# ■ RGSS3 戦闘中パーティ入れ替え&パーティ入れ替え封印特徴 Ver1.02 by 星潟
#==============================================================================
# 戦闘中、パーティコマンドからパーティメンバーの入れ替えを行えるようにします。
# 控えメンバーがいない場合は使用できません。
#
# また、パーティメンバーの入れ替えを封印する特徴を設定可能になります。
#
# 当方の他サイト対応素材における下記スクリプトは
# このスクリプトにも同じように、拡張スクリプトとして使用できます。
#
# 戦闘後パーティメンバー復元
# 戦闘後パーティメンバー復元機能をメニュー画面で切り替え
#==============================================================================
# 特徴を有する項目のメモ欄に下記のように記述する事で効果を発揮します。
#------------------------------------------------------------------------------
# <戦闘中入れ替え不可>
#
# このアクターの戦闘中の入れ替えが禁止されます。
#==============================================================================
module PTMCB
#パーティ入れ替えコマンドの有効化スイッチを指定します。
#ここで指定したスイッチがONの時のみ入れ替えが可能になります。
#0にした場合は、常時入れ替え可能になります。
I = 0
#入れ替え不可特徴設定用キーワードを指定。
W = "Cannot be replaced in battle"
#パーティメンバー入れ替えコマンド名を指定。
C = "Switch"
#ヘルプウィンドウに表示するテキストを指定。
#例.["入れ替える戦闘メンバーを選択して下さい。","入れ替える控えメンバーを選択して下さい。"]
#この場合、入れ替える戦闘メンバー選択時には
#「入れ替える戦闘メンバーを選択して下さい。」の文章。(鍵括弧は除く)
#入れ替える控えメンバー選択時には
#「入れ替える控えメンバーを選択して下さい。」の文章(鍵括弧は除く)が
#ヘルプウィンドウに表示される。
H = ["Please select the shikigami to switch out.","Please select the standby shikigami to switch in."]
#ステート無効の特徴が付与されている場合
#ステート有効度の表示を"無効"と表示するか、0もしくは100と表示するか
#trueで"無効"、falseで0か100。
R = false
#空の配列を用意。
S = []
#以下にステータス描写設定を行います。
#顔グラフィック・キャラグラフィックは設定項目3種。実質2種
#(:xと:yの後の値がそれぞれX座標とY座標)
#顔グラフィック描写設定。
S.push({:t => "F",:x => 0,:y => 24})
#顔グラフィック描写設定。
#S.push({:t => "G",:x => 16,:y => 120})
#アイコン通常能力値までは設定項目4種。実質3種
#(:xと:yの後の値がそれぞれX座標とY座標、:wの後の値が項目の幅)
#アイコン描写設定。
S.push({:t => "I",:x => 120,:y => 24,:w => 96})
#アクター名描写設定。
S.push({:t => "A",:x => 0,:y => 0,:w => 112})
#クラス名描写設定。
S.push({:t => "C",:x => 120,:y => 0,:w => 112})
#HP描写設定。
S.push({:t => 0,:x => 120,:y => 48,:w => 160})
#MP描写設定。
S.push({:t => 1,:x => 120,:y => 72,:w => 160})
#TP描写設定。
# S.push({:t => "T",:x => 120,:y => 96,:w => 160})
#攻撃力描写設定。
S.push({:t => 2,:x => 0,:y => 144,:w => 120})
#防御力描写設定。
S.push({:t => 3,:x => 0,:y => 168,:w => 120})
#魔法力描写設定。
S.push({:t => 4,:x => 0,:y => 192,:w => 120})
#魔法防御描写設定。
S.push({:t => 5,:x => 0,:y => 216,:w => 120})
#敏捷力描写設定。
S.push({:t => 6,:x => 0,:y => 240,:w => 120})
#運描写設定。
S.push({:t => 7,:x => 0,:y => 264,:w => 120})
#以下、「#」を使用してコメントアウト済み。
#使用する場合はここまでの処理を参考に式部分だけ外して下さい。
#追加能力値は設定項目5種。
#(:tの後の数字は種類に応じた値に1000を足した物。
# :xと:yの後の値がそれぞれX座標とY座標、:wの後の値が項目の幅、:nameの後が項目名)
#命中率描写設定。
#S.push({:t => 1000,:x => 124,:y => 144,:w => 120,:name => "命中率"})
#回避率描写設定。
#S.push({:t => 1001,:x => 124,:y => 168,:w => 120,:name => "回避率"})
#会心率描写設定。
#S.push({:t => 1002,:x => 124,:y => 192,:w => 120,:name => "会心率"})
#会心回避描写設定。
#S.push({:t => 1003,:x => 124,:y => 216,:w => 120,:name => "会心回避"})
#魔法回避描写設定。
#S.push({:t => 1004,:x => 124,:y => 240,:w => 120,:name => "魔法回避"})
#魔法反射描写設定。
#S.push({:t => 1005,:x => 124,:y => 264,:w => 120,:name => "魔法反射"})
#特殊能力値は設定項目5種。
#(:tの後の数字は種類に応じた値に2000を足した物。
# :xと:yの後の値がそれぞれX座標とY座標、:wの後の値が項目の幅、:nameの後が項目名)
#狙われ率描写設定。
#S.push({:t => 2000,:x => 0,:y => 288,:w => 120,:name => "狙われ率"})
#属性有効度ステート有効度までは設定項目6種。
#(:tの後の数字は種類に応じた値に特定の値を足した物。
# 属性有効度なら属性IDに3000を足した値。
# 弱体有効度なら弱体対象の能力値IDに4000を足した値。
# ステート有効度ならステートIDに5000を足した値。
# :xと:yの後の値がそれぞれX座標とY座標、:wの後の値が項目の幅、
# :nameの後が項目名、:rの後は表示する値を100から本来の値を引いた値にするかの指定)
#属性ID3有効度描写設定。#を使用してコメントアウト済み。使用する場合は外して下さい。
#S.push({:t => 3003,:x => 0,:y => 312,:w => 120,:name => "炎耐性",:r => true})
#防御弱体有効度描写設定。#を使用してコメントアウト済み。使用する場合は外して下さい。
#S.push({:t => 4003,:x => 124,:y => 288,:w => 120,:name => "防御弱体",:r => true})
#ステートID2有効度設定。#を使用してコメントアウト済み。使用する場合は外して下さい。
#S.push({:t => 5002,:x => 124,:y => 312,:w => 120,:name => "毒耐性",:r => true})
end
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# 開始処理
#--------------------------------------------------------------------------
alias start_ptm_window start
def start
ptm_atf_clear
start_ptm_window
end
#--------------------------------------------------------------------------
# 全ウィンドウの作成
#--------------------------------------------------------------------------
alias create_all_windows_ptm_window create_all_windows
def create_all_windows
create_all_windows_ptm_window
create_ptmh_window
create_ptmi_window
create_ptmo_window
create_ptms_window
end
#--------------------------------------------------------------------------
# パーティコマンドウィンドウの作成
#--------------------------------------------------------------------------
alias create_party_command_window_ptm_window create_party_command_window
def create_party_command_window
create_party_command_window_ptm_window
@party_command_window.set_handler(:ptm_change, method(:ptm_change_start))
end
#--------------------------------------------------------------------------
# パーティ入れ替えヘルプウィンドウの作成
#--------------------------------------------------------------------------
def create_ptmh_window
@window_ptmh = Window_Help.new(1)
@window_ptmh.back_opacity = 255
@window_ptmh.hide
end
#--------------------------------------------------------------------------
# 戦闘メンバーウィンドウの作成
#--------------------------------------------------------------------------
def create_ptmi_window
@window_ptmi = Window_PTMI.new
@window_ptmi.set_handler(:ptmi_select, method(:ptmi_select))
@window_ptmi.set_handler(:cancel, method(:ptmi_cancel))
@window_ptmi.y = @window_ptmh.height
end
#--------------------------------------------------------------------------
# 控えメンバーウィンドウの作成
#--------------------------------------------------------------------------
def create_ptmo_window
y = @window_ptmi.y + @window_ptmi.height
@window_ptmo = Window_PTMO.new(@window_ptmi,Graphics.height - y)
@window_ptmo.set_handler(:ptmo_select, method(:ptmo_select))
@window_ptmo.set_handler(:cancel,method(:ptmo_cancel))
@window_ptmo.y = y
end
#--------------------------------------------------------------------------
# 選択アクターステータスウィンドウの作成
#--------------------------------------------------------------------------
def create_ptms_window
@window_ptms = Window_PTM_Status.new(@window_ptmo,@window_ptmi,Graphics.height - @window_ptmh.height)
@window_ptms.x = @window_ptmi.width
@window_ptms.y = @window_ptmh.height
@window_ptms.hide
end
#--------------------------------------------------------------------------
# 入れ替えの実行
#--------------------------------------------------------------------------
def ptm_change
create_ptm_windows
@window_ptmi.activate
end
#--------------------------------------------------------------------------
# 入れ替え開始
#--------------------------------------------------------------------------
def ptm_change_start
ptm_change
@window_ptmh.show
@window_ptmi.show
@window_ptmo.show
@window_ptms.show
end
#--------------------------------------------------------------------------
# メンバー入れ替え
#--------------------------------------------------------------------------
def ptm_change
@window_ptmi.activate
@window_ptmi.refresh
@window_ptmo.y = @window_ptmi.y + @window_ptmi.height
@window_ptmo.refresh
@window_ptms.refresh
@window_ptmh.set_text(PTMCB::H[0])
end
#--------------------------------------------------------------------------
# 戦闘メンバー選択
#--------------------------------------------------------------------------
def ptmi_select
@window_ptmo.activate
@window_ptmh.set_text(PTMCB::H[1])
end
#--------------------------------------------------------------------------
# 選択終了
#--------------------------------------------------------------------------
def ptmi_cancel
@party_command_window.activate
refresh_status
@window_ptmh.hide
@window_ptmi.hide
@window_ptmo.hide
@window_ptms.hide
$game_party.make_actions
end
#--------------------------------------------------------------------------
# 控えメンバー選択
#--------------------------------------------------------------------------
def ptmo_select
a = [@window_ptmi.actor,@window_ptmo.actor].inject([]) {|r,i| r += [$game_party.all_members.index(i)]}
$game_party.swap_order(a[0],a[1])
ptm_change
end
#--------------------------------------------------------------------------
# 控えメンバーキャンセル
#--------------------------------------------------------------------------
def ptmo_cancel
@window_ptmi.activate
@window_ptmh.set_text(PTMCB::H[0])
end
#--------------------------------------------------------------------------
# ターン開始
#--------------------------------------------------------------------------
alias turn_start_ptm_change turn_start
def turn_start
ptm_atf_clear
turn_start_ptm_change
end
#--------------------------------------------------------------------------
# 行動回数リセット
#--------------------------------------------------------------------------
def ptm_atf_clear
$game_party.members.each {|i| i.action_times_fix = nil}
end
end
class Game_BattlerBase
#--------------------------------------------------------------------------
# 戦闘中パーティ変更禁止
#--------------------------------------------------------------------------
def party_c_sib
feature_objects.any? {|f| f.party_c_sib}
end
end
class Game_Battler < Game_BattlerBase
attr_accessor :action_times_fix
#--------------------------------------------------------------------------
# 行動回数の決定
#--------------------------------------------------------------------------
alias make_action_times_ptm_window make_action_times
def make_action_times
if self.actor?
@action_times_fix ||= make_action_times_ptm_window
else
make_action_times_ptm_window
end
end
end
class Window_PartyCommand < Window_Command
#--------------------------------------------------------------------------
# コマンドリストの作成
#--------------------------------------------------------------------------
alias make_command_list_ptm_window make_command_list
def make_command_list
make_command_list_ptm_window
i = PTMCB::I
d = $game_party.all_members.size > $game_party.battle_members.size && (i == 0 or $game_switches[i])
add_command(PTMCB::C,:ptm_change,d)
end
end
class Window_PTMB < Window_Command
#--------------------------------------------------------------------------
# オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
actors_get
super(0, 0)
self.back_opacity = 255
deactivate
hide
end
#--------------------------------------------------------------------------
# ウィンドウの幅を取得
#--------------------------------------------------------------------------
def window_width
Graphics.width / 2
end
#--------------------------------------------------------------------------
# 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
super(index)
r = item_rect(index)
draw_actor_hp(@actors[index], r.width - 144, r.y, 140)
end
#--------------------------------------------------------------------------
# リフレッシュ
#--------------------------------------------------------------------------
def refresh
actors_get
super
end
#--------------------------------------------------------------------------
# アクター情報取得
#--------------------------------------------------------------------------
def actor
@actors[self.index]
end
end
class Window_PTMI < Window_PTMB
#--------------------------------------------------------------------------
# アクター配列取得
#--------------------------------------------------------------------------
def actors_get
@actors = $game_party.battle_members
end
#--------------------------------------------------------------------------
# 項目数の取得
#--------------------------------------------------------------------------
def item_max
$game_party.battle_members.size
end
#--------------------------------------------------------------------------
# コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
@actors.each {|a| add_command(a.name, :ptmi_select, !a.party_c_sib, a.id)}
end
#--------------------------------------------------------------------------
# 表示行数の取得
#--------------------------------------------------------------------------
def visible_line_number
$game_party.max_battle_members
end
end
class Window_PTMO < Window_PTMB
#--------------------------------------------------------------------------
# オブジェクト初期化(とりあえず)
#--------------------------------------------------------------------------
def initialize
super
end
#--------------------------------------------------------------------------
# オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_ptmo initialize
def initialize(window,height)
@ptmi_window = window
@height = height
initialize_ptmo
end
#--------------------------------------------------------------------------
# アクター配列取得
#--------------------------------------------------------------------------
def actors_get
b = $game_party.battle_members
@actors = $game_party.all_members.select {|i| !b.include?(i)}
end
#--------------------------------------------------------------------------
# ウィンドウの高さ
#--------------------------------------------------------------------------
def window_height
@height
end
#--------------------------------------------------------------------------
# コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
l = command_usable?
@actors.each {|a| add_command(a.name, :ptmo_select,!a.party_c_sib && (l or a.alive?), a.id)}
end
#--------------------------------------------------------------------------
# 更新
#--------------------------------------------------------------------------
def update
super
cu = command_usable?
if @lcu != cu
@lcu = cu
refresh
end
end
#--------------------------------------------------------------------------
# コマンド特殊制限
#--------------------------------------------------------------------------
def command_usable?
($game_party.battle_members.select {|a| a.alive?}).size > 1 or !@ptmi_window.actor.alive?
end
end
class Window_PTM_Status < Window_Base
#--------------------------------------------------------------------------
# 初期化
#--------------------------------------------------------------------------
def initialize(window1,window2,h)
@window1 = window1
@window2 = window2
super(0,0,@window1.width,h)
self.back_opacity = 255
end
#--------------------------------------------------------------------------
# リフレッシュ
#--------------------------------------------------------------------------
def refresh
create_contents
a = actor
return unless a
PTMCB::S.each {|i| draw_item(a,i)}
end
#--------------------------------------------------------------------------
# 項目描写
#--------------------------------------------------------------------------
def draw_item(actor,h)
x = h[:x]
y = h[:y]
w = h[:w]
a = actor
case h[:t]
when "A"
draw_actor_name(a, x, y)
when "C"
draw_actor_class(a, x, y)
when "N"
draw_actor_nickname(a, x, y)
when "F"
draw_actor_face(a, x, y)
when "G"
draw_actor_graphic(a, x, y)
when "I"
draw_actor_icons(a, x, y)
when "T"
draw_actor_tp(a, x, y)
when 0
draw_actor_hp(a, x, y)
when 1
draw_actor_mp(a, x, y)
else
draw_actor_param_ptms(a, x, y, h, w)
end
end
#--------------------------------------------------------------------------
# パラメータ描写
#--------------------------------------------------------------------------
def draw_actor_param_ptms(actor, x, y, h, w)
change_color(system_color)
draw_text(x,y,w,line_height,h[:name] ? h[:name] : Vocab.param(h[:t]))
change_color(normal_color)
case h[:t]
when 2..999
d = actor.param(h[:t])
when 1000..1999
d = ((actor.xparam(h[:t] - 1000)) * 100).to_i
when 2000..2999
d = ((actor.sparam(h[:t] - 2000)) * 100).to_i
when 3000..3999
d = ((actor.element_rate(h[:t] - 3000)) * 100).to_i
d = 100 - d if h[:r]
when 4000..4999
d = ((actor.debuff_rate(h[:t] - 4000)) * 100).to_i
d = 100 - d if h[:r]
when 5000..5999
i = h[:t] - 5000
if actor.state_resist?(i)
d = PTMCB::R ? "無効" : (h[:r] ? 100 : 0)
else
d = ((actor.state_rate(i)) * 100).to_i
d = 100 - d if h[:r]
end
end
draw_text(x,y,w,line_height,d, 2)
end
#--------------------------------------------------------------------------
# 選択されているアクター
#--------------------------------------------------------------------------
def actor
[@window1,@window2].each {|w| return w.actor if w.active}
nil
end
#--------------------------------------------------------------------------
# 更新
#--------------------------------------------------------------------------
def update
super
if actor && @la_id != actor.id
@la_id = actor.id
refresh
end
end
end
class RPG::BaseItem
#--------------------------------------------------------------------------
# 戦闘中パーティ変更禁止
#--------------------------------------------------------------------------
def party_c_sib
@party_c_sib ||= /<#{PTMCB::W}>/ =~ note
end
end