Class: Gemwarrior::Shovel

Inherits:
Item show all
Defined in:
lib/gemwarrior/entities/items/shovel.rb

Constant Summary collapse

DIG_NOISE =

CONSTANTS

'*DIG*'

Instance Attribute Summary

Attributes inherited from Item

#is_armor, #is_weapon

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

Methods inherited from Item

#describe_detailed

Methods inherited from Entity

#puts

Constructor Details

#initializeShovel

Returns a new instance of Shovel.



11
12
13
14
15
16
17
# File 'lib/gemwarrior/entities/items/shovel.rb', line 11

def initialize
  super

  self.name         = 'shovel'
  self.name_display = 'Shovel'
  self.description  = 'You can really "dig" this tool, despite its well-worn appearance.'
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
58
59
60
# File 'lib/gemwarrior/entities/items/shovel.rb', line 19

def use(world)
  cur_location = world.location_by_coords(world.player.cur_coords)

  if cur_location.name.eql?('pain_quarry-west') and cur_location.contains_item?('locker_corner')
    puts 'You bolster yourself and then begin the tedious job of digging the locker out of its several-inch-deep prison of sand with your trusty shovel.'
    puts

    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)

    puts
    puts 'You drop the head of the shovel into the ground, lean on it for a moment, and wipe the sweat from your brow. This quarry is really causing you considerable pain.'
    STDIN.getc

    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)
    Animation.run(phrase: DIG_NOISE)

    puts
    puts 'After what feels like several hours, you finally unearth the locker from the ground, open it, and place it next to its previous location.'
    
    cur_location.add_item('locker')
    cur_location.remove_item('locker_corner')
    
    { type: 'dmg', data: rand(1..2) }
  else
    puts 'You grip the shovel by its handle and thrust it, head-first, into the sky. Huzzah!'

    { type: nil, data: nil }
  end
end