Question: Make an RPG in java, where the arena contains two of each of the classes described below. We should be able to get a description
Make an RPG in java, where the arena contains two of each of the classes described below. We should be able to get a description of the arena with everything in it and the beginning and after each round of fighting. Contestants that are dead should be described as such. In each round, all contestants in the arena are given a turn to act, in which they will be able to attack if possible. After a round, if there is only one contestant left standing, they are to be named the victor. If no one is alive, pick a winner at random. Random values for damage are determined every attack. Random values for health are determined when the character is created. Below is a list of the different types of contestants.
Berserker Character Class
Berserker contestants attack a random contestant in the arena and deal 20 smashing damage. They may hit themselves. They can take 35 points of damage before dying. They take half damage from fire, and double from slashing damage.
Warrior Character Class
The warrior looks at all his potential targets and attacks the one he finds most threatening, which is determined by how much damage it would take to kill a target. Warriors never attack themselves. Their attacks deal between 10 and 16 slashing damage, and they take between 20 and 40 points of damage before dying. A warrior has a 25% chance to dodge smashing or slashing damage.
Wild Mage Character Class
Wild mages deal fire damage to everyone in the arena, themselves included. Each target takes a random amount of damage between 0 and 6 fire damage (calculated per target). It takes between 10 and 60 points of damage to kill a mage. When they are killed they deal 5 fire damage back to whoever killed them.
Files Given
RPG.java
package rpg;
public class RPG {
public static void main(String[] args) { Arena arena = new Arena();
arena.add(new Beserker()); arena.add(new Beserker()); arena.add(new Warrior()); arena.add(new Warrior()); arena.add(new WildMage()); arena.add(new WildMage());
while (arena.getWinner() == null) { System.out.println(arena.getDescription()); arena.playRound(); }
System.out.println(); System.out.println(arena.getDescription()); System.out.println("Winner: " + arena.getWinner().getDescription());
}
}
Arena.java
package rpg;
import java.util.ArrayList; import java.util.Random;
class Arena {
public Arena() { }
public void add(Contestant contestant) { }
public void playRound() { }
public String getDescription() { }
public Contestant getWinner() { }
// Private private void checkVictor() { }
}
Sample Output:

In the arena.. A raging Berserker (35) A raging Berserker (35) A disciplined Warrior (33) A disciplined Warrior (39) A wild Mage (29) A wild Mage (11) A wild Mage (11) takes 20 Smashing damage from A raging Berserker (35) A raging Berserker (35) takes 2 Fire damage from A dead Mage A disciplined Warrior (39) takes 13 Slashing damage from A disciplined Warrior (33) A raging Berserker (35) takes 26 Slashing damage from A disciplined Warrior (26) A raging Berserker (33 takes 1 Fire damage from A wild Mage (29) A raging Berserker (9) takes 0 Fire damage from A wild Mage (29) A disciplined Warrior (33) takes 2 Fire damage from A wild Mage (29) A disciplined Warrior (26) takes 5 Fire damage from A wild Mage (29) A wild Mage (29) takes 1 Fire damage from A wild Mage (29) In the arena... A raging Berserker (32) A raging Berserker (9) A disciplined Warrior (31) A disciplined Warrior (21) A wild Mage (28) A dead Mage A disciplined Warrior (31) takes 20 Smashing damage from A raging Berserker (32) A wild Mage (28) takes 20 Smashing damage from A raging Berserker (9) A raging Berserker (32) takes 28 Slashing damage from A disciplined Warrior (11) A disciplined Warrior (11) takes 15 Slashing damage from A disciplined Warrior (21) A raging Berserker (4) takes 0 Fire damage from A wild Mage (8) A raging Berserker (9) takes 1 Fire damage from A wild Mage (8) A disciplined Warrior (21) takes 3 Fire damage from A wild Mage (8) A wild Mage (8) takes 1 Fire damage from A wild Mage (8) In the arena... A raging Berserker (4) A raging Berserker (8) In the arena.. A raging Berserker (35) A raging Berserker (35) A disciplined Warrior (33) A disciplined Warrior (39) A wild Mage (29) A wild Mage (11) A wild Mage (11) takes 20 Smashing damage from A raging Berserker (35) A raging Berserker (35) takes 2 Fire damage from A dead Mage A disciplined Warrior (39) takes 13 Slashing damage from A disciplined Warrior (33) A raging Berserker (35) takes 26 Slashing damage from A disciplined Warrior (26) A raging Berserker (33 takes 1 Fire damage from A wild Mage (29) A raging Berserker (9) takes 0 Fire damage from A wild Mage (29) A disciplined Warrior (33) takes 2 Fire damage from A wild Mage (29) A disciplined Warrior (26) takes 5 Fire damage from A wild Mage (29) A wild Mage (29) takes 1 Fire damage from A wild Mage (29) In the arena... A raging Berserker (32) A raging Berserker (9) A disciplined Warrior (31) A disciplined Warrior (21) A wild Mage (28) A dead Mage A disciplined Warrior (31) takes 20 Smashing damage from A raging Berserker (32) A wild Mage (28) takes 20 Smashing damage from A raging Berserker (9) A raging Berserker (32) takes 28 Slashing damage from A disciplined Warrior (11) A disciplined Warrior (11) takes 15 Slashing damage from A disciplined Warrior (21) A raging Berserker (4) takes 0 Fire damage from A wild Mage (8) A raging Berserker (9) takes 1 Fire damage from A wild Mage (8) A disciplined Warrior (21) takes 3 Fire damage from A wild Mage (8) A wild Mage (8) takes 1 Fire damage from A wild Mage (8) In the arena... A raging Berserker (4) A raging Berserker (8)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
