加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
#encoding:utf-8
#==============================================================================
# ■ 随机属性装备 By wyongcan
#==============================================================================
module Equipplus
#得到随机属性装备方法:gainequip(装备ID,属性数)
#~ 前缀结构:
#~ ①权重(1-100) 越大越重要
#~ ②名称(多个名称用","分开,会随机取其中一个添加到武器名前)
#~ ③属性数组 提供两种方式:
#~ 1.[属性ID,增加值] 属性ID参考说明增强脚本 增加了9号属性“极品出现率” ID为8,影响前缀的好坏 1 - 100
#~ 2.与装备特性相同[code,data_id,value] code,data_id参考说明增强脚本
@maxparamplus = 5 #最大前缀数
@moneyrate = 10 #物品价格计算公式为:原价格 + 前缀权重 * @moneyrate
@transpose = [*1..100].reverse #用于把1变成100,100变成1
@paramsplus = [ #暂时只写了三个前缀,可以自己添加,参照前缀结构\
[71,"绝情",[[2,-30],[4,-30],[14,6,1],[14,7,1],[14,8,1]]],
[72,"伤势",[[3,-20],[5,-20],[32,64,0.1]]],
[73,"峻刑",[[2,-100],[3,-50],[4,-100],[5,-50],[6,-50],[7,-50],[32,66,0.2],[32,59,0.2]]],
[74,"苦肉",[[0,-3000],[21,2,1.2]]],
[75,"挥泪",[[23,6,1.2],[23,7,1.2]]],
[61,"安恤",[[0,1000],[22,7,0.1]]],
[62,"恃勇",[[2,5],[21,2,1.05]]],
[63,"智愚",[[1,20],[4,5],[21,4,1.05]]],
[64,"自守",[[3,10],[5,10],[13,2,0.5],[13,3,0.5],[13,4,0.5],[13,5,0.5]]],
[65,"旋风",[[6,5],[21,6,1.05]]],
[66,"英姿",[[7,10],[21,7,1.05]]],
[30,"铁骑",[[2,5],[22,2,0.3],[32,57,0.1]]],# 必杀几率+30%
[31,"青囊",[[22,7,0.2]]],# 体力恢复速度+20%
[32,"奸雄",[[23,9,1.2]]],# 经验获得+20%
[33,"烈弓",[[22,0,1.1],[22,2,0.2]]],
[35,"追忆",[[64,4,1.3],[64,5,1.3]]], #金钱 装备掉落 1.3倍
[21,"仁德",[[21,0,1.2]]],
[22,"武圣,武魂",[[2,30],[0,1000],[4,-50]]],
[23,"集智,鬼才",[[1,100],[4,30],[2,-50]]],
[24,"毅重,克已",[[3,30],[5,30],[23,7,0.9]]],
[25,"神速",[[6,30]]],
[26,"英魂",[[7,30]]],
[27,"雷击",[[32,23,1]]],
[28,"火计",[[32,21,1]]],
[29,"御策",[[11,3,0.3],[11,4,0.3],[11,5,0.3],[11,6,0.3]]],
[11,"龙胆",[[61,0,1]]],
[12,"咆哮",[[34,0,1]]],
[13,"空城",[[23,0,0.5]]],
[14,"酒诗",[[22,2,1]]],
[15,"无言",[[22,4,0.3]]],
[16,"八阵",[[22,3,1]]],
[17,"节命",[[23,5,1.3]]],
[18,"潜袭",[[22,6,0.2],[32,47,0.1]]],
[19,"不屈",[[23,6,0.9]]],
[10,"三国霸主",[[0,1000],[2,30],[3,30],[4,30],[5,30]]],
[9,"蛊惑",[[32,2,0.1],[32,3,0.1],[32,7,0.1],[32,8,0.1]]],
[8,"Fuak三国",[[0,3000],[1,30],[2,30],[3,30],[4,30],[5,30],[6,30],[7,30]]],
[7,"神愤",[[22,9,0.2]]],
[3,"Ace三国",[[0,5000],[1,50],[2,50],[3,50],[4,50],[5,50],[6,50],[7,50]]],
[2,"超越三国",[[21,0,1.1],[21,1,1.1],[21,2,1.1],[21,3,1.1],[21,4,1.1],[21,5,1.1],[21,6,1.1],[21,7,1.1],[0,10000],[1,100],[2,100],[3,100],[4,100],[5,100],[6,100],[7,100]]],
[1,"三国归一",[[21,0,1.1],[21,1,1.1],[21,2,1.1],[21,3,1.1],[21,4,1.1],[21,5,1.1],[21,6,1.1],[21,7,1.1],[0,12000],[1,120],[2,120],[3,120],[4,120],[5,120],[6,120],[7,120]]],
[1,"超越时空",[[21,0,1.1],[21,1,1.1],[21,2,1.1],[21,3,1.1],[21,4,1.1],[21,5,1.1],[21,6,1.1],[21,7,1.1]]]
#[1,"创世天下",[[0,9999],[1,9999],[2,9999],[3,9999],[4,9999],[5,9999],[6,9999],[7,9999],[22,0,9.99],[22,1,9.99],[22,2,9.99],[22,3,9.99],[22,4,9.99],[22,5,9.99],[22,6,9.99],[22,7,9.99],[22,8,9.99],[22,9,9.99],[23,0,9.99],[23,1,9.99],[23,2,9.99],[23,3,9.99],[23,4,9.99],[23,5,9.99],[23,6,9.99],[23,7,9.99],[23,8,9.99],[23,9,9.99],[64,0,2],[64,1,2],[64,2,2],[64,3,2],[64,4,2],[61,0,9],[33,1,9.99],[14,2,1],[14,3,1],[14,4,1],[14,5,1],[14,6,1],[14,7,1],[14,8,1],[14,9,1],[14,10,1],[14,11,1],[14,12,1],[32,1,0.1],[32,2,0.2],[32,3,0.3],[32,4,0.4],[32,5,0.5],[32,6,0.6],[32,7,0.2],[32,8,0.3],[32,9,0.4],[32,10,0.5],[32,11,0.6],[32,12,0.6],[32,13,0.6],[32,14,0.6]]]
]
$商店随机 = false #商店买装备时出随机属性
$战斗随机 = true #战斗后获得随机属性装备
def self.getname(paramsplus)
name = ""
paramsplus.is_a?(Array) ? paramsplus.each{|a| @temp = []; a[1].scan(/^[\u4e00-\u9fa5|\w]*|,[\u4e00-\u9fa5|\w]*/){|b| @temp.push b.gsub(","){}}; name += @temp[rand(@temp.size)]} : paramsplus[1].scan(/^[\u4e00-\u9fa5|\w]*|,[\u4e00-\u9fa5|\w]*/){|b| @temp = [] if @temp == nil ;@temp.push b.gsub(","){}}
name += @temp[rand(@temp.size)] if paramsplus.is_a?(Array) != true
name += "的"
end
def self.getluck #获得极品出现率
luck = 0
$game_party.all_members.each{|a| a.weapons.each{|a| luck += a.params[8] if a.params.size == 9};a.armors.each{|a| luck += a.params[8] if a.params.size == 9}}
luck
end
def self.getnewequip(xequip,params = nil) #提供两个参数 装备(RPG::Equip类下的)和附加前缀数,不填则为随机
return unless xequip.is_a?(RPG::EquipItem)
#xparamplus为前缀数
xequip.paramsplus = [] if xequip.paramsplus == nil
return if xequip.paramsplus.size >= @maxparamplus
params != nil ? xparamplus = params : xparamplus = rand(@maxparamplus * 105) / 100
xparamplus = xparamplus.to_int
return xequip if xparamplus == 0
equip = xequip.dup
paramsplus = equip.paramsplus.dup #无奈的方法,不这样改一个装备所有同父装备的装备都会变
newparams = equip.params.dup
newfeatures = equip.features.dup
aparamsplus = @paramsplus.collect{|a| [a[0] = @transpose[a[0]-1],a[1],a[2]]}.sort_by{|a| a[0]}
while paramsplus.size < xparamplus
temp = rand(aparamsplus[-1][0])
temp = [temp - getluck,0].max
x = []
for i in aparamsplus
x.push i if i[0] >= temp && paramsplus.include?(i) != true
end
if x != []
a = [(x.size-1)*100 - getluck,0].max
a = (rand(a)/100).to_int
paramsplus.push x[a]
end
end
equip.name = getname(paramsplus) + equip.name #更新名称
paramsplus.each{|a| equip.price += @transpose[a[0] - 1] * @moneyrate} #更新价格
paramsplus.select{|a| a[2].select{|a| a.size == 2}.each{|a| newparams[a[0]] += a[1]}} #更新属性
#以下为更新特性
features = []
paramsplus.each{|a| a[2].each{|a| features.push a if a.size == 3}}
while features.size > 0
i = features.pop
newfeatures.select{|a| a.code == i[0] && a.data_id == i[1]}.size == 0 ? newfeatures.push(RPG::BaseItem::Feature.new(i[0],i[1],i[2])) : newfeatures.each_with_index{|a,b| newfeatures.value += i[2] if a.code == i[0] && a.data_id == i[1]}
end
if equip.is_a?(RPG::Weapon)
equip.id = $data_weapons.size
$data_weapons.insert $data_weapons.size,equip
$data_weapons[equip.id].paramsplus = paramsplus
$data_weapons[equip.id].params = newparams
$data_weapons[equip.id].features = newfeatures
else
equip.id = $data_armors.size
$data_armors.insert $data_armors.size,equip
$data_armors[equip.id].paramsplus = paramsplus
$data_armors[equip.id].params = newparams
$data_armors[equip.id].features = newfeatures
end
equip
end
def self.gainequip(id,params = nil)
$game_party.gain_item(Equipplus.getnewequip($data_weapons[id],params),1,true)
end
end
if $商店随机 == true
class Scene_Shop < Scene_MenuBase
def do_buy(number)
$game_party.lose_gold(number * buying_price)
if @item.is_a?(RPG::EquipItem)
x = number
loop do
break if x <= 0
x -= 1
$game_party.gain_item(Equipplus.getnewequip(@item), 1)
end
else
$game_party.gain_item(@item, number)
end
end
end
end
if $战斗随机 == true
module BattleManager
def self.gain_drop_items
$game_troop.make_drop_items.each do |item|
item.is_a?(RPG::EquipItem) ? xitem = Equipplus.getnewequip(item) : xitem = item
$game_party.gain_item(xitem, 1)
$game_message.add(sprintf(Vocab::ObtainItem, xitem.name))
end
wait_for_message
end
end
end
class RPG::EquipItem < RPG::BaseItem
alias old initialize
def initialize
old
@paramsplus #前缀
end
attr_accessor :paramsplus
end
就是想修改一下 1-10的几率 那个几率不会调
比如说 1超越时空(1-10的物品)的几率为 1/100 需要修改哪一项。
求大神帮帮忙 |