summaryrefslogtreecommitdiff
path: root/npc/craft/options.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/craft/options.txt')
-rw-r--r--npc/craft/options.txt44
1 files changed, 25 insertions, 19 deletions
diff --git a/npc/craft/options.txt b/npc/craft/options.txt
index 6cc7e585d..8bd1126dc 100644
--- a/npc/craft/options.txt
+++ b/npc/craft/options.txt
@@ -500,35 +500,41 @@ function script csys_WeaponFix {
return;
}
-// csys_BonusCalc( lv1, lv2, vartp{, equip lvl} )
+// csys_BonusCalc( lv1, lv2, vartp{, equip lvl, skip=false} )
// Calculates the due bonus
function script csys_BonusCalc {
.@craft=getarg(0);
.@skill=getarg(1);
.@var=getarg(2);
.@eqlv=getarg(3, 0);
+ .@skip=getarg(4, false);
.@mult=csys_Multiplier(.@var);
.@avmult=(.@craft+.@skill)*.@mult;
.@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)
+ // Roll or no roll
+ if (!.@skip) {
.@base=rand2(1, .@avg+1);
- // Bonus grace reroll if crafting is maxed at 10 (SCRIPT only)
- if (.@craft >= 10 && .@base < (.@avg+1)*.@eqlv/500) {
- .@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)
+ .@base=rand2(1, .@avg+1);
+
+ // Bonus grace reroll if crafting is maxed at 10 (SCRIPT only)
+ if (.@craft >= 10 && .@base < (.@avg+1)*.@eqlv/500) {
+ .@base=rand2(1, .@avg+1);
+ }
+ } else {
+ .@base=rand2(.@avg*9/10+1, .@avg+1);
}
////////////////////////////////////
@@ -630,7 +636,7 @@ function script csys_Apply {
if (rand(10000) < .@base && .@max_pena) {
// Apply a malus using array_pop (it was shuffled so we're fine)
.@vartp=array_pop(@csys_penalty);
- .@malus=csys_BonusCalc(.@lv, .@lv2, .@vartp);
+ .@malus=csys_BonusCalc(.@lv, .@lv2, .@vartp); // .@eqplv ?
.@malus=.@malus*70/100;
if (.@vartp > 0 && .@malus > 0)
setitemoptionbyindex(.@id, .@slot, .@vartp, -(.@malus));
@@ -681,7 +687,7 @@ function script csys_ApplyPerfect {
while (.@slot < min(3, .@max_attr)) {
// Apply a bonus using array_pop (it was shuffled so we're fine)
.@vartp=array_pop(@csys_attr);
- .@bonus=csys_BonusCalc(10, .@lv, .@vartp, .@eqplv);
+ .@bonus=csys_BonusCalc(10, .@lv, .@vartp, .@eqplv, true);
setitemoptionbyindex(.@id, .@slot, .@vartp, .@bonus);
//debugmes "Bonus applied: %d at %d (slot: %d)", .@vartp, .@bonus, .@slot;
.@slot+=1;
@@ -690,7 +696,7 @@ function script csys_ApplyPerfect {
if (.@max_pena) {
// Apply a malus using array_pop (it was shuffled so we're fine)
.@vartp=array_pop(@csys_penalty);
- .@malus=csys_BonusCalc(10, .@lv, .@vartp);
+ .@malus=csys_BonusCalc(10, .@lv, .@vartp, .@eqplv, true);
.@malus=.@malus*70/100;
if (.@vartp > 0 && .@malus > 0)
setitemoptionbyindex(.@id, .@slot, .@vartp, -(.@malus));