Class: Gemwarrior::Pedestal
- Defined in:
- lib/gemwarrior/entities/items/pedestal.rb
Constant Summary collapse
- USE_TEXT =
CONSTANTS
'** WHOOOOOSH **'
Instance Attribute Summary collapse
-
#switches ⇒ Object
Returns the value of attribute switches.
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
- #init_switches ⇒ Object
-
#initialize ⇒ Pedestal
constructor
A new instance of Pedestal.
- #use(world) ⇒ Object
Methods inherited from Item
Methods inherited from Entity
Constructor Details
#initialize ⇒ Pedestal
Returns a new instance of Pedestal.
13 14 15 16 17 18 19 20 |
# File 'lib/gemwarrior/entities/items/pedestal.rb', line 13 def initialize super self.name = 'pedestal' self.name_display = 'Pedestal' self.description = 'A pedestal about 4 feet in height rises up from the ground, with six switches arranged vertically above a large gem affixed to the top. The switches each have a word next to them in some language that looks familiar yet strange. Each letter is made of some kind of ink crudely splashed on stone, and each can be moved to arrange them in a different fashion than they are now. The large gem glitters with utter brilliance.' self.switches = init_switches end |
Instance Attribute Details
#switches ⇒ Object
Returns the value of attribute switches.
11 12 13 |
# File 'lib/gemwarrior/entities/items/pedestal.rb', line 11 def switches @switches end |
Instance Method Details
#init_switches ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gemwarrior/entities/items/pedestal.rb', line 22 def init_switches self.switches = [ ['iolita', jumble('iolita'), nil], ['rockney', jumble('rockney'), nil], ['emerald', jumble('emerald'), nil], ['ruby', jumble('ruby'), nil], ['amberoo', jumble('amberoo'), nil], ['alexandrat', jumble('alexandrat'), nil] ] self.switches = self.switches.sort_by { rand } end |
#use(world) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/gemwarrior/entities/items/pedestal.rb', line 35 def use(world) puts 'You look at the pedestal and its switches. The raised gem beckons you to push it and, deductively, you believe that pressing it will do something. However, those switches probably have something to do with the result.' loop do print_switches(self.switches) puts puts 'You can rearrange the letters in the words themselves, and you can push the large gem. What do you do?' puts puts '>> 1 Rearrange the letters in switch 1\'s word' puts '>> 2 Rearrange the letters in switch 2\'s word' puts '>> 3 Rearrange the letters in switch 3\'s word' puts '>> 4 Rearrange the letters in switch 4\'s word' puts '>> 5 Rearrange the letters in switch 5\'s word' puts '>> 6 Rearrange the letters in switch 6\'s word' puts '>> 7 Push the large gem into the pedestal' puts '>> 8 Stop this nonsense' puts print '> ' choice = gets.chomp! case choice when '1' switch1 = switches[0][2].nil? ? switches[0][1] : switches[0][2] puts "Switch 1: #{switch1}" puts 'What should the switch\'s word be set to?' switches[0][2] = get_new_word(switch1) when '2' switch2 = switches[1][2].nil? ? switches[1][1] : switches[1][2] puts "Switch 2: #{switch2}" puts 'What should the switch\'s word be set to?' switches[1][2] = get_new_word(switch2) when '3' switch3 = switches[2][2].nil? ? switches[2][1] : switches[2][2] puts "Switch 3: #{switch3}" puts 'What should the switch\'s word be set to?' switches[2][2] = get_new_word(switch3) when '4' switch4 = switches[3][2].nil? ? switches[3][1] : switches[3][2] puts "Switch 4: #{switch4}" puts 'What should the switch\'s word be set to?' switches[3][2] = get_new_word(switch4) when '5' switch5 = switches[4][2].nil? ? switches[4][1] : switches[4][2] puts "Switch 5: #{switch5}" puts 'What should the switch\'s word be set to?' switches[4][2] = get_new_word(switch5) when '6' switch6 = switches[5][2].nil? ? switches[5][1] : switches[5][2] puts "Switch 6: #{switch6}" puts 'What should the switch\'s word be set to?' switches[5][2] = get_new_word(switch6) when '7' pedestal_configured = true for i in 0..switches.length-1 do pedestal_configured = false unless switches[i][0].downcase.eql? switches[i][2].downcase end if pedestal_configured Audio.play_synth(:uncover_secret) puts 'You push the large gem into the pedestal and it descends without a hitch, almost as if it were meant to be. The pedestal begins to violently shake and a strong gust of wind picks you up off the ground. You feel completely taken aback and unsettled, but you have no choice: you are being whisked away somewhere into the sky, destination unknown.'.colorize(:yellow) # stats world.player.movements_made += 1 Animation.run(phrase: USE_TEXT) return { type: 'move', data: 'Sky Tower (Entryway)' } else puts 'You attempt to push the large gem, but it puts up quite the resistance, and nothing much else happens. Your attention once again returns to the pedestal and its switches.'.colorize(:red) end when '8' puts 'You step away from the mysterious pedestal.' return { type: nil, data: nil } else next end end end |