From 2322462ab38337054e1921e4d1a3207c26ce9cb6 Mon Sep 17 00:00:00 2001 From: Katchan Date: Thu, 28 Oct 2021 23:19:53 +0200 Subject: [PATCH] Add various changes on Pair toString, Firearm getter --- .../fr/lnl/game/server/games/player/ClassPlayer.java | 10 +++++----- .../java/fr/lnl/game/server/games/weapon/Firearm.java | 8 ++++---- .../src/main/java/fr/lnl/game/server/utils/Pair.java | 5 +++++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/server/src/main/java/fr/lnl/game/server/games/player/ClassPlayer.java b/server/src/main/java/fr/lnl/game/server/games/player/ClassPlayer.java index 9c706ee..5ec633c 100644 --- a/server/src/main/java/fr/lnl/game/server/games/player/ClassPlayer.java +++ b/server/src/main/java/fr/lnl/game/server/games/player/ClassPlayer.java @@ -13,7 +13,7 @@ public enum ClassPlayer { private final int mineCost; private final int bombCost; private final int moveCost; - private final int gainEnergyCost; + private final int gainEnergy; private final int penaltyShoot; private final int penaltyBomb; private final int penaltyMine; @@ -21,14 +21,14 @@ public enum ClassPlayer { ClassPlayer(int energy, int shieldCost, int shootCost, int mineCost, int bombCost, int moveCost, - int gainEnergyCost, int penaltyShoot, int penaltyBomb, int penaltyMine, Weapon weapon){ + int gainEnergy, int penaltyShoot, int penaltyBomb, int penaltyMine, Weapon weapon){ this.energy = energy; this.shieldCost = shieldCost; this.shootCost = shootCost; this.mineCost = mineCost; this.bombCost = bombCost; this.moveCost = moveCost; - this.gainEnergyCost = gainEnergyCost; + this.gainEnergy = gainEnergy; this.penaltyShoot = penaltyShoot; this.penaltyBomb = penaltyBomb; this.penaltyMine = penaltyMine; @@ -59,8 +59,8 @@ public enum ClassPlayer { return moveCost; } - public int getGainEnergyCost() { - return gainEnergyCost; + public int getGainEnergy() { + return gainEnergy; } public int getPenaltyShoot() { diff --git a/server/src/main/java/fr/lnl/game/server/games/weapon/Firearm.java b/server/src/main/java/fr/lnl/game/server/games/weapon/Firearm.java index 9885152..4c054a5 100644 --- a/server/src/main/java/fr/lnl/game/server/games/weapon/Firearm.java +++ b/server/src/main/java/fr/lnl/game/server/games/weapon/Firearm.java @@ -8,23 +8,23 @@ public class Firearm implements Weapon{ public Firearm(){ this.bullet = 10; - this.horizontalDistance = 2; + this.horizontalDistance = 3; this.verticalDistance = 3; } @Override public int getBullet() { - return 0; + return this.bullet; } @Override public int getHorizontalDistance() { - return 0; + return this.horizontalDistance; } @Override public int getVerticalDistance() { - return 0; + return this.verticalDistance; } } diff --git a/server/src/main/java/fr/lnl/game/server/utils/Pair.java b/server/src/main/java/fr/lnl/game/server/utils/Pair.java index ff6f167..9052001 100644 --- a/server/src/main/java/fr/lnl/game/server/utils/Pair.java +++ b/server/src/main/java/fr/lnl/game/server/utils/Pair.java @@ -41,4 +41,9 @@ public class Pair { public int hashCode() { return Objects.hash(a, b); } + + @Override + public String toString() { + return "Pair[" + a + "," + b + ']'; + } }