def qiangxz_cancel
@wu_window.show
@qiangxz_window.hide
@qiangxz_window.deactivate
if $wufang == true
@wu_window.activate
else
@fang_window.activate
end
$当前使用宝石加成率 = 0
$usegem = false
@command_window.deactivate
end
def qianging
i = 0
while i < 20
i += 1
text = "\n"
text += "★" * i + "☆" * (20 - i)
text = text + "\n强化中,请等待。"
@qianghelp_window.set_text(text)
Graphics.wait(6)
end
end
end
class RPG::EquipItem < RPG::BaseItem
alias old initialize
def initialize
old
@up = 0 #装备强化次数
end
attr_accessor :up
end
#==============================================================================
# ■ Window_Qiangwu
#------------------------------------------------------------------------------
# 强化系统_武器强化窗口
#==============================================================================
class Window_Qiangwu < Window_ItemList
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(qianghelp,xuanze)
super(0, 0, Graphics.width, fitting_height(8))
self.openness = 0
deactivate
@qianghelp = qianghelp
@xuanze = xuanze
end
#--------------------------------------------------------------------------
# ● 开始输入的处理
#--------------------------------------------------------------------------
def start
self.category = :weapon
refresh
select(0)
open
activate
end
#--------------------------------------------------------------------------
# ● 查询此物品是否可用
#--------------------------------------------------------------------------
def enable?(item)
return false unless item != nil
Qiang.weaponupable?(item.id)
end
#--------------------------------------------------------------------------
# ● 确定强化武器
#--------------------------------------------------------------------------
def qiangwu_ok
result = item ? item.id : 0
end
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
return unless item != nil
@help_window.set_item(item)
needmoney = 0
Qiang.weaponupable?(item.id)
qitemname = Qiang.lostitem.name
if item.up >= $强化哈希表["最高等级"]
qitemname = "无法继续升级"
end
temp = []
$usegem == true ? temp.push("使用") : temp.push("未使用")
temp.push($data_items[$强化哈希表["特殊物品"][0]].name)
$fangb == true ? temp.push("使用") : temp.push("未使用")
temp.push($data_items[$强化哈希表["特殊物品"][1]].name)
$fangj == true ? temp.push("使用") : temp.push("未使用")
cgl = ($强化哈希表["每级概率"][item.up] + $当前使用宝石加成率).to_s
if item.up == 0
min = item.params[2] + 1
max = min + 5
else
if item.up >= $强化哈希表["最高等级"]
min = item.params[2].to_int
max = min
else
min = (item.params[2] * (1 + $强化哈希表["提升能力"][item.up] / 100)).to_int + item.up
max = min + item.up * 5
end
end
text = "装备名称:" + item.name + " 强化所需" + Vocab::currency_unit + ":" + Qiang.needmoney.to_s
text = text + "\n" + "当前强化等级:" + item.up.to_s + " 强化需要:" + qitemname
text = text + "\n" + "强化宝石:" + temp [0] + " " + temp[1] + ":" + temp[2]+ " " + temp[3] + ":" + temp[4]
text = text + "\n" + "成功率:" + cgl + "% " + "强化后攻击力范围:" + min.to_s + "~" + max.to_s
@qianghelp.set_text(text)
end
#--------------------------------------------------------------------------
# ● 获取当前武器等级
#--------------------------------------------------------------------------
def getweaponup
Qiang.weaponupisnil(item.id)
item.up
end
def itemid
item.id
end
#--------------------------------------------------------------------------
# ● 选择项目
#--------------------------------------------------------------------------
def select(index)
self.index = index if index
update_help
end
end
#==============================================================================
# ■ Window_Qiangfang
#------------------------------------------------------------------------------
# 强化系统_防具强化窗口
#==============================================================================
class Window_Qiangfang < Window_ItemList
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(qianghelp,xuanze)
super(0, 0, Graphics.width, fitting_height(8))
self.openness = 0
deactivate
@qianghelp = qianghelp
@xuanze = xuanze
end
#--------------------------------------------------------------------------
# ● 开始输入的处理
#--------------------------------------------------------------------------
def start
self.category = :armor
refresh
select(0)
open
activate
end
#--------------------------------------------------------------------------
# ● 查询此物品是否可用
#--------------------------------------------------------------------------
def enable?(item)
return false unless item != nil
Qiang.armorupable?(item.id)
end
#--------------------------------------------------------------------------
# ● 确定强化防具
#--------------------------------------------------------------------------
def qiangfang_ok
result = item ? item.id : 0
end
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
return unless item != nil
@help_window.set_item(item)
needmoney = 0
Qiang.armorupable?(item.id)
qitemname = Qiang.lostitem.name
if item.up >= $强化哈希表["最高等级"]
qitemname = "无法继续升级"
end
temp = []
$usegem == true ? temp.push("使用") : temp.push("未使用")
temp.push($data_items[$强化哈希表["特殊物品"][0]].name)
$fangb == true ? temp.push("使用") : temp.push("未使用")
temp.push($data_items[$强化哈希表["特殊物品"][1]].name)
$fangj == true ? temp.push("使用") : temp.push("未使用")
cgl = ($强化哈希表["每级概率"][item.up] + $当前使用宝石加成率).to_s
if item.up == 0
min = item.params[3] + 1
max = min + 5
else
if item.up >= $强化哈希表["最高等级"]
min = item.params[3].to_int
max = min
else
min = (item.params[3] * (1 + $强化哈希表["提升能力"][item.up] / 100)).to_int + item.up
max = min + item.up * 5
end
end
text = "装备名称:" + item.name + " 强化所需" + Vocab::currency_unit + ":" + Qiang.needmoney.to_s
text = text + "\n" + "当前强化等级:" + item.up.to_s + " 强化需要:" + qitemname
text = text + "\n" + "强化宝石:" + temp [0] + " " + temp[1] + ":" + temp[2]+ " " + temp[3] + ":" + temp[4]
text = text + "\n" + "成功率:" + cgl + "% " + "强化后防御力范围:" + min.to_s + "~" + max.to_s
@qianghelp.set_text(text)
end
#--------------------------------------------------------------------------
# ● 获取当前防具等级
#--------------------------------------------------------------------------
def getarmorup
Qiang.armorupisnil(item.id)
item.up
end
def itemid
item.id
end
#--------------------------------------------------------------------------
# ● 选择项目
#--------------------------------------------------------------------------
def select(index)
self.index = index if index
update_help
end
end
#==============================================================================
# ■ Window_QiangCommand
#------------------------------------------------------------------------------
# 强化系统中,处理命令选择的窗口。
#==============================================================================
class Window_Qianghelp < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, fitting_height(4) + 8)
refresh
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 544
end
#--------------------------------------------------------------------------
# ● 获取持有金钱
#--------------------------------------------------------------------------
def value
$game_party.gold
end
#--------------------------------------------------------------------------
# ● 获取货币单位
#--------------------------------------------------------------------------
def currency_unit
Vocab::currency_unit
end
#--------------------------------------------------------------------------
# ● 设置内容
#--------------------------------------------------------------------------
def set_text(text)
if text != @text
@text = text
refresh
end
end
#--------------------------------------------------------------------------
# ● 清除
#--------------------------------------------------------------------------
def clear
set_text("")
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_text_ex(4, 0, @text)
end
end
#==============================================================================
# ■ Window_Qiangxz
#------------------------------------------------------------------------------
# 强化系统中,选择强化方式的窗口。
#==============================================================================
class Window_Qiangxz < Window_Command
@havegem = false
@havefangb = false
@havefangj = false
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0, 0)
index = 0
update_placement
self.openness = 0
open
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 180
end
#--------------------------------------------------------------------------
# ● 更新窗口的位置
#--------------------------------------------------------------------------
def update_placement
self.x = (Graphics.width - width) / 2
self.y = (Graphics.height - height) / 2
end
#--------------------------------------------------------------------------
# ● 检查可用
#--------------------------------------------------------------------------
def haveitem
@havegem = false
@havefangb = false
@havefangj = false
for i in $强化哈希表["宝石效果"]
if $game_party.has_item?($data_items[i[1]])
@havegem = true
end
end
@havefangb = $game_party.has_item?($data_items[$强化哈希表["特殊物品"][0]])
@havefangj = $game_party.has_item?($data_items[$强化哈希表["特殊物品"][1]])
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
haveitem
add_command("宝石", :gem, @havegem)
add_command(Qiang.idgetitem($强化哈希表["特殊物品"][0]).name, :fangb, @havefangb)
add_command(Qiang.idgetitem($强化哈希表["特殊物品"][1]).name, :fangj, @havefangj)
add_command("开始强化", :start)
add_command("取消强化", :cancel)
end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中所有窗口的父类
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 绘制物品名称
# enabled : 有效的标志。false 的时候使用半透明效果绘制
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, enabled = true, width = 172)
return unless item
draw_icon(item.icon_index, x, y, enabled)
change_color(normal_color, enabled)
if item.is_a?(RPG::EquipItem)
if item.up != nil && item.up != 0
draw_text(x + 24, y, width, line_height, item.name + "+" + item.up.to_s)
else
draw_text(x + 24, y, width, line_height, item.name)
end
else
draw_text(x + 24, y, width, line_height, item.name)
end
end
end
class Window_ItemList
#--------------------------------------------------------------------------
# ● 查询列表中是否含有此物品
#--------------------------------------------------------------------------
def include?(item)
case @category
when :item
item.is_a?(RPG::Item) && !item.key_item?
when :weapon
item.is_a?(RPG::Weapon)
when :armor
item.is_a?(RPG::Armor)
when :key_item
item.is_a?(RPG::Item) && item.key_item?
when :gem
itemid = item ? item.id : 0
itemid != 0 ? isgem(itemid) : false
else
false
end
end
def isgem(itemid)
for i in $强化哈希表["宝石效果"]
return true if i[1] == itemid
end
false
end
end
#==============================================================================
# ■ Window_Choosegem
#------------------------------------------------------------------------------
# 选择强化使用的宝石
#==============================================================================
def wufangwindow=(wufangwindow)
@wufangwindow = wufangwindow
end
def qiangxz=(qiangxz)
@qiangxz = qiangxz
end
#--------------------------------------------------------------------------
# ● 开始输入的处理
#--------------------------------------------------------------------------
def start
self.category = :gem
self.y = (Graphics.height - height) / 2
refresh
select(0)
open
activate
end
#--------------------------------------------------------------------------
# ● 确定时的处理
#--------------------------------------------------------------------------
def on_ok
result = item ? item.id : 0
if result != 0
$usegem = true
$当前使用宝石id = result
for i in $强化哈希表["宝石效果"]
$当前使用宝石加成率 = i[0] if i[1] == $当前使用宝石id
end
else
$当前使用宝石加成率 = 0
$usegem = false
end
@wufangwindow.update_help
@qiangxz.activate
close
end
#--------------------------------------------------------------------------
# ● 查询此物品是否可用
#--------------------------------------------------------------------------
def enable?(item)
true
end
#--------------------------------------------------------------------------
# ● 取消时的处理
#--------------------------------------------------------------------------
def on_cancel
$当前使用宝石加成率 = 0
$usegem = false
@wufangwindow.update_help
@qiangxz.activate
close
end
end
#==============================================================================
# ■ 强化系统DataManager
#------------------------------------------------------------------------------
# 将武器和防具数据保存入存档
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# ● 生成存档内容
#--------------------------------------------------------------------------
def self.make_save_contents
contents = {}
contents[:system] = $game_system
contents[:timer] = $game_timer
contents[:message] = $game_message
contents[:switches] = $game_switches
contents[:variables] = $game_variables
contents[:self_switches] = $game_self_switches
contents[:actors] = $game_actors
contents[:party] = $game_party
contents[:troop] = $game_troop
contents[:map] = $game_map
contents[:player] = $game_player
contents[:weapons] = $data_weapons
contents[:armors] = $data_armors
contents
end
#--------------------------------------------------------------------------
# ● 展开存档内容
#--------------------------------------------------------------------------
def self.extract_save_contents(contents)
$game_system = contents[:system]
$game_timer = contents[:timer]
$game_message = contents[:message]
$game_switches = contents[:switches]
$game_variables = contents[:variables]
$game_self_switches = contents[:self_switches]
$game_actors = contents[:actors]
$game_party = contents[:party]
$game_troop = contents[:troop]
$game_map = contents[:map]
$game_player = contents[:player]
$data_weapons = contents[:weapons]
$data_armors = contents[:armors]
end
end
#==============================================================================
# [PS0]物品颜色描绘
# Window_Base_Itemcolor
#------------------------------------------------------------------------------
# 在物品、技能选项中显示物品品质并显示品质框和修改物品名颜色。
#==============================================================================
# [更新记录]
# - 2012.01.03 By 仲秋启明
# * 修改为VA定义
# - 2011.12.27 By 仲秋启明
# * 移植至RGSS3,遵循PS0协议;
# * 优化数据库备注中设定方法
# - 2011.08.22 By 冰舞蝶恋
# * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框)
# - 2010.08.06 By 仲秋启明
# * 蓝本(物品颜色描绘脚本(完整无冲突版))
#------------------------------------------------------------------------------
# [使用方法]
# - 替换原Window_Base中的draw_item_name定义或复制到Main之前
#==============================================================================
$_PS0 = {} if $_PS0 == nil
$_PS0["Window_Base_Itemcolor"] = 20111227
#==============================================================================
# [PS0] 通用配置模块
#==============================================================================
module PS0
module Window_Base_Itemcolor
Color1 = Color.new(255, 255, 255) # 一般品质的色彩(白,1)
Color2 = Color.new(128, 255, 128) # 平庸品质的色彩(绿,2)
Color3 = Color.new(57, 185, 255) # 精良品质的色彩(蓝,3)
Color4 = Color.new(128, 100, 245) # 卓越品质的色彩(紫,4)
Color5 = Color.new(255, 40, 255) # 神秘品质的色彩(红,5)
Color6 = Color.new(255, 128, 0) # 传说品质的色彩(橙,6)
Color7 = Color.new(255, 255, 128) # 特殊品质的色彩(黄,7)
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
def draw_item_name(item, x, y, enabled = true, width = 172)
if item != nil
n = item.note
a = n.split{/<(?:Quality|品质)\s*(.+)>/i}
c = a[1].to_i
if c <= 1
color = PS0::Window_Base_Itemcolor::Color1
elsif c == 2
color = PS0::Window_Base_Itemcolor::Color2
elsif c == 3
color = PS0::Window_Base_Itemcolor::Color3
elsif c == 4
color = PS0::Window_Base_Itemcolor::Color4
elsif c == 5
color = PS0::Window_Base_Itemcolor::Color5
elsif c == 6
color = PS0::Window_Base_Itemcolor::Color6
elsif c == 7
color = PS0::Window_Base_Itemcolor::Color7
else
color = Color.new(0, 0, 0, 0)
end
self.contents.fill_rect(x, y, 24, 1, color)
self.contents.fill_rect(x, y, 1, 24, color)
self.contents.fill_rect(x, y+23, 24, 1, color)
self.contents.fill_rect(x+23, y, 1, 24, color)
draw_icon(item.icon_index, x, y, enabled)
change_color(color, enabled)
if item.is_a?(RPG::EquipItem)
if item.up != nil && item.up != 0
draw_text(x + 24, y, width, line_height, "+" + item.up.to_s + item.name)
else
draw_text(x + 24, y, width, line_height, item.name)
end
else
draw_text(x + 24, y, width, line_height, item.name)
end
end
end
end
#==============================================================================
# [PS0] End of Script
#==============================================================================