Bug - Fixed Spelunky: throw [item] removes [item] from inventory

ckb

Minion
Staff member
In Spelunky, using the "skill" Throw [item] will unequip and remove the [item] from inventory

This is true for [item]:
  • crumbling skull
  • rock
  • pot


Example:

{39} The Jungle
Encounter: bee
Strategy: C:\Users\craigb\Dropbox\KOLMafia\ccs\ckb3.ccs [default]
Round 0: ckb wins initiative!
Round 1: ckb casts THROW ROCK!
Round 2: bee takes 30 damage.
Round 2: ckb wins the fight!
After Battle: You gain 8 gold

You need 1 more rock to continue.
 

ckb

Minion
Staff member
How did you generate that?

I am working on a script to automate turns in spelunky, With a CCS that will throw a rock, and a check to equip a rock if you have one.
When you lose the rock in the fight, mafia does not subtract it from inventory, hence the "You need 1 more rock to continue."
 

Veracity

Developer
Staff member
OK. The key words were "automating turns". Since I have always ever run Spelunky manually, and I see it properly removing thrown items from equipment/inventory when I do so, I have never seen this.

I'm sure it's a simple fix. I'll see if I can find time to look at it, by and by.

It will have to wait until I rewrite how we handle server cookies.
 

Hellno

Member
It happens because there is some code that wants to change the players gear to whatever it was at the start of the turn- I think I remember you implementing that as a simple way of detecting any rocks/skulls/torches that are picked up and automatically equipped at end of combat. They are unequipped which presumably helps recognizing that something was found.

What happens here instead is that you had a rock equipped at the start of the combat, but after combat no longer do- mafia tries to equip one so that you have the same gear you did at the start of combat, even though it should know there is no rock to equip.
 

Veracity

Developer
Staff member
Yeah, when you automate, it saves/restores an implicit checkpoint around each adventure. There are any number of ways that you can lose equipment during normal fights, so we have a "discardEquipment" method to handle that. That will, by default, remove the equipment from active checkpoints, which is why you don't normally see this problem.

However, since Spelunky is a bit different (like sometimes autoequipping things), we have a discardSpelunkyEquipment method - and that does not remove things from checkpoints.

It should. I'll look again at that method and figure out what to do.
 

Veracity

Developer
Staff member
Try revision 17205:

- if you throw an item, it will discard it from implicit checkpoints
- if you autoequip a found item, it will replace it in implicit checkpoints
 

Veracity

Developer
Staff member
So ... any response from ckb or Hellno? Does this fix the behavior you complained about?
 

ckb

Minion
Staff member
I have not forgotten about this, I have just been distracted by work and NA runs. I'll try to get some testing done this weekend.
 

ckb

Minion
Staff member
Update, just tested my spelunknig script fight with r17226, no issues with using a rock in combat. Thanks!
 
Top