Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need help with this in java Dungeon Master Create a program that allows a user to explore a dungeon maze and fight monsters that

i need help with this in java

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Dungeon Master Create a program that allows a user to explore a dungeon maze and fight monsters that they encounter along the way. Use the UML diagram on the next page, the example output, and the descriptions below to help you create your classes. Classes: 1. Entity - describes a character in the game a. an entity has a name and some hit points (maxHp is the maximum amount of hp an entity can have and hp is initialized to the maxHp). b. heal method should increase the entity's hp by the amount passed in, but it should not go above the maxHp value. c. takeDamage method should decrease the entity's hp by the amount passed in, but it should not go below 0. d. toString method should display the name and hp over maxHp. 2. Hero - describes the character that represents the user. a. the hero has a map, a location on the map, and a level. b. Construct a hero with a name, some hp, a new Map, at the start of level 1. c. direction methods should change the hero's location (if that location is within the bounds of the map), reveal that location, get the character at that location, remove it and then return it. d. levelUp method increments the hero's level and loads the next map (note: the level should continue to increase, but the maps are numbered 1, 2, and 3, and should be repeated in that order (a finish is the next map's start). e. attack methods should each do a different amount of damage within a random range and returns a string representing that damage. f. toString should display the name, hp, level, and map. 3. Map represents the dungeon maze a. a map has a 5x5 set of characters representing the types of rooms in the maze, and a 5x5 set of booleans that allow you to determine if that room has been visited yet. b. load Map reads in the map from the file and stores it in the character array. c. mapToString returns a string of the map with the hero's current position, revealed rooms, and any unrevealed rooms represented by 'x's. 4. Enemy - represents an enemy the hero will encounter a. an enemy has a name and some hp b. attack method should do some damage within a random range and return a string representing that damage. 5. MagicalEnemy represents a magical enemy a. attack methods randomly select one of the three spells. Each of the spell methods should do a different amount of damage within a random range and return a string representing that damage. 6. Magical defines magical abilities, implemented by Hero and MagicalEnemy. 7. EnemyGenerator - creates random enemies to encounter in the maze a. constructor reads the file and adds the different enemies to the ArrayList (do not assume you know the length of the file). b. generate Enemy method randomly selects an enemy from the list, then randomly selects either Enemy or Magical Enemy, then copies over the name and hp to construct a new enemy of that type. If it is a magical enemy, then add a title like Magical, Wizard, or Warlock to the name (that way you know it's supposed to be casting spells). 8. Main a. prompt the user to enter a name, then construct a Hero with that name. b. display the hero with the map and have the user choose a direction. c. get the resulting character from the hero's direction methods i. x - location was out of bounds ii. n - nothing here iii. S-start (nothing here) iv. f-finish - level up the hero to move to the next map v. i - item - the hero finds a health potion. Heal the hero for 25 hp vi. m - monster fight an enemy by calling monsterRoom. d. monsterRoom displays the enemy and then repeatedly prompts the user to fight or to run away. If they choose to fight, call the fight method. If they run away, then choose a random direction to move the hero. Return true if the hero is still alive after the entire encounter. e. fight allows the user to choose to do a physical attack or a magical attack. If they choose physical, then call the hero's attack method. If they choose magical, then allow them to choose from the magical menu for which spell to cast. The enemy then attacks back if it is still alive. Return true if the hero is still alive. f. repeat from b until the user quits or the hero dies. Notes You can use the Point class from the java.awt library to keep the location of the hero, or make your own Point class. EnemyGenerator class reads in the file in the constructor to make a list of templates. The generateEnemy method randomly chooses from the template list and constructs a new enemy (ie. do not return the template's reference). Make sure the enemies you create are of the right type (either physical or magical). The attack and magic attack methods should do a random amount of damage to the entity passed in. Return a string representing the attack with the amount of damage done to the entity (see example output). The MagicalEnemy class's attack method should choose a random magic attack to do (ie. magical enemies should not have a physical attack). Please do not add any extra instance variables or methods to the UML. Ask questions about any methods you do not fully understand. This project will be expanded on for Project 2. C . Enemy Generator -ArrayList enemyList + EnemyGenerator + Enemy generate Enemy Enemy Entity String name int maxHp - int hp + Entity(Str n, int mHp) + abstract String attack(Entity e) + String getName + int getHPO + int getMaxHPO + void heal(int h) + void takeDamage(int d) + String toStringo 4 + Enemy(Str n, int mHp) MagicalEnemy + MagicalEnemy(Str n, int mhp) + String attack(Entity e) Hero Map

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions