v2.0.0: fixed disarming traps rarely teleporting into containers

This commit is contained in:
Evan Debenham
2022-11-29 12:06:47 -05:00
parent 2700debaf5
commit 613f4c850b

View File

@@ -50,11 +50,15 @@ public class DisarmingTrap extends Trap{
Heap heap = Dungeon.level.heaps.get( pos );
if (heap != null && heap.type == Heap.Type.HEAP){
int cell = Dungeon.level.randomRespawnCell( null );
Item item = heap.pickUp();
int cell;
do {
cell = Dungeon.level.randomRespawnCell(null);
} while (cell != -1 && Dungeon.level.heaps.get( pos ) != null
&& Dungeon.level.heaps.get( pos ).type != Heap.Type.HEAP);
if (cell != -1) {
Item item = heap.pickUp();
Heap dropped = Dungeon.level.drop( item, cell );
dropped.seen = true;
if (item instanceof Honeypot.ShatteredPot){