Add various changes on Pair toString, Firearm getter

This commit is contained in:
Katchan 2021-10-28 23:19:53 +02:00
parent 19e5f19b19
commit 2322462ab3
3 changed files with 14 additions and 9 deletions

View File

@ -13,7 +13,7 @@ public enum ClassPlayer {
private final int mineCost; private final int mineCost;
private final int bombCost; private final int bombCost;
private final int moveCost; private final int moveCost;
private final int gainEnergyCost; private final int gainEnergy;
private final int penaltyShoot; private final int penaltyShoot;
private final int penaltyBomb; private final int penaltyBomb;
private final int penaltyMine; private final int penaltyMine;
@ -21,14 +21,14 @@ public enum ClassPlayer {
ClassPlayer(int energy, int shieldCost, int shootCost, int mineCost, int bombCost, int moveCost, 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.energy = energy;
this.shieldCost = shieldCost; this.shieldCost = shieldCost;
this.shootCost = shootCost; this.shootCost = shootCost;
this.mineCost = mineCost; this.mineCost = mineCost;
this.bombCost = bombCost; this.bombCost = bombCost;
this.moveCost = moveCost; this.moveCost = moveCost;
this.gainEnergyCost = gainEnergyCost; this.gainEnergy = gainEnergy;
this.penaltyShoot = penaltyShoot; this.penaltyShoot = penaltyShoot;
this.penaltyBomb = penaltyBomb; this.penaltyBomb = penaltyBomb;
this.penaltyMine = penaltyMine; this.penaltyMine = penaltyMine;
@ -59,8 +59,8 @@ public enum ClassPlayer {
return moveCost; return moveCost;
} }
public int getGainEnergyCost() { public int getGainEnergy() {
return gainEnergyCost; return gainEnergy;
} }
public int getPenaltyShoot() { public int getPenaltyShoot() {

View File

@ -8,23 +8,23 @@ public class Firearm implements Weapon{
public Firearm(){ public Firearm(){
this.bullet = 10; this.bullet = 10;
this.horizontalDistance = 2; this.horizontalDistance = 3;
this.verticalDistance = 3; this.verticalDistance = 3;
} }
@Override @Override
public int getBullet() { public int getBullet() {
return 0; return this.bullet;
} }
@Override @Override
public int getHorizontalDistance() { public int getHorizontalDistance() {
return 0; return this.horizontalDistance;
} }
@Override @Override
public int getVerticalDistance() { public int getVerticalDistance() {
return 0; return this.verticalDistance;
} }
} }

View File

@ -41,4 +41,9 @@ public class Pair<A,B> {
public int hashCode() { public int hashCode() {
return Objects.hash(a, b); return Objects.hash(a, b);
} }
@Override
public String toString() {
return "Pair[" + a + "," + b + ']';
}
} }