rebf-gaiden/Scripts/_.13.rb
2025-04-27 12:27:49 -05:00

1034 lines
No EOL
37 KiB
Ruby
Raw 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.05 by 星潟
#------------------------------------------------------------------------------
# Scene_Equip等を大幅に変更し、装備拡張を実現します。
# なるべく、素材スクリプト欄の上側に挿入してください。
# 相当な量の設定項目がありますのでご注意下さい。
# また、SHIFTキーで装備解除を行えるようになっています。無効にする事も出来ます
# 最強装備・全て外す等を選択する為のコマンドウィンドウについては
# 「不要・画面描写上の無駄・無駄な操作が増える」と判断した為、消去しています。
#
# このスクリプト導入時、以下のイベントスクリプトが使用可能になります。
#
# ch_eq(a, b, c)
#
# =>アクターナンバーaの装備スロットb番をアイテムcに変更する。
# (装備スロットは武器を0番とする)
#
# ar_eq(a)
#
# =>アクターナンバーaの装備を全て解除する。
#
# また、導入後は導入前のセーブデータを使用する事が基本的に出来なくなります。
# この為、未配布のゲームに導入される事を強くお勧めします。
#
#
# スクリプト製作者から二言ほど。
#
# いらぬお節介でしょうが、表示項目を増やせるからといって
# 増やせるだけ増やせばいいというものではありません。
# プレイして下さる方の事を考えた上で、必要な物を取捨選択して下さい。
#
# また、本スクリプトを配布している場所にも書いてあると思いますが
# 不具合報告は受け付けますが、要望については基本的に受け付けません。
# 更に変更したい場合は、自力でスクリプトを書き換えてください。
#
# Ver1.01 不要な記述二点を消去しました。
# 設定項目に変更はないので、基本カスタマイズ項目を丸ごと
# 旧Verから上書きしていただければ、Ver1.00での設定は生かせます。
#
# Ver1.02 属性有効度・ステート有効度の表示不具合を修正しました。
#
# Ver1.03 大量のスロットを用意した際、一定数以上は表示されなくなる不具合を修正。
# スロットタイプの判定を大きく修正し、動作を軽量化。
# 装備タイプの名称決定方式を変更。
# 旧Verから上書きしていただければ、装備タイプの名称以外は生かせます。
#
# Ver1.04 通常アイテムが含まれていた場合にエラーが出る致命的不具合の修正。
#
# Ver1.05 特殊能力値の表示を変更しました。
#==============================================================================
module EQ_EX
#==============================================================================
#★★★基本カスタマイズ項目はここからです★★★
#==============================================================================
#==============================================================================
#★装備拡張の為の設定を行います★
#==============================================================================
#装備タイプ設定の為に使用する設定用ワード
#<装備タイプ:5>、<装備タイプ:8>等と防具のメモ欄に書き込むことで
#その防具の装備タイプを内部的に変更する事が出来ます。
#なお、盾だろうと鎧だろうと、メモ欄の装備タイプが優先されます。
WORD = "装備タイプ"
#通常時の腕装備(デフォルトでは武器・盾)
SLT_ARM1 = [0, 1]
#二刀流時の腕装備(デフォルトでは武器・武器)
SLT_ARM2 = [0, 0]
#防具(デフォルトでは頭・身体・装飾品)
SLT_ARMOR = [2, 3,4, 4,4, 4,]
#装備タイプ別の名称を5番から順番に指定します。
#1番:盾4番:装飾品で、それ以降の追加スロットについての名称設定です)
SLT_NAME = ["","","魔法書","技術書","宝珠","紋章","特殊"]
#==============================================================================
#★装備ステータスウィンドウにおける表示項目をページ別に設定します★
#==============================================================================
#使用数ページ数の定義と、各ページに表示するステータス項目設定を行ってください。
# 07 基本能力値(最大HP~運)
#
# 817 追加能力値(命中率~TP再生率)
#
# 1827 特殊能力値(狙われ率~経験値効率)
#
# 10012000 ステータス有効度(ステートID順 例.戦闘不能……1001 混乱……1005
#
# 20013000 属性有効度(属性ID順 例.物理……2001 炎……2003
#
# 30013008 弱体有効度(最大HP~運)
#ページ最大数
ESP_MAX = 6
#装備ステータスウィンドウ表示項目設定 ページ1
ES_MAX = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 25, 27, 2051]
#装備ステータスウィンドウ表示項目設定 ページ2
ES_MAX2 = [12, 13, 14, 15, 16, 17, 18, 19]
#装備ステータスウィンドウ表示項目設定 ページ3
ES_MAX3 = [20, 21, 22, 23, 24, 25, 26, 27]
#装備ステータスウィンドウ表示項目設定 ページ4
ES_MAX4 = [2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010]
#装備ステータスウィンドウ表示項目設定 ページ5
ES_MAX5 = [1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008]
#装備ステータスウィンドウ表示項目設定 ページ6
ES_MAX6 = [3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008]
#==============================================================================
#★装備ステータスウィンドウについて、表示形式を決定します★
#==============================================================================
#装備ステータスウィンドウフォントサイズ
ESFS = 20
#装備ステータスウィンドウ桁数(横)
ES_CLM = 2
#装備ステータスウィンドウ桁数(縦)(名前欄も1行と見なす)
ES_LM = 9
#装備ステータスウィンドウ桁数2ページ目
ES_CLM2 = 2
#装備ステータスウィンドウ桁数2ページ目名前欄も行と見なす
ES_LM2 = 5
#装備ステータスウィンドウ桁数3ページ目
ES_CLM3 = 2
#装備ステータスウィンドウ桁数3ページ目名前欄も行と見なす
ES_LM3 = 5
#装備ステータスウィンドウ桁数4ページ目
ES_CLM4 = 2
#装備ステータスウィンドウ桁数4ページ目名前欄も行と見なす
ES_LM4 = 5
#装備ステータスウィンドウ桁数5ページ目
ES_CLM5 = 2
#装備ステータスウィンドウ桁数5ページ目名前欄も行と見なす
ES_LM5 = 5
#装備ステータスウィンドウ桁数6ページ目
ES_CLM6 = 2
#装備ステータスウィンドウ桁数6ページ目名前欄も行と見なす
ES_LM6 = 5
#ステータスの項目名描画開始位置と現在値描画開始位置の間
SNWD1 = 84
#ステータスの項目名矢印の位置
SNWD2 = 117
#ステータスの項目名描画開始位置と変更値描画開始位置の間
SNWD3 = 140
#ページ切り替えに使用するキーを設定します。使用しない場合はnilにして下さい。
ESP_KEY = :nil
#==============================================================================
#★装備品表示ウィンドウについて、表示形式を決定します★
#==============================================================================
#装備品ウィンドウフォントサイズ
EQFS = 18
#装備品ウィンドウ桁数(横)
EW_LM = 2
#装備品ウィンドウ桁数(縦)
EW_CLM = 6
#装備品の項目名描画開始位置とアイテム名描画開始位置の間
ENWD = 50
#装備解除に使用するキーを設定します。使用しない場合はnilにして下さい。
ER_KEY = :A
end
#==============================================================================
#★ステータスの名前を追加定義します★
#==============================================================================
module Vocab
# Defines the name for hit rate.
X_0 = "HIT"
# Defines the name for evasion rate.
X_1 = "Evasion"
# Defines the name for critical rate.
X_2 = "CRI"
# Defines the name for critical evade rate.
X_3 = "CRI Evasion"
# Defines the name for magic evasion rate.
X_4 = "Magic Evasion"
# Defines the name for magic reflection rate.
X_5 = "Magic Reflection"
# Defines the name for counterattack rate.
X_6 = "Counter Rate"
# Defines the name for HP regeneration rate.
X_7 = "HP Regen"
# Defines the name for MP regeneration rate.
X_8 = "MP Regen"
# Defines the name for TP regeneration rate.
X_9 = "TP Regen"
# Defines the name for taunt rate.
X_10 = "Taunt Rate"
# Defines the name for defense effect rate.
X_11 = "Defense Boost"
# Defines the name for healing effect rate.
X_12 = "Healing Boost"
# Defines the name for medicinal knowledge.
X_13 = "Medicine Knowledge"
# Defines the name for MP consumption rate.
X_14 = "MP Consumption"
# Defines the name for TP charge rate.
X_15 = "TP Amplify"
# Defines the name for physical damage rate.
X_16 = "Physical Amplify"
# Defines the name for magic damage rate.
X_17 = "Magic Damage"
# Defines the name for floor damage rate.
X_18 = "Floor Damage Reduction"
# Defines the name for EXP efficiency.
X_19 = "EXP"
# Defines the name for HP decrease.
Xd_0 = "HP Down"
# Defines the name for MP decrease.
Xd_1 = "MP Down"
# Defines the name for attack decrease.
Xd_2 = "Attack Down"
# Defines the name for defense decrease.
Xd_3 = "Defense Down"
# Defines the name for magic decrease.
Xd_4 = "Magic Down"
# Defines the name for magic defense decrease.
Xd_5 = "M. Defense Down"
# Defines the name for agility decrease.
Xd_6 = "Agility Down"
# Defines the name for luck decrease.
Xd_7 = "Luck Down"
end
#==============================================================================
#★★★基本カスタマイズ項目はここまでです。お疲れ様でした★★★
#==============================================================================
module Vocab
def self.xparam(param_id)
case param_id
when 0
X_0
when 1
X_1
when 2
X_2
when 3
X_3
when 4
X_4
when 5
X_5
when 6
X_6
when 7
X_7
when 8
X_8
when 9
X_9
end
end
def self.sparam(param_id)
case param_id
when 0
X_10
when 1
X_11
when 2
X_12
when 3
X_13
when 4
X_14
when 5
X_15
when 6
X_16
when 7
X_17
when 8
X_18
when 9
X_19
end
end
def self.debuff_rate(param_id)
case param_id
when 0
Xd_0
when 1
Xd_1
when 2
Xd_2
when 3
Xd_3
when 4
Xd_4
when 5
Xd_5
when 6
Xd_6
when 7
Xd_7
end
end
def self.etype(etype_id)
if etype_id < 5
return $data_system.terms.etypes[etype_id]
end
data = etype_id - 5
return EQ_EX::SLT_NAME[data]
end
end
class RPG::EquipItem < RPG::BaseItem
def etype_id
return @true_etype_id if @true_etype_id != nil
data = self.note.scan(/<#{EQ_EX::WORD}[:](\d+)>/).flatten
if data != nil && !data.empty?
@true_etype_id = data[0].to_i
else
@true_etype_id = @etype_id
end
return @true_etype_id
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 装備スロットの配列を取得
#--------------------------------------------------------------------------
def equip_slots
return EQ_EX::SLT_ARM2 + EQ_EX::SLT_ARMOR if dual_wield? # 二刀流
return EQ_EX::SLT_ARM1 + EQ_EX::SLT_ARMOR # 通常
end
end
#==============================================================================
# ■ Window_SEI
#------------------------------------------------------------------------------
#  装備画面で、装備中のアイテムと、選択中のアイテムを表示するウィンドウです。
#==============================================================================
class Window_SEI < Window_Base
attr_accessor :actor # 装備種類
attr_accessor :e_type # 装備種類
attr_accessor :equip1 # 装備中アイテム
attr_accessor :equip2 # 装備対象アイテム
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, window_width, window_height)
@equip1 = nil
@equip2 = nil
@e_type = nil
refresh
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return Graphics.width
end
#--------------------------------------------------------------------------
# ● ウィンドウ高さの取得
#--------------------------------------------------------------------------
def window_height
48
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_item(0, 0, @equip1, @equip2)
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(x, y, item1, item2)
if e_type != nil
draw_e_type(4, y, @e_type)
draw_e_item_name(70, y, item1)
draw_right_arrow(280, y)
draw_current_item_param(310, y, item2)
end
end
#--------------------------------------------------------------------------
# ● 装備スロットの名前を取得
#--------------------------------------------------------------------------
def slot_name(index)
@actor ? Vocab::etype(@actor.equip_slots[index]) : ""
end
#--------------------------------------------------------------------------
# ● 装備スロットの名前を描画
#--------------------------------------------------------------------------
def draw_e_type(x, y, e_type)
change_color(system_color)
draw_text(x, y, 90, line_height, slot_name(e_type))
end
#--------------------------------------------------------------------------
# ● 現在の装備品を描画
#--------------------------------------------------------------------------
def draw_e_item_name(x, y, equip1)
draw_item_name(equip1, x, y, enabled = true)
end
#--------------------------------------------------------------------------
# ● 選択中の装備品を描画
#--------------------------------------------------------------------------
def draw_current_item_param(x, y, equip2)
self.contents.font.size = 18##紅茶走↓のフォントサイズ
draw_item_name(equip2, x, y, enabled = true)
end
#--------------------------------------------------------------------------
# ● 右向き矢印を描画
#--------------------------------------------------------------------------
def draw_right_arrow(x, y)
change_color(system_color)
draw_text(x, y, 22, line_height, "", 1)
end
end
#==============================================================================
# ■ Window_EquipStatus
#------------------------------------------------------------------------------
#  装備画面で、アクターの能力値変化を表示するウィンドウです。
#==============================================================================
class Window_EquipStatus < Window_Base
attr_reader :item_window # アイテムウィンドウ
attr_accessor :page_data # アイテムウィンドウ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_exeq initialize
def initialize(x, y)
@page_data = 0
initialize_exeq(x, y)
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return Graphics.width
end
#--------------------------------------------------------------------------
# ● ウィンドウ高さの取得
#--------------------------------------------------------------------------
def window_height
fitting_height(visible_line_number)
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
if @page_data == 0
return EQ_EX::ES_CLM
elsif @page_data == 1
return EQ_EX::ES_CLM2
elsif @page_data == 2
return EQ_EX::ES_CLM3
elsif @page_data == 3
return EQ_EX::ES_CLM4
elsif @page_data == 4
return EQ_EX::ES_CLM5
elsif @page_data == 5
return EQ_EX::ES_CLM6
end
end
#--------------------------------------------------------------------------
# ● 表示行数の取得
#--------------------------------------------------------------------------
def visible_line_number
if @page_data == 0
return EQ_EX::ES_LM
elsif @page_data == 1
return EQ_EX::ES_LM2
elsif @page_data == 2
return EQ_EX::ES_LM3
elsif @page_data == 3
return EQ_EX::ES_LM4
elsif @page_data == 4
return EQ_EX::ES_LM5
elsif @page_data == 5
return EQ_EX::ES_LM6
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_actor_name(@actor, 4, 0) if @actor
if @page_data == 0
data = EQ_EX::ES_MAX
elsif @page_data == 1
data = EQ_EX::ES_MAX2
elsif @page_data == 2
data = EQ_EX::ES_MAX3
elsif @page_data == 3
data = EQ_EX::ES_MAX4
elsif @page_data == 4
data = EQ_EX::ES_MAX5
elsif @page_data == 5
data = EQ_EX::ES_MAX6
end
lm = 0
vlm = 0
plm = visible_line_number
pclm = col_max
self.contents.font.size = EQ_EX::ESFS
for p_i in data
vlm += 1
if vlm == plm
vlm = 1
lm += 1
end
draw_item((window_width - 32) / pclm * lm, line_height * (vlm), p_i)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(x, y, param_id)
draw_param_name(x + 4, y, param_id)
draw_current_param(x + EQ_EX::SNWD1, y, param_id) if @actor
draw_right_arrow(x + EQ_EX::SNWD2, y)
draw_new_param(x + EQ_EX::SNWD3, y, param_id) if @temp_actor
end
#--------------------------------------------------------------------------
# ● 能力値の名前を描画
#--------------------------------------------------------------------------
def draw_param_name(x, y, param_id)
change_color(system_color)
if param_id > 3000
draw_text(x, y, 80, line_height, Vocab::debuff_rate(param_id - 3001))
elsif param_id > 2000
draw_text(x, y, 80, line_height, $data_system.elements[param_id - 2000])
elsif param_id > 1000
draw_text(x, y, 80, line_height, $data_states[param_id - 1000].name)
elsif param_id > 17
draw_text(x, y, 80, line_height, Vocab::sparam(param_id - 18))
elsif param_id > 7
draw_text(x, y, 80, line_height, Vocab::xparam(param_id - 8))
else
draw_text(x, y, 80, line_height, Vocab::param(param_id))
end
end
#--------------------------------------------------------------------------
# ● 現在の能力値を描画
#--------------------------------------------------------------------------
def draw_current_param(x, y, param_id)
change_color(normal_color)
if param_id > 3000
draw_text(x-32, y, 64, line_height, ((@actor.debuff_rate(param_id - 3001) * -1 + 1) * 100).round, 2)
elsif param_id > 2000
draw_text(x-32, y, 64, line_height, ((@actor.element_rate(param_id - 2000) * -1 + 1) * 100).round, 2)
elsif param_id > 1000
if @actor.state_resist?(param_id - 1000)
draw_text(x-32, y, 64, line_height, "無効", 2)
else
draw_text(x-32, y, 64, line_height, ((@actor.state_rate(param_id - 1000) * -1 + 1) * 100).round, 2)
end
elsif param_id > 17
draw_text(x-32, y, 64, line_height, ((@actor.sparam(param_id - 18) * 100)).round, 2)
elsif param_id > 7
draw_text(x-32, y, 64, line_height, (@actor.xparam(param_id - 8) * 100).round, 2)
else
draw_text(x-32, y, 64, line_height, @actor.param(param_id), 2)
end
end
#--------------------------------------------------------------------------
# ● 右向き矢印を描画
#--------------------------------------------------------------------------
def draw_right_arrow(x, y)
change_color(system_color)
draw_text(x, y, 22, line_height, "", 1)
end
#--------------------------------------------------------------------------
# ● 装備変更後の能力値を描画
#--------------------------------------------------------------------------
def draw_new_param(x, y, param_id)
if param_id > 3000
change_color(param_change_color((@temp_actor.debuff_rate(param_id - 3001) * -1 + 1) - (@actor.debuff_rate(param_id - 3001) * -1 + 1)))
draw_text(x-32, y, 64, line_height, ((@temp_actor.debuff_rate(param_id - 3001) * -1 + 1) * 100).round, 2)
elsif param_id > 2000
change_color(param_change_color((@temp_actor.element_rate(param_id - 2000) * -1 + 1) - (@actor.element_rate(param_id - 2000) * -1 + 1)))
draw_text(x-32, y, 64, line_height, ((@temp_actor.element_rate(param_id - 2000) * -1 + 1) * 100).round, 2)
elsif param_id > 1000
if @temp_actor.state_resist?(param_id - 1000)
if @actor.state_resist?(param_id - 1000)
change_color(normal_color)
else
change_color(power_up_color)
end
draw_text(x-32, y, 64, line_height, "無効", 2)
else
if @actor.state_resist?(param_id - 1000)
change_color(power_down_color)
else
change_color(param_change_color((@temp_actor.state_rate(param_id - 1000) * -1 + 1) - (@actor.state_rate(param_id - 1000) * -1 + 1)))
end
draw_text(x-32, y, 64, line_height, ((@temp_actor.state_rate(param_id - 1000) * -1 + 1) * 100).round, 2)
end
elsif param_id > 17
change_color(param_change_color(@temp_actor.sparam(param_id - 18) - @actor.sparam(param_id - 18)))
draw_text(x-32, y, 64, line_height, ((@temp_actor.sparam(param_id - 18) * 100)).round, 2)
elsif param_id > 7
change_color(param_change_color(@temp_actor.xparam(param_id - 8) - @actor.xparam(param_id - 8)))
draw_text(x-32, y, 64, line_height, (@temp_actor.xparam(param_id - 8) * 100).round, 2)
else
change_color(param_change_color(@temp_actor.param(param_id) - @actor.param(param_id)))
draw_text(x-32, y, 64, line_height, @temp_actor.param(param_id), 2)
end
end
end
#==============================================================================
# ■ Window_EquipSlot
#------------------------------------------------------------------------------
#  装備画面で、アクターが現在装備しているアイテムを表示するウィンドウです。
#==============================================================================
class Window_EquipSlot < Window_Selectable
attr_reader :index # 装備種類
#--------------------------------------------------------------------------
# ● 表示行数の取得
#--------------------------------------------------------------------------
def visible_line_number
return EQ_EX::EW_CLM + 1
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return EQ_EX::EW_LM
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
return unless @actor
self.contents.font.size = EQ_EX::EQFS
rect = item_rect_for_text(index)
change_color(system_color, enable?(index))
draw_text(rect.x, rect.y, 90, line_height, slot_name(index))
draw_item_name(@actor.equips[index], 32+rect.x + EQ_EX::ENWD, rect.y, enable?(index))
end
#--------------------------------------------------------------------------
# ● 装備品の解除
#--------------------------------------------------------------------------
def process_release
if @actor.equip_type_fixed?(index)
Sound.play_buzzer
return false
elsif @actor.equips[index] == nil
return
end
Sound.play_equip
@actor.change_equip(index, nil)
refresh
@item_window.refresh
@status_window.refresh
end
#--------------------------------------------------------------------------
# ● ステータスウィンドウページチェンジ
#--------------------------------------------------------------------------
def p_change
Sound.play_cursor
if @status_window.page_data == EQ_EX::ESP_MAX - 1
@status_window.page_data = 0
else
@status_window.page_data += 1
end
@status_window.refresh
end
alias refresh_ex_eq refresh
def refresh
create_contents
refresh_ex_eq
end
end
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
#  装備画面の処理を行うクラスです。
#==============================================================================
class Scene_Equip < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_help_window
create_status_window
create_sei_window
create_slot_window
create_item_window
end
#--------------------------------------------------------------------------
# ● 装備品及び現在選択中の装備品表示用ウィンドウの作成
#--------------------------------------------------------------------------
def create_sei_window
@sei_window = Window_SEI.new(0, @help_window.height + @status_window.height)
@sei_window.viewport = @viewport
@sei_window.visible = false
@sei_window.actor = @actor
end
#--------------------------------------------------------------------------
# ● ステータスウィンドウの作成
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_EquipStatus.new(0, @help_window.height)
@status_window.viewport = @viewport
@status_window.actor = @actor
end
#--------------------------------------------------------------------------
# ● スロットウィンドウの作成
#--------------------------------------------------------------------------
def create_slot_window
wx = 0
wy = @status_window.y + @status_window.height
ww = 640
@slot_window = Window_EquipSlot.new(wx, wy, ww)
@slot_window.height = Graphics.height - wy
@slot_window.viewport = @viewport
@slot_window.help_window = @help_window
@slot_window.status_window = @status_window
@slot_window.actor = @actor
@slot_window.set_handler(:ok, method(:on_slot_ok))
@slot_window.set_handler(:release, method(:off_slot_ok))
@slot_window.set_handler(:pagechange, method(:p_change))
@slot_window.set_handler(:cancel, method(:return_scene))
@slot_window.set_handler(:pagedown, method(:next_actor))
@slot_window.set_handler(:pageup, method(:prev_actor))
@slot_window.activate
@slot_window.select(0)
end
#--------------------------------------------------------------------------
# ● アイテムウィンドウの作成
#--------------------------------------------------------------------------
def create_item_window
wx = 0
wy = @slot_window.y + @sei_window.height
ww = Graphics.width
wh = Graphics.height - wy
@item_window = Window_EquipItem.new(wx, wy, ww, wh)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.status_window = @status_window
@item_window.actor = @actor
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@slot_window.item_window = @item_window
@item_window.visible = false
end
#--------------------------------------------------------------------------
# ● スロット[決定]
#--------------------------------------------------------------------------
def on_slot_ok
@item_window.visible = true
@sei_window.visible = true
@slot_window.visible = false
@item_window.activate
@item_window.select(0)
@sei_window.e_type = @slot_window.index
@sei_window.equip1 = @slot_window.item
@sei_window.equip2 = @item_window.item
@sei_window.refresh
end
#--------------------------------------------------------------------------
# ● スロット[解除]
#--------------------------------------------------------------------------
def off_slot_ok
end
#--------------------------------------------------------------------------
# ● スロット[解除]
#--------------------------------------------------------------------------
def p_change
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
super
@sei_window.equip1 = @slot_window.item
@sei_window.equip2 = @item_window.item
@sei_window.refresh
end
#--------------------------------------------------------------------------
# ● スロット[キャンセル]
#--------------------------------------------------------------------------
def on_slot_cancel
@slot_window.unselect
return_scene
end
#--------------------------------------------------------------------------
# ● アイテム[決定]
#--------------------------------------------------------------------------
def on_item_ok
Sound.play_equip
@actor.change_equip(@slot_window.index, @item_window.item)
@slot_window.activate
@slot_window.visible = true
@sei_window.visible = false
@item_window.visible = false
@slot_window.refresh
@item_window.unselect
@item_window.refresh
end
#--------------------------------------------------------------------------
# ● アイテム[キャンセル]
#--------------------------------------------------------------------------
def on_item_cancel
@slot_window.activate
@slot_window.visible = true
@sei_window.visible = false
@item_window.visible = false
@item_window.unselect
end
#--------------------------------------------------------------------------
# ● アクターの切り替え
#--------------------------------------------------------------------------
def on_actor_change
@status_window.actor = @actor
@slot_window.actor = @actor
@item_window.actor = @actor
@sei_window.actor = @actor
@slot_window.activate
end
end
class Window_EquipItem < Window_ItemList
#--------------------------------------------------------------------------
# ● アイテムをリストに含めるかどうか
#--------------------------------------------------------------------------
alias include_exeq? include?
def include?(item)
if item == nil
return true
end
return false unless item.is_a?(RPG::EquipItem)
if item.etype_id < 5
include_exeq?(item)
else
return false if @slot_id < 0
return false unless item.etype_id == @actor.equip_slots[@slot_id]
return @actor.equippable?(item)
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
super
if @actor && @status_window
temp_actor = Marshal.load(Marshal.dump(@actor))
temp_actor.force_change_equip(@slot_id, item)
@status_window.set_temp_actor(temp_actor)
end
end
end
class Window_Selectable < Window_Base
#--------------------------------------------------------------------------
# ● 決定やキャンセルなどのハンドリング処理
#--------------------------------------------------------------------------
alias process_handling_exeq process_handling
def process_handling
process_handling_exeq
return process_release if handle?(:release) && Input.trigger?(EQ_EX::ER_KEY)
return p_change if handle?(:pagechange) && Input.trigger?(EQ_EX::ESP_KEY)
end
end
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 装備の変更
#--------------------------------------------------------------------------
def ch_eq(actor_number, slot_number, item_id)
actor = $game_actors[actor_number]
actor.change_equip_by_id(slot_number, item_id) if actor
end
#--------------------------------------------------------------------------
# ● 装備の全解除
#--------------------------------------------------------------------------
def ar_eq(actor_number)
actor = $game_actors[actor_number]
data = actor.equip_slots.size - 1
for i in 0..data
actor.change_equip_by_id(i, 0) if actor
end
end
end
#==============================================================================
# ■ Game_BattlerBase
#------------------------------------------------------------------------------
#  バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ
# のクラスは Game_Battler クラスのスーパークラスとして使用されます。
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# ● 装備可能判定
#--------------------------------------------------------------------------
alias equippable_exeq? equippable?
def equippable?(item)
if item == nil
return equippable_exeq?(item)
end
if item.etype_id < 5
equippable_exeq?(item)
else
return false unless item.is_a?(RPG::EquipItem)
return false if equip_type_sealed?(item.etype_id)
return equip_wtype_ok?(item.wtype_id) if item.is_a?(RPG::Weapon)
return equip_atype_ok?(item.atype_id) if item.is_a?(RPG::Armor)
return false
end
end
end