From 2133b7f03c15ecf058a84f9551cb5644ff822d25 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 26 Jun 2020 10:49:59 -0300 Subject: Avoid possible bugs --- npc/craft/options.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'npc') diff --git a/npc/craft/options.txt b/npc/craft/options.txt index a6770c45f..22b7f8a71 100644 --- a/npc/craft/options.txt +++ b/npc/craft/options.txt @@ -567,15 +567,15 @@ function script csys_Apply { // You have 102% chance of a malus, skill and equips lower it in 0.5% each .@base=10200-(.@lv*50); - if (rand(10000) > .@base) - break; - - // 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=.@malus*70/100; - setitemoptionbyindex(.@id, .@slot, .@vartp, -(.@malus)); - .@slot+=1; + 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=.@malus*70/100; + if (.@vartp > 0 && .@malus > 0) + setitemoptionbyindex(.@id, .@slot, .@vartp, -(.@malus)); + .@slot+=1; + } // The options have been attributed, clear temporary variables @csysArmor=false; -- cgit v1.2.3-70-g09d2