本帖最后由 魔法丶小肉包 于 2017-3-14 20:45 编辑
举个修改的例子,具体的算法还得楼主自己去修改
class Game_Battler < Game_BattlerBase def make_damage_value(user, item) value = item.damage.eval(user, self, $game_variables) value *= item_element_rate(user, item) value *= pdr if item.physical? value *= mdr if item.magical? value *= rec if item.damage.recover? value = apply_critical(value) if @result.critical value = apply_variance(user,value, item.damage.variance) value = apply_guard(value) @result.make_damage(value.to_i, item) end def apply_variance(user,damage, variance) amp = [damage.abs * variance / 100, 0].max.to_i var = rand(amp + 1) + rand(amp + 1) - amp if user.luk / self.luk >= 2 damage + amp#(固定值)伤害+离散度 elsif (user.luk / self.luk >= 1.5) && (user.luk / self.luk < 2) damage + rand(amp)#(伤害)100%~(伤害+离散度)% 离散度50→100%~150% elsif user.luk < self.luk damage - rand(amp)#与上面相反 else damage >= 0 ? damage + var : damage - var #(都不满足条件)采用默认算法 end end end
class Game_Battler < Game_BattlerBase
def make_damage_value(user, item)
value = item.damage.eval(user, self, $game_variables)
value *= item_element_rate(user, item)
value *= pdr if item.physical?
value *= mdr if item.magical?
value *= rec if item.damage.recover?
value = apply_critical(value) if @result.critical
value = apply_variance(user,value, item.damage.variance)
value = apply_guard(value)
@result.make_damage(value.to_i, item)
end
def apply_variance(user,damage, variance)
amp = [damage.abs * variance / 100, 0].max.to_i
var = rand(amp + 1) + rand(amp + 1) - amp
if user.luk / self.luk >= 2
damage + amp#(固定值)伤害+离散度
elsif (user.luk / self.luk >= 1.5) && (user.luk / self.luk < 2)
damage + rand(amp)#(伤害)100%~(伤害+离散度)% 离散度50→100%~150%
elsif user.luk < self.luk
damage - rand(amp)#与上面相反
else
damage >= 0 ? damage + var : damage - var #(都不满足条件)采用默认算法
end
end
end
|