Class: Gemwarrior::Bookcase
- Defined in:
- lib/gemwarrior/entities/items/bookcase.rb
Constant Summary collapse
- OPEN_TEXT =
CONSTANTS
'** BRRRRRNNNGG **'
Instance Attribute Summary
Attributes inherited from Item
Attributes inherited from Entity
#consumable, #describe, #describe_detailed, #description, #display_shopping_cart, #equippable, #equipped, #name, #name_display, #number_of_uses, #takeable, #talkable, #useable, #useable_battle, #used, #used_again
Instance Method Summary collapse
-
#initialize ⇒ Bookcase
constructor
A new instance of Bookcase.
- #use(world) ⇒ Object
Methods inherited from Item
Methods inherited from Entity
Constructor Details
#initialize ⇒ Bookcase
Returns a new instance of Bookcase.
11 12 13 14 15 16 17 |
# File 'lib/gemwarrior/entities/items/bookcase.rb', line 11 def initialize super self.name = 'bookcase' self.name_display = 'Bookcase' self.description = 'This oaken monstrosity has six shelves, each about 3 feet high. Mathing, you determine it to be "huge", featuring many books within it.' end |
Instance Method Details
#use(world) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/gemwarrior/entities/items/bookcase.rb', line 19 def use(world) forest_southwest = world.location_by_name('forest-southwest') if forest_southwest.paths[:west].eql? false if !self.used puts 'Many books look interesting, including one specific volume entitled "Use Me Again to Attempt Unlocking the Way", by Not Very Subtle.' puts self.used = true else puts 'You pull out the tome entitled "Use Me Again to Attempt Unlocking the Way".' STDIN.getc puts 'Opening the book, you see a question on the inside cover:' puts '>> "What do you get when an underground excavator is named after a famous "weird" guy?"' print '? ' answer = gets.chomp.downcase case answer when 'mineral' Audio.play_synth(:uncover_secret) forest_southwest.paths[:west] = true puts Animation.run(phrase: OPEN_TEXT) puts puts 'After you shout out your answer to the book\'s question to no one in particular, you manage to see a clearing in the forest to the west that was presumably not there before. Huh.' STDIN.getc puts 'Before getting back to your travels, however, you notice the book\'s back cover warns: "The path westward is a difficult one and has "ended" many an adventurer. Take care before venturing forth."' else puts 'For some reason, you blurt out an answer to the unhearing trees, feel embarrassed, and put the book back in the bookcase.' end end { type: nil, data: nil } else puts 'You pull out a book here and there, glancing at their weathered pages and scuffed bindings. Nothing really interests you and it is back to staring at the forest.' end { type: nil, data: nil } end |