I don´t understand the logic that is to be implemented within the attack and/or defend method for the case, that Chest is applied. I used different variations for setting hitCount and applied an else case but nothing worked. I hope someone can explain me the logic behind it, thanks in advance.
package de.codegym.task.task13.task1328;
/*
Roboterschlachten
*/
public class Solution {
public static void main(String[] args) {
Robot amigo = new Robot("Amigo");
Robot enemy = new Robot("Feind");
doMove(amigo, enemy);
doMove(amigo, enemy);
doMove(enemy, amigo);
doMove(amigo, enemy);
doMove(enemy, amigo);
doMove(amigo, enemy);
doMove(enemy, amigo);
doMove(amigo, enemy);
}
public static void doMove(AbstractRobot robotFirst, AbstractRobot robotSecond) {
BodyPart attacked = robotFirst.attack();
BodyPart defended = robotSecond.defend();
System.out.println(String.format("%s hat %s angegriffen: sein %s wurde angegriffen und sein %s wurde verteidigt",
robotFirst.getName(), robotSecond.getName(), attacked, defended));
}
}