The game is made up of five units. Four friendly units (Warrior, Rogue, Archer and Mage)
and one enemy unit (Ogre). Each unit must be able to Display(), Attack() and Defend(). You
must ensure that the attack behavior and a defend behavior are set dynamically and that
they are interchangeable. The following guidelines on the units are given to be used at
instantiation time:
• Ogre: ClubAttack, NoDefend
• Warrior: SwordAttack, ShieldDefend
• Rogue: DaggerAttack, ShieldDefend
• Archer: ArrowAttack, NoDefend
• Mage: Adapt the given code (next page) to work with project:
public class Mage
{
public object fireball()
{
return"CAST A FIREBALL"
}
public object orb
{
return "Cast orb protection"
}
}
Equipment
The units should have the functionality to be dynamically decorated with equipment and
allow for unlimited additions. For this simulation the Warrior should get three “Golden
Rings” and the Mage one “Topaz Amulet”. Have a single “Golden Ring” removed from the
Warrior whenever the “Remove Ring from Warrior” button is clicked until the Warrior has no
more rings outfitted.
Note: Display a MessageBox if there is no ring left to beremoved.
Upgrades
The units should have the functionality to be dynamically decorated with upgrades to both
their base weapon class and base armor class. Use +10 for each armor upgrade and +1 for
each weapon upgrade. The upgrades should be unlimited. You do not need to upgrade the
base armor or base weapon class of the Mage.
Bonus Marks: Include the functionality to upgrade the Ogre’s armor class and weapon
class.
Weapons Messages
The Weapons textbox must display the damage information for each unit. This value must
be accumulative taking into account the base damageand all weapon upgrades.
• Ogre base damage is 20
• Warrior base damage is 10
• Archer base damage is 9
• Rogue base damage is 8
• Mage base damage is 15
NOTE: The damage value should be displayed for each unit’s behavioural attack as
indicated on Figure 1.
Bonus marks. Give units the functionality to be decorated with aweapon and allow the units
to use that weapon for the attack. For example decorate the “Warrior” with “Excalibur”
resulting in the following output: Warrior : Attack with Excalibur. [21].
Armor Messages:
The Armor textbox must display the armor information for each unit. This value must be
accumulative taking into account the base armor class and all armor upgrades.
• Ogre base armor is 0
• Warrior base armor is 0
• Archer base armor is 0
• Rogue base armor is 0
• Mage base armor is 0
NOTE: The armor value should be displayed each unit’s behavioral defense as indicated on
Hit points
Each unit must have hit points which will be adjusted according to the damage inflicted upon
it by the Ogre. Starting hit points;
• Ogre starts with 1000 hit points
• Warrior starts with 250 hit points
• Archers starts with 100 hit points
• Rogues starts with 100 hit points
• Mages starts with 100 hit points
Combat
Combat can be divided into three section: the party, units combatting with the ogre and ogre
combatting the units.
The Party
The four friendly units must belong to the party tobe able to engage in combat. Ensure they
are assigned to the party when the simulation starts. When a party member flees or dies, the
unit is no longer a member of the party and will disengage from combat. You can then
remove it from the party list. Make sure you updatethe Party Members textbox (see below)
to reflect any changes to the party. Also in brackets [] indicate the current hit points of each
unit.
Ogre Combatting the Units
When the “Ogre Deal Damage” button is clicked, the Ogre will attack all the party members
(listed in Party Members). The Ogre must be able to dynamically change his weapon to
either a Club or Sword. Also, the attacks of the Ogre must be modified according to the unit’s
armor upgrades. Use the following formula:
formula = ogreDamage - (unit.Armor() / 10);
Update the (Feedback Round x) and (Party Member) textboxes each time you click “Ogre
Deal Damage”. An example is provided. The attacks of the Ogre should be listed under
(Feedback Round x) and the members and their respective hit points in [] under (Party
Members).
Party Combating the Ogre
When the “Combat” button is clicked, the units in the party will attack the Ogre and inflict
physical damage to it. The attacks of each unit must take into account all weapon upgrades
made to it.
Update the (Feedback Round x) textbox for each timeyou click “Combat”. An example is
provided.
Leader
Make use of a delegateto assign the warrior unit as the leader of the group. Each time you
click on “Combat” he must display the message “Charge!”. If the warrior dies, or flees,
deregister the warrior as a delegate and indicate on the screen the party is leaderless.
Sorting
Please Note: You must sort all the textboxes on the simulationinterface alphabetically.