#==============================================================================
# ■ Harts_Window_EquipTitle
#------------------------------------------------------------------------------
# 装備画面で、タイトルを表示するウィンドウ。
#==============================================================================
class Harts_Window_EquipTitle < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, $data_system.words.equip, 1)
end
end
#==============================================================================
# ■ Harts_Window_EquipCommand
#------------------------------------------------------------------------------
# 装備の選択を行うウィンドウです。
#==============================================================================
class Harts_Window_EquipCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(160, 0, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@column_max = 3
@commands = ["Equiper", "Auto-Equip", "Annuler"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
x = index * 160 + 4
self.contents.draw_text(x, 0, 128, 32, @commands[index], 1)
end
end
#==============================================================================
# ■ Harts_Window_EquipItem
#------------------------------------------------------------------------------
# 装備画面で、装備変更の候補となるアイテムの一覧を表示するウィンドウです。
#==============================================================================
class Harts_Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
# equip_type : 装備部位 (0~3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(272, 256, 368, 160)
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 最強アイテムのid取得
#--------------------------------------------------------------------------
def max_item_id
if @equip_type == 0
if @actor.weapon_id == 0
max = 0
else
max = $data_weapons[@actor.weapon_id].atk
end
elsif @equip_type == 1
if @actor.armor1_id == 0
max = 0
else
max = $data_armors[@actor.armor1_id].pdef
end
elsif @equip_type == 2
if @actor.armor2_id == 0
max = 0
else
max = $data_armors[@actor.armor2_id].pdef
end
elsif @equip_type == 3
if @actor.armor3_id == 0
max = 0
else
max = $data_armors[@actor.armor3_id].pdef
end
end
for i in
0...@data.size-1
if @equip_type == 0
if max <= $data_weapons[@data[i].id].atk
max = $data_weapons[@data[i].id].atk
item_id = @data[i].id
end
elsif @equip_type >= 1
if max <= $data_armors[@data[i].id].pdef
max = $data_armors[@data[i].id].pdef
item_id = @data[i].id
end
end
end
return item_id
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 装備可能な武器を追加
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
# 装備可能な防具を追加
if @equip_type >= 1
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
# 空白を追加
@data.push(nil)
# ビットマップを作成し、全項目を描画
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = index * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 280, y, 16, 32, ":", 1)
self.contents.draw_text(x + 296, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ■ Harts_Window_EquipLeft
#------------------------------------------------------------------------------
# 装備画面で、アクターのパラメータ変化を表示するウィンドウです。
#==============================================================================
class Harts_Window_EquipLeft < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 272, 352)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 32, 64)
draw_actor_name(@actor, 4 + 96, 0)
draw_actor_level(@actor, 4 + 96, 32)
draw_actor_parameter(@actor, 4, 80, 0)
draw_actor_parameter(@actor, 4, 112, 1)
draw_actor_parameter(@actor, 4, 144, 2)
draw_actor_parameter(@actor, 4, 192, 3)
draw_actor_parameter(@actor, 4, 224, 4)
draw_actor_parameter(@actor, 4, 256, 5)
draw_actor_parameter(@actor, 4, 288, 6)
if @new_atk != nil and @new_atk != @actor.atk
if @new_atk > @actor.atk
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 80, 40, 32, "→", 1)
self.contents.draw_text(200, 80, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil and @new_pdef != @actor.pdef
if @new_pdef > @actor.pdef
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 112, 40, 32, "→", 1)
self.contents.draw_text(200, 112, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil and @new_mdef != @actor.mdef
if @new_mdef > @actor.mdef
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 144, 40, 32, "→", 1)
self.contents.draw_text(200, 144, 36, 32, @new_mdef.to_s, 2)
end
if @new_str != nil and @new_str != @actor.str
if @new_str > @actor.str
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 192, 40, 32, "→", 1)
self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
end
if @new_dex != nil and @new_dex != @actor.dex
if @new_dex > @actor.dex
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 224, 40, 32, "→", 1)
self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
end
if @new_agi != nil and @new_agi != @actor.agi
if @new_agi > @actor.agi
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 256, 40, 32, "→", 1)
self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
end
if @new_int != nil and @new_int != @actor.int
if @new_int > @actor.int
self.contents.font.color = system_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(160, 288, 40, 32, "→", 1)
self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
end
end
#--------------------------------------------------------------------------
# ● 装備変更後のパラメータ設定
# new_atk : 装備変更後の攻撃力
# new_pdef : 装備変更後の物理防御
# new_mdef : 装備変更後の魔法防御
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or @new_int != new_int
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end
#==============================================================================
# ■ Harts_Scene_Equip
#------------------------------------------------------------------------------
# 装備画面の処理を行うクラスです。
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor_index : アクターインデックス
# equip_index : 装備インデックス
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = -1, command_index = 0, equip_active = false, command_active = true)
@actor_index = actor_index
@equip_index = equip_index
@command_index = command_index
@equip_active = equip_active
@command_active = command_active
end
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# アクターを取得
@actor = $game_party.actors[@actor_index]