赞 | 123 |
VIP | 13 |
好人卡 | 16 |
积分 | 195 |
经验 | 38692 |
最后登录 | 2024-11-21 |
在线时间 | 3106 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 19463
- 在线时间
- 3106 小时
- 注册时间
- 2013-1-11
- 帖子
- 1292
|
6楼
楼主 |
发表于 2015-11-14 10:22:15
|
只看该作者
本帖最后由 张咚咚 于 2015-11-14 10:44 编辑
正太君 发表于 2015-11-13 16:57
利用劳动课来机房帮你修脚本...
谢谢你,嗯,还有最后一个问题。
就是卖装备时,它显示属性增减正常,买的时候只能以普通属性增减,怎么把附加属性也算进去呢。
#============================================================================== # ■ 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
#==============================================================================
# ■ 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
#============================================================================== # ■ Window_ShopBuy #------------------------------------------------------------------------------ # 商店画面、浏览显示可以购买的商品的窗口。 #============================================================================== class Window_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 # x : 窗口 X 座标 # y : 窗口 Y 座标 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 304, 360) @shop_goods = $game_temp.shop_goods refresh self.index = 0 end #-------------------------------------------------------------------------- # ● 获取商品 #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh @data = [] unless $game_switches[1] # 控制开关必须和这里一致... for goods_item in @shop_goods case goods_item[0] when 0 item = $data_items[goods_item[1]] when 1 item = $base_weapons[goods_item[1]] when 2 item = $base_armors[goods_item[1]] end if item != nil @data.push(item) end end else for i in 0..$game_variables[1].size # 存储数组必须和这里一致... @data.push($game_variables[1][i]) if $game_variables[1][i] end end @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # ● 绘制商品 # index : 商品索引 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] number = $game_party.item_number(item) enabled = (item.price <= $game_party.gold and number < 99) rect = item_rect(index) self.contents.clear_rect(rect) draw_item_name(item, rect.x, rect.y, enabled) rect.width -= 4 self.contents.draw_text(rect, item.price, 2) end #-------------------------------------------------------------------------- # ● 更新帮助窗口文字 #-------------------------------------------------------------------------- def update_help @help_window.set_text(item == nil ? "" : item.description) end end
#==============================================================================
# ■ Window_ShopBuy
#------------------------------------------------------------------------------
# 商店画面、浏览显示可以购买的商品的窗口。
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# x : 窗口 X 座标
# y : 窗口 Y 座标
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 304, 360)
@shop_goods = $game_temp.shop_goods
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 获取商品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@data = []
unless $game_switches[1] # 控制开关必须和这里一致...
for goods_item in @shop_goods
case goods_item[0]
when 0
item = $data_items[goods_item[1]]
when 1
item = $base_weapons[goods_item[1]]
when 2
item = $base_armors[goods_item[1]]
end
if item != nil
@data.push(item)
end
end
else
for i in 0..$game_variables[1].size # 存储数组必须和这里一致...
@data.push($game_variables[1][i]) if $game_variables[1][i]
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 绘制商品
# index : 商品索引
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item)
enabled = (item.price <= $game_party.gold and number < 99)
rect = item_rect(index)
self.contents.clear_rect(rect)
draw_item_name(item, rect.x, rect.y, enabled)
rect.width -= 4
self.contents.draw_text(rect, item.price, 2)
end
#--------------------------------------------------------------------------
# ● 更新帮助窗口文字
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? "" : item.description)
end
end
|
|