v3.0.0: added a check for disarming traps if they can't find a valid pos
This commit is contained in:
+7
-2
@@ -92,13 +92,18 @@ public class DisarmingTrap extends Trap{
|
|||||||
PathFinder.buildDistanceMap(pos, Dungeon.level.passable);
|
PathFinder.buildDistanceMap(pos, Dungeon.level.passable);
|
||||||
} while (cell == -1 || PathFinder.distance[cell] < 10 || PathFinder.distance[cell] > 20);
|
} while (cell == -1 || PathFinder.distance[cell] < 10 || PathFinder.distance[cell] > 20);
|
||||||
|
|
||||||
|
if (tries < 0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
hero.belongings.weapon = null;
|
hero.belongings.weapon = null;
|
||||||
Dungeon.quickslot.clearItem(weapon);
|
Dungeon.quickslot.clearItem(weapon);
|
||||||
weapon.updateQuickslot();
|
weapon.updateQuickslot();
|
||||||
|
|
||||||
Dungeon.level.drop(weapon, cell).seen = true;
|
Dungeon.level.drop(weapon, cell).seen = true;
|
||||||
for (int i : PathFinder.NEIGHBOURS9)
|
for (int i : PathFinder.NEIGHBOURS9) {
|
||||||
Dungeon.level.mapped[cell+i] = true;
|
Dungeon.level.mapped[cell + i] = true;
|
||||||
|
}
|
||||||
GameScene.updateFog(cell, 1);
|
GameScene.updateFog(cell, 1);
|
||||||
|
|
||||||
GLog.w( Messages.get(this, "disarm") );
|
GLog.w( Messages.get(this, "disarm") );
|
||||||
|
|||||||
Reference in New Issue
Block a user