RPGツクールXP/VX用のRGSS素材です。
一部英語版対応です。
(A few materials can be used for English RPG MAKER XP/VX.)
競合率はルファーの独断と偏見なのでたまにハズレます。
#==============================================================================
# ■ ダブルプレイヤーモード (分割定義 4)
#------------------------------------------------------------------------------
# 2 つのデータを読み込んで対戦するシーンクラスの定義です。
# ゲーム内で使うには、 $scene = Scene_DoublePlayersLoad.new というスクリプトを
# どこかに挿入する必要があります。
# (C) ルファー
# HP https://tkoolerlufar.pages.dev/
#==============================================================================
#----------------------------------------------------------------------------
# ◆ Window_DoublePlayersCommand クラス
#----------------------------------------------------------------------------
class Window_DoublePlayersCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_writer :actor # アクター
attr_reader :mode # モード
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 96)
@column_max = 2
self.mode = 0
end
#--------------------------------------------------------------------------
# ● スキルの取得
#--------------------------------------------------------------------------
def skill
return @mode == 2 ? @data[self.index] : nil
end
#--------------------------------------------------------------------------
# ● モードの設定
# mode : モード
#--------------------------------------------------------------------------
def mode=(mode)
@mode = mode
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
case @mode
when 0
if self.contents != nil
self.contents.dispose
self.contents = nil
end
self.contents = Bitmap.new(1, 1)
self.index = -1
when 1
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@item_max = 3
self.contents = Bitmap.new(width - 32, row_max * 32)
draw_item(nil)
when 2
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
if index.is_a?(Integer)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
else
commands = [$data_system.words.attack, $data_system.words.skill,
$data_system.words.guard]
for index in 0...3
x = 4 + index % 2 * 320
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.draw_text(x + 4, y, 204, 32, commands[index], 0)
end
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
#----------------------------------------------------------------------------
# ◆ Window_DoublePlayerstatus クラス
#----------------------------------------------------------------------------
class Window_DoublePlayersStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# player_index : プレイヤーインデックス
#--------------------------------------------------------------------------
def initialize(player_index)
@party = $game_doubleplayers[player_index]
super(0, 160 * (player_index + 1), 640, 160)
bitmap = self.windowskin.clone
bitmap.hue_change(120 * (player_index + 1))
self.windowskin = bitmap
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = @party.actors.size
for i in 0...@party.actors.size
actor = @party.actors[i]
actor_x = i * 160 + 4
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
draw_actor_state(actor, actor_x, 96)
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 191
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end
戻る