v2.2.0: improved gold mining: takes 1 turn and doesn't break crystal

This commit is contained in:
Evan Debenham
2023-09-25 11:20:35 -04:00
parent 341a2134ed
commit 1ac19a002d

View File

@@ -1149,6 +1149,14 @@ public class Hero extends Char {
@Override
public void call() {
boolean crystalAdjacent = false;
for (int i : PathFinder.NEIGHBOURS8) {
if (Dungeon.level.map[action.dst + i] == Terrain.MINE_CRYSTAL){
crystalAdjacent = true;
break;
}
}
if (Dungeon.level.map[action.dst] == Terrain.WALL_DECO){
DarkGold gold = new DarkGold();
if (gold.doPickUp( Dungeon.hero )) {
@@ -1160,6 +1168,7 @@ public class Hero extends Char {
GLog.i(Messages.get(DarkGold.class, "you_now_have", existing.quantity()));
}
}
spend(-Actor.TICK); //picking up the gold doesn't spend a turn here
} else {
Dungeon.level.drop( gold, pos ).sprite.drop();
}
@@ -1168,6 +1177,9 @@ public class Hero extends Char {
Sample.INSTANCE.play( Assets.Sounds.EVOKE );
Level.set( action.dst, Terrain.EMPTY_DECO );
//mining gold doesn't break crystals
crystalAdjacent = false;
} else if (Dungeon.level.map[action.dst] == Terrain.WALL){
buff(Hunger.class).affectHunger(-5);
PixelScene.shake(0.5f, 0.5f);
@@ -1194,14 +1206,6 @@ public class Hero extends Char {
GameScene.updateMap( action.dst+i );
}
boolean crystalAdjacent = false;
for (int i : PathFinder.NEIGHBOURS8) {
if (Dungeon.level.map[action.dst + i] == Terrain.MINE_CRYSTAL){
crystalAdjacent = true;
break;
}
}
if (crystalAdjacent){
sprite.parent.add(new Delayer(0.2f){
@Override