UML CLASS DIAGRAM
This is a Design Exercise. You will need to make classes that could be used to stage a battle as described below.
You have been tasked to create a number of items that can be used in an online game. All items can be used on a game character who will have a name, a number of health-points and a bag to hold the items.
Here are examples of items that can be made:
Item | type of item | effectOnHealth | other info |
---|---|---|---|
Widow's Cloak | Armor | +15 | |
Gladiator's Shield | Armor | +8 | |
Rusty Knife | Weapon | -3 | |
Protection Spell | Spell | 1 | has magic words that can be read |
Note from Zelda | Letter | 0 | says "Beware of the Witch" |
Here are examples of characters that can be made:
name | health points |
---|---|
Godwin | 30 |
Marilyn | 40 |
All items can be added to any character's bag and also used on any character. (For instance the Rusty Knife could be used on a character to lower their health by 3 points.)
Armor and weapons can be equipped (worn) and removed. Spells can also be equipped (memorized) which casts a glow around the character and removed (forgotten) which removes the glow. In the future, any time a character equips or removes any item, their appearance will be altered. These methods -- for now -- can just have a body which says either "equipping" or "removing."
Both spells and letters have some text that could be read. Whenever a spell or letter is used, the text will also be read (displayed). However these items can be read independently from their use on a character.
Build these items using good interface and abstract class design as appropriate. Set the toString() method of the Character class to return a character's name and current health. You should have a good object oriented structure and good method signatures.
To illustrate this, in a driver class, two characters, Godwin and Marilyn are created. They begin by having items added to their bags (both Godwin and Marilyn get a copy of the Note from Zelda). Then the items they have are used on themselves or one another as follows:
This is a sample of how a Driver could work, staging a battle between the defensive Godwin and the offensive Marilyn.
- The Protection Spell is used on Godwin (by Godwin)
- The Rusty Knife is used on Godwin (by Marilyn)
- The Gladiator's Shield is used on Godwin (by Godwin)
- The Rusty Knife is used on Godwin (by Marilyn)
The Driver output could look something like this:
** Godwin and Marilyn add items to their bags.
Note from Zelda added to Godwin (30)
Note from Zelda added to Marilyn (40)
Protection Spell added to Godwin (30)
Widow's Cloak added to Marilyn (40)
Gladiator's Shield added to Godwin (30)
Rusty Knife added to Marilyn (40)
** Godwin and Marilyn battle
Protection Spell used on Godwin (31)
Reading Spell,'Goddess of the day and night, protect me with all
your might'
Rusty Knife used on Godwin (28)
Gladiator's Shield used on Godwin (36)
Rusty Knife used on Godwin (33)
You do not need to code a driver, but if there is time it might be a good way to check your design.
UML class diagram
For the above given scenerio there are 3 classes namely - Item,Driver and Character.Driver class is used as an interface which holds 4 methods or functions which are getCharacter_Health(),setCharacterHealth(),getitem() and getspelltext().
getCharacter_Health() - which displays current health status of the character.
setCharacterHealth() - which displays set health status when the items are used by the character(Godwin,Marilyn). The health status is updated with respect to effect on health of the character.
getitem() - String enum "@equipping" is used when equipping the item and "@removing" is used for removing the items from the character bag.
getspelltext() - Display spell text to the character when the type of the item - 'spell' or 'letter' is invoked by the character.
toString() - Display the output of each methods.
UML CLASS DIAGRAM This is a Design Exercise. You will need to make classes that could...
*IN PYTHON* A role-playing game or RPG is a game in which players assume the roles of characters in a fictional setting. The popularity of the epic saga told in J.R.R. Tolkien's The Hobbit and The Lord of The Rings greatly influenced the genre, as seen in the game Dungeons & Dragons and all of its subsequent variants. In most RPGs, a player creates a character of a specific archetype or class, such as "Fighter", "Wizard", or "Thief". (Note: do...
Recursion and Trees Application – Building a Word Index Make sure you have read and understood · lesson modules week 10 and 11 · chapters 9 and 10 of our text · module - Lab Homework Requirements before submitting this assignment. Hand in only one program, please. Background: In many applications, the composition of a collection of data items changes over time. Not only are new data items added and existing ones removed, but data items may be duplicated. A list data structure...
Need answers. thank you VOCABULARY BUILDER Misspelled Words Find the words below that are misspelled; circle them, and then correctly spell them in the spaces provided. Then fill in the blanks below with the correct vocabulary terms from the following list. amino acids digestion clectrolytes nutrients antioxident nutrition basal metabolic rate extracellulare oxydation calories fat-soluble presearvatives catalist glycogen processed foods cellulose homeostasis saturated fats major mineral coenzyeme trace minerals diaretics metabolism water-soluable 1. Artificial flavors, colors, and commonly added to...
Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...