Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shopkeepers don't charge for consecutive acts of vandalism on the same square #121

Closed
Tomsod opened this issue Aug 4, 2018 · 0 comments
Closed

Comments

@Tomsod
Copy link

Tomsod commented Aug 4, 2018

When doing damage to a shop tile the second time, before the first damage to the same tile is repaired, you will not anger the shopkeeper or be prompted to pay. The only realistic scenario (that I can think of) of this happening is breaking down the door and then digging a pit in the doorway. Normally you would be charged 200 zm for ruining the doorway, but after paying 400 zm for breaking the door the shopkeeper ignores the pit. Restoring the broken door with wizard lock and then breaking it down again will also not trigger a second payment, but it sort of makes sense.

Why this is happening: when add_damage() registers new damage, it checks for existing damage at the same square, and upon finding some merely updates its cost:

NetHack/src/shk.c

Line 3314 in fedc093

tmp_dam->cost += cost;

But at pay_for_damage() there's a check for stale damage records:

NetHack/src/shk.c

Line 3874 in fedc093

(tmp_dam && (tmp_dam->when == monstermoves));

And the updated record still has its old when field which is likely stale by now. (In fact, it may even be behind other stale records, in which case the loop won't even get to check it.) And so it is ignored.

I suppose the accumulation of cost makes sense for two damage events occuring on the same move (right?), but while old records do need to be kept (they hold the original terrain type), they probably should be moved to the top of the list with updated when, or something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant