Project1
标题:
请帮忙改下升级随机提升能力脚本的单项能力最大提升量
[打印本页]
作者:
午睡的风铃
时间:
2014-12-30 12:38
标题:
请帮忙改下升级随机提升能力脚本的单项能力最大提升量
本帖最后由 午睡的风铃 于 2014-12-30 17:47 编辑
@feizhaodan
脚本是搜索到的,作者已经俩多月没来了……
此脚本会将点数在设定好的范围内随机分配给各项能力,但会已经分配过的能力还会被重复分配。
请帮忙修改成同一项能力最多只能分配一次,要么就不分配的那种。
如果此行为会触犯到啥规定或侵害了脚本作者权益,希望大神们帮忙给个其他的脚本,或闲来无事碰巧想写点啥又不知道写啥的话,能给写下。
#==============================================================================
# ■ FE_Param
#------------------------------------------------------------------------------
# 设置各职业用的各数据
# 制作者:feizhaodan
# 版本: 1.1.0
# 更新: 1.1.0 : 更改了随机式,从原来的非即下一项改为范围随机。
#==============================================================================
module FE_Param
CLASSPER = {} # 不要改
# 在这里设置各职业的提升几率
# 格式:
# CLASSPER[id] = {
# :para => n%,
#}
# id 输入职业ID
# para 代入属性标识(mhp, mmp, atk, def, mat, mdf, agi, luk)
# n 代入属性提升几率
CLASSPER[1] ={
:mhp => 60, # 血
:mmp => 40, # 魔
:atk => 70, # 攻
:def => 60, # 防
:mat => 20, # 魔攻
:mdf => 20, # 魔防
:agi => 50, # 敏
:luk => 10, # 幸运
}
CLASSUP = {} # 不要改
# 在这里设置各职业的提升量
# 格式:
# CLASSUP[id] = [mi, ma]
# id 输入职业ID
# mi 代入提升量最小值
# ma 代入提升量最大值
CLASSUP[1] = [5, 9]
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors) 的内部使用、
# Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
FEPARAM_LIST_ = [:mhp,:mmp,:atk,:def,:mat,:mdf,:agi,:luk]
#--------------------------------------------------------------------------
# ● 获取普通能力
#--------------------------------------------------------------------------
def param(param_id)
value = super
value += param_gained(param_id)
return [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
end
#--------------------------------------------------------------------------
# ● 获取提升量
#--------------------------------------------------------------------------
def param_up
param_up = FE_Param::CLASSUP[@class_id]
up = param_up[0] + rand(param_up[1] - param_up[0] + 1)
return up
end
#--------------------------------------------------------------------------
# ● 获取提升率
# param : 属性
#--------------------------------------------------------------------------
def param_per
@param_per = FE_Param::CLASSPER[@class_id] if @param_per == nil
return @param_per
end
#--------------------------------------------------------------------------
# ● 获取已提升量
# param : 属性
#--------------------------------------------------------------------------
def param_gained(param)
@param_gained = {} if @param_gained == nil
return 0 if @param_gained[param] == nil
return @param_gained[param]
end
#--------------------------------------------------------------------------
# ● 升级
#--------------------------------------------------------------------------
alias fe_level_up level_up
def level_up
fe_level_up
gain_param
end
#--------------------------------------------------------------------------
# ● 提升属性
#--------------------------------------------------------------------------
def gain_param
@param_gained = {} if @param_gained == nil
param_per
percentage = 0
@param_per.each_value do |v|
percentage += v
end
point = param_up
mhpper = @param_per[:mhp]
mmpper = @param_per[:mmp] + mhpper
atkper = @param_per[:atk] + mmpper
defper = @param_per[:def] + atkper
matper = @param_per[:mat] + defper
mdfper = @param_per[:mdf] + matper
agiper = @param_per[:agi] + mdfper
lukper = @param_per[:luk] + agiper
loop do
if point == 0
break
end
per = rand(percentage) + 1
p [mhpper,mmpper,atkper,defper,matper,mdfper,agiper,lukper,per]
case per
when 1...mhpper
i = FEPARAM_LIST_.index(:mhp)
@param_gained[i] = 0 if @param_gained[i] == nil
@param_gained[i] += 1
point -= 1
when mhpper...mmpper
i = FEPARAM_LIST_.index(:mmp)
@param_gained[i] = 0 if @param_gained[i] == nil
@param_gained[i] += 1
point -= 1
when mmpper...atkper
i = FEPARAM_LIST_.index(:atk)
@param_gained[i] = 0 if @param_gained[i] == nil
@param_gained[i] += 1
point -= 1
when atkper...defper
i = FEPARAM_LIST_.index(:def)
@param_gained[i] = 0 if @param_gained[i] == nil
@param_gained[i] += 1
point -= 1
when defper...matper
i = FEPARAM_LIST_.index(:mat)
@param_gained[i] = 0 if @param_gained[i] == nil
@param_gained[i] += 1
point -= 1
when matper...mdfper
i = FEPARAM_LIST_.index(:mdf)
@param_gained[i] = 0 if @param_gained[i] == nil
@param_gained[i] += 1
point -= 1
when mdfper...agiper
i = FEPARAM_LIST_.index(:agi)
@param_gained[i] = 0 if @param_gained[i] == nil
@param_gained[i] += 1
point -= 1
when agiper...lukper
i = FEPARAM_LIST_.index(:luk)
@param_gained[i] = 0 if @param_gained[i] == nil
@param_gained[i] += 1
point -= 1
end
end
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1