From 1090d358c2bb917e97c3302c72353817f6addb95 Mon Sep 17 00:00:00 2001 From: Katchan Date: Wed, 20 Oct 2021 14:52:04 +0200 Subject: [PATCH] Remove position atribute on Player --- .../lnl/game/server/games/player/AbstractPlayer.java | 12 +----------- .../lnl/game/server/games/player/ComputerPlayer.java | 6 +++--- .../fr/lnl/game/server/games/player/HumanPlayer.java | 9 ++++++--- 3 files changed, 10 insertions(+), 17 deletions(-) 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 a5177d2..8e76985 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 @@ -7,16 +7,14 @@ import fr.lnl.game.server.utils.Point; public abstract class AbstractPlayer implements Player { private int id; - private Point position; private int energy; private Weapon weapon; private boolean shieldDeploy; private Action[] actions; private ClassPlayer classPlayer; - public AbstractPlayer(int id, Point position, boolean shieldDeploy, ClassPlayer classPlayer) { + public AbstractPlayer(int id, boolean shieldDeploy, ClassPlayer classPlayer) { this.id = id; - this.position = position; this.classPlayer = classPlayer; this.energy = classPlayer.getEnergy(); this.weapon = classPlayer.getWeapon(); @@ -31,10 +29,6 @@ public abstract class AbstractPlayer implements Player { return id; } - public Point getPosition() { - return position; - } - public int getEnergy() { return energy; } @@ -51,10 +45,6 @@ public abstract class AbstractPlayer implements Player { this.energy = energy; } - public void setPosition(Point position) { - this.position = position; - } - public void setShieldDeploy(boolean shieldDeploy) { this.shieldDeploy = shieldDeploy; } 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 abcdf35..a51003d 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 @@ -4,11 +4,11 @@ import fr.lnl.game.server.utils.Point; public class ComputerPlayer extends AbstractPlayer{ - public ComputerPlayer(int id, Point position, boolean shieldDeploy, ClassPlayer classPlayer) { - super(id, position, shieldDeploy, classPlayer); + public ComputerPlayer(int id, boolean shieldDeploy, ClassPlayer classPlayer) { + super(id, shieldDeploy, classPlayer); } public ComputerPlayer(int id, ClassPlayer classPlayer) { - super(id, null,false, classPlayer); + super(id,false, classPlayer); } } 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 f2c840c..6d7f97f 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 @@ -1,11 +1,14 @@ 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 { - public HumanPlayer(int id, Point position, boolean shieldDeploy, ClassPlayer classPlayer) { - super(id, position, shieldDeploy, classPlayer); + public HumanPlayer(int id, boolean shieldDeploy, ClassPlayer classPlayer) { + super(id, shieldDeploy, classPlayer); + } + + public HumanPlayer(int id, ClassPlayer classPlayer) { + super(id, false, classPlayer); } }