diff --git a/server/src/main/java/fr/lnl/game/server/ServerMain.java b/server/src/main/java/fr/lnl/game/server/ServerMain.java new file mode 100644 index 0000000..190225a --- /dev/null +++ b/server/src/main/java/fr/lnl/game/server/ServerMain.java @@ -0,0 +1,12 @@ +package fr.lnl.game.server; + +import fr.lnl.game.server.games.grid.Grid; + +public class ServerMain { + + public static void main(String[] args) { + Grid grid = new Grid(10,10); + grid.initGrid(); + grid.printGrid(); + } +} diff --git a/server/src/main/java/fr/lnl/game/server/games/action/AbstractAction.java b/server/src/main/java/fr/lnl/game/server/games/action/AbstractAction.java new file mode 100644 index 0000000..b4c0902 --- /dev/null +++ b/server/src/main/java/fr/lnl/game/server/games/action/AbstractAction.java @@ -0,0 +1,4 @@ +package fr.lnl.game.server.games.action; + +public abstract class AbstractAction implements Action { +} diff --git a/server/src/main/java/fr/lnl/game/server/games/action/DeployShield.java b/server/src/main/java/fr/lnl/game/server/games/action/DeployShield.java index a5130c8..28d2978 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/DeployShield.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/DeployShield.java @@ -1,6 +1,6 @@ package fr.lnl.game.server.games.action; -public class DeployShield implements Action{ +public class DeployShield extends AbstractAction { @Override public void doAction() { diff --git a/server/src/main/java/fr/lnl/game/server/games/action/DropBomb.java b/server/src/main/java/fr/lnl/game/server/games/action/DropBomb.java index ea790b2..9279315 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/DropBomb.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/DropBomb.java @@ -1,4 +1,4 @@ package fr.lnl.game.server.games.action; -public class DropBomb extends DropObject{ +public class DropBomb extends DropObject { } diff --git a/server/src/main/java/fr/lnl/game/server/games/action/DropMine.java b/server/src/main/java/fr/lnl/game/server/games/action/DropMine.java index 67dc200..c6e69ce 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/DropMine.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/DropMine.java @@ -1,4 +1,4 @@ package fr.lnl.game.server.games.action; -public class DropMine extends DropObject{ +public class DropMine extends DropObject { } diff --git a/server/src/main/java/fr/lnl/game/server/games/action/DropObject.java b/server/src/main/java/fr/lnl/game/server/games/action/DropObject.java index 9c83bba..7b1fa17 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/DropObject.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/DropObject.java @@ -1,6 +1,6 @@ package fr.lnl.game.server.games.action; -public class DropObject implements Action{ +public abstract class DropObject extends AbstractAction { @Override public void doAction() { diff --git a/server/src/main/java/fr/lnl/game/server/games/action/Move.java b/server/src/main/java/fr/lnl/game/server/games/action/Move.java index cc98ae3..853f12c 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/Move.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/Move.java @@ -1,6 +1,6 @@ package fr.lnl.game.server.games.action; -public class Move implements Action{ +public class Move extends AbstractAction { @Override public void doAction() { diff --git a/server/src/main/java/fr/lnl/game/server/games/action/Nothing.java b/server/src/main/java/fr/lnl/game/server/games/action/Nothing.java index e76f783..21014f5 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/Nothing.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/Nothing.java @@ -1,6 +1,6 @@ package fr.lnl.game.server.games.action; -public class Nothing implements Action { +public class Nothing extends AbstractAction { @Override public void doAction() { diff --git a/server/src/main/java/fr/lnl/game/server/games/action/Shot.java b/server/src/main/java/fr/lnl/game/server/games/action/Shot.java index d5a0894..e101eeb 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/Shot.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/Shot.java @@ -1,6 +1,6 @@ package fr.lnl.game.server.games.action; -public class Shot implements Action{ +public class Shot extends AbstractAction { @Override public void doAction() { diff --git a/server/src/main/java/fr/lnl/game/server/games/grid/Explosive.java b/server/src/main/java/fr/lnl/game/server/games/grid/Explosive.java index 562ca9c..f321505 100644 --- a/server/src/main/java/fr/lnl/game/server/games/grid/Explosive.java +++ b/server/src/main/java/fr/lnl/game/server/games/grid/Explosive.java @@ -1,4 +1,4 @@ package fr.lnl.game.server.games.grid; -public class Explosive implements Box{ +public abstract class Explosive implements Box{ } diff --git a/server/src/main/java/fr/lnl/game/server/games/grid/Grid.java b/server/src/main/java/fr/lnl/game/server/games/grid/Grid.java index 9a0e4a9..49ac0f6 100644 --- a/server/src/main/java/fr/lnl/game/server/games/grid/Grid.java +++ b/server/src/main/java/fr/lnl/game/server/games/grid/Grid.java @@ -47,6 +47,11 @@ public class Grid { } + // TODO: 18/10/2021 + public void placePlayers() { + + } + public void printGrid() { for (int i = 0; i < x; i++) { System.out.print("\n"); @@ -77,10 +82,4 @@ public class Grid { } } } - - public static void main(String[] args) { - Grid grid = new Grid(10,10); - grid.initGrid(); - grid.printGrid(); - } } diff --git a/server/src/main/java/fr/lnl/game/server/games/grid/Wall.java b/server/src/main/java/fr/lnl/game/server/games/grid/Wall.java index 8b1bdf1..06208d4 100644 --- a/server/src/main/java/fr/lnl/game/server/games/grid/Wall.java +++ b/server/src/main/java/fr/lnl/game/server/games/grid/Wall.java @@ -2,7 +2,7 @@ package fr.lnl.game.server.games.grid; import fr.lnl.game.server.utils.Cardinal; -public class Wall implements Box{ +public class Wall implements Box { private Cardinal cardinal; private int x; diff --git a/server/src/main/java/fr/lnl/game/server/games/player/AbstractPlayer.java b/server/src/main/java/fr/lnl/game/server/games/player/AbstractPlayer.java index 8bd527f..e4195a4 100644 --- a/server/src/main/java/fr/lnl/game/server/games/player/AbstractPlayer.java +++ b/server/src/main/java/fr/lnl/game/server/games/player/AbstractPlayer.java @@ -3,7 +3,7 @@ package fr.lnl.game.server.games.player; import fr.lnl.game.server.games.weapon.Weapon; import fr.lnl.game.server.utils.Point; -public abstract class AbstractPlayer { +public abstract class AbstractPlayer implements Player { private int id; private Point position; diff --git a/server/src/main/java/fr/lnl/game/server/games/player/ComputerPlayer.java b/server/src/main/java/fr/lnl/game/server/games/player/ComputerPlayer.java index a8bcb66..5428852 100644 --- a/server/src/main/java/fr/lnl/game/server/games/player/ComputerPlayer.java +++ b/server/src/main/java/fr/lnl/game/server/games/player/ComputerPlayer.java @@ -3,7 +3,8 @@ package fr.lnl.game.server.games.player; import fr.lnl.game.server.games.weapon.Weapon; import fr.lnl.game.server.utils.Point; -public class ComputerPlayer extends AbstractPlayer implements Player{ +public class ComputerPlayer extends AbstractPlayer{ + public ComputerPlayer(int id, Point position, int energy, Weapon weapon, boolean shieldDeploy) { super(id, position, energy, weapon, shieldDeploy); } diff --git a/server/src/main/java/fr/lnl/game/server/games/player/HumanPlayer.java b/server/src/main/java/fr/lnl/game/server/games/player/HumanPlayer.java index f56bcca..90ce542 100644 --- a/server/src/main/java/fr/lnl/game/server/games/player/HumanPlayer.java +++ b/server/src/main/java/fr/lnl/game/server/games/player/HumanPlayer.java @@ -3,7 +3,7 @@ package fr.lnl.game.server.games.player; import fr.lnl.game.server.games.weapon.Weapon; import fr.lnl.game.server.utils.Point; -public class HumanPlayer extends AbstractPlayer implements Player{ +public class HumanPlayer extends AbstractPlayer { public HumanPlayer(int id, Point position, int energy, Weapon weapon, boolean shieldDeploy) { super(id, position, energy, weapon, shieldDeploy); } diff --git a/server/src/main/java/fr/lnl/game/server/model/AbstractModelListening.java b/server/src/main/java/fr/lnl/game/server/model/AbstractModelListening.java index 310daab..148bf98 100644 --- a/server/src/main/java/fr/lnl/game/server/model/AbstractModelListening.java +++ b/server/src/main/java/fr/lnl/game/server/model/AbstractModelListening.java @@ -1,10 +1,14 @@ package fr.lnl.game.server.model; import java.util.List; -public abstract class AbstractModelListening implements ModelListener{ +public abstract class AbstractModelListening implements ModelListener { + List listeners; + public abstract void addListener(ModelListener e); + public abstract void removalListener(ModelListener e); + public void fireChange(){ for(ModelListener e : listeners){ e.updateModel(this); diff --git a/server/src/main/java/fr/lnl/game/server/utils/Cardinal.java b/server/src/main/java/fr/lnl/game/server/utils/Cardinal.java index 6d38b17..b7dab95 100644 --- a/server/src/main/java/fr/lnl/game/server/utils/Cardinal.java +++ b/server/src/main/java/fr/lnl/game/server/utils/Cardinal.java @@ -1,5 +1,12 @@ package fr.lnl.game.server.utils; public enum Cardinal { - NORTH,SOUTH,EAST,WEST,NORTH_EAST,NORTH_WEST,SOUTH_EAST,SOUTH_WEST + NORTH, + SOUTH, + EAST, + WEST, + NORTH_EAST, + NORTH_WEST, + SOUTH_EAST, + SOUTH_WEST }