diff --git a/cicaprojekt/Field.java b/cicaprojekt/Field.java index 5888e82..8e6eb2c 100644 --- a/cicaprojekt/Field.java +++ b/cicaprojekt/Field.java @@ -17,6 +17,7 @@ public class Field extends cicaprojekt.Tile { } public void onEntry(PlayerBase playerBase) { + super.onEntry(playerBase); if (boxStack.size() > 0) return; playerBase.setCurrentTile(this); diff --git a/cicaprojekt/Gap.java b/cicaprojekt/Gap.java index 0944647..60c6bf7 100644 --- a/cicaprojekt/Gap.java +++ b/cicaprojekt/Gap.java @@ -12,7 +12,9 @@ public class Gap extends cicaprojekt.Tile { } public void onEntry(PlayerBase playerBase) { + super.onEntry(playerBase); playerBase.destroy(); + Game.instance.playerBaseDestroyed(playerBase); } public void onExit(PlayerBase playerBase) throws IllegalStateException { diff --git a/cicaprojekt/Gate.java b/cicaprojekt/Gate.java index 362fe63..624f5ff 100644 --- a/cicaprojekt/Gate.java +++ b/cicaprojekt/Gate.java @@ -13,6 +13,7 @@ public class Gate extends Tile { } public void onEntry(PlayerBase playerBase) { + super.onEntry(playerBase); if (open) { playerBase.setCurrentTile(this); } else diff --git a/cicaprojekt/PlayerBase.java b/cicaprojekt/PlayerBase.java index 0d1cd49..892a2cf 100644 --- a/cicaprojekt/PlayerBase.java +++ b/cicaprojekt/PlayerBase.java @@ -20,7 +20,6 @@ public class PlayerBase implements Destroyable { public void destroy() { destroyed = true; - Game.instance.playerBaseDestroyed(this); } public Tile getCurrentTile() { diff --git a/cicaprojekt/Scale.java b/cicaprojekt/Scale.java index 27aa94f..0bd2a2e 100644 --- a/cicaprojekt/Scale.java +++ b/cicaprojekt/Scale.java @@ -25,6 +25,7 @@ public class Scale extends Field { @Override public void onEntry(PlayerBase playerBase) { + super.onEntry(playerBase); gateConnected.setOpen(true); } diff --git a/cicaprojekt/Stargate.java b/cicaprojekt/Stargate.java index 8f6e900..92d81a5 100644 --- a/cicaprojekt/Stargate.java +++ b/cicaprojekt/Stargate.java @@ -58,6 +58,7 @@ public class Stargate { public boolean isSpawned() { return isSpawned; } + public boolean isOpen() { if(isSpawned & other.isSpawned) return other.getCurrentWall().getAdjacentTile(other.getExitDirection()).isSteppable(); diff --git a/cicaprojekt/Tile.java b/cicaprojekt/Tile.java index 69d2eb3..3683209 100644 --- a/cicaprojekt/Tile.java +++ b/cicaprojekt/Tile.java @@ -10,6 +10,7 @@ public abstract class Tile { protected Stack boxStack; protected int y = -666; protected int x = -666; + protected PlayerBase playerBaseOnTile = null; public Tile() { @@ -42,10 +43,15 @@ public abstract class Tile { } public void spawnStargate(Stargate stargate, Direction direction) { + if (playerBaseOnTile != null && playerBaseOnTile.name.equals("Replicator")) + playerBaseOnTile.destroy(); + adjacentTile.get(direction).spawnStargate(stargate, direction); } - public abstract void onEntry(PlayerBase playerBase); + public void onEntry(PlayerBase playerBase) { + playerBaseOnTile = playerBase; + } public abstract void onExit(PlayerBase playerBase); diff --git a/cicaprojekt/Wall.java b/cicaprojekt/Wall.java index c100da8..1f4a1b9 100644 --- a/cicaprojekt/Wall.java +++ b/cicaprojekt/Wall.java @@ -36,6 +36,7 @@ public class Wall extends Tile { } public void onEntry(PlayerBase playerBase) { + super.onEntry(playerBase); if (sg == null) { return; } else { diff --git a/mastertest.dungeon b/mastertest.dungeon index 4cb11ad..a1cb43b 100644 --- a/mastertest.dungeon +++ b/mastertest.dungeon @@ -2,8 +2,8 @@ 150 W W W W W -W R W F W -W X O F W +W R F F W +W F O F W W F F Z W W W W W W