summaryrefslogtreecommitdiff
path: root/npc/craft/tweak.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/craft/tweak.txt')
-rw-r--r--npc/craft/tweak.txt39
1 files changed, 29 insertions, 10 deletions
diff --git a/npc/craft/tweak.txt b/npc/craft/tweak.txt
index 56f0874e8..9419e9462 100644
--- a/npc/craft/tweak.txt
+++ b/npc/craft/tweak.txt
@@ -25,10 +25,11 @@ function script SmithTweakReset {
return;
}
-// Usage: SmithTweakSystem ({price})
+// Usage: SmithTweakSystem ({price=600, retry=False})
// Returns true on success, false on failure
function script SmithTweakSystem {
.@price=getarg(0, 600);
+ .@retry=getarg(1, false);
// Adjust price
.@price=POL_AdjustPrice(.@price);
@@ -95,13 +96,31 @@ function script SmithTweakSystem {
POL_PlayerMoney(.@price);
SMITH_TWEAKS+=1;
- // Check if you fail
- if (!csys_Check(.@id)) {
- mesc l("YOU FAIL! It is a simple item now."), 1;
- return false;
- }
-
- csys_Apply(.@id);
- mesc l("SUCCESS! Congratulations, the item was improved!"), 3;
- return true;
+ // Apply the bonuses. This will only loop if `continue;` is cast.
+ // `continue` will only be cast if .@retry is set
+ do
+ {
+ // Check if you fail
+ if (!csys_Check(.@id)) {
+ mesc l("YOU FAIL! It is a simple item now."), 1;
+ if (.@retry) {
+ .@retry=false;
+ mesc l("...Automatically retrying...");
+ continue;
+ }
+ return false;
+ }
+
+ csys_Apply(.@id);
+ mesc l("SUCCESS! Congratulations, the item was improved!"), 3;
+ if (.@retry) {
+ next;
+ mesc l("Do you want to re-roll?"), 1;
+ if (askyesno() == ASK_YES) {
+ .@retry=false;
+ continue;
+ }
+ }
+ return true;
+ } while (true);
}