summaryrefslogtreecommitdiff
path: root/npc/012-1/mahad.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/012-1/mahad.txt')
-rw-r--r--npc/012-1/mahad.txt49
1 files changed, 32 insertions, 17 deletions
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;