public class Player { int power; int attackment; String playerName; boolean isDead = true; public Player(String playerName, int power, int attackment) { this.playerName = playerName; this.attackment = attackment; this.power = power; } public Player(String playerName) { this.playerName = playerName; this.attackment = 100; this.power = 100; } public void adjPower(int adjustment) { //System.out.println("[debug] adjustment = "+adjustment); if (adjustment < 0) { this.power += adjustment; } else { this.power += adjustment; } } public int getpower() { return power; } public String getPlayerName() { return playerName; } public void attack(Player victim) { System.out.println(getPlayerName() + " attack " + victim.getPlayerName()); int diff = Math.abs(this.power-victim.power); if (diff==0) { diff = 1; } victim.adjPower(-diff); this.adjPower(+diff); } public boolean isDead() { return (this.power <= 0); } }//770623