This is a simple console-based magical arena game implemented in Java. Two players take turns attacking each other until one of them wins or the game ends in a draw.
- Purpose: Serves as the entry point of the application. It initializes players, sets up the game, and starts the
MagicalArena
. - Key Responsibilities:
- Gathers player information using
PlayerInitializer
. - Initializes and starts the game using
MagicalArena
.
- Gathers player information using
- Purpose: Handles input and validation for player information.
- Key Responsibilities:
- Collects and validates player details such as name, health, strength, and attack.
- Ensures that the attributes are valid positive integers.
- Purpose: Represents a player in the game.
- Key Responsibilities:
- Stores attributes like name, health, strength, and attack.
- Provides methods to access these attributes.
- Simulates an attack on another player, calculating damage and then reduces the player's health by specified damage
- Purpose: Manages the game logic and flow between two players.
- Key Responsibilities:
- Determines which player attacks first based on health or randomly if tied.
- Starts and controls the game flow, displaying relevant information about the game state.
-
Extract Zip folder
-
Navigate to the
src/main
directory of the extracted project. -
Compile the
Main.java
file using thejavac
command:javac Main.java
-
Execute the compiled Java program using the
java
command:java Main
-
Follow the prompts in the terminal to enter details for Player A and Player B as the game initializes.
- Enjoy playing the Magical Arena game!
Make sure you have Java Development Kit (JDK) installed on your system and configured in your PATH environment variable to successfully compile and run the Java program.