From 2486a1dd2b67bfea7722f793d1c9f180fcc8d57a Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 28 Mar 2019 23:25:03 -0300 Subject: *evil laugh* --- npc/012-1/mahad.txt | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) (limited to 'npc/012-1') diff --git a/npc/012-1/mahad.txt b/npc/012-1/mahad.txt index 9fd44fd75..5195b7045 100644 --- a/npc/012-1/mahad.txt +++ b/npc/012-1/mahad.txt @@ -6,29 +6,44 @@ // Mahad is the Hurnscald Well Master // ...Well, he takes the water from the pond, but you shouldn't mind this. // It's still safe to drink, 100% warranted! -// TODO: Chance to lose 3 GP by getting a fish instead of a water bottle +// Note: You may get a Grass Carp (worth 100 GP) instead. Bottle is lost? O.o 012-1,117,54,0 script Mahad NPC_PLAYER,{ mesn; - mes l("I can fill your bottle with water for only @@ gp the bottle.", .COST_PER_BOTTLE); + mes l("I can fill your bottle with water for only @@ gp the bottle.", .price); mes l("After all, I am the Well Master!"); input .@count; - if (.@count == 0) + + if (!.@count) close; - .@Cost = .@count * .COST_PER_BOTTLE; - .@empty = countitem(EmptyBottle); - - if (.@empty < .@count) - goto L_NotEnoughBottles; - if (Zeny < .@Cost) - goto L_NotEnoughMoney; - getinventorylist; - inventoryplace BottleOfWoodlandWater, .@count; - - Zeny=Zeny-.@Cost; - delitem EmptyBottle, .@count; - getitem BottleOfWoodlandWater, .@count; + + .@gp = .@count * .price; + + if (Zeny < .@gp) { + mesc l("Not enough money."); + close; + } + + if (countitem(EmptyBottle) < .@count) { + mesc l("Not enough bottles."); + close; + } + + inventoryplace GrassCarp, .@count, BottleOfWoodlandWater, .@count; + + // Calculate how many grass carp you'll get + .@iced=0; + for (.@i=0; .@i < .@count; .@i++) { + if (rand(1,1000) < 11) + .@iced++; + } + + // Apply the results and have a happy day! + Zeny-=.@gp; + if (.@iced) + getitem GrassCarp, .@iced; + getitem BottleOfWoodlandWater, .@count-.@iced; close; L_NotEnoughBottles: @@ -44,7 +59,7 @@ L_NotEnoughMoney: close; OnInit: - .COST_PER_BOTTLE = 60; + .price = 60; .sex = G_MALE; .distance = 7; -- cgit v1.2.3-60-g2f50