Make as many of the properties of Character to be final as possible. init (which should be named initiative) should not be a property at all.
Delete getRandom. Pass in an instance of Random for testability, and call its nextInt. Make Character a static inner class - it won't be able to access properties of Game, and that's a good thing - it's better to pass them in explicitly when needed.
cls (clearing the screen) is an anti-feature. The user can clear the screen when they want through their own terminal controls.
Don't \' escape apostrophes when that isn't needed.
There is no need for Console in this application.
Make more use of printf instead of string concatenation.
Don't abbreviate variables like h (hero) and e (enemy) to single letters; spell them out.
Various spelling issues like croud (should be crowd); enable spellcheck.
clash calling doBattle is recursion, which is not a good idea; you almost certainly shouldn't be recursing here.
Don't nextInt for your option. Since it's only used in a simple comparison, leave it as a string; it removes the potential for an exception and simplifies validation.
Whenever possible, construct your console formatting so that it produces logically-related paragraphs. Also, prefer accepting terminal input on the same line as the prompt.
Suggested
package com.stackexchange; import java.util.Optional; import java.util.Random; import java.util.Scanner; public class Game { public record Hit( boolean blocked, int attack_points ) { @Override public String toString() { if (attack_points <= 0) return "no damage"; return "%d points of damage".formatted(attack_points); } } public static class Character { private int health; private int defense; public final int strength; public final String name; public Character(String name, Random rand) { health = rand.nextInt(1, 100); defense = rand.nextInt(1, 100); strength = rand.nextInt(1, 100); this.name = name; } public boolean isAlive() { return health > 0; } public Hit receiveHit(Character attacker) { int attack_points = Integer.max(0, attacker.strength - defense); boolean blocked = attack_points == 0; if (blocked) defense -= (defense % attacker.strength) + 1; health = Integer.max(0, health - attack_points); return new Hit(blocked, attack_points); } private void printStats() { System.out.printf("%s's Stats:%n", name); System.out.println("---------------"); final String fmt = "%-10s %-3d%n"; System.out.printf(fmt, "Health:", health); System.out.printf(fmt, "Defense:", defense); System.out.printf(fmt, "Strength:", strength); System.out.println(); } @Override public String toString() { return name; } } private final Random rand = new Random(); private final Scanner scanner = new Scanner(System.in); private final Character hero; private final Character enemy = new Character("Spock", rand); public Game() { System.out.println("Welcome to the arena!"); System.out.print("Enter your hero's name: "); hero = new Character(scanner.nextLine(), rand); } public void clash() { System.out.printf("%s took a cheapshot!%n", enemy); System.out.println("(Crowd gasps)"); System.out.printf("But %s blocked it in the nick of time!%n", hero); System.out.println("(Crowd cheers)"); } public Optional<Character> rollInitiative() { int hero_initiative = rand.nextInt(1, 7), enemy_initiative = rand.nextInt(1, 7); if (hero_initiative > enemy_initiative) return Optional.of(hero); if (hero_initiative < enemy_initiative) return Optional.of(enemy); return Optional.empty(); } public void attack(Character attacker, Character defender) { Hit hit = defender.receiveHit(attacker); if (hit.blocked) { System.out.printf("%s blocks %s's attack and takes %s!%n", defender, attacker, hit); System.out.println("(Crowd cheers)"); } else { System.out.printf("%s strikes %s for %s!%n", attacker, defender, hit); System.out.println("(Crowd boos)"); } } public void doBattle() { Optional<Character> goesFirst = rollInitiative(); if (goesFirst.isPresent()) { Character attacker = goesFirst.get(); System.out.printf("%s takes initiative!%n", attacker); Character defender = hero == attacker? enemy: hero; attack(attacker, defender); } else { clash(); } } public void run() { System.out.printf("Avast, %s! Go forth!%n", hero); do { System.out.println(); hero.printStats(); enemy.printStats(); if (!hero.isAlive()) { System.out.printf("%s defeated %s!%n", enemy, hero); System.out.println("(Crowd boos aggressively)"); System.out.println("Someone from the crowd yelled \"YOU SUCK!\""); break; } if (!enemy.isAlive()) { System.out.printf("%s utterly smote %s!%n", hero, enemy); System.out.println("(Crowd ROARS)"); break; } } while (doRound()); } private boolean doRound() { while (true) { System.out.print("Enter option (1 to battle, 2 to escape)! "); switch (scanner.nextLine()) { case "1": doBattle(); return true; case "2": System.out.println("YOU COWARD!"); return false; default: System.err.println("Invalid option"); } } } public static void main(String[] args) { new Game().run(); } }
Output
Welcome to the arena! Enter your hero's name: Julio Avast, Julio! Go forth! Julio's Stats: --------------- Health: 69 Defense: 59 Strength: 62 Spock's Stats: --------------- Health: 99 Defense: 32 Strength: 85 Enter option (1 to battle, 2 to escape)! 1 Spock takes initiative! Spock strikes Julio for 26 points of damage! (Crowd boos) Julio's Stats: --------------- Health: 43 Defense: 59 Strength: 62 Spock's Stats: --------------- Health: 99 Defense: 32 Strength: 85 Enter option (1 to battle, 2 to escape)! 1 Julio takes initiative! Julio strikes Spock for 30 points of damage! (Crowd boos) Julio's Stats: --------------- Health: 43 Defense: 59 Strength: 62 Spock's Stats: --------------- Health: 69 Defense: 32 Strength: 85 Enter option (1 to battle, 2 to escape)! 1 Julio takes initiative! Julio strikes Spock for 30 points of damage! (Crowd boos) Julio's Stats: --------------- Health: 43 Defense: 59 Strength: 62 Spock's Stats: --------------- Health: 39 Defense: 32 Strength: 85 Enter option (1 to battle, 2 to escape)! 1 Julio takes initiative! Julio strikes Spock for 30 points of damage! (Crowd boos) Julio's Stats: --------------- Health: 43 Defense: 59 Strength: 62 Spock's Stats: --------------- Health: 9 Defense: 32 Strength: 85 Enter option (1 to battle, 2 to escape)! 1 Julio takes initiative! Julio strikes Spock for 30 points of damage! (Crowd boos) Julio's Stats: --------------- Health: 43 Defense: 59 Strength: 62 Spock's Stats: --------------- Health: 0 Defense: 32 Strength: 85 Julio utterly smote Spock! (Crowd ROARS)