gemwarrior 0.8.7 → 0.8.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d62c41e85fe6c1517f33d1254e5110ef0f7865a
4
- data.tar.gz: 61ba0897384b10410d1047636330f5ab4d228a58
3
+ metadata.gz: fa82fbc6782413cc8ed1c240c0ba60fb29a36d35
4
+ data.tar.gz: 796d5835605a51733e5afe922eae97e188a2c211
5
5
  SHA512:
6
- metadata.gz: 65e8374beb7b7ea6122d5e84edcd16cba935beb3a9bb93c9fe1b688a09233040b1832363e87e919a43616224eea4963155a1603a3974260dd5166d0919e6d886
7
- data.tar.gz: 54d4f5e2fbbc7e966ff139f602686f594dbf0a50ea259dc01aeab584d6570d8062f7d57eb974bf00975b961a6a582a1e7e920fce1fea16e0d10509a9bd6d77e5
6
+ metadata.gz: 9c0126cfa23604ce2197888921bd0f3fbd7d93042d738782314ac3a3bafd0f91496d67adc77aa4f7bac6c1f259d8622d09ac26afb4ffd6d5ca71798a430f1308
7
+ data.tar.gz: 6a4c98268a64db8c57a8f90d6312eaae5ca551a164366a6102e02a5776bbb6777ca745676d520cacbea2df847d85fcb2f754ba0c3bf75278f304dcaf10b797ce
data/data/locations.yml CHANGED
@@ -225,6 +225,25 @@
225
225
  lo: 3
226
226
  hi: 4
227
227
 
228
+ -
229
+ name: 'Tunnel Alcove'
230
+ description: 'A moderately-sized alcove seems to have been blown out of the side of tunnel here, almost as if an actual bomb detonated, the remainder of the wall a mix of rock and wires.'
231
+ danger_level: :moderate
232
+ coords:
233
+ x: 4
234
+ y: 5
235
+ z: -1
236
+ locs_connected:
237
+ north: false
238
+ east: true
239
+ south: false
240
+ west: false
241
+ monster_level_range:
242
+ lo: 3
243
+ hi: 4
244
+ items:
245
+ - SmallHole
246
+
228
247
  -
229
248
  name: 'Metal Tunnel'
230
249
  description: 'The walls of this underground tunnel shine, as if some otherworldly light source emanates directly from them. It is cold and narrow and you are not sure you are a huge fan of it.'
@@ -11,7 +11,8 @@ module Gemwarrior
11
11
  :useable,
12
12
  :equippable,
13
13
  :equipped,
14
- :use
14
+ :use,
15
+ :reuse
15
16
 
16
17
  def use(inventory = nil)
17
18
  'That item does not do anything...yet.'
@@ -0,0 +1,19 @@
1
+ # lib/gemwarrior/entities/items/dagger.rb
2
+ # Item::Dagger
3
+
4
+ require_relative '../item'
5
+
6
+ module Gemwarrior
7
+ class Dagger < Item
8
+ def initialize
9
+ self.name = 'dagger'
10
+ self.description = 'Flint that has been sharpened to a point, attached to a block of smooth granite by thin rope. Truly a work of art.'
11
+ self.atk_lo = 2
12
+ self.atk_hi = 4
13
+ self.takeable = true
14
+ self.useable = false
15
+ self.equippable = true
16
+ self.equipped = false
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,87 @@
1
+ # lib/gemwarrior/entities/items/small_hole.rb
2
+ # Item::SmallHole
3
+
4
+ require_relative '../item'
5
+ require_relative 'herb'
6
+ require_relative 'dagger'
7
+
8
+ module Gemwarrior
9
+ PLAYER_ROX_INSUFFICIENT = 'You do not have enough rox to purchase that item.'
10
+
11
+ class SmallHole < Item
12
+ def initialize
13
+ self.name = 'small_hole'
14
+ self.description = 'Amongst the rubble of the alcove, a small hole, barely big enough for a rodent, exists in an absently-minded way near the bottom of the wall.'
15
+ self.atk_lo = nil
16
+ self.atk_hi = nil
17
+ self.takeable = false
18
+ self.useable = true
19
+ self.equippable = false
20
+ self.equipped = false
21
+ end
22
+
23
+ def use(player = nil)
24
+ puts 'You lower yourself to the ground and attempt to peer in the hole in the wall. Just as you begin to think this is a fruitless endeavor, a pair of bright, beady eyes manifest, and an unexpectedly low voice begins speaking to you:'
25
+
26
+ rat_shop(player)
27
+ end
28
+
29
+ def reuse(player = nil)
30
+ rat_shop(player)
31
+ end
32
+
33
+ def rat_shop(player)
34
+ items_purchased = []
35
+
36
+ puts '>>"Hello, wanderer. Welcome to my establishment, as it were. Are you in need of anything?"'
37
+ puts
38
+ puts 'The creature gently shoves a small slip of paper out of his hole and towards you. You take a peek and notice it has a list of things with prices on it.'
39
+ puts
40
+ puts 'Rodney\'s Hole in the Wall'
41
+ puts '--------------------------'
42
+ puts '(1) Herb - 10 rox'
43
+ puts '(2) Dagger - 150 rox'
44
+ puts
45
+ puts '>>"What are you in need of?"'
46
+
47
+ loop do
48
+ puts " 1 - Herb"
49
+ puts " 2 - Dagger"
50
+ puts " x - leave"
51
+
52
+ choice = gets.chomp!
53
+
54
+ case choice
55
+ when '1'
56
+ if player.rox >= 10
57
+ player.rox -= 10
58
+ items_purchased.push(Herb.new)
59
+ puts '>>"Excellent choice."'
60
+ puts '>>"Anything else?"'
61
+ next
62
+ else
63
+ puts PLAYER_ROX_INSUFFICIENT
64
+ next
65
+ end
66
+ when '2'
67
+ if player.rox >= 150
68
+ player.rox -= 150
69
+ items_purchased.push(Dagger.new)
70
+ puts '>>"A fine blade, indeed."'
71
+ puts '>>"Anything else?"'
72
+ next
73
+ else
74
+ puts PLAYER_ROX_INSUFFICIENT
75
+ next
76
+ end
77
+ when 'x'
78
+ puts '>>"If you need anything further, I\'m always in this hole..."'
79
+ return {:type => 'purchase', :data => items_purchased}
80
+ else
81
+ puts '>>"Huh?"'
82
+ next
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -120,7 +120,7 @@ module Gemwarrior
120
120
  return world.list(param1, param2)
121
121
  end
122
122
  when 'map', 'm'
123
- world.print_map
123
+ world.print_map(param1)
124
124
  when 'stat', 'st', 's'
125
125
  if param1.nil?
126
126
  puts ERROR_DEBUG_STAT_PARAM_MISSING
@@ -316,10 +316,13 @@ module Gemwarrior
316
316
  when 'arena'
317
317
  arena = Arena.new({:world => world, :player => world.player})
318
318
  arena.start
319
- #return 'You enter the arena and fight some battles. It was cool, but not as cool as if it were actually implemented.'
320
319
  when 'item'
321
320
  world.location_by_coords(world.player.cur_coords).add_item(result[:data])
322
321
  return
322
+ when 'purchase'
323
+ result[:data].each do |i|
324
+ world.player.inventory.items.push(i)
325
+ end
323
326
  else
324
327
  return
325
328
  end
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = "0.8.7"
5
+ VERSION = "0.8.8"
6
6
  end
@@ -35,7 +35,7 @@ module Gemwarrior
35
35
  puts "#{list("locations", true)}\n"
36
36
  end
37
37
 
38
- def print_map
38
+ def print_map(floor)
39
39
  0.upto(WORLD_DIM_HEIGHT-1) do |count_y|
40
40
  print ' '
41
41
  0.upto(WORLD_DIM_WIDTH-1) do
@@ -44,7 +44,11 @@ module Gemwarrior
44
44
  print "\n"
45
45
  print "#{(WORLD_DIM_HEIGHT-1) - count_y} "
46
46
  0.upto(WORLD_DIM_WIDTH-1) do |count_x|
47
- cur_map_coords = {:x => count_x, :y => (WORLD_DIM_HEIGHT-1) - count_y, :z => self.player.cur_coords[:z]}
47
+ cur_map_coords = {
48
+ :x => count_x,
49
+ :y => (WORLD_DIM_HEIGHT-1) - count_y,
50
+ :z => floor.nil? ? self.player.cur_coords[:z] : floor.to_i
51
+ }
48
52
  if self.player.cur_coords.eql?(cur_map_coords)
49
53
  print '|O|'
50
54
  elsif location_by_coords(cur_map_coords)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemwarrior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.8.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick
@@ -214,6 +214,7 @@ files:
214
214
  - lib/gemwarrior/entities/items/bed.rb
215
215
  - lib/gemwarrior/entities/items/couch.rb
216
216
  - lib/gemwarrior/entities/items/cup.rb
217
+ - lib/gemwarrior/entities/items/dagger.rb
217
218
  - lib/gemwarrior/entities/items/dehumidifier.rb
218
219
  - lib/gemwarrior/entities/items/feather.rb
219
220
  - lib/gemwarrior/entities/items/floor_tile.rb
@@ -227,6 +228,7 @@ files:
227
228
  - lib/gemwarrior/entities/items/opalaser.rb
228
229
  - lib/gemwarrior/entities/items/pond.rb
229
230
  - lib/gemwarrior/entities/items/rope.rb
231
+ - lib/gemwarrior/entities/items/small_hole.rb
230
232
  - lib/gemwarrior/entities/items/snowman.rb
231
233
  - lib/gemwarrior/entities/items/sparklything.rb
232
234
  - lib/gemwarrior/entities/items/stalactite.rb