From 5e1f768729778a60be895e46815486444734a95e Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 9 Aug 2019 23:11:00 -0300 Subject: Rewrite how Transmigration works (it is now bad and maybe broken) --- npc/magic/transmigration.txt | 100 ++++++++++++++++++++++++++++++++----------- 1 file changed, 75 insertions(+), 25 deletions(-) (limited to 'npc/magic') diff --git a/npc/magic/transmigration.txt b/npc/magic/transmigration.txt index 4e45d8510..4fb2232e2 100644 --- a/npc/magic/transmigration.txt +++ b/npc/magic/transmigration.txt @@ -10,12 +10,6 @@ - script sk#mkpot 32767,{ end; OnCall: - // Other requeriments - if (countitem(Plushroom) < 10 || !countitem(Milk)) { - dispbottom l("You need @@ @@ and @@ to cast this skill.", 10, getitemlink(Plushroom), getitemlink(Milk)); - end; - } - // Check cooldown if (@mkpot_at > gettimetick(2)) { dispbottom l("Skill is in cooldown for @@.", FuzzyTime(@mkpot_at)); @@ -26,26 +20,82 @@ OnCall: if (!MagicCheck(TMW2_TRANSMIGRATION, 185, -5)) end; - // Consume items - delitem Plushroom, 10; - delitem Milk, 1; - - // Create the stuff based on MAGIC_EXP - // The closer to zero, best; - // Each 3 mexp reduces chance to get a fail - // Each skill level reduces chances to get a fail - .@r=rand(141,181)-(MAGIC_EXP/3)-getskilllv(TMW2_TRANSMIGRATION); - if (.@r < 21) { - // Get up to 6 Haste Potions depending on your skill. - getitem HastePotion, abizit()+1; - } else if (.@r < 82) { - getitem any(BottleOfTonoriWater, BottleOfWoodlandWater, BottleOfDivineWater, Milk, CelestiaTea, PileOfAsh), 1; - } else if (.@r < 122) { - getitem any(BottleOfSewerWater, Milk, CelestiaTea, PileOfAsh), 1; - } else if (.@r < 162) { - getitem any(BottleOfSewerWater, BottleOfSewerWater, PileOfAsh), 1; + do { + mes ".:: " + l("Transmutation Skill") + " ::."; + mesc l("What will you transmute today?"); + mes ""; + menuint + l("Haste Potion"), HastePotion, + l("Mouboo Figurine"), MoubooFigurine; + + mes ""; + switch (@menuret) { + case HastePotion: + mesc l("Transmutating @@ will require:", getitemlink(@menuret)); + mesc l("* @@/@@ @@", countitem(Plushroom), 10, getitemlink(Plushroom)); + mesc l("* @@/@@ @@", countitem(Milk), 1, getitemlink(Milk)); + next; + mesc l("Transmute?!"); + if (askyesno() == ASK_NO) + @menuret=0; + break; + case MoubooFigurine: + mesc l("Transmutating @@ will require:", getitemlink(@menuret)); + mesc l("* @@/@@ @@", countitem(WoodenLog), 1, getitemlink(WoodenLog)); + next; + mesc l("Transmute?!"); + if (askyesno() == ASK_NO) + @menuret=0; + break; + } + } while (!@menuret); + + // Close the dialog + closeclientdialog; + + // Check and Consume the reagents + switch (@menuret) { + case HastePotion: + if (countitem(Plushroom) < 10 || + countitem(Milk) < 1) { + dispbottom l("Not enough items!"); + end; + } + // Consume items + delitem Plushroom, 10; + delitem Milk, 1; + break; + case MoubooFigurine: + if (countitem(WoodenLog) < 1) { + dispbottom l("Not enough items!"); + end; + } + // Consume items + delitem WoodenLog, 1; + break; + } + + // Do the roll from 1 to 100 + // Base success chance is 0% + // Each abizit() point gives you 18% success rate (max 90%) + // Each skill level gives you 1% success rate (max 10%) + .@r=rand2(1, 100)-abizit()*18-getskilllv(TMW2_TRANSMIGRATION); + + // Backfire chance: 30% + if (.@r >= 70) { + dispbottom l("The spell backfires!"); + percentheal -(rand2(5, 15)), 0; + // Chance for nothing to happen + } else if (.@r >= 30) { + dispbottom l("Your reagents vanish into emptiness!"); + // Chance for you getting a junk item + } else if (.@r > 0) { + dispbottom l("Your spell takes a mind of its own and shapes in something else!"); + geitem WarpedLog, 1; + // You were successful } else { - dispbottom l("Your items vanishes into thin air. What?!"); + dispbottom l("*plim*"); + getitem @menuret, 1; } // set cooldown -- cgit v1.2.3-60-g2f50