summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;