From c1b43b273c31cdf15d26f28b759721d14004493d Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 5 Jun 2019 14:25:19 -0300 Subject: Rewrite a bit how bonuses are calculated for maintenance purposes (no effect) --- npc/craft/options.txt | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'npc/craft/options.txt') diff --git a/npc/craft/options.txt b/npc/craft/options.txt index 76862cee5..284d57ead 100644 --- a/npc/craft/options.txt +++ b/npc/craft/options.txt @@ -367,6 +367,21 @@ function script csys_Multiplier { return 0; } +// csys_BonusCalc( lv1, lv2, vartp ) +// Calculates the due bonus +function script csys_BonusCalc { + .@craft=getarg(0); + .@skill=getarg(1); + .@var=getarg(2); + + .@avg=(.@craft+.@skill)/2; + .@base=rand2(1, .@avg+1); + .@mult=csys_Multiplier(.@var); + + return .@base*.@mult+1; + +} + // Attribute item options // Does NOT performs success chance check, and can be used by NPC // csys_Apply( invindex{, lvl, scope} ) @@ -398,7 +413,7 @@ function script csys_Apply { // Apply a bonus using array_pop (it was shuffled so we're fine) .@vartp=array_pop(@csys_attr); - .@bonus=rand(1, (.@lv+.@lv2)/2+1)*csys_Multiplier(.@vartp)+1; + .@bonus=csys_BonusCalc(.@lv, .@lv2, .@vartp); setitemoptionbyindex(.@id, .@slot, .@vartp, .@bonus); //debugmes "Bonus applied: %d at %d (slot: %d)", .@vartp, .@bonus, .@slot; .@slot+=1; @@ -414,7 +429,7 @@ function script csys_Apply { // Apply a malus using array_pop (it was shuffled so we're fine) .@vartp=array_pop(@csys_penalty); - .@malus=rand(1, (.@lv+.@lv2)/2+1)*csys_Multiplier(.@vartp)+1; + .@malus=csys_BonusCalc(.@lv, .@lv2, .@vartp); setitemoptionbyindex(.@id, .@slot, .@vartp, -(.@malus)); .@slot+=1; .@slt+=1; -- cgit v1.2.3-70-g09d2