Need help creating this in JAVA You will build a turn based

Need help creating this in JAVA:

You will build a turn based battle game called BattleCode. The characters in the game are called Heros - a data class detailed below. In BattleCode, two Heroes enter a battle. The battle is managed by a manager class called the BattleManager - detailed below.

Game Play

Setup

The game starts by initializing Heroes. Heroes have 3 properties: strength, agility, and health. Health is 100, but strength and agility must be initialized by randomness. Strength helps with attacking and agility helps with blocking. Roll three 6-sided die. Choose one die and assign that value to strength. Choose another die to assign to agility.

The next step is determining the battle conditions - a battle can have a fixed number of rounds or it can run until one player runs out of health.

Battles

A battle consists of rounds. In each round, a player can choose how to move their hero - attack, block, or rest.

Once both players select a move damage is calculated.

This completes a round. If battle conditions are not met, another round is initiated.

Once battle conditions are met, there must be a winner. The winner is the hero with the most health. If at the end of a battle, both heroes have the same value for health, the battle is extended by one round. New rounds are initiated until there is a winner.

Hero Class

A hero performs the following

BattleManager Class

A battle manager has a single public method (other private methods are encouraged and should be used)

Instructions

Move Result Calculation
Attack Attack the opponent and apply damage Roll a two 6-sided die, add sum to strength to determine attack value.
Block Block an attack Roll an 10-sided die. If the value is less than 4, double it and add it to agility. Otherwise, add the value rolled to agility.
Rest Rest and heal Roll two 8-sided die. Add the sum to your health

Solution

import java.util.Random; public class Duel { Random hit = new Random(); Random hit1 = new Random(); int newHealth, newHealth1; int outcome, outcome1, outcome2, outcome3; int attack, attack1; int defense, defense1; int health, health1; void calculateWinner() { do { outcome = hit1.nextInt(100) - hit1.nextInt(15); newHealth1 = health1 - outcome; System.out.println(\"Your attack does \" + outcome + \" damage!\"); System.out.println(\"\"); System.out.print(\"Warrior Health: \" + newHealth1 + \"\ \"); break; } while(newHealth1 == 0); //System.out.println(\"Gladiator is the winner!\"); } void calculateWinner1() { do { outcome1 = hit.nextInt(100) - hit.nextInt(15); newHealth = health - outcome1; System.out.println(\"Your attack does \" + outcome1 + \" damage!\"); System.out.println(\"\"); System.out.print(\"Gladiator Health: \" + newHealth + \"\ \ \"); break; } while(newHealth == 0); //System.out.println(\"Warrior is the winner!\"); } void calculateHealth() { do { newHealth = health + hit.nextInt(35); System.out.println(\"You drink the potion.\"); System.out.println(\"Your health is now at \" + newHealth + \"!\"); break; } while(newHealth1 > 0 && newHealth > 0); } void calculateHealth1() { do { newHealth1 = health1 + hit.nextInt(35); System.out.println(\"You drink the potion.\"); System.out.println(\"Your health is now at \" + newHealth1 + \"!\"); break; } while(newHealth1 > 0 && newHealth > 0); } } import java.util.Random; import java.util.Scanner; public class DuelMain { public static void main(String[] args) { // Random + Scanner Random hit = new Random(); Random hit1 = new Random(); Scanner input = new Scanner(System.in); // String + Int String player1name = \"\"; String player2name = \"\"; int restart; int player1option; int player2option; int fight = 0; Duel warrior = new Duel(); Duel gladiator = new Duel(); gladiator.attack = hit.nextInt(100); gladiator.defense = hit.nextInt(15); gladiator.health = 1000; warrior.attack1 = hit1.nextInt(100); warrior.defense1 = hit1.nextInt(15);; warrior.health1 = 1000; // Printing Names System.out.print(\"Gladiator Enter Name: \"); player1name = input.nextLine(); System.out.print(\"Warrior Enter Name: \"); player2name = input.nextLine(); while(fight == 0) { // Choose Moves (Player1) System.out.printf(\"%n%s, Choose Your Move! \ \", player1name); System.out.println(\"1: Thrust 2: Slice 3: Drink Potion\"); player1option = input.nextInt(); if(player1option == 1) { System.out.printf(\"You Thrust Your Sword At %s! \ \", player2name); warrior.attack1 = hit1.nextInt(100); warrior.defense1 = hit1.nextInt(15); warrior.health1 = 1000; warrior.calculateWinner(); } if(player1option == 2) { System.out.printf(\"You Slice Your Sword At %s! \ \", player2name); warrior.attack1 = hit1.nextInt(100); warrior.defense1 = hit1.nextInt(15); warrior.health1 = 1000; warrior.calculateWinner(); } if(player1option == 3) { warrior.calculateHealth(); } // Choose Moves (Player2) System.out.printf(\"%n%s, Choose Your Move! \ \", player2name); System.out.println(\"1: Thrust 2: Slice 3: Drink Potion\"); player2option = input.nextInt(); if(player2option == 1) { System.out.printf(\"You Thrust Your Sword At %s! \ \", player1name); gladiator.attack = hit.nextInt(100); gladiator.defense = hit.nextInt(15); gladiator.health = 1000; gladiator.calculateWinner1(); } if(player2option == 2) { System.out.printf(\"You Slice Your Sword At %s! \ \", player1name); gladiator.attack = hit.nextInt(100); gladiator.defense = hit.nextInt(15); gladiator.health = 1000; gladiator.calculateWinner1();; } if(player2option == 3) { gladiator.calculateHealth1(); } } } }
Need help creating this in JAVA: You will build a turn based battle game called BattleCode. The characters in the game are called Heros - a data class detailed
Need help creating this in JAVA: You will build a turn based battle game called BattleCode. The characters in the game are called Heros - a data class detailed

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site