Just spent all my gold on a staff of Teleportation, or so I thought, but it turns out I spent more than all of it. That's never happened to me before. Any ideas why this happened?
V3.0.9 Negative gold?
Collapse
X
-
V3.0.9 Negative gold?
Just spent all my gold on a staff of Teleportation, or so I thought, but it turns out I spent more than all of it. That's never happened to me before. Any ideas why this happened?Tags: None -
http://angband.oook.cz/ladder-show.php?id=7454
Just spent all my gold on a staff of Teleportation, or so I thought, but it turns out I spent more than all of it. That's never happened to me before. Any ideas why this happened?takkaria whispers something about options. -more- -
I'm no programmer but I'd come to a similar conclusion.
Guess I can consider it reported. Once I picked up some more gold everything returned to normal.Comment
-
Better be on your guard now.
A Bill Collector suddenly appears!
The Creditor summons Repo Men!
The Repo Man hits you!
Your possessions were stolen!
The Repo Man hits you!
Your house was repossessed!
The Bill Collector hits you!
Your Credit Rating {average} was destroyed!Comment
-
This happened to me also. I believe it is because the price listed in the store display is an average for the stack. When you buy a staff, the number of charges you get is ceiling(stack_charges / stack_size), and the price you pay is not the price of an average staff, but the price for the specific staff you are buying. If the number of charges divided by the number of items in the stack does not equal an integer, then you'll pay more than the listed average.
... I think, anyway.
Or maybe the shopkeeper just decided to cut you a break and accept an I.O.U.Comment
-
Takkaria - Would you mind if I update that dump at some point?
Eric -
Zero - that makes sense to me, just about.Comment
-
This happened to me also. I believe it is because the price listed in the store display is an average for the stack. When you buy a staff, the number of charges you get is ceiling(stack_charges / stack_size), and the price you pay is not the price of an average staff, but the price for the specific staff you are buying. If the number of charges divided by the number of items in the stack does not equal an integer, then you'll pay more than the listed average.
Code:/* Price of one */ price = price_item(o_ptr, FALSE); /* Check if the player can afford any at all */ if ((u32b)p_ptr->au < (u32b)price) { /* Tell the user */ msg_print("You do not have enough gold for this item."); store_flags |= STORE_KEEP_PROMPT; /* Abort now */ return FALSE; }
Code:/* * XXX Stacking * If a rod or wand, allocate total maximum timeouts or charges * between those purchased and left on the shelf. */ reduce_charges(i_ptr, i_ptr->number - amt);
Finally, at about line 1888, the price is re-calculated and deducted, without a sanity check.
Code:/* Extract the price for the entire stack */ price = price_item(i_ptr, FALSE) * i_ptr->number; ... /* Spend the money */ p_ptr->au -= price;
If we add another sanity check at this point, we would have to either (1) tell the player that we lied about the quantity he could afford or (2) we would have to (silently?) sell below-average items so that he could afford them.
I don't know what has happened to store.c since 3.0.9, but takkaria can find this code by looking for the store_purchase() function.
KevinComment
Comment