From 1bac65c9c8f1828515ddd7b4b95f3e06fb005381 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 27 May 2019 17:09:39 -0300 Subject: Fix option bugs --- npc/craft/options.txt | 55 +++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 24 deletions(-) (limited to 'npc') diff --git a/npc/craft/options.txt b/npc/craft/options.txt index 0466b7d05..3f3822d9e 100644 --- a/npc/craft/options.txt +++ b/npc/craft/options.txt @@ -37,30 +37,30 @@ function script csys_Generate { switch (.@gid) { case CRGROUP_BASE: - if (@lvl >= 1) + if (.@lvl >= 1) array_push(@csys_attr, VAR_STRAMOUNT); - if (@lvl >= 2) + if (.@lvl >= 2) array_push(@csys_attr, VAR_AGIAMOUNT); - if (@lvl >= 3) + if (.@lvl >= 3) array_push(@csys_attr, VAR_VITAMOUNT); - if (@lvl >= 4) + if (.@lvl >= 4) array_push(@csys_attr, VAR_INTAMOUNT); - if (@lvl >= 5) + if (.@lvl >= 5) array_push(@csys_attr, VAR_DEXAMOUNT); - if (@lvl >= 6) + if (.@lvl >= 6) array_push(@csys_attr, VAR_LUKAMOUNT); - if (@lvl >= 8) + if (.@lvl >= 8) array_push(@csys_attr, VAR_MAXHPAMOUNT); - if (@lvl >= 10) + if (.@lvl >= 10) array_push(@csys_attr, VAR_MAXSPAMOUNT); break; // First tier case CRGROUP_ATK: - if (@lvl >= 1) { + if (.@lvl >= 1) { array_push(@csys_attr, VAR_ATTPOWER); array_push(@csys_attr, VAR_ATTMPOWER); } - if (@lvl >= 5) { + if (.@lvl >= 5) { array_push(@csys_attr, VAR_MAGICATKPERCENT); array_push(@csys_attr, VAR_ATKPERCENT); } @@ -68,11 +68,11 @@ function script csys_Generate { array_push(@csys_penalty, VAR_MDEFPOWER); break; case CRGROUP_DEF: - if (@lvl >= 1) { + if (.@lvl >= 1) { array_push(@csys_attr, VAR_ITEMDEFPOWER); array_push(@csys_attr, VAR_MDEFPOWER); } - if (@lvl >= 5) { + if (.@lvl >= 5) { array_push(@csys_attr, DAMAGE_CRI_USER); array_push(@csys_attr, RANGE_ATTACK_DAMAGE_USER); } @@ -80,10 +80,10 @@ function script csys_Generate { array_push(@csys_penalty, VAR_ATTMPOWER); break; case CRGROUP_ACC: - if (@lvl >= 1) { + if (.@lvl >= 1) { array_push(@csys_attr, VAR_HITSUCCESSVALUE); } - if (@lvl >= 5) { + if (.@lvl >= 5) { array_push(@csys_attr, VAR_CRITICALSUCCESSVALUE); } array_push(@csys_penalty, VAR_ATTPOWER); @@ -91,10 +91,10 @@ function script csys_Generate { break; break; case CRGROUP_EVD: - if (@lvl >= 1) { + if (.@lvl >= 1) { array_push(@csys_attr, VAR_AVOIDSUCCESSVALUE); } - if (@lvl >= 5) { + if (.@lvl >= 5) { array_push(@csys_attr, VAR_PLUSAVOIDSUCCESSVALUE); } array_push(@csys_penalty, VAR_ATTPOWER); @@ -103,16 +103,20 @@ function script csys_Generate { break; // Second tier case CRGROUP_REGEN: - if (@lvl >= 1) { + if (.@lvl >= 1) { array_push(@csys_attr, VAR_HPACCELERATION); } - if (@lvl >= 5) { + if (.@lvl >= 5) { array_push(@csys_attr, VAR_SPACCELERATION); } array_push(@csys_penalty, VAR_ATTPOWER); array_push(@csys_penalty, VAR_ATTMPOWER); break; } + + // Clear the dummies + array_remove(@csys_attr, DeathPenalty); + array_remove(@csys_penalty, DeathPenalty); return; //return Exception("Invalid ID"); } @@ -181,33 +185,36 @@ function script csys_Apply { .@max_attr=getarraysize(@csys_attr); .@max_pena=getarraysize(@csys_penalty); + //debugmes "We have %d attributes and %d penalties", .@max_attr, .@max_pena; + .@slot=0; while (.@slot < min(3, .@max_attr)) { // You have 100% for first bonus/onus, -20% each, depending on skill lv .@base=2000-(.@lv*75); - if (rand(10000) < 10000-(.@base*.@slot)) + if (rand(10000) > 10000-(.@base*.@slot)) break; // Apply a bonus using array_pop (it was shuffled so we're fine) // A pity 1 str and 1 hp is so different. .@vartp=array_pop(@csys_attr); - .@bonus=rand(1, .@lv/2); + .@bonus=rand(1, .@lv); setitemoptionbyindex(.@id, .@slot, .@vartp, .@bonus); + //debugmes "Bonus applied: %d at %d (slot: %d)", .@vartp, .@bonus, .@slot; .@slot+=1; } // We need a new temp var .@slt=0; while (.@slt < min(2, .@max_pena)) { - // You have 100% for first bonus/onus, -20% each, depending on skill lv - .@base=2000-(.@lv*75); - if (rand(10000) < 10000-(.@base*.@slot)) + // You have 100% for first bonus/onus, -30% each, depending on skill lv + .@base=3000+(.@lv*75); + if (rand(10000) > 10000-(.@base*.@slt)) break; // Apply a bonus using array_pop (it was shuffled so we're fine) // A pity 1 str and 1 hp is so different. .@vartp=array_pop(@csys_penalty); - .@bonus=rand(1, .@lv/2); + .@bonus=rand(1, .@lv); setitemoptionbyindex(.@id, .@slot, .@vartp, .@bonus); .@slot+=1; .@slt+=1; -- cgit v1.2.3-70-g09d2