Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this project you will create a simple text-based adventure game. Package RPG Java Files Creature.java Player.java Monster.java Room.java TreasureRoom.java Battle.java Game.java The game will

In this project you will create a simple text-based adventure game.

Package

RPG

Java Files

Creature.java Player.java Monster.java Room.java TreasureRoom.java Battle.java Game.java

The game will create a player object using information from a file, build a dungeon of three rooms each containing a monster, and allow the player to challenge the monster one-by-one and explore for treasure.

Objects

Player Dungeon with 3 Rooms 3 Monsters

The game will display messages on the screen to tell user what happens. It also creates a log file that keeps a record of the game.

Needs

Keyboard.ReadLine (Person Input) System.out.println (Game Output) Game Log (Logging File)

The program contains the following classes: (See Javadocs for detailed descriptions)

  1. A Creature class with attributes name, description, hitPoints, damage, and room. A creature object can attack and take damage. It also has an isAlive() method and a toString() method.

For Example

public class Creature(String name, String description, int hitPoints, int damage){

name = new get.name(); room = null; }

  1. A Player class that inherits Creature. A player has an attribute healAmount, and a heal() method that increase players hitPoints by healAmount.

For Example

public class Player extends Creature{

}

  1. A Monster class that inherits Creature. A monster as an attribute enrageThreshold, and will be enraged (double its attack damage) if its hitPoints falls below the threshold. It has methods canEnrage() and enrage().

For Example

public class Monster extends Creature{

}

  1. A Room class with attributes roomIndex, description, and monster. It has an enter() methods that displays description of the room and the monster in the room, and then initiates a battle between player and monster. The class also has a isComplete() method and a toString() method.

For Example

public class Room(int roomIndex, String roomDescription){

}

  1. A TreasureRoom class that inherits Room. A TreasureRoom has a String treasure, and an overrided enter() method that in addition to what Rooms enter() method does, if the player defeats the monster, displays a message that player finds the treasure.

For Example

public class TreasureRoom extends Room{

}

  1. A Battle class that has attributes player and monster. There is a run() method that let player and monster battle against each other until one of them dies. In each player turn, the method displays player hitPoints and monster hitPoints, then attack or heal following players command, and checks if monster is killed. In each monster turn, the method checks if the monster is going to enrage, then let the monster attack the player and checks if player is killed.

For Example

public class Battle( ){

}

  1. A Game class with attributes player and dungeon. Dungeon is an array of 3 Room objects. There is a constructor that constructs the player object using information from a file, and constructs three monsters and three rooms with attributed given in the tables below. There is a play() method that let the player enter the dungeon rooms one by one until the player dies or clears all rooms. The method also updates the GameLog file as player progresses.

For Example

public class Game( ){

}

  1. Finally, the Game class has a static main method that instantiates a Game object and runs the game.

For Example

public static void main( ){

}

Given tables to show relationships

Table 1

Monster Name

Room Index

Description

Hit Points

Attack Damage

Enrage Threshold

Orc

0

Covered with green blood

20

5

0

Skeleton

1

Funny how it moves

40

10

10

Fire Dragon

2

Spout fire with each breath

100

20

40

Table 2

Room Index

Description

Monster in the Room

0

A room with an unbearable smell

Orc

1

Dark and cold

Skeleton

2

A giant hall with something shiny on the other end

Fire Dragon

This is an example of the program!

For Example

package RPG;

public interface Creature{

public class Creature(String name, String description, int hitPoints, int damage){

name = new get.name();

room = null;

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

Differentiate between a cost center and a profit center.

Answered: 1 week ago