battle-maiden-mizuki/Scripts/_.10.rb
2025-06-17 11:57:06 -05:00

690 lines
No EOL
28 KiB
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.01
# 2013/12/23公開
# 2014/03/03 STATUS_MODEが無効になっていたのを修正
# C Winter (http://ccwinter.blog.fc2.com/)
#==============================================================================
module BattleCommand_Custom
#--------------------------------------------------------------------------
# ● 設定項目
#--------------------------------------------------------------------------
# 用語
# アクターコマンドウインドウ: 「攻撃、防御、スキル、アイテム」を選択
# パーティコマンドウインドウ: 「戦う、逃げる」を選択
# ステータスウインドウ 各キャラのHPなどを表示
# アクターコマンドウインドウの表示位置
# 0: ステータスの右に表示(デフォルトと同じ)
# 1: ステータスの左に表示(デフォルトのパーティコマンドの位置)
# 2: ACTOR_WINDOW_POSで指定した位置に表示
ACTOR_MODE = 0
# ※ACTOR_MODEが2の時のみ
# アクターコマンドウインドウの位置指定 [x座標, y座標]
ACTOR_WINDOW_POS = [0, 296]
# ※ACTOR_MODEが2の時のみ
# ウインドウy座標の基準
# 0:「ACTOR_WINDOW_POSのy座標」をウインドウの上端にする
# 1:「ACTOR_WINDOW_POSのy座標」をウインドウの下端にする
ACTOR_WINDOW_Y_MODE = 1
# ※ACTOR_MODEが2の時のみ
# コマンドウインドウの1ページの「縦の行数」の[最小数, 最大数]
# 行が「最小数」より少ない場合、余った行は空白
# 行が「最大数」より多い場合、スクロールで表示
ACTOR_ROW = [2, 4]
# コマンドウインドウの[横の列数, ウインドウの横幅]
# 「横の列数」を nil にすると、横の列数はコマンドの数と同じになる
# (列数とコマンドの数が同じ=1行で全コマンドを表示)
# ウインドウの横幅はデフォルトでは128
ACTOR_COL = [1, 128]
# アクターコマンドに表示するコマンドを指定
# 攻撃は   :attack
# スキルは  :skill
# 防御は   :guard
# アイテムは :item
# 逃走は   :escape
# 指定した並び順でアクターコマンドに表示する 指定しなかったものは表示されない
# アイテムを使わないゲーム、攻撃と防御を無くしてスキルのみ使うゲーム、
# パーティコマンドを無くしてアクターコマンドで逃走するゲーム などが作れる
# デフォルト [:attack, :skill, :guard, :item]
# 逃走を追加 [:attack, :skill, :guard, :item, :escape]
ACTOR_COMMAND_LIST = [:skill, :item]
# アクターコマンドの各項目にアイコンを表示するかどうか
# true なら表示する false なら表示しない
ACTOR_ICON = true
# ※ACTOR_ICONが true の時のみ
#  スキルのスキルタイプごとのアイコン番号
ACTOR_ICON_SKILL = [490, 117, 16, 16, 16, 16, 16, 16]
# ※ACTOR_ICONが true の時のみ
# [通常攻撃, 防御, アイテム, 逃走] のアイコン番号
ACTOR_ICON_OTHER = [116, 160, 510, 467]
# ※ACTOR_ICONが true の時のみ
# true : 通常攻撃のアイコンを「装備している武器」のアイコンにする
# false : 通常攻撃のアイコンを ACTOR_ICON_OTHER で設定したアイコンにする
#  (ここが true なら
# スキルリストの「ID1番のスキル」も「装備している武器」のアイコンにする
ACTOR_ICON_ATTACK_WEAPON = true
# パーティコマンド(戦う、逃げる)の形式
# 0: ステータスの左に表示(デフォルトと同じ)
# 1: ステータスの右に表示(デフォルトのアクターコマンドの位置)
# 2: パーティコマンドウインドウを画面上部 横幅いっぱいに表示
# 3: パーティコマンドを無くす
PARTY_MODE = 1
# パーティコマンドの各項目にアイコンを表示するかどうか
# true なら表示する false なら表示しない
PARTY_ICON = true
# ※PARTY_ICON が true の時のみ
# 各項目のアイコン番号(パーティコマンドの数だけ設定)
PARTY_ICON_LIST = [597, 598, 599, 599]
# ステータスウインドウの横幅
# 0: デフォルトと同じ横幅
# 1: 画面サイズと同じ横幅(ゲージの長さなどもそれに合わせて表示されます)
STATUS_MODE = 0
STATUS_X = [128, 128, 128]
# 画面下部の「パーティコマンドとステータスとアクターコマンド のセット」の位置
#
# それぞれ[パーティコマンド選択中, アクターコマンド選択中, ターン中]の位置指定
# 設定値は
# 0:右側に移動 アクターコマンドは右の画面外に押し出される
# 64:中央に移動 ターン中
# 128:左側に移動 パーティコマンドは左の画面外に押し出される
# ACTOR_MDOEやPARTY_MODEが2以上だと、
#  そのウインドウはずっと定位置にあるのでステータスと一緒に動くことはない)
# 設定例
# ACTOR_MODEが0、PARTY_MODEが0   の時は[0, 128, 64]
# ACTOR_MODEが0、PARTY_MODEが2以上 の時は[64, 128, 64]や[128, 128, 128]
# ACTOR_MODEが2、PARTY_MODEが0   の時は[0, 64, 64] や[0, 128, 128]
# ACTOR_MODEが2、PARTY_MODEが2以上 の時は[64, 64, 64] や[128, 128, 128]
# STATUS_MODEが1 の時は[128, 128, 128]
=begin
XPスタイルバトル使用時
ACTOR_MODE
ACTOR_WINDOW_POS
ACTOR_WINDOW_Y_MODE
は無効 アクターコマンドの座標は、XPスタイルバトル側の設定で決まる
STATUS_MODE
STATUS_X
は無効
=end
end
#==============================================================================
# ■ BattleCommand_Custom
#==============================================================================
module BattleCommand_Custom
def self.xp_style?
return ($lnx_include != nil and $lnx_include[:lnx11a] != nil)
end
def self.no_xp_style?
return !(self.xp_style?)
end
def self.default_under_viewport?
return false if self.xp_style?
return true
end
def self.default_actor_command_window?
return false if self.xp_style?
return false if ACTOR_MODE == 2
return true
end
def self.wide_party_window?
return true if self.xp_style?
return true if PARTY_MODE == 2
return false
end
end
$cwinter_script_battle_command_custom = true
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 情報表示ビューポートの更新
#--------------------------------------------------------------------------
def update_info_viewport
if BattleCommand_Custom.default_under_viewport?
move_info_viewport(BattleCommand_Custom::STATUS_X[0]) if @party_command_window.active
move_info_viewport(BattleCommand_Custom::STATUS_X[1]) if @actor_command_window.active
move_info_viewport(BattleCommand_Custom::STATUS_X[2]) if BattleManager.in_turn?
end
if sideview_actor_pos_command?
@actor_command_window.set_position
end
end
def sideview_actor_pos_command?
return false
end
#--------------------------------------------------------------------------
# ● 全ウィンドウの作成
#--------------------------------------------------------------------------
alias :battle_command_custom_create_all_windows :create_all_windows
def create_all_windows
battle_command_custom_create_all_windows
default_create_all_windows if BattleCommand_Custom.no_xp_style?
xp_style_create_all_windows if BattleCommand_Custom.xp_style?
end
def default_create_all_windows
# アクターコマンドの位置を変えると
# ウインドウリフォーム使用時にスキルウインドウ等と重なって変なことになる
# のを防止するためz座標を変更
@actor_command_window.z = 5
@actor_command_window.viewport = nil if BattleCommand_Custom::ACTOR_MODE >= 2
@party_command_window.viewport = nil if BattleCommand_Custom::PARTY_MODE >= 2
@actor_command_window.x = 0 if BattleCommand_Custom::ACTOR_MODE == 1
@party_command_window.x = Graphics.width if BattleCommand_Custom::PARTY_MODE == 1
@actor_command_window.set_handler(:escape, method(:command_escape))
if BattleCommand_Custom::PARTY_MODE == 3
@info_viewport.ox = BattleCommand_Custom::STATUS_X[1]
else
@info_viewport.ox = BattleCommand_Custom::STATUS_X[0]
end
end
def xp_style_create_all_windows
@actor_command_window.set_handler(:escape, method(:command_escape))
end
end
#==============================================================================
# ■ Window_ActorCommand
#==============================================================================
class Window_ActorCommand < Window_Command
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
if BattleCommand_Custom::ACTOR_COL[0] == nil
return @list.size == 0 ? 1 : @list.size
else
return BattleCommand_Custom::ACTOR_COL[0]
end
end
#--------------------------------------------------------------------------
# ● カーソルを下に移動
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
return if item_max <= 1
return if (item_max - 1) / col_max <= 0
if wrap || (index / col_max != (item_max - 1) / col_max)
i = index + col_max
if i >= item_max
if index / col_max == (item_max - 1) / col_max
i = index % col_max
else
i = item_max - 1
end
end
select(i)
end
end
#--------------------------------------------------------------------------
# ● カーソルを上に移動
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
return if item_max <= 1
return if (item_max - 1) / col_max <= 0
if wrap || (index / col_max != 0)
i = index - col_max
if i < 0
if index % col_max <= (item_max - 1) % col_max
i = index + (item_max - 1) / col_max * col_max
else
i = item_max - 1
end
end
select(i)
end
end
#--------------------------------------------------------------------------
# ● カーソルを右に移動
#--------------------------------------------------------------------------
def cursor_right(wrap = false)
return if item_max <= 1
return if col_max <= 1
if wrap || (index % col_max != (col_max - 1))
i = index + 1
if (i >= item_max) or (index / col_max != i / col_max)
i -= col_max
i = [i, 0].max
end
select(i)
end
end
#--------------------------------------------------------------------------
# ● カーソルを左に移動
#--------------------------------------------------------------------------
def cursor_left(wrap = false)
return if item_max <= 1
return if col_max <= 1
if wrap || (index % col_max != 0)
i = index - 1
if index / col_max != i / col_max
if i + col_max < item_max
i += col_max
end
end
select(i)
end
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def original_window_width
return BattleCommand_Custom::ACTOR_COL[1]
end
def window_width
return original_window_width
end
#--------------------------------------------------------------------------
# ● ウィンドウ高さの取得
#--------------------------------------------------------------------------
def original_window_height
if BattleCommand_Custom.default_actor_command_window?
return 120
else
fitting_height(visible_line_number)
end
end
def window_height
return original_window_height
end
#--------------------------------------------------------------------------
# ● 表示行数の取得
#--------------------------------------------------------------------------
def visible_line_number
if (not BattleCommand_Custom.default_actor_command_window?)
return custom_visible_line_number
else
return default_visible_line_number
end
end
def default_visible_line_number
return 4
end
def custom_visible_line_number
n = @list.size / col_max + (@list.size % col_max > 0 ? 1 : 0)
n = [BattleCommand_Custom::ACTOR_ROW[0], n].max
n = [BattleCommand_Custom::ACTOR_ROW[1], n].min
return n
end
#--------------------------------------------------------------------------
# ● 横に項目が並ぶときの空白の幅を取得
#--------------------------------------------------------------------------
def spacing
return 0
end
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
alias :battle_command_custom_setup :setup
def setup(actor)
battle_command_custom_setup(actor)
self.arrows_visible = true
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
return unless @actor
for symbol in BattleCommand_Custom::ACTOR_COMMAND_LIST
add_attack_command if symbol == :attack
add_skill_commands if symbol == :skill
add_guard_command if symbol == :guard
add_item_command if symbol == :item
add_escape_command if symbol == :escape
end
set_position if BattleCommand_Custom::ACTOR_MODE >= 2
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
change_color(normal_color, command_enabled?(index))
par = command_name(index)
rect = item_rect_for_text(index)
if BattleCommand_Custom::ACTOR_ICON
draw_icon(par[1], rect.x, rect.y)
rect.x += 24
rect.width -= 24
draw_text(rect, par[0], alignment)
else
draw_text(rect, par, alignment)
end
end
#--------------------------------------------------------------------------
# ● 高さと座標の更新
#--------------------------------------------------------------------------
def set_position
self.height = window_height
pos = window_pos
if $cwinter_script_actor_command_reform_ex_image
l_space = left_space
t_space = top_space
u_space = under_space
else
l_space = 0
t_space = 0
u_space = 0
end
self.x = pos[0] + l_space
if BattleCommand_Custom::ACTOR_WINDOW_Y_MODE == 0
self.y = pos[1] + t_space
else
self.y = pos[1] - self.height - u_space
end
end
def window_pos
return BattleCommand_Custom::ACTOR_WINDOW_POS
end
#--------------------------------------------------------------------------
# ● [追加]:X 座標をアクターに合わせる
#--------------------------------------------------------------------------
def actor_x(actor)
if $cwinter_script_actor_command_reform_ex_image
l_space = left_space
else
l_space = 0
end
left_width = self.width - l_space
right_width = self.width
ax = $game_party.members_screen_x_nooffset[actor.index] - left_width / 2
left_pad = LNX11::STATUS_SIDE_PADDING / 2 + l_space
right_pad = LNX11::STATUS_SIDE_PADDING / 2
# 画面内に収める
self.x = [[ax, left_pad].max, Graphics.width - right_pad - right_width].min
self.x += LNX11::ACTOR_COMMAND_OFFSET[:x]
end
#--------------------------------------------------------------------------
# ● [追加]:Y 座標をアクターに合わせる
#--------------------------------------------------------------------------
def actor_y(actor)
if $cwinter_script_actor_command_reform_ex_image
u_space = under_space
else
u_space = 0
end
self_height = self.height + u_space
self.y = actor.screen_y_top - self_height
self.y += LNX11::ACTOR_COMMAND_OFFSET[:y]
end
#--------------------------------------------------------------------------
# ● [追加]:固定 Y 座標
#--------------------------------------------------------------------------
def screen_y
if $cwinter_script_actor_command_reform_ex_image
u_space = under_space
else
u_space = 0
end
if LNX11::ACTOR_COMMAND_Y_POSITION == 0
self_height = self.height + u_space
self.y = Graphics.height - self_height + LNX11::ACTOR_COMMAND_OFFSET[:y]
else
self.y = LNX11::ACTOR_COMMAND_OFFSET[:y]
end
end
#--------------------------------------------------------------------------
# ● 攻撃コマンドをリストに追加
#--------------------------------------------------------------------------
def add_attack_command
if BattleCommand_Custom::ACTOR_ICON
if BattleCommand_Custom::ACTOR_ICON_ATTACK_WEAPON and @actor.weapons[0]
icon = @actor.weapons[0].icon_index
else
icon = BattleCommand_Custom::ACTOR_ICON_OTHER[0]
end
par = [Vocab::attack, icon]
else
par = Vocab::attack
end
add_command(par, :attack, @actor.attack_usable?)
end
#--------------------------------------------------------------------------
# ● スキルコマンドをリストに追加
#--------------------------------------------------------------------------
def add_skill_commands
@actor.added_skill_types.sort.each do |stype_id|
name = $data_system.skill_types[stype_id]
if BattleCommand_Custom::ACTOR_ICON
par = [name, BattleCommand_Custom::ACTOR_ICON_SKILL[stype_id - 1]]
else
par = name
end
add_command(par, :skill, true, stype_id)
end
end
#--------------------------------------------------------------------------
# ● 防御コマンドをリストに追加
#--------------------------------------------------------------------------
def add_guard_command
if BattleCommand_Custom::ACTOR_ICON
par = [Vocab::guard, BattleCommand_Custom::ACTOR_ICON_OTHER[1]]
else
par = Vocab::guard
end
add_command(par, :guard, @actor.guard_usable?)
end
#--------------------------------------------------------------------------
# ● アイテムコマンドをリストに追加
#--------------------------------------------------------------------------
def add_item_command
if BattleCommand_Custom::ACTOR_ICON
par = [Vocab::item, BattleCommand_Custom::ACTOR_ICON_OTHER[2]]
else
par = Vocab::item
end
add_command(par, :item)
end
#--------------------------------------------------------------------------
# ● 逃走コマンドをリストに追加
#--------------------------------------------------------------------------
def add_escape_command
if BattleCommand_Custom::ACTOR_ICON
par = [Vocab::escape, BattleCommand_Custom::ACTOR_ICON_OTHER[3]]
else
par = Vocab::escape
end
add_command(par, :escape, BattleManager.can_escape?)
end
end
#==============================================================================
# ■ Window_SkillList
#==============================================================================
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# ● アイテム名の描画
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, enabled = true, width = 172)
return unless item
if item.id == 1 and
BattleCommand_Custom::ACTOR_ICON_ATTACK_WEAPON and @actor.weapons[0]
icon = @actor.weapons[0].icon_index
else
icon = item.icon_index
end
draw_icon(icon, x, y, enabled)
change_color(normal_color, enabled)
draw_text(x + 24, y, width, line_height, item.name)
end
end
#==============================================================================
# ■ Window_PartyCommand
#==============================================================================
class Window_PartyCommand < Window_Command
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect_for_text(index)
enable = command_enabled?(index)
if BattleCommand_Custom::PARTY_ICON
x = rect.x
y = rect.y
draw_icon(BattleCommand_Custom::PARTY_ICON_LIST[index], x, y, enable)
rect.x += 24
end
change_color(normal_color, enable)
draw_text(rect, command_name(index), alignment)
end
end
if BattleCommand_Custom.wide_party_window?
#==============================================================================
# ■ Window_PartyCommand
#==============================================================================
class Window_PartyCommand < Window_Command
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return Graphics.width
end
#--------------------------------------------------------------------------
# ● 表示行数の取得
#--------------------------------------------------------------------------
def visible_line_number
return 1
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return @list.size
end
#--------------------------------------------------------------------------
# ● アライメントの取得
#--------------------------------------------------------------------------
def alignment
return 1
end
#--------------------------------------------------------------------------
# ● 横に項目が並ぶときの空白の幅を取得
#--------------------------------------------------------------------------
def spacing
return 16
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect_for_text(index)
enable = command_enabled?(index)
if BattleCommand_Custom::PARTY_ICON
t_rect = self.contents.text_size(command_name(index))
x = rect.x + (rect.width / 2 - t_rect.width / 2) - 25
y = rect.y
draw_icon(BattleCommand_Custom::PARTY_ICON_LIST[index], x, y, enable)
end
rect = item_rect_for_text(index)
change_color(normal_color, enable)
draw_text(rect, command_name(index), alignment)
end
end
end
if BattleCommand_Custom::PARTY_MODE == 3
#==============================================================================
# ■ Window_PartyCommand
#==============================================================================
class Window_PartyCommand < Window_Command
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
def setup
call_handler(:fight)
end
end
end
if BattleCommand_Custom.no_xp_style? and
BattleCommand_Custom::STATUS_MODE == 1
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
Graphics.width
end
#--------------------------------------------------------------------------
# ● ゲージエリアの幅を取得
#--------------------------------------------------------------------------
def gauge_area_width
return 348
end
#--------------------------------------------------------------------------
# ● ゲージエリアの描画TP あり)
#--------------------------------------------------------------------------
def draw_gauge_area_with_tp(rect, actor)
draw_actor_hp(actor, rect.x + 128 - 60 + 0, rect.y, 72 + 20)
draw_actor_mp(actor, rect.x + 128 - 40 + 82, rect.y, 64 + 20)
draw_actor_tp(actor, rect.x + 128 - 20 + 156, rect.y, 64 + 20)
end
#--------------------------------------------------------------------------
# ● ゲージエリアの描画TP なし)
#--------------------------------------------------------------------------
def draw_gauge_area_without_tp(rect, actor)
draw_actor_hp(actor, rect.x + 128 - 60 + 0, rect.y, 134 + 30)
draw_actor_mp(actor, rect.x + 128 - 30 + 144, rect.y, 76 + 30)
end
end
#==============================================================================
# ■ Window_BattleActor
#==============================================================================
class Window_BattleActor < Window_BattleStatus
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
Graphics.width - 128
end
#--------------------------------------------------------------------------
# ● ゲージエリアの幅を取得
#--------------------------------------------------------------------------
def gauge_area_width
return 220
end
#--------------------------------------------------------------------------
# ● ゲージエリアの描画TP あり)
#--------------------------------------------------------------------------
def draw_gauge_area_with_tp(rect, actor)
draw_actor_hp(actor, rect.x + 0, rect.y, 72)
draw_actor_mp(actor, rect.x + 82, rect.y, 64)
draw_actor_tp(actor, rect.x + 156, rect.y, 64)
end
#--------------------------------------------------------------------------
# ● ゲージエリアの描画TP なし)
#--------------------------------------------------------------------------
def draw_gauge_area_without_tp(rect, actor)
draw_actor_hp(actor, rect.x + 0, rect.y, 134)
draw_actor_mp(actor, rect.x + 144, rect.y, 76)
end
end
end