From 134655b116471ab8e63b51c2cd10523cb12a814f Mon Sep 17 00:00:00 2001 From: valentinlucas <21901740@unicaen.fr> Date: Wed, 20 Oct 2021 15:43:54 +0200 Subject: [PATCH] =?UTF-8?q?Modifications=20des=20classes=20li=C3=A9es=20au?= =?UTF-8?q?x=20actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/games/action/AbstractAction.java | 6 ++++++ .../fr/lnl/game/server/games/action/Action.java | 8 ++++++-- .../game/server/games/action/DeployShield.java | 17 ++++++++++++++++- .../lnl/game/server/games/action/DropBomb.java | 17 +++++++++++++++++ .../lnl/game/server/games/action/DropMine.java | 14 ++++++++++++++ .../game/server/games/action/DropObject.java | 7 +++++++ .../lnl/game/server/games/action/Nothing.java | 11 +++++++++++ 7 files changed, 77 insertions(+), 3 deletions(-) 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 index b4c0902..bb67d47 100644 --- 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 @@ -1,4 +1,10 @@ package fr.lnl.game.server.games.action; +import fr.lnl.game.server.games.Game; + public abstract class AbstractAction implements Action { + private Game game; + public AbstractAction(Game game){ + this.game = game; + } } diff --git a/server/src/main/java/fr/lnl/game/server/games/action/Action.java b/server/src/main/java/fr/lnl/game/server/games/action/Action.java index 366d30a..6ee599e 100644 --- a/server/src/main/java/fr/lnl/game/server/games/action/Action.java +++ b/server/src/main/java/fr/lnl/game/server/games/action/Action.java @@ -1,6 +1,10 @@ package fr.lnl.game.server.games.action; -public interface Action { +import fr.lnl.game.server.games.grid.Grid; +import fr.lnl.game.server.games.player.Player; + +public interface Action { + void doAction(); + boolean isPossible(); - public void doAction(); } 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 28d2978..9e21ad5 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,8 +1,23 @@ package fr.lnl.game.server.games.action; +import fr.lnl.game.server.games.Game; +import fr.lnl.game.server.games.player.AbstractPlayer; + public class DeployShield extends AbstractAction { + public DeployShield(Game game){ + super(game); + } + @Override - public void doAction() { + public void doAction(){ } + + @Override + public boolean isPossible() { + return true; + } + + } + 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 9279315..9baa749 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,21 @@ package fr.lnl.game.server.games.action; +import fr.lnl.game.server.games.Game; +import fr.lnl.game.server.games.player.AbstractPlayer; + public class DropBomb extends DropObject { + + public DropBomb(Game game){ + super(game); + } + + @Override + public void doAction() { + + } + + @Override + public boolean isPossible() { + return false; + } } 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 c6e69ce..bfdee35 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,18 @@ package fr.lnl.game.server.games.action; +import fr.lnl.game.server.games.Game; + public class DropMine extends DropObject { + public DropMine(Game game){ + super(game); + } + @Override + public void doAction() { + super.doAction(); + } + + @Override + public boolean isPossible() { + return false; + } } 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 7b1fa17..c2b234c 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,13 @@ package fr.lnl.game.server.games.action; +import fr.lnl.game.server.games.Game; + public abstract class DropObject extends AbstractAction { + + public DropObject(Game game){ + super(game); + } + @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 21014f5..20f0531 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,8 +1,19 @@ package fr.lnl.game.server.games.action; +import fr.lnl.game.server.games.Game; + public class Nothing extends AbstractAction { + + public Nothing(Game game){ + super(game); + } @Override public void doAction() { } + + @Override + public boolean isPossible() { + return true; + } }