diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-06-05 14:25:19 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-06-05 14:25:19 -0300 |
commit | c1b43b273c31cdf15d26f28b759721d14004493d (patch) | |
tree | c4ffd6c1848152ef8b134f4aba2db3222c811241 | |
parent | 7ff8068df6164f6b5cd8df29ded820e2c8e80491 (diff) | |
download | serverdata-c1b43b273c31cdf15d26f28b759721d14004493d.tar.gz serverdata-c1b43b273c31cdf15d26f28b759721d14004493d.tar.bz2 serverdata-c1b43b273c31cdf15d26f28b759721d14004493d.tar.xz serverdata-c1b43b273c31cdf15d26f28b759721d14004493d.zip |
Rewrite a bit how bonuses are calculated for maintenance purposes (no effect)
-rw-r--r-- | npc/craft/options.txt | 19 |
1 files changed, 17 insertions, 2 deletions
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; |