Class: Hamlet1
- Inherits:
-
Object
- Object
- Hamlet1
- Defined in:
- lib/hamlet.rb
Instance Attribute Summary collapse
-
#fightchance ⇒ Object
Returns the value of attribute fightchance.
-
#locations ⇒ Object
Returns the value of attribute locations.
-
#monsters ⇒ Object
Returns the value of attribute monsters.
-
#name ⇒ Object
Returns the value of attribute name.
-
#visit ⇒ Object
Returns the value of attribute visit.
Instance Method Summary collapse
-
#initialize(name = 'Deserted Hamlet', locations = {'house' => Abnd_house , 'tavern' => Abnd_tavern }, visit = 1, fightchance = 6, monsters = 0) ⇒ Hamlet1
constructor
A new instance of Hamlet1.
- #look ⇒ Object
Constructor Details
#initialize(name = 'Deserted Hamlet', locations = {'house' => Abnd_house , 'tavern' => Abnd_tavern }, visit = 1, fightchance = 6, monsters = 0) ⇒ Hamlet1
Returns a new instance of Hamlet1.
7 8 9 10 11 12 13 |
# File 'lib/hamlet.rb', line 7 def initialize(name = 'Deserted Hamlet', locations = {'house' => Abnd_house , 'tavern' => Abnd_tavern }, visit = 1, fightchance = 6, monsters = 0) @name = name @locations = locations @visit = visit @fightchance = fightchance @monsters = monsters end |
Instance Attribute Details
#fightchance ⇒ Object
Returns the value of attribute fightchance.
5 6 7 |
# File 'lib/hamlet.rb', line 5 def fightchance @fightchance end |
#locations ⇒ Object
Returns the value of attribute locations.
5 6 7 |
# File 'lib/hamlet.rb', line 5 def locations @locations end |
#monsters ⇒ Object
Returns the value of attribute monsters.
5 6 7 |
# File 'lib/hamlet.rb', line 5 def monsters @monsters end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/hamlet.rb', line 5 def name @name end |
#visit ⇒ Object
Returns the value of attribute visit.
5 6 7 |
# File 'lib/hamlet.rb', line 5 def visit @visit end |
Instance Method Details
#look ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/hamlet.rb', line 15 def look puts 'You see the remains of several buildings, many of which have collapsed due' puts 'from the weight of time and neglect. Only two buildings are left standing' puts 'and intact. The closest one looks to have been a tavern of sorts, judging' puts 'by the sign that has, surpisingly, survived. The other, you assume, was a' puts 'house. (Move: tavern, house)' puts '' end |