diff options
author | Jesusaves <cpntb1@ymail.com> | 2024-01-20 22:54:17 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2024-01-20 22:54:17 -0300 |
commit | 355d4a09917936699d6f5d3c1ca31f68bd44ab81 (patch) | |
tree | 2ed6b21c7bacb597eeff8e09d308a32b3b1abeda | |
parent | 5140b8d9fb6e5055502d51d6934b0c00adb4804f (diff) | |
download | serverdata-355d4a09917936699d6f5d3c1ca31f68bd44ab81.tar.gz serverdata-355d4a09917936699d6f5d3c1ca31f68bd44ab81.tar.bz2 serverdata-355d4a09917936699d6f5d3c1ca31f68bd44ab81.tar.xz serverdata-355d4a09917936699d6f5d3c1ca31f68bd44ab81.zip |
...And we got a terrible seasoning minigame. Oh well. I warned you.
-rw-r--r-- | npc/craft/cooking.txt | 100 | ||||
-rw-r--r-- | npc/craft/options.txt | 2 |
2 files changed, 94 insertions, 8 deletions
diff --git a/npc/craft/cooking.txt b/npc/craft/cooking.txt index b95405387..a6ab0e382 100644 --- a/npc/craft/cooking.txt +++ b/npc/craft/cooking.txt @@ -42,18 +42,104 @@ function script CookingSystem { .@bt=min(1500, getiteminfo(.@it, ITEMINFO_SELLPRICE)) * 10; // basetime .@tm=limit(3600, .@bt * getskilllv(TMW2_COOKING), 86400); - if (countitem(.@it)) { + // Create the item immediately (in case you crash, etc.) + rentitem(.@it, .@tm); // From 1 hour to 1 day + + // Note: Seasoning it will destroy it and re-rent it once done + if (countitem(.@it) != 1) { mesc l("Skipping seasoning: You have multiple %s.", getitemlink(.@it)); } else { mesc l("Do you want to try to season it? If you succeed, it might become more powerful, but if you fail, it might become weaker."); select - l("No"); - } + l("No"), + l("Yes"); + mes ""; + if (@menu == 2) { + .@moves=5;.@goal=rand2(4,10);.@stat=0;.@view=false;.@smel=false; + while (.@moves) { + mesc l(".:: Seasoning ::."); + mesc l("You have %d moves left.%s%s", .@moves, + (.@view ? "" : l(" You can view the recipe once.")), + (.@smel ? "" : l(" You can smell the recipe once."))); + next; + select + l("Put a large amount of spice"), + l("Put a small amount of spice"), + rif(!.@view, l("View the dish")), + rif(!.@smel, l("Smell the dish")), + l("Finish the seasoning"); + mes ""; + switch (@menu) { + case 1: + .@stat+=3; .@moves -= 1; break; + case 2: + .@stat+=2; .@moves -= 1; break; + case 3: + if ((.@stat + 5) <= .@goal) + mesc l("You cannot see any spice in there."); + else if ((.@stat + 3) <= .@goal) + mesc l("The spice is vaguely visible... It needs more."); + else if (.@stat <= .@goal) + mesc l("The spice seems good... or at least, almost enough..."); + else if (.@stat - 3 <= .@goal) + mesc l("The spice is clearly visible... This is not a good sign."); + else + mesc l("The dish is covered in spice. It is ruined."); + .@view=true; + next; + break; + case 4: + if ((.@stat + 5) <= .@goal) + mesc l("You cannot smell any spice in there."); + else if ((.@stat + 3) <= .@goal) + mesc l("The spice's smell is too faint... It needs more."); + else if (.@stat <= .@goal) + mesc l("The spice smells good... or at least, almost enough..."); + else if (.@stat - 3 <= .@goal) + mesc l("The spice is smelling strong... This is not a good sign."); + else + mesc l("The spice smell is nauseating. The dish is ruined."); + .@smel=true; + next; + break; + case 5: + .@moves=0; break; + } // switch move + } // while game + // Recreate the item, so its rent time is preserved + delitem .@it, 1; + rentitem(.@it, .@tm); + delinventorylist(); // Needed, because we'll rely on rfind() + getinventorylist(); + .@index=array_rfind(@inventorylist_id, .@it); + .@opt1 = any(VAR_DEXAMOUNT, VAR_MAXSPAMOUNT, VAR_VITAMOUNT, CLASS_DAMAGE_BOSS_TARGET, VAR_ITEMDEFPOWER, VAR_PLUSASPD, IOPT_CRITDMG, RANGE_ATTACK_DAMAGE_USER, IOPT_SCPROVOKE_BLIND, SP_DRAIN, HP_DRAIN); + // By how much you missed the goal? + // Note: It is perfectly possible to avoid a negative bonus + .@excess = abs(.@stat-.@goal); + if (.@excess == 0) + .@pow = 30; // The default assigned power + else if (.@excess == 1) + .@pow = 20; + else if (.@excess == 2) + .@pow = 10; + else if (.@excess == 3) + .@pow = -10; + else if (.@excess == 4) + .@pow = -20; + else + .@pow = -30; - // Create the item - rentitem(.@it, .@tm); // From 1 hour to 1 day - // TODO: Season if it is still the only copy - // getskilllv(TMW2_COOKING) → and in theory, we can apply options + // Translate .@pow into a value and apply it + .@val1=csys_BonusCalc(getskilllv(TMW2_COOKING), abs(.@pow), .@opt1); + if (.@pow < 0) + .@val1=-(.@val1); + // If you're lucky: Cancel the debuff + if (.@val1 < 0 && .@opt1 == IOPT_SCPROVOKE_BLIND) + .@val1=0; + // Apply the seasoning bonus + setitemoptionbyindex(.@index, 0, .@opt1, .@val1); + } // if seasoning + } // if can season .success=true; } else { .success=false; diff --git a/npc/craft/options.txt b/npc/craft/options.txt index dc42d3add..f8948b614 100644 --- a/npc/craft/options.txt +++ b/npc/craft/options.txt @@ -643,7 +643,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); // .@eqplv ? + .@malus=csys_BonusCalc(.@lv, .@lv2, .@vartp); // .@eqplv ? FIXME .@malus=.@malus*70/100; if (.@vartp > 0 && .@malus > 0) setitemoptionbyindex(.@id, .@slot, .@vartp, -(.@malus)); |