#==============================================================================
# ■ Window_ShopStatus
#------------------------------------------------------------------------------
# 商店画面、显示物品所持数与角色装备的窗口。
#==============================================================================
class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# x : 窗口 X 座标
# y : 窗口 Y 座标
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 240, 360)
@item = nil
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @item != nil
number = $game_party.item_number(@item)
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 200, WLH, number, 2)
for actor in $game_party.members
x = 4
y = WLH * (2 + actor.index * 2)
draw_actor_parameter_change(actor, x, y)
end
end
end
#--------------------------------------------------------------------------
# ● 绘制角色当前装备和能力值
# actor : 角色
# x : 绘制点 X 座标
# y : 绘制点 Y 座标
#--------------------------------------------------------------------------
def draw_actor_parameter_change(actor, x, y)
return if @item.is_a?(RPG::Item)
enabled = actor.equippable?(@item)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x, y, 200, WLH, "")
self.contents.draw_text(x, y + WLH * 1, 200, WLH, "气血上限")
self.contents.draw_text(x, y + WLH * 2, 200, WLH, "法力上限")
self.contents.draw_text(x, y + WLH * 3, 200, WLH, "攻击")
self.contents.draw_text(x, y + WLH * 4, 200, WLH, "防御")
self.contents.draw_text(x, y + WLH * 5, 200, WLH, "抗魔")
self.contents.draw_text(x, y + WLH * 6, 200, WLH, "速度")
self.contents.draw_text(x, y + WLH * 7, 200, WLH, "暴击率")
self.contents.draw_text(x, y + WLH * 8, 200, WLH, "闪避率")
if @item.is_a?(RPG::Weapon)
item1 = weaker_weapon(actor)
elsif actor.two_swords_style and @item.kind == 0
item1 = nil
else
item1 = actor.equips[1 + @item.kind]
end
draw_item_name(item1, x, y, enabled)
maxhp1 = item1 == nil ? 0 : item1.maxhp
maxhp2 = @item == nil ? 0 : @item.maxhp
change = maxhp2 - maxhp1
self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0 #绿色(+)
self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0 #红色(-)
self.contents.draw_text(x, y + WLH * 1, 200, WLH, sprintf("%+d", change), 2)
maxmp1 = item1 == nil ? 0 : item1.maxmp
maxmp2 = @item == nil ? 0 : @item.maxmp
change = maxmp2 - maxmp1
self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0 #绿色(+)
self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0 #红色(-)
self.contents.draw_text(x, y + WLH * 2, 200, WLH, sprintf("%+d", change), 2)
atk1 = item1 == nil ? 0 : item1.atk
atk2 = @item == nil ? 0 : @item.atk
change = atk2 - atk1
self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0 #绿色(+)
self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0 #红色(-)
self.contents.draw_text(x, y + WLH * 3, 200, WLH, sprintf("%+d", change), 2)
def1 = item1 == nil ? 0 : item1.def
def2 = @item == nil ? 0 : @item.def
change = def2 - def1
self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0 #绿色(+)
self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0 #红色(-)
self.contents.draw_text(x, y + WLH * 4, 200, WLH, sprintf("%+d", change), 2)
spi1 = item1 == nil ? 0 : item1.spi
spi2 = @item == nil ? 0 : @item.spi
change = spi2 - spi1
self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0 #绿色(+)
self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0 #红色(-)
self.contents.draw_text(x, y + WLH * 5, 200, WLH, sprintf("%+d", change), 2)
agi1 = item1 == nil ? 0 : item1.agi
agi2 = @item == nil ? 0 : @item.agi
change = agi2 - agi1
self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0 #绿色(+)
self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0 #红色(-)
self.contents.draw_text(x, y + WLH * 6, 200, WLH, sprintf("%+d", change), 2)
hit1 = item1 == nil ? 0 : item1.hit
hit2 = @item == nil ? 0 : @item.hit
change = hit2 - hit1
self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0 #绿色(+)
self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0 #红色(-)
self.contents.draw_text(x, y + WLH * 7, 200, WLH, sprintf("%+d", change), 2)
eva1 = item1 == nil ? 0 : item1.eva
eva2 = @item == nil ? 0 : @item.eva
change = eva2 - eva1
self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0 #绿色(+)
self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0 #红色(-)
self.contents.draw_text(x, y + WLH * 8, 200, WLH, sprintf("%+d", change), 2)
end
#--------------------------------------------------------------------------
# ● 获取双刀派角色所装备的武器中较弱的武器
# actor : 角色
#--------------------------------------------------------------------------
def weaker_weapon(actor)
if actor.two_swords_style
weapon1 = actor.weapons[0]
weapon2 = actor.weapons[1]
if weapon1 == nil or weapon2 == nil
return nil
elsif weapon1.atk < weapon2.atk
return weapon1
else
return weapon2
end
else
return actor.weapons[0]
end
end
#--------------------------------------------------------------------------
# ● 设置物品
# item : 新物品
#--------------------------------------------------------------------------
def item=(item)
if @item != item
@item = item
refresh
end
end
end