class Window_EquipBaseInfo < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# x : ウィンドウの X 座標
# y : ウィンドウの Y 座標
# actor : アクター
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y, Graphics.width / 2, WLH + 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 0, 0)
# EP 制を使用する場合は EP を描画
if $imported["EquipExtension"] && KGC::EquipExtension::USE_EP_SYSTEM
draw_actor_ep(@actor, 116, 0, Graphics.width / 2 - 148)
end
end
end
#--------------------------------------------------------------------------
# ● カーソルを 1 ページ後ろに移動
#--------------------------------------------------------------------------
def cursor_pagedown
return if Input.repeat?(Input::R)
super
end
#--------------------------------------------------------------------------
# ● カーソルを 1 ページ前に移動
#--------------------------------------------------------------------------
def cursor_pageup
return if Input.repeat?(Input::L)
super
end
end # <-- unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
@caption_cache = Bitmap.new(self.contents.width, self.contents.height)
@caption_cache.blt(0, 0, self.contents, self.contents.rect)
end
#--------------------------------------------------------------------------
# ○ 能力値名の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
# type : 能力値の種類
#--------------------------------------------------------------------------
def draw_parameter_name(x, y, type)
case type
when :maxhp
name = Vocab.hp
when :maxmp
name = Vocab.mp
when :atk
name = Vocab.atk
when :def
name = Vocab.def
when :spi
name = Vocab.spi
when :agi
name = Vocab.agi
when :hit
name = Vocab.hit
when :eva
name = Vocab.eva
when :cri
name = Vocab.cri
end
self.contents.font.color = system_color
self.contents.draw_text(x + 4, y, 96, WLH, name)
self.contents.font.color = system_color
self.contents.draw_text(x + 156, y, 20, WLH, "→", 1)
end
#--------------------------------------------------------------------------
# ● 装備変更後の能力値設定
# new_param : 装備変更後のパラメータの配列
# new_item : 変更後の装備
#--------------------------------------------------------------------------
def set_new_parameters(new_param, new_item)
changed = false
# パラメータ変化判定
KGC::ExtendedEquipScene::EQUIP_PARAMS.each { |k|
if @new_param[k] != new_param[k]
changed = true
break
end
}
changed |= (@new_item != new_item)
if changed
@new_item = new_item
@new_param = new_param
refresh
end
end
#--------------------------------------------------------------------------
# ● 能力値の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
# type : 能力値の種類
#--------------------------------------------------------------------------
def draw_parameter(x, y, type)
case type
when :maxhp
value = @actor.maxhp
when :maxmp
value = @actor.maxmp
when :atk
value = @actor.atk
when :def
value = @actor.def
when :spi
value = @actor.spi
when :agi
value = @actor.agi
when :hit
value = @actor.hit
when :eva
value = @actor.eva
when :cri
value = @actor.cri
end
new_value = @new_param[type]
self.contents.font.color = normal_color
self.contents.draw_text(x + 106, y, 48, WLH, value, 2)
if new_value != nil
self.contents.font.color = new_parameter_color(value, new_value)
self.contents.draw_text(x + 176, y, 48, WLH, new_value, 2)
end
end
end
# 位置更新
ay = @ap_window.y
ayb = @ap_window.y + @ap_window.height # AP window: Bottom
cy = @item_window.y + 16
cy += @item_window.cursor_rect.y if @item_window.active
cyb = cy + Window_Base::WLH # Cursor rect: Bottom
bottom = (ay != @item_window.y)
if bottom
# 下で被る
@ap_window.y = @item_window.y if ay < cyb
else
# 上で被る
@ap_window.y = Graphics.height - @ap_window.height if cy < ayb
end
end
#--------------------------------------------------------------------------
# ○ コマンド選択の更新
#--------------------------------------------------------------------------
def update_command_selection
update_window_position_for_equip_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
case @command_window.index
when 0 # 装備変更
Sound.play_decision
# 装備部位ウィンドウに切り替え
@equip_window.active = true
@command_window.active = false
@command_window.close
when 1 # 最強装備
if @actor.fix_equipment
Sound.play_buzzer
return
end
Sound.play_equip
process_equip_strongest
when 2 # すべて外す
if @actor.fix_equipment
Sound.play_buzzer
return
end
Sound.play_equip
process_remove_all
end
end
end
#--------------------------------------------------------------------------
# ● 装備部位選択の更新
#--------------------------------------------------------------------------
alias update_equip_selection_KGC_ExtendedEquipScene update_equip_selection
def update_equip_selection
update_window_position_for_equip_selection
if Input.trigger?(Input::A)
if @actor.fix_equipment
Sound.play_buzzer
return
end
# 選択している装備品を外す
Sound.play_equip
@actor.change_equip(@equip_window.index, nil)
refresh_window
elsif Input.trigger?(Input::B)
Sound.play_cancel
if KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
show_command_window
else
# コマンドウィンドウ不使用なら終了
return_scene
end
return
elsif Input.trigger?(Input::R)
unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
# コマンドウィンドウ不使用時のみ切り替え
Sound.play_cursor
prev_actor
return
end
elsif Input.trigger?(Input::L)
unless KGC::ExtendedEquipScene::USE_COMMAND_WINDOW
# コマンドウィンドウ不使用時のみ切り替え
Sound.play_cursor
next_actor
return
end
elsif Input.trigger?(Input::C)
# 前回のアイテムをダミーにする
@last_item = RPG::Weapon.new
end
update_equip_selection_KGC_ExtendedEquipScene
end
#--------------------------------------------------------------------------
# ○ コマンドウィンドウに切り替え
#--------------------------------------------------------------------------
def show_command_window
@equip_window.active = false
@command_window.active = true
@command_window.open
end
#--------------------------------------------------------------------------
# ● アイテム選択の更新
#--------------------------------------------------------------------------
alias update_item_selection_KGC_ExtendedEquipScene update_item_selection
def update_item_selection
update_window_position_for_item_selection
update_item_selection_KGC_ExtendedEquipScene
if Input.trigger?(Input::C)
@base_info_window.refresh
end
end
#--------------------------------------------------------------------------
# ○ ウィンドウ位置の更新 (装備部位選択)
#--------------------------------------------------------------------------
def update_window_position_for_equip_selection
return if @item_window.x == @equip_window.width
@base_info_window.width = @equip_window.width
@item_window.x = [@item_window.x + ANIMATION_SPPED, @equip_window.width].min
if @ap_window != nil
@ap_window.x = @item_window.x
end
@equip_window.visible = true
@status_window.visible = false
end
#--------------------------------------------------------------------------
# ○ ウィンドウ位置の更新 (アイテム選択)
#--------------------------------------------------------------------------
def update_window_position_for_item_selection
return if @item_window.x == STANDARD_WIDTH
self.note.split(/[
]+/).each { |line|
case line
when KGC::EquipExtension::Regexp::BaseItem::EP_COST
# 消费 EP
@__ep_cost = $1.to_i
when KGC::EquipExtension::Regexp::BaseItem::EQUIP_TYPE
# 装备类别
@__equip_type = []
$1.scan(/d+/) { |num|
@__equip_type << num.to_i
}
end
}
# 不使用EP 时EP 消费= 0
@__ep_cost = 0 unless KGC::EquipExtension::USE_EP_SYSTEM
end
#--------------------------------------------------------------------------
# ○ 消费 EP
#--------------------------------------------------------------------------
def ep_cost
create_equip_extension_cache if @__ep_cost == nil
return @__ep_cost
end
#--------------------------------------------------------------------------
# ○ 装备类别
#--------------------------------------------------------------------------
def equip_type
create_equip_extension_cache if @__equip_type == nil
return @__equip_type
end
end
class RPG::Armor < RPG::BaseItem
#--------------------------------------------------------------------------
# ○生成扩展装备的cache
#--------------------------------------------------------------------------
def create_equip_extension_cache
super
@__kind = -1
self.note.split(/[
]+/).each { |line|
if line =~ KGC::EquipExtension::Regexp::Armor::EQUIP_KIND
# 装备类别
e_index = KGC::EquipExtension::EXTRA_EQUIP_KIND.index($1)
next if e_index == nil
@__kind = e_index + 4
end
}
end
unless $@
#--------------------------------------------------------------------------
# ○ 类别
#--------------------------------------------------------------------------
alias kind_KGC_EquipExtension kind
def kind
create_equip_extension_cache if @__kind == nil
return (@__kind == -1 ? kind_KGC_EquipExtension : @__kind)
end
end
# 搜索扩展防具栏
extra_armor_number.times { |i|
if extra_armor_id == item.id
@extra_armor_id = 0
break
end
}
restore_battle_skill if $imported["SkillCPSystem"]
restore_passive_rev if $imported["PassiveSkill"]
end
#--------------------------------------------------------------------------
# ● 职业 ID変更
# class_id : 新职业 ID
#--------------------------------------------------------------------------
alias class_id_equal_KGC_EquipExtension class_id=
def class_id=(class_id)
class_id_equal_KGC_EquipExtension(class_id)
return if extra_armor_number == 0 # 没有扩展防具栏
# 删除无法装备的扩展防具
for i in 5..armor_number
change_equip(i, nil) unless equippable?(equips)
end
end
#--------------------------------------------------------------------------
# ○ EP 条件清除判定
# equip_type : 装备部位
# item : 武器 or 防具
#--------------------------------------------------------------------------
def ep_condition_clear?(equip_type, item)
return true if item == nil # 为空可以解除
curr_item = equips[equip_type]
offset = (curr_item != nil ? curr_item.ep_cost : 0)
return false if self.ep < (item.ep_cost - offset) # EP 不足
return true
end
#--------------------------------------------------------------------------
# ○修复装备
#--------------------------------------------------------------------------
def restore_equip
#退避以前的装备品・参数
last_equips = equips
last_hp = self.hp
last_mp = self.mp
if $imported["SkillCPSystem"]
last_battle_skill_ids = battle_skill_ids.clone
end
if KGC::EquipExtension::SHOW_STATUS_EP
#--------------------------------------------------------------------------
# ● 基本情報描画
# x : 描画 X 座標
# y : 描画 Y 坐标
#--------------------------------------------------------------------------
alias draw_basic_info_KGC_EquipExtension draw_basic_info
def draw_basic_info(x, y)
draw_basic_info_KGC_EquipExtension(x, y)
draw_actor_ep(@actor, x + 160, y + WLH * 4)
end
end
#--------------------------------------------------------------------------
# ● 装备品描画
# x : 描画 X 坐标
# y : 描画 Y 坐标
#--------------------------------------------------------------------------
def draw_equipments(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
item_number = [@actor.equips.size, @actor.armor_number + 1].min
item_number.times { |i|
draw_item_name(@actor.equips, x + 16, y + WLH * (i + 1))
}
end
end
self.note.split(/[\r\n]+/).each { |line|
case line
when KGC::EquipExtension::Regexp::BaseItem::EP_COST
# 消费 EP
@__ep_cost = $1.to_i
when KGC::EquipExtension::Regexp::BaseItem::EQUIP_TYPE
# 装备类别
@__equip_type = []
$1.scan(/\d+/) { |num|
@__equip_type << num.to_i
}
end
}
# 不使用EP 时EP 消费= 0
@__ep_cost = 0 unless KGC::EquipExtension::USE_EP_SYSTEM
end
#--------------------------------------------------------------------------
# ○ 消费 EP
#--------------------------------------------------------------------------
def ep_cost
create_equip_extension_cache if @__ep_cost == nil
return @__ep_cost
end
#--------------------------------------------------------------------------
# ○ 装备类别
#--------------------------------------------------------------------------
def equip_type
create_equip_extension_cache if @__equip_type == nil
return @__equip_type
end
end
class RPG::Armor < RPG::BaseItem
#--------------------------------------------------------------------------
# ○生成扩展装备的cache
#--------------------------------------------------------------------------
def create_equip_extension_cache
super
@__kind = -1
self.note.split(/[\r\n]+/).each { |line|
if line =~ KGC::EquipExtension::Regexp::Armor::EQUIP_KIND
# 装备类别
e_index = KGC::EquipExtension::EXTRA_EQUIP_KIND.index($1)
next if e_index == nil
@__kind = e_index + 4
end
}
end
unless $@
#--------------------------------------------------------------------------
# ○ 类别
#--------------------------------------------------------------------------
alias kind_KGC_EquipExtension kind
def kind
create_equip_extension_cache if @__kind == nil
return (@__kind == -1 ? kind_KGC_EquipExtension : @__kind)
end
end
# 搜索扩展防具栏
extra_armor_number.times { |i|
if extra_armor_id == item.id
@extra_armor_id = 0
break
end
}
restore_battle_skill if $imported["SkillCPSystem"]
restore_passive_rev if $imported["PassiveSkill"]
end
#--------------------------------------------------------------------------
# ● 职业 ID変更
# class_id : 新职业 ID
#--------------------------------------------------------------------------
alias class_id_equal_KGC_EquipExtension class_id=
def class_id=(class_id)
class_id_equal_KGC_EquipExtension(class_id)
return if extra_armor_number == 0 # 没有扩展防具栏
# 删除无法装备的扩展防具
for i in 5..armor_number
change_equip(i, nil) unless equippable?(equips)
end
end
#--------------------------------------------------------------------------
# ○ EP 条件清除判定
# equip_type : 装备部位
# item : 武器 or 防具
#--------------------------------------------------------------------------
def ep_condition_clear?(equip_type, item)
return true if item == nil # 为空可以解除
curr_item = equips[equip_type]
offset = (curr_item != nil ? curr_item.ep_cost : 0)
return false if self.ep < (item.ep_cost - offset) # EP 不足
return true
end
#--------------------------------------------------------------------------
# ○修复装备
#--------------------------------------------------------------------------
def restore_equip
#退避以前的装备品・参数
last_equips = equips
last_hp = self.hp
last_mp = self.mp
if $imported["SkillCPSystem"]
last_battle_skill_ids = battle_skill_ids.clone
end
if KGC::EquipExtension::SHOW_STATUS_EP
#--------------------------------------------------------------------------
# ● 基本情報描画
# x : 描画 X 座標
# y : 描画 Y 坐标
#--------------------------------------------------------------------------
alias draw_basic_info_KGC_EquipExtension draw_basic_info
def draw_basic_info(x, y)
draw_basic_info_KGC_EquipExtension(x, y)
draw_actor_ep(@actor, x + 160, y + WLH * 4)
end
end
#--------------------------------------------------------------------------
# ● 装备品描画
# x : 描画 X 坐标
# y : 描画 Y 坐标
#--------------------------------------------------------------------------
def draw_equipments(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
item_number = [@actor.equips.size, @actor.armor_number + 1].min
item_number.times { |i|
draw_item_name(@actor.equips, x + 16, y + WLH * (i + 1))
}
end
end