Skip to content

WDI-HK-7/ruby_assessment_objects

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

General Assembly Logo

Ruby Objects Assessment

Medieval Objects

We are going to model a game that is set in Medieval Times. Along the way we are going to create:

Person

A Person class that is the "root" of the class hierarchy

  • Attributes
    • first_name
    • last_name
    • full_name

Player

A Player class that is a subclass of the Person class.

  • Attributes
    • health, defaults to 20
    • strength, defaults to 5
    • alive, default is true. A player will be dead if there health reaches zero
  • Methods
    • take_damage(attack_strength): subtract the attack_strength from the recievers health.
    • attack(player): call the player's take_damage method passing the attackers strength as an argument.

Knight

A Knight will be a subclass of the Player class.

  • It's default health will be 50
  • It's default strength will be 7

Wizard

A Wizard will be a subclass of the Player class.

  • It's default health will be 20
  • It's default strength will be 75

Instructions

  • Fork and clone this repo, change into the ruby_assessment_objects directory.
  • Run bundle install
  • Create a game program (in lib/asessment.rb) that will model a battle/fight between players, knights and wizards. Don't need user input, unless you feel you want to.
  • On Github, initiate a Pull Request to turn in your assessment

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%