| 赞 | 7 |
| VIP | |
| 好人卡 | |
| 积分 | 15 |
| 经验 | |
| 最后登录 | 2026-6-20 |
| 在线时间 | 815 小时 |
- 梦石
- 0
- 星屑
- 1461
- 在线时间
- 815 小时
- 注册时间
- 2013-8-3
- 回帖
- 355
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 小小西 于 2017-5-27 23:37 编辑
强化系统选择装备时物品属性介绍没有弹出,帮忙看看什么情况。{:2_253:}
物品属性介绍[pre lang="ruby"]#encoding:utf-8
#==============================================================================
# ■ 技能物品说明增强 蓝本:wyongcan
# 修改 :VIPArcher
#
# 改动说明:
# 改用新的帮助窗口和新定义draw_text_vip方法来增强兼容性
# 更改初始化数据时机以支持跳过标题
# 追加对普通物品和技能的说明内容
# 修改了对帮助窗口行数的计算以支持控制符
# 加上了各种颜色的设置,具体更高级的玩法自己领悟吧
# 改成光标不动一段时间后才会出现帮助窗口
#
# -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:help_ex] = 20141007
$VIPArcherScript[:equip_limit] = false #是否使用了后知后觉的装备能力限制
class << DataManager
alias_method :vip_load_database, :load_database
#--------------------------------------------------------------------------
# ● 读取数据库
#--------------------------------------------------------------------------
def load_database
vip_load_database
VIPArcher::Equipplus.equiphelpready
end
end
module VIPArcher;end
module VIPArcher::Equipplus
TIME = 3 #帮助窗口自动出现的时间(单位帧
Font_Name = Font.default_name # 推荐"微软雅黑"
Font_Size = 18 # "微软雅黑"的话就20号字体
UP = 24 #能力值提升颜色编号
DOWN = 25 #能力值下降颜色编号
VIP = 14 #特殊能力颜色编号
MP = 23
TP = 29
CODE ={
11 => "属性抗性",
12 => "弱化抗性",
13 => "状态抗性",
14 => "状态免疫",
21 => "普通能力",
22 => "添加能力",
23 => "特殊能力",
31 => "附加属性",
32 => "附加状态",
33 => "攻击速度",
34 => "添加攻击次数",
41 => "添加技能类型",
42 => "禁用技能类型",
43 => "添加技能",
44 => "禁用技能",
51 => "可用武器",
52 => "可用护甲",
53 => "固定装备",
54 => "禁用装备",
55 => "装备风格",
61 => "添加行动次数",
62 => "特殊标志",
63 => "消失效果",
64 => "队伍"}
#特殊标志
FLAG ={
0 => "自动战斗",
1 => "擅长防御",
2 => "保护弱者",
3 => "特技专注"}
#技能效果范围
SCOPE ={
0 => "无",
1 => "单个敌人",
2 => "全体敌人",
3 => "一个随机敌人",
4 => "两个随机敌人",
5 => "三个随机敌人",
6 => "四个随机敌人",
7 => "单个队友",
8 => "全体队友",
9 => "单个队友(战斗不能)",
10 => "全体队友(战斗不能)",
11 => "使用者" }
#技能命中类型
HIT ={
0 => "必定命中",
1 => "物理攻击",
2 => "魔法攻击"}
#使用限制
OCCASION ={
0 => "随时可用",
1 => "仅战斗中",
2 => "仅菜单中",
3 => "不能使用"}
#添加能力
XPARAM ={
0 => "物理命中率:",
1 => "物理闪避率:",
2 => "必杀几率:",
3 => "必杀闪避率:",
4 => "魔法闪避率:",
5 => "魔法反射率:",
6 => "物理反击率:",
7 => "HP逐渐恢复:",
8 => "MP逐渐恢复:",
9 => "SP逐渐增加:"}
#特殊能力
SPARAM ={
0 => "受到攻击率",
1 => "防御效果",
2 => "魔法恢复",
3 => "道具恢复",
4 => "MP消耗率",
5 => "SP获得率",
6 => "物理伤害加成",
7 => "魔法伤害加成",
8 => "地形伤害加成",
9 => "经验获得加成"}
#装备风格 require 装备风格扩展脚本
SLOT_TYPE ={
0 => "普通",
1 => "双持武器",
2 => "索爷三刀流",
3 => "NPC",
4 => "233",
5 => "论坛@的BUG好烦啊"}
#队伍能力
PARTY_ABILITY ={
0 => "遇敌几率减半",
1 => "随机遇敌无效",
2 => "敌人偷袭无效",
3 => "先制攻击提高",
4 => "获得金钱加倍",
5 => "掉落几率加倍"}
#伤害类型
DAMAGE_TYPE = {
0 => "无",
1 => "属性伤害",
2 => "属性伤害",
3 => "HP值恢复",
4 => "MP值恢复",
5 => "HP值吸收",
6 => "MP值吸收"}
#普通能力
#这只是个示范,你也可以依照个人喜好对这些用语添加颜色控制符
@params ={
0 => "\\c[17]最大HP",
1 => "\\c[16]最大MP",
2 => "\\c[20]攻击",
3 => "\\c[21]防御",
4 => "\\c[30]智慧",
5 => "\\c[31]精神",
6 => "\\c[14]速度",
7 => "\\c[17]幸运"}
#我举例技能类型的原因就是因为它 短
@skill_types = { # 这个和下面equiphelpready里注释掉的做的是一样的事
# 只是下面是读取数据库添加用语,这里是手动枚举
1 => "\\c[1]特技",
2 => "\\c[2]魔法",
3 => "\\c[3]必杀",
4 => "\\c[5]卖萌"}
#初始化数据,当然如果你要用上面那样的控制符改变颜色的话
#欢迎枚举格式就是上面这样用Hash,用ID做键把用语对应起来
def self.equiphelpready
params = $data_system.terms.params
elements = $data_system.elements
weapon_types = $data_system.weapon_types
armor_types = $data_system.armor_types
etypes = $data_system.terms.etypes
skill_types = $data_system.skill_types
@states ||= {}
@params ||= {}
@weapon_types ||= {}
@armor_types ||= {}
@etypes ||= {}
@skill_types ||= {}
@elements ||= {}
skill_types.each_with_index{|x,y| @skill_types[y] = x if !x.nil?} if @skill_types == {}
$data_states.each{|x| @states[x.id] = x.name if !x.nil?} if @states == {}
elements.each_with_index{|x,y| @elements[y] = x if !x.nil?} if @elements == {}
weapon_types.each_with_index{|x,y| @weapon_types[y] = x if !x.nil?} if @weapon_types == {}
armor_types.each_with_index{|x,y| @armor_types[y] = x if !x.nil?} if @armor_types == {}
etypes.each_with_index{|x,y| @etypes[y] = x} if @etypes == {}
params.each_with_index{|x,y| @params[y] = x} if @params == {}
end
#获取装备帮助内容
def self.getequiphelp(equip)
help = ""
param = []
help += "\\c[16]装备位置:#{Vocab::etype(equip.etype_id)}\\c[0]\n"
if $VIPArcherScript[:equip_limit] #装备能力限制
help += "\\c[16]等级需求:#{equip.level_limit}\n" if equip.level_limit > 0
param_limit = []
for i in 0..7
if equip.params_limit(i) != 0
help += "\\c[16]#{@params}需求:#{equip.params_limit(i)}\\c[0]\n"
end
end
end
equip.params.each_with_index{|x,y| param.push([@params[y],x])}
param = param.select{|x| x[1] != 0}
param.each{|x| help += "\\c[#{x[1]>0? UP : DOWN}]#{x[0]}:\\c[#{x[1]>0? UP : DOWN}]#{"﹢"if x[1]>0}#{x[1].to_int.to_s}\\c[0]\n"}
features = equip.features
featuresparam = []
featuresparam.push features.select{|x| x.code == 21}
featuresparam.push features.select{|x| x.code == 22}
featuresparam.push features.select{|x| x.code == 23}
featuresparam[0].each{|x| help += "\\c[#{x.value<0?DOWN: UP}]#{@params[x.data_id]}#{x.value<0?"﹣":" * "}#{(x.value.abs*100).to_i}%\n"}
featuresparam[1].each{|x| help += "\\c[#{x.value<0?DOWN: UP}]#{XPARAM[x.data_id]}#{x.value<0?"﹣":" * "}#{(x.value.abs*100).to_i}%\n"}
featuresparam[2].each{|x| help += "\\c[#{x.value<0?DOWN: UP}]#{SPARAM[x.data_id]}#{x.value<0?"﹣":" * "}#{(x.value.abs*100).to_i}%\n"}
if $VIPArcherScript[:slot_type]
help += "\\c[#{VIP}]#{CODE[55]}:#{SLOT_TYPE[$1.to_i]}\\c[0]\n" if equip.note =~ /<slot_type\s*[:](.*)>/i
else
features.select{|x| x.code == 55}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:双持武器\\c[0]\n"}
end
features.select{|x| x.code == 11}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@elements[x.data_id]}*#{(x.value*100).to_i}%\\c[0]\n"}
features.select{|x| x.code == 12}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@params[x.data_id]}*#{(x.value*100).to_i}%\\c[0]\n"}
features.select{|x| x.code == 13}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@states[x.data_id]}*#{(x.value*100).to_i}%\\c[0]\n"}
features.select{|x| x.code == 14}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{@states[x.data_id]}\\c[0]\n"}
features.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@elements[x.data_id]}\\c[0]\n"}
features.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@states[x.data_id]}#{(x.value*100).to_i}%\\c[0]\n"}
features.select{|x| x.code == 33}.each{|x| help += "\\c[#{x.value>0? UP : DOWN}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
features.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
features.select{|x| x.code == 41}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@skill_types[x.data_id]}\\c[0]\n"}
features.select{|x| x.code == 42}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@skill_types[x.data_id]}\\c[0]\n"}
features.select{|x| x.code == 43}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{$data_skills[x.data_id].name}\\c[0]\n"}
features.select{|x| x.code == 44}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{$data_skills[x.data_id].name}\\c[0]\n"}
features.select{|x| x.code == 51}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@weapon_types[x.data_id]}\\c[0]\n"}
features.select{|x| x.code == 52}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@armor_types[x.data_id]}\\c[0]\n"}
features.select{|x| x.code == 53}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@etypes[x.data_id]}\\c[0]\n"}
features.select{|x| x.code == 54}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@etypes[x.data_id]}\\c[0]\n"}
features.select{|x| x.code == 61}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
features.select{|x| x.code == 62}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{FLAG[x.data_id]}\\c[0]\n"}
features.select{|x| x.code == 64}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{PARTY_ABILITY[x.data_id]}\\c[0]\n"}
help
end
#获取技能帮助内容
def self.getskillhelp(skill)
help = ""
effects = skill.effects
damage = skill.damage
r = [skill.required_wtype_id1,skill.required_wtype_id2]
help += "\\c[16]消耗:\\c[#{MP}]MP:#{skill.mp_cost.to_s} \\c[#{TP}]SP:#{skill.tp_cost.to_s}\\c[0]\n" if skill.mp_cost > 0 && skill.tp_cost > 0
help += "\\c[16]消耗:\\c[#{MP}]MP:#{skill.mp_cost.to_s}\\c[0]\n" if skill.mp_cost > 0 && skill.tp_cost <= 0
help += "\\c[16]消耗:\\c[#{TP}]SP:#{skill.tp_cost.to_s}\\c[0]\n" if skill.tp_cost > 0 && skill.mp_cost <= 0
help += "\\c[#{skill.speed<0?DOWN: UP}]速度修正:#{skill.speed}\\c[0]\n" if skill.speed != 0
help += "\\c[#{DOWN}]成功率:#{skill.success_rate}%\\c[0]\n" if skill.success_rate != 100
help += "\\c[16]类型:#{HIT[skill.hit_type]}\\c[0]\n"
help += "\\c[16]效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\\c[0]\n" if damage.type != 0
effects.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]强化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
effects.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
effects.select{|x| x.code == 33}.each{|x| help += "\\c[#{UP}]解除:强化#{@params[x.data_id]}\n"}
effects.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]解除:弱化#{@params[x.data_id]}\n"}
effects.select{|x| x.code == 22}.each{|x| help += "\\c[#{UP}]解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
effects.select{|x| x.code == 41}.each{|x| help += "\\c[#{VIP}]特殊效果:撤退\n"}
effects.select{|x| x.code == 42}.each{|x| help += "\\c[#{UP}]提升:#{@params[x.data_id]}#{x.value1.to_i}点\\c[0]\n"}
effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_skills[x.data_id].name}\\c[0]\n"}
help += "\\c[16]场合:#{OCCASION[skill.occasion]}\n"
help += "\\c[#{DOWN}]限制:#{$data_system.weapon_types[r[0]] if r[0] != 0} #{$data_system.weapon_types[r[1]] if r[1] != 0}\\c[0]\n" if r != [0,0]
help
end
#获取道具帮助内容
def self.getitemhelp(item)
help = ""
effects = item.effects
damage = item.damage
help += "\\c[16]类型:\\c[#{VIP}]#{"贵重物品 "if item.itype_id != 1}\\c[#{DOWN}]#{item.consumable ? "消耗品":"非消耗品"}\\c[0]\n"
help += "\\c[16]效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\\c[0]\n" if damage.type != 0
effects.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]强化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
effects.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
effects.select{|x| x.code == 33}.each{|x| help += "\\c[#{UP}]解除:强化#{@params[x.data_id]}\\c[0]\n"}
effects.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]解除:弱化#{@params[x.data_id]}\\c[0]\n"}
effects.select{|x| x.code == 22}.each{|x| help += "\\c[#{UP}]解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
effects.select{|x| x.code == 41}.each{|x| help += "\\c[#{VIP}]特殊效果:撤退\n"}
effects.select{|x| x.code == 42}.each{|x| help += "\\c[#{VIP}]提升:#{@params[x.data_id]}#{x.value1.to_i}点\\c[0]\n"}
effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_skills[x.data_id].name}\\c[0]\n"}
help += "\\c[16]场合:#{OCCASION[item.occasion]}\\c[0]\n"
help
end
#计算行数(有些字体的汉字和[字母,数字,符号]的宽度不同,
#有可能会照成行数计算不对,尽量用宽度相同的字体吧)
def self.getline(text,maxtext)
text_new = ""
xtext = []
line = 0
text.each_line{|x| text_new += x.gsub(/\\\S\[\d+\]/i){}} #去掉控制符
text_new.each_line{|x| xtext.push x.gsub(/\n/){}} #去掉换行符
xtext.each{|x| line += (x.size / (maxtext.to_f + 1).to_i) + 1}
line
end
end
#==============================================================================
# ■ Window_Help_Ex
#------------------------------------------------------------------------------
# 加强显示特技和物品等的说明
#==============================================================================
class Window_Help_Ex < Window_Base
include VIPArcher::Equipplus
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(line_number = 0)
super(0, 0, 210, 0)
self.z = 150
contents.font.size = 18
@Time = 0
end
#--------------------------------------------------------------------------
# ● 设置内容
#--------------------------------------------------------------------------
def set_text(text)
@text = text
refresh
end
#--------------------------------------------------------------------------
# ● 清除
#--------------------------------------------------------------------------
def clear
set_text("")
end
#--------------------------------------------------------------------------
# ● 更新帮助位置
#--------------------------------------------------------------------------
def uppos(index,rect,window)
self.height = fitting_height_vip(VIPArcher::Equipplus.getline(@xtext,13))
create_contents
contents.font.name = Font_Name
contents.font.size = Font_Size
rect.x -= window.ox
rect.y -= window.oy
ax = rect.x + rect.width + 10
ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
ax += window.x
ax = 0 if ax < 0
ay = rect.y + rect.height
ay = rect.y - self.height if ay + self.height > window.height
ay += window.y
ay = 0 if ay < 0
self.x = ax
self.y = ay + 12
set_text(@xtext)
@time = TIME
self.show
self.openness = 0
end
#--------------------------------------------------------------------------
# ● 设置物品
# item : 技能、物品等
#--------------------------------------------------------------------------
def set_item(item)
if item == nil
set_text("")
return
end
@xtext = ""
if $VIPArcherScript[:itemcolor] # require 物品描绘颜色脚本
@xtext = "\\c[16]名称:\\c[#{VIPArcher::ItemColor::Color_Lv[item.color]}]" +
"#{item.name} #{item.color if item.color != 0}#{"★" if item.color != 0}\\c[0]\n"
else
@xtext = "\\c[16]名称:\\c[0]#{item.name}\n"
end
if $VIPArcherScript[:load] # require 队伍负重脚本
@xtext += "\\c[16]售价:#{item.price} 重量:#{item.load}\\c[0]\n"
else
@xtext += item.price == 0 ? "\\c[16]售价:\\c[14]无法出售\\c[0]\n":"\\c[16]售价:#{item.price}\\c[0]\n"
end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
@xtext += VIPArcher::Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
@xtext += VIPArcher::Equipplus.getskillhelp(item) if item.is_a?(RPG::Skill)
@xtext += VIPArcher::Equipplus.getitemhelp(item) if item.is_a?(RPG::Item)
if $VIPArcherScript[:exdrop_rate] # require 队伍掉率扩展
@xtext += "\\c[#{$2.to_i > 0 ? UP : DOWN}]#{$1}掉率: #{$2}%\\c[0]\n" if
item.note =~ /<(\W+)掉率:\s*([0-9+.-]+)%>/i
end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Skill)
@xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
self.hide if @text == ""
draw_text_vip(4, 0, @text,width,40,false)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
@time -= 1 if @time > 0
self.open if @time == 0
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 计算窗口显示指定行数时的应用高度2*************************
#--------------------------------------------------------------------------
def fitting_height_vip(line_number)
line_number * contents.font.size + standard_padding * 2
end
# draw_text_ex的增强,使其可以自动换行 原作者:叶子 修改:wyongcan
#--------------------------------------------------------------------------
# ● 绘制带有控制符的文本内容
# 如果传递了width参数的话,会自动换行
#--------------------------------------------------------------------------
def draw_text_vip(x, y, text, width = nil,textwidth = nil,normalfont = true)
reset_font_settings if normalfont == true
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
if width != nil
pos[:height] = contents.font.size
pos[:width] = width
pos[:textwidth] = textwidth
end
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
#--------------------------------------------------------------------------
# ● 绘制分割线
#--------------------------------------------------------------------------
def draw_split_line(y,color=Color.new(254,215,0))
@window.bitmap.draw_line(padding,y,@window.bitmap.width-padding,y,color)
end
#--------------------------------------------------------------------------
# ● 文字的处理
# c : 文字
# text : 绘制处理中的字符串缓存(字符串可能会被修改)
# pos : 绘制位置 {:x, :y, :new_x, :height}
#--------------------------------------------------------------------------
def process_character(c, text, pos)
case c
when "\r" # 回车
return
when "\n" # 换行
process_new_line(text, pos)
when "\f" # 翻页
process_new_page(text, pos)
when "\e" # 控制符
process_escape_character(obtain_escape_code(text), text, pos)
else # 普通文字
pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
process_new_line(text, pos)
end
process_normal_character(c, pos)
end
end
#--------------------------------------------------------------------------
# ● 处理换行文字
#--------------------------------------------------------------------------
alias vip_20141007_process_new_line process_new_line
def process_new_line(text, pos)
vip_20141007_process_new_line(text, pos)
pos[:height] = contents.font.size if pos[:width] != nil
end
end
#==============================================================================
# ■ 设置帮助增强窗口
#==============================================================================
class Window_Selectable < Window_Base
attr_reader :help_ex_window
#--------------------------------------------------------------------------
# ● 调用帮助窗口的更新方法
#--------------------------------------------------------------------------
alias help_ex_call_update_help call_update_help
def call_update_help
help_ex_call_update_help
update_ex_help if active && @help_ex_window
end
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_ex_help
@help_ex_window.set_item(item) if @help_ex_window
if index != -1 && item != nil
@help_ex_window.uppos(index,item_rect(index),self)
end
end
#--------------------------------------------------------------------------
# ● 设置帮助增强窗口
#--------------------------------------------------------------------------
def help_ex_window=(help_ex_window)
@help_ex_window = help_ex_window
end
end
#==============================================================================
# ■ 在各场景处理帮助窗口
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# ● 生成帮助增强窗口
#--------------------------------------------------------------------------
def create_help_ex
@help_ex_window = Window_Help_Ex.new
@help_ex_window .viewport = @viewport
@item_window.help_ex_window = @help_ex_window if @item_window
@slot_window.help_ex_window = @help_ex_window if @slot_window
@skill_window.help_ex_window = @help_ex_window if @skill_window
@buy_window.help_ex_window = @help_ex_window if @buy_window
@sell_window.help_ex_window = @help_ex_window if @sell_window
end
end
#道具栏
class Scene_Item < Scene_ItemBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
alias help_ex_start start
def start
help_ex_start
create_help_ex
end
#--------------------------------------------------------------------------
# ● 物品“取消”
#--------------------------------------------------------------------------
alias help_ex_on_item_cancel on_item_cancel
def on_item_cancel
help_ex_on_item_cancel
@help_ex_window.hide
end
end
#装备栏
class Scene_Equip < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
alias help_ex_start start
def start
help_ex_start
create_help_ex
end
#--------------------------------------------------------------------------
# ● 装备栏“取消”
#--------------------------------------------------------------------------
alias help_ex_on_slot_cancel on_slot_cancel
def on_slot_cancel
help_ex_on_slot_cancel
@help_ex_window.hide
end
end
#技能栏
class Scene_Skill < Scene_ItemBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
alias help_ex_start start
def start
help_ex_start
create_help_ex
end
#--------------------------------------------------------------------------
# ● 物品“确定”
#--------------------------------------------------------------------------
alias help_ex_on_item_ok on_item_ok
def on_item_ok
help_ex_on_item_ok
@help_ex_window.hide
end
#--------------------------------------------------------------------------
# ● 物品“取消”
#--------------------------------------------------------------------------
alias help_ex_on_item_cancel on_item_cancel
def on_item_cancel
help_ex_on_item_cancel
@help_ex_window.hide
end
end
#战斗界面
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
alias help_ex_start start
def start
help_ex_start
create_help_ex
end
#--------------------------------------------------------------------------
# ● 技能“确定”
#--------------------------------------------------------------------------
alias help_ex_on_skill_ok on_skill_ok
def on_skill_ok
help_ex_on_skill_ok
@help_ex_window.hide
end
#--------------------------------------------------------------------------
# ● 技能“取消”
#--------------------------------------------------------------------------
alias help_ex_on_skill_cancel on_skill_cancel
def on_skill_cancel
help_ex_on_skill_cancel
@help_ex_window.hide
end
#--------------------------------------------------------------------------
# ● 物品“确定”
#--------------------------------------------------------------------------
alias help_ex_on_item_ok on_item_ok
def on_item_ok
help_ex_on_item_ok
@help_ex_window.hide
end
#--------------------------------------------------------------------------
# ● 物品“取消”
#--------------------------------------------------------------------------
alias help_ex_on_item_cancel on_item_cancel
def on_item_cancel
help_ex_on_item_cancel
@help_ex_window.hide
end
end
#商店界面
class Scene_Shop < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
alias help_ex_start start
def start
help_ex_start
create_help_ex
end
#--------------------------------------------------------------------------
# ● 买入“确定”
#--------------------------------------------------------------------------
alias help_ex_on_buy_ok on_buy_ok
def on_buy_ok
help_ex_on_buy_ok
@help_ex_window.hide
end
#--------------------------------------------------------------------------
# ● 买入“取消”
#--------------------------------------------------------------------------
alias help_ex_on_buy_cancel on_buy_cancel
def on_buy_cancel
help_ex_on_buy_cancel
@help_ex_window.hide
end
#--------------------------------------------------------------------------
# ● 卖出“确定”
#--------------------------------------------------------------------------
alias help_ex_on_sell_ok on_sell_ok
def on_sell_ok
help_ex_on_sell_ok
@help_ex_window.hide
end
#--------------------------------------------------------------------------
# ● 卖出“取消”
#--------------------------------------------------------------------------
alias help_ex_on_sell_cancel on_sell_cancel
def on_sell_cancel
help_ex_on_sell_cancel
@help_ex_window.hide
end
end
[/pre]
装备强化[pre lang="ruby"]#encoding:utf-8
#==============================================================================
# ■ 装备强化系统 By wyongcan
#===========================================$game_party===================================
module Equipplus
#升到各级时装备颜色请在“颜色描绘”脚本中修改
$maxlv = 10 #最高升到的级数
$gailv = [100,90,80,70,60,50,40,30,20,10] #每级提升概率
$gemlv = [[5,442],[10,443],[15,444],[20,445],[25,446],[30,447],[35,448],[40,449],[45,450],[50,451]] #使用宝石提高的几率 [提高几率,宝石ID]
$uplv = [[2,437],[4,438],[6,439],[8,440],[10,441]] #强化所需要的强化石 [最大强化到的等级,强化石ID]
$xxlv = [0,5,10,15,20,25,30,35,40,50] #每级强化后失败物品消失的几率
$jjlv = [0,10,20,30,40,50,60,70,80,90] #每级强化后失败物品降级的几率
$tsnl = [10,11,12,13,14,15,16,17,18,19] #每级强化提升能力的百分比
$tswp = [221,452] # 意思是:如果有31号物品则失败后物品不消失,如果有32号物品则失败后物品不降级
#武器强化后的计算公式为: 原攻击 * (1 + 提升能力百分比) + (0到当前强化级数随机) * 5 + 当前强化级数
$gemlv.sort!
$uplv.sort!
$当前使用宝石id = 0
$当前使用宝石加成率 = 0
$强化哈希表 = {
"最高等级" => $maxlv ,
"每级概率" => $gailv ,
"宝石效果" => $gemlv ,
"消失几率" => $xxlv ,
"降级几率" => $jjlv ,
"提升能力" => $tsnl ,
"特殊物品" => $tswp ,
"强化材料" => $uplv }
def self.idlostitem(id,amount = 1)
$game_party.lose_item(idgetitem(id),amount)
end
def self.idlostequip(id,weapon = true,amount = 1)
weapon == true ? $game_party.lose_item($data_weapons[id],amount,true) : $game_party.lose_item($data_armors[id],amount,true)
end
def self.idgainequip(id,weapon = true,amount = 1)
weapon == true ? $game_party.gain_item($data_weapons[id],amount,true) : $game_party.gain_item($data_armors[id],amount,true)
end
def self.idgetitem(id)
$data_items[id]
end
def self.equipable?(id,weapon = true)
weapon == true ? weaponupisnil(id) : armorupisnil(id)
weapon == true ? equip = $data_weapons[id].dup : equip = $data_armors[id].dup
price = equip.price
@needmoney = price * equip.up
if @needmoney == 0
@needmoney = price / 2
end
#循环取出需要的强化材料
temp = false
for i in $强化哈希表["强化材料"]
if equip.up < i[0]
@lostitem = idgetitem i[1]
$game_party.has_item?(idgetitem(i[1])) ? temp = true : temp = false
break
end
end
$game_party.gold >= @needmoney && temp == true ? true : false
end
def self.upweapon (id)
$message = ""
success = false
weaponupisnil(id)
weapon = $data_weapons[id].dup
gl = 0
fangb = false
fangj = false
return unless weapon.up < $强化哈希表["最高等级"] && weaponupable?(id)
loststh
$message += "本次强化,共消耗:" + Vocab::currency_unit + " " + @needmoney.to_s
$message += " " + @lostitem.name + "\n "
gl = $强化哈希表["每级概率"][weapon.up]
if $usegem == true
gl += $当前使用宝石加成率
idlostitem($当前使用宝石id)
$message += idgetitem($当前使用宝石id).name + " "
end
if $fangb == true
fangb = true
idlostitem $强化哈希表["特殊物品"][0]
$message += idgetitem($强化哈希表["特殊物品"][0]).name + " "
end
if $fangj == true
fangj = true
idlostitem $强化哈希表["特殊物品"][1]
$message += idgetitem($强化哈希表["特殊物品"][1]).name + " "
end
suiji = rand (100)
if suiji <= gl
success = true
end
$message += "\n强化结果:"
if success == true
$message += "强化成功"
idlostequip id
weapon.id = $data_weapons.size
params = weapon.params.dup
params[2] *= 1 + $强化哈希表["提升能力"][weapon.up] / 100
params[2] += rand(weapon.up) * 5 + weapon.up
params[2] += 1 if params[2] == weapon.params[2]
$message += " 攻击力提升:" + (params[2] - weapon.params[2]).to_int.to_s
weapon.up += 1
$data_weapons.insert $data_weapons.size,weapon
$data_weapons[$data_weapons.size-1].params = params
idgainequip weapon.id
else
$message += "强化失败"
suiji = rand (100)
if suiji <= $强化哈希表["消失几率"][weapon.up]
if fangb != true
$message += ",道具消失"
idlostequip id
else
$message += ",由于" + idgetitem($强化哈希表["特殊物品"][0]).name + "的作用,道具未消失"
end
else
suiji = rand (100)
if suiji <= $强化哈希表["降级几率"][weapon.up]
if fangj == false && weapon.up != 0
$message += ",道具降级"
params = weapon.params.dup
params[2] -= weapon.up + rand(weapon.up) * 5
params[2] /= 1 + $强化哈希表["提升能力"][weapon.up] / 100
weapon.params = params
weapon.up -= 1
$data_weapons[id] = weapon
else
$message += ",由于" + idgetitem($强化哈希表["特殊物品"][1]).name + "的作用,道具未降级"
end
end
end
end
$usegem = false
$fangb = false
$fangj = false
end
def self.weaponupisnil(id)
$data_weapons[id].up = 0 unless $data_weapons[id].up != nil
end
def self.weaponupable?(id)
equipable?(id)
end
def self.uparmor (id)
$message = ""
success = false
armorupisnil(id)
armor = $data_armors[id].dup
gl = 0
fangb = false
fangj = false
return unless armor.up < $强化哈希表["最高等级"] && armorupable?(id)
loststh
$message += "本次强化,共消耗:" + Vocab::currency_unit + " " + @needmoney.to_s
$message += " " + @lostitem.name + "\n "
gl = $强化哈希表["每级概率"][armor.up]
if $usegem == true
gl += $当前使用宝石加成率
idlostitem($当前使用宝石id)
$message += idgetitem($当前使用宝石id).name + " "
end
if $fangb == true
fangb = true
idlostitem $强化哈希表["特殊物品"][0]
$message += idgetitem($强化哈希表["特殊物品"][0]).name + " "
end
if $fangj == true
fangj = true
idlostitem $强化哈希表["特殊物品"][1]
$message += idgetitem($强化哈希表["特殊物品"][1]).name + " "
end
suiji = rand (100)
if suiji <= gl
success = true
end
$message += "\n强化结果:"
if success == true
$message += "强化成功"
idlostequip id,false
armor.id = $data_armors.size
params = armor.params.dup
params[3] *= 1 + $强化哈希表["提升能力"][armor.up] / 100
params[3] += rand(armor.up) * 5 + armor.up
params[3] += 1 if params[3] == armor.params[3]
$message += " 防御力提升:" + (params[3] - armor.params[3]).to_int.to_s
armor.up += 1
$data_armors.insert $data_armors.size,armor
$data_armors[$data_armors.size-1].params = params
idgainequip armor.id,false
else
$message += "强化失败"
suiji = rand (100)
if suiji <= $强化哈希表["消失几率"][armor.up]
if fangb != true
$message += ",道具消失"
idlostequip id,false
else
$message += ",由于" + idgetitem($强化哈希表["特殊物品"][0]).name + "的作用,道具未消失"
end
else
suiji = rand (100)
if suiji <= $强化哈希表["降级几率"][armor.up]
if fangj == false && armor.up != 0
$message += ",道具降级"
params = armor.params.dup
params[3] -= armor.up + rand(armor.up) * 5
params[3] /= 1 + $强化哈希表["提升能力"][armor.up] / 100
armor.params = params
armor.up -= 1
$data_armors[id] = armor
else
$message += ",由于" + idgetitem($强化哈希表["特殊物品"][1]).name + "的作用,道具未降级"
end
end
end
end
$usegem = false
$fangb = false
$fangj = false
end
def self.armorupisnil(id)
$data_armors[id].up = 0 unless $data_armors[id].up != nil
end
def self.armorupable?(id)
equipable?(id,false)
end
def self.loststh()
$game_party.lose_item(@lostitem,1)
$game_party.lose_gold(@needmoney)
end
def self.needmoney
@needmoney
end
def self.lostitem
@lostitem
end
end
#==============================================================================
# ■ Scene_Qiang
#------------------------------------------------------------------------------
# 强化画面
#==============================================================================
class Scene_Qiang < Scene_MenuBase
$wufang = true
$usegem = false
$fangb = false
$fangj = false
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_help_window
create_qianghelp_window
create_command_window
create_qiangxz_window
create_wu_window
create_fang_window
create_choosegem_window
end
#--------------------------------------------------------------------------
# ● 生成说明窗口
#--------------------------------------------------------------------------
def create_qianghelp_window
@qianghelp_window = Window_Qianghelp.new
@qianghelp_window.y = Graphics.height - @qianghelp_window.height
@qianghelp_window.viewport = @viewport
@qianghelp_window.hide
end
#--------------------------------------------------------------------------
# ● 生成选择宝石
#--------------------------------------------------------------------------
def create_choosegem_window
@choosegem_window = Window_Choosegem.new
@choosegem_window.y = Graphics.height - @choosegem_window.height
@choosegem_window.viewport = @viewport
@choosegem_window.z = 120
end
#--------------------------------------------------------------------------
# ● 生成选择窗口
#--------------------------------------------------------------------------
def create_qiangxz_window
@qiangxz_window = Window_Qiangxz.new
@qiangxz_window.y = @help_window.height + fitting_height(5) /2
@qiangxz_window.z = 110
@qiangxz_window.viewport = @viewport
@qiangxz_window.set_handler(:gem, method(:qiangxz_gem))
@qiangxz_window.set_handler(:fangb, method(:qiangxz_fangb))
@qiangxz_window.set_handler(:fangj, method(:qiangxz_fangj))
@qiangxz_window.set_handler(:ok, method(:qiangxz_ok))
@qiangxz_window.set_handler(:cancel, method(:qiangxz_cancel))
@qiangxz_window.hide
@qiangxz_window.deactivate
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_QiangCommand.new
@command_window.viewport = @viewport
@command_window.y = @help_window.height + fitting_height(3) /2
@command_window.set_handler(:qiangwu, method(:qiangwu))
@command_window.set_handler(:qiangfang, method(:qiangfang))
@command_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# ● 生成武器强化窗口
#--------------------------------------------------------------------------
def create_wu_window
@wu_window = Window_Qiangwu.new(@qianghelp_window,@qiangxz_window)
@wu_window.viewport = @viewport
@wu_window.y += @help_window.height
@wu_window.hide
@wu_window.help_window= @help_window
@wu_window.set_handler(:cancel, method(:qiangwu_cancel))
@wu_window.set_handler(:ok, method(:qiangwu_ok))
end
#--------------------------------------------------------------------------
# ● 生成防具强化窗口
#--------------------------------------------------------------------------
def create_fang_window
@fang_window = Window_Qiangfang.new(@qianghelp_window,@qiangxz_window)
@fang_window.viewport = @viewport
@fang_window.y += @help_window.height
@fang_window.hide
@fang_window.help_window= @help_window
@fang_window.set_handler(:cancel, method(:qiangfang_cancel))
@fang_window.set_handler(:ok, method(:qiangfang_ok))
end
#--------------------------------------------------------------------------
# ● 计算窗口显示指定行数时的应用高度
#--------------------------------------------------------------------------
def fitting_height(line_number)
line_number * 24 + 12 * 2
end
#--------------------------------------------------------------------------
# ● 显示强化武器
#--------------------------------------------------------------------------
def qiangwu
@command_window.hide
@help_window.show
@wu_window.show
@wu_window.start
@qianghelp_window.show
@wu_window.activate
$wufang = true
@command_window.deactivate
end
#--------------------------------------------------------------------------
# ● 显示强化防具
#--------------------------------------------------------------------------
def qiangfang
@command_window.hide
@help_window.show
@fang_window.show
@fang_window.start
@qianghelp_window.show
@fang_window.activate
$wufang = false
@command_window.deactivate
end
#--------------------------------------------------------------------------
# ● 取消强化武器
#--------------------------------------------------------------------------
def qiangwu_cancel
@command_window.show
@help_window.hide
@wu_window.hide
@qianghelp_window.hide
@command_window.activate
@qianghelp_window.set_text("")
@help_window.set_text("")
end
#--------------------------------------------------------------------------
# ● 取消强化防具
#--------------------------------------------------------------------------
def qiangfang_cancel
@command_window.show
@help_window.hide
@fang_window.hide
@qianghelp_window.hide
@command_window.activate
@qianghelp_window.set_text("")
@help_window.set_text("")
end
#--------------------------------------------------------------------------
# ● 确定强化武器
#--------------------------------------------------------------------------
def qiangwu_ok
@help_window.hide
@wu_window.qiangwu_ok
@qiangxz_window.show
@qiangxz_window.activate
end
#--------------------------------------------------------------------------
# ● 确定强化防具
#--------------------------------------------------------------------------
def qiangfang_ok
@help_window.hide
@fang_window.qiangfang_ok
@qiangxz_window.show
@qiangxz_window.activate
end
#--------------------------------------------------------------------------
# ● 获取卖出价格
#--------------------------------------------------------------------------
def selling_price
@item.price / 2
end
def qiangxz_gem
@choosegem_window.start
@qiangxz_window.deactivate
@choosegem_window.qiangxz= @qiangxz_window
if $wufang == true
@choosegem_window.wufangwindow= @wu_window
else
@choosegem_window.wufangwindow= @fang_window
end
end
def qiangxz_fangb
$fangb = !$fangb
if $wufang == true
@wu_window.update_help
else
@fang_window.update_help
end
@qiangxz_window.activate
end
def qiangxz_fangj
$fangj = !$fangj
if $wufang == true
@wu_window.update_help
else
@fang_window.update_help
end
@qiangxz_window.activate
end
def qiangxz_ok
if $wufang == true
Equipplus.upweapon(@wu_window.itemid)
qianging
@qianghelp_window.set_text($message)
@qiangxz_window.hide
Graphics.wait(60)
@wu_window.activate
@qiangxz_window.deactivate
@help_window.hide
$当前使用宝石加成率 = 0
$usegem = false
@fang_window.update_help
@wu_window.refresh
@command_window.deactivate
else
Equipplus.uparmor(@fang_window.itemid)
qianging
@qianghelp_window.set_text($message)
@qiangxz_window.hide
Graphics.wait(60)
@fang_window.activate
@qiangxz_window.deactivate
@help_window.hide
$当前使用宝石加成率 = 0
$usegem = false
@fang_window.update_help
@fang_window.refresh
@command_window.deactivate
end
end
def qiangxz_cancel
@help_window.refresh
@help_window.show
@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(5))
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
Equipplus.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
Equipplus.weaponupable?(item.id)
qitemname = Equipplus.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
Font.default_size = 18
text = "装备名称:" + item.name + "\n强化所需" + Vocab::currency_unit + ":" + Equipplus.needmoney.to_s
text += "\n当前强化等级:" + item.up.to_s + "\n强化需要:" + qitemname
text += "\n道具:" + temp [0] + " " + temp[1] + ":" + temp[2]+ " " + temp[3] + ":" + temp[4]
text += "\n成功率:" + cgl + "% " + "\n强化后攻击力范围:" + min.to_s + "~" + max.to_s
@qianghelp.set_text(text)
Font.default_size = 24
end
#--------------------------------------------------------------------------
# ● 获取当前武器等级
#--------------------------------------------------------------------------
def getweaponup
Equipplus.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(5))
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
Equipplus.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
Equipplus.armorupable?(item.id)
qitemname = Equipplus.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
Font.default_size = 18
text = "装备名称:" + item.name + "\n强化所需" + Vocab::currency_unit + ":" + Equipplus.needmoney.to_s
text += "\n当前强化等级:" + item.up.to_s + "\n强化需要:" + qitemname
text += "\n道具:" + temp [0] + " " + temp[1] + ":" + temp[2]+ " " + temp[3] + ":" + temp[4]
text += "\n成功率:" + cgl + "% " + "\n强化后防御力范围:" + min.to_s + "~" + max.to_s
@qianghelp.set_text(text)
Font.default_size = 24
end
#--------------------------------------------------------------------------
# ● 获取当前防具等级
#--------------------------------------------------------------------------
def getarmorup
Equipplus.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_QiangCommand < Window_Command
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0, 0)
update_placement
self.openness = 0
open
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# ● 更新窗口的位置
#--------------------------------------------------------------------------
def update_placement
self.x = (Graphics.width - width) / 2
self.y = (Graphics.height - height) / 2
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_command("强化武器", :qiangwu)
add_command("强化防具", :qiangfang)
add_command(Vocab::ShopCancel, :cancel)
end
end
#==============================================================================
# ■ Window_Qianghelp
#------------------------------------------------------------------------------
# 显示说明
#==============================================================================
class Window_Qianghelp < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, fitting_height(7) + 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(Equipplus.idgetitem($强化哈希表["特殊物品"][0]).name, :fangb, @havefangb)
add_command(Equipplus.idgetitem($强化哈希表["特殊物品"][1]).name, :fangj, @havefangj)
add_command("开始强化", :start)
add_command("取消强化", :cancel)
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
#------------------------------------------------------------------------------
# 选择强化使用的宝石
#==============================================================================
class Window_Choosegem < Window_ItemList
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize()
super(0, 0, Graphics.width, fitting_height(2))
self.openness = 0
deactivate
@wufangwindow = nil
@qiangxz = nil
set_handler(:ok, method(:on_ok))
set_handler(:cancel, method(:on_cancel))
end
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[/pre] |
|