summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-07-16 23:23:24 -0300
committerJesusaves <cpntb1@ymail.com>2020-07-16 23:23:24 -0300
commit0e046a0fc6c2a37084dddbb83d0b58cfa4d01052 (patch)
treeff3e148a8fa54798a2f580e1ffa504c598a66345 /npc
parent39bbbe037acaf4d16bd65bee6d830636f390c270 (diff)
downloadserverdata-0e046a0fc6c2a37084dddbb83d0b58cfa4d01052.tar.gz
serverdata-0e046a0fc6c2a37084dddbb83d0b58cfa4d01052.tar.bz2
serverdata-0e046a0fc6c2a37084dddbb83d0b58cfa4d01052.tar.xz
serverdata-0e046a0fc6c2a37084dddbb83d0b58cfa4d01052.zip
And, for players general happiness, I added a re-roll when result is too low.
This re-roll is based on equipment level, and do not happen on maluses. Legendary Wand, for example, will get a re-roll if result < 20% of maximum.
Diffstat (limited to 'npc')
-rw-r--r--npc/craft/options.txt13
1 files changed, 11 insertions, 2 deletions
diff --git a/npc/craft/options.txt b/npc/craft/options.txt
index cb9b28068..fb23c7fd2 100644
--- a/npc/craft/options.txt
+++ b/npc/craft/options.txt
@@ -494,12 +494,13 @@ function script csys_WeaponFix {
return;
}
-// csys_BonusCalc( lv1, lv2, vartp )
+// csys_BonusCalc( lv1, lv2, vartp{, equip lvl} )
// Calculates the due bonus
function script csys_BonusCalc {
.@craft=getarg(0);
.@skill=getarg(1);
.@var=getarg(2);
+ .@eqlv=getarg(3, 0);
.@mult=csys_Multiplier(.@var);
.@avmult=(.@craft+.@skill)*.@mult;
@@ -507,6 +508,13 @@ function script csys_BonusCalc {
.@avg=.@avmult/10;
.@base=rand2(1, .@avg+1);
+ // Re-roll if you got a too bad result:
+ // Each equip level will yield 0.2% reroll
+ // Means a lv 100 equip gets 20% of grace-reroll.
+ // By default, this rule is skipped for maluses!
+ if (.@base < (.@avg+1)*.@eqlv/500)
+ .@base=rand2(1, .@avg+1);
+
// If you are in the upper 70%, we do a re-roll
// It usually will lower the result, but is up to luck
if (.@base >= (.@avg+1)*7/10)
@@ -577,6 +585,7 @@ function script csys_Apply {
csys_ArmorFix(.@itemid);
else
csys_WeaponFix(.@itemid);
+ .@eqplv=getiteminfo(.@itemid, ITEMINFO_ELV);
// Shuffle the arrays
array_shuffle(@csys_attr);
@@ -599,7 +608,7 @@ function script csys_Apply {
// Apply a bonus using array_pop (it was shuffled so we're fine)
.@vartp=array_pop(@csys_attr);
- .@bonus=csys_BonusCalc(.@lv, .@lv2, .@vartp);
+ .@bonus=csys_BonusCalc(.@lv, .@lv2, .@vartp, .@eqplv);
setitemoptionbyindex(.@id, .@slot, .@vartp, .@bonus);
//debugmes "Bonus applied: %d at %d (slot: %d)", .@vartp, .@bonus, .@slot;
.@slot+=1;