Submission 4: Inheritance
Objective: Introduce inheritance by creating subclasses from base classes.
Instructions:
Create Enemy Subclasses:
Goblin
Class:Inherits from
Enemy
.Additional Attributes:
int stealChance
Methods:
Override
attack(Player player)
to include a chance to steal an item.
Dragon
Class:Inherits from
Enemy
.Additional Attributes:
int fireBreathDamage
Methods:
Override
attack(Player player)
to include fire breath attack.
Create Item Subclasses:
Weapon
Class:Inherits from
Item
.Additional Attributes:
int durability
Methods:
void degrade()
Potion
Class:Inherits from
Item
.Additional Attributes:
int restoreAmount
Methods:
void consume(Player player)
Update Game Mechanics:
Integrate new enemy types and item types into the game.
Adjust combat and inventory systems to accommodate inheritance.
Deliverables:
Updated source code files.
Screenshot of Program running
COSC-1437 / ITSE-2457 Computer Science Dept. - Author: Dr. Kevin Roark