gemwarrior 0.14.8 → 0.15.0

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: 355463631c092fa850eb8cb355aec722181cc0e6
4
- data.tar.gz: 9a9b11452f91d22161501042856539e54401a71e
3
+ metadata.gz: 42b11f28fb910a20ab8c22ad7c97f67403c0ea9b
4
+ data.tar.gz: 884e88c0ee09cd7c34cd75b675c09d301750642a
5
5
  SHA512:
6
- metadata.gz: 69e8b6df32dd804eaf914cb564ff241dc07fa0a5106891f5c12678f95fac190ad9b3be64932a808e9dc614a9008606b0231c78eecf4b78d502f6915607e52af1
7
- data.tar.gz: 7b3f8272981305f36b9762050f5fc6ca742d8e7cff122c4e041d7b3e4ba214851a029e4aff3beb129ec8a9b56139374a5f71480088e9e2bc16d9cf71b9b585d3
6
+ metadata.gz: 59cc678e76ce6dbd0d88fcef353eeef743185f4d78fa27dde69a84b7bc7779b1fc50d35c4ab1a2cb3d0a43588c0b866460838459b6499a7620074cb076922e88
7
+ data.tar.gz: 94ef68e78d3e118385b91b26ee3ac71123546a6535b05fbe8baeb3a41b197e5977c10fd4a19c66aad557c2443d5a717fe2c4152343bc03c1618567ab9ea5905f
@@ -756,7 +756,20 @@ locations:
756
756
  begin: 5
757
757
  end: 6
758
758
  excl: false
759
- items: []
759
+ items:
760
+ - !ruby/object:Gemwarrior::RedKey
761
+ equipped: false
762
+ consumable: false
763
+ used: false
764
+ used_again: false
765
+ number_of_uses:
766
+ name: red_key
767
+ name_display: Red Key
768
+ description: Redder than an embarrassed tomato in front of a moderate fire, but still very capable of being a key.
769
+ takeable: true
770
+ talkable: false
771
+ useable: true
772
+ equippable: false
760
773
  monsters_abounding: []
761
774
  bosses_abounding: []
762
775
  checked_for_monsters: false
@@ -1067,17 +1080,17 @@ locations:
1067
1080
  end: 20
1068
1081
  excl: false
1069
1082
  items:
1070
- - !ruby/object:Gemwarrior::SandJewel
1083
+ - !ruby/object:Gemwarrior::LockerCorner
1071
1084
  equipped: false
1072
1085
  consumable: false
1073
1086
  used: false
1074
1087
  used_again: false
1075
1088
  number_of_uses:
1076
1089
  talkable: false
1077
- name: sand_jewel
1078
- name_display: Sand Jewel
1079
- description: As blue (or is it violet? or brown?) as it is brittle, this shiny rock feels warm to the touch.
1080
- takeable: true
1090
+ name: locker_corner
1091
+ name_display: Locker (Corner)
1092
+ description: The top corner of what appears to be a small locker is slightly sticking up from the sand floor.
1093
+ takeable: false
1081
1094
  useable: true
1082
1095
  equippable: false
1083
1096
  monsters_abounding: []
@@ -1660,6 +1673,19 @@ locations:
1660
1673
  takeable: false
1661
1674
  useable: true
1662
1675
  equippable: false
1676
+ - !ruby/object:Gemwarrior::Shovel
1677
+ equipped: false
1678
+ consumable: false
1679
+ used: false
1680
+ used_again: false
1681
+ number_of_uses:
1682
+ talkable: false
1683
+ name: shovel
1684
+ name_display: Shovel
1685
+ description: You can really "dig" this tool, despite its well-worn appearance.
1686
+ takeable: true
1687
+ useable: true
1688
+ equippable: false
1663
1689
  monsters_abounding: []
1664
1690
  bosses_abounding: []
1665
1691
  checked_for_monsters: false
@@ -45,11 +45,11 @@ module Gemwarrior
45
45
  'That does not appear to be useable.'
46
46
  end
47
47
 
48
- def describe
48
+ def describe(world)
49
49
  desc_text = "#{description}".colorize(:white)
50
50
  end
51
51
 
52
- def describe_detailed
52
+ def describe_detailed(world)
53
53
  desc_text = "\"#{name_display}\"\n".colorize(:yellow)
54
54
  desc_text << "(#{name})\n".colorize(:green)
55
55
  desc_text << "#{description}\n".colorize(:white)
@@ -21,7 +21,7 @@ module Gemwarrior
21
21
  'That item does not do anything...yet.'
22
22
  end
23
23
 
24
- def describe_detailed
24
+ def describe_detailed(world)
25
25
  desc_text = "\"#{name_display}\"\n".colorize(:yellow)
26
26
  desc_text << "(#{name})\n".colorize(:green)
27
27
  desc_text << "#{description}\n".colorize(:white)
@@ -0,0 +1,43 @@
1
+ # lib/gemwarrior/entities/items/locker.rb
2
+ # Entity::Item::Locker
3
+
4
+ require_relative '../item'
5
+
6
+ module Gemwarrior
7
+ class Locker < Item
8
+ attr_accessor :locked
9
+
10
+ def initialize
11
+ super
12
+
13
+ self.name = 'locker'
14
+ self.name_display = 'Locker'
15
+ self.description = 'A small, locked locker with a lock on it. You will need to unlock it to gain access to its insides.'
16
+ self.takeable = false
17
+ self.locked = true
18
+ end
19
+
20
+ def use(world)
21
+ cur_location = world.location_by_coords(world.player.cur_coords)
22
+ locker = cur_location.get_item_ref('locker')
23
+
24
+ if locker.locked
25
+ puts 'You pull on the lock, hoping it will unlock and leave the locker unlocked, but it is no good. You will need something else to unlock this locked locker.'
26
+
27
+ return { type: nil, data: nil }
28
+ else
29
+ if self.used
30
+ puts 'The locker is open and you can see a shiny gem inside.'
31
+
32
+ return { type: nil, data: nil }
33
+ else
34
+ self.used = true
35
+ puts 'You open the unlocked locker and look inside. Thereabouts, is a shiny gem of some sort.'
36
+ cur_location.add_item('sand_jewel')
37
+
38
+ return { type: nil, data: nil }
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,26 @@
1
+ # lib/gemwarrior/entities/items/locker_corner.rb
2
+ # Entity::Item::LockerCorner
3
+
4
+ require_relative '../item'
5
+
6
+ module Gemwarrior
7
+ class LockerCorner < Item
8
+ attr_accessor :locked
9
+
10
+ def initialize
11
+ super
12
+
13
+ self.name = 'locker_corner'
14
+ self.name_display = 'Locker (Corner)'
15
+ self.description = 'The top corner of what appears to be a small locker is slightly sticking up from the sand floor.'
16
+ self.takeable = false
17
+ self.useable = true
18
+ end
19
+
20
+ def use(world)
21
+ puts 'Pulling with all your might on the corner of the locker doesn\'t get it it budge one inch. Some other method is going to be needed.'
22
+
23
+ { type: nil, data: nil }
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,82 @@
1
+ # lib/gemwarrior/entities/items/red_key.rb
2
+ # Entity::Item::RedKey
3
+
4
+ require_relative '../item'
5
+
6
+ module Gemwarrior
7
+ class RedKey < Item
8
+ attr_accessor :locked
9
+
10
+ def initialize
11
+ super
12
+
13
+ self.name = 'red_key'
14
+ self.name_display = 'Red Key'
15
+ self.description = 'Redder than an embarrassed tomato in front of a moderate fire, but still very capable of being a key.'
16
+ end
17
+
18
+ def describe(world)
19
+ super
20
+
21
+ cur_location = world.location_by_coords(world.player.cur_coords)
22
+ if cur_location.name.eql?('pain_quarry-west')
23
+ return desc_text += ' The key "glows" quite intently.'.colorize(:red)
24
+ elsif cur_location.name.include?('pain_quarry')
25
+ return desc_text += ' The key "glows" almost so brightly you have to shield your eyes.'.colorize(:red)
26
+ else
27
+ return desc_text += ' The key lightly "glows".'.colorize(:red)
28
+ end
29
+ end
30
+
31
+ def describe_detailed(world)
32
+ desc_text = "\"#{name_display}\"\n".colorize(:yellow)
33
+ desc_text << "(#{name})\n".colorize(:green)
34
+ desc_text << "#{description}\n".colorize(:white)
35
+
36
+ cur_location = world.location_by_coords(world.player.cur_coords)
37
+ if cur_location.name.include?('pain_quarry')
38
+ desc_text += "The key O==> *glows* quite intently.\n".colorize(:red)
39
+ elsif cur_location.name.eql?('pain_quarry-west')
40
+ desc_text += "The key O==> *shines* almost so brightly you have to shield your eyes.\n".colorize(:red)
41
+ else
42
+ desc_text += "The key O==> lightly *shimmers*.\n".colorize(:red)
43
+ end
44
+
45
+ desc_text << "TAKEABLE? #{takeable}\n".colorize(:white)
46
+ desc_text << "USEABLE? #{useable}\n".colorize(:white)
47
+ desc_text << "TALKABLE? #{talkable}\n".colorize(:white)
48
+ desc_text << "CONSUMABLE? #{consumable}\n".colorize(:white)
49
+ desc_text << "EQUIPPABLE? #{equippable}\n".colorize(:white)
50
+ desc_text << "EQUIPPED? #{equipped}\n".colorize(:white)
51
+ desc_text << "USED? #{used}\n".colorize(:white)
52
+ desc_text << "USED AGAIN? #{used_again}\n".colorize(:white)
53
+ desc_text << "USES LEFT? #{number_of_uses}\n".colorize(:white) unless number_of_uses.nil?
54
+ desc_text
55
+ end
56
+
57
+ def use(world)
58
+ cur_location = world.location_by_coords(world.player.cur_coords)
59
+
60
+ if cur_location.contains_item?('locker')
61
+ locker = cur_location.get_item_ref('locker')
62
+ if locker.locked
63
+ puts 'You place the reddish key into the lock on the locker. Moments later, after a quick turn, the locked locker is no longer locked.'
64
+
65
+ locker.locked = false
66
+ locker.description = 'A small, unlocked locker with a lock on it. You have unlocked it with a reddish key you found.'
67
+ { type: nil, data: nil }
68
+ else
69
+ puts 'You place the reddish key into the lock on the locker. Moments later, after a quick turn, the locked locker is once again quite locked.'
70
+
71
+ locker.locked = true
72
+ locker.description = 'A small, locked locker with a lock on it. You will need to unlock it to gain access to its insides.'
73
+ { type: nil, data: nil }
74
+ end
75
+ else
76
+ puts 'You try to put the key into one of its natural habitats, but can\'t find anything suitable.'
77
+
78
+ { type: nil, data: nil }
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,62 @@
1
+ # lib/gemwarrior/entities/items/shovel.rb
2
+ # Entity::Item::Shovel
3
+
4
+ require_relative '../item'
5
+
6
+ module Gemwarrior
7
+ class Shovel < Item
8
+ # CONSTANTS
9
+ DIG_NOISE = '*DIG*'
10
+
11
+ def initialize
12
+ super
13
+
14
+ self.name = 'shovel'
15
+ self.name_display = 'Shovel'
16
+ self.description = 'You can really "dig" this tool, despite its well-worn appearance.'
17
+ end
18
+
19
+ def use(world)
20
+ cur_location = world.location_by_coords(world.player.cur_coords)
21
+
22
+ if cur_location.name.eql?('pain_quarry-west') and cur_location.contains_item?('locker_corner')
23
+ 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.'
24
+ puts
25
+
26
+ Animation.run(phrase: DIG_NOISE)
27
+ Animation.run(phrase: DIG_NOISE)
28
+ Animation.run(phrase: DIG_NOISE)
29
+ Animation.run(phrase: DIG_NOISE)
30
+ Animation.run(phrase: DIG_NOISE)
31
+ Animation.run(phrase: DIG_NOISE)
32
+ Animation.run(phrase: DIG_NOISE)
33
+ Animation.run(phrase: DIG_NOISE)
34
+
35
+ puts
36
+ 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.'
37
+ STDIN.getc
38
+
39
+ Animation.run(phrase: DIG_NOISE)
40
+ Animation.run(phrase: DIG_NOISE)
41
+ Animation.run(phrase: DIG_NOISE)
42
+ Animation.run(phrase: DIG_NOISE)
43
+ Animation.run(phrase: DIG_NOISE)
44
+ Animation.run(phrase: DIG_NOISE)
45
+ Animation.run(phrase: DIG_NOISE)
46
+ Animation.run(phrase: DIG_NOISE)
47
+
48
+ puts
49
+ 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.'
50
+
51
+ cur_location.add_item('locker')
52
+ cur_location.remove_item('locker_corner')
53
+
54
+ { type: 'dmg', data: rand(1..2) }
55
+ else
56
+ puts 'You grip the shovel by its handle and thrust it, head-first, into the sky. Huzzah!'
57
+
58
+ { type: nil, data: nil }
59
+ end
60
+ end
61
+ end
62
+ end
@@ -11,6 +11,7 @@ module Gemwarrior
11
11
  DANGER_LEVEL = { none: 0, low: 15, moderate: 30, high: 55, assured: 100 }
12
12
  ERROR_ITEM_ADD_INVALID = 'That item cannot be added to the location\'s inventory.'
13
13
  ERROR_ITEM_REMOVE_INVALID = 'That item cannot be removed as it does not exist here.'
14
+ ERROR_ITEM_REF_INVALID = 'That item cannot be accessed.'
14
15
  ERROR_SPAWN_NAME_INVALID = 'That monster does not exist in the game, and cannot be spawned.'
15
16
 
16
17
  attr_accessor :coords,
@@ -72,6 +73,17 @@ module Gemwarrior
72
73
  bosses_abounding.map{|b| b.name.downcase}.include?(boss_name.downcase)
73
74
  end
74
75
 
76
+ def get_item_ref(item_name)
77
+ all_items = GameItems.data | GameWeapons.data | GameArmor.data
78
+ all_items.each do |game_item|
79
+ if game_item.name.eql?(item_name)
80
+ item_ref = self.items.find{ |i| i.name.downcase == item_name.downcase }
81
+ return item_ref
82
+ end
83
+ end
84
+ return ERROR_ITEM_REF_INVALID
85
+ end
86
+
75
87
  def add_item(item_name_to_add)
76
88
  all_items = GameItems.data | GameWeapons.data | GameArmor.data
77
89
  all_items.each do |game_item|
@@ -80,7 +92,7 @@ module Gemwarrior
80
92
  return
81
93
  end
82
94
  end
83
- return LOCATION_INVENTORY_ADD_ITEM_INVALID
95
+ return ERROR_ITEM_ADD_INVALID
84
96
  end
85
97
 
86
98
  def remove_item(item_name)
@@ -286,7 +286,7 @@ module Gemwarrior
286
286
  self.hp_cur = self.hp_cur - dmg.to_i
287
287
 
288
288
  if hp_cur <= 0
289
- player_death
289
+ return player_death
290
290
  end
291
291
  end
292
292
 
@@ -362,7 +362,6 @@ module Gemwarrior
362
362
 
363
363
  def player_death
364
364
  puts 'Your actions have reduced you to death.'.colorize(:red)
365
- puts 'Somehow, however, your adventure does not end here. Instead, you are whisked back home via some magical force, a bit worse for the weary and somewhat poorer, but ALIVE!'.colorize(:yellow)
366
365
  return 'death'
367
366
  end
368
367
 
@@ -256,7 +256,7 @@ module Gemwarrior
256
256
  item_const_name = Gemwarrior.const_get(Formatting.upstyle(param2, no_space: true))
257
257
  item = item_const_name.new
258
258
  world.player.inventory.items.push(item)
259
- return "#{item.name} added to player inventory."
259
+ return "#{item.name.colorize(:yellow)} added to player inventory."
260
260
  rescue
261
261
  return ERROR_DEBUG_STAT_INV_PARAM_INVALID
262
262
  end
@@ -555,8 +555,11 @@ module Gemwarrior
555
555
  player_cur_location = world.location_by_coords(world.player.cur_coords)
556
556
  world.describe(player_cur_location)
557
557
  when 'dmg'
558
- world.player.take_damage(result[:data])
559
- return
558
+ result = world.player.take_damage(result[:data])
559
+
560
+ if result.eql?('death')
561
+ player_death_resurrection
562
+ end
560
563
  when 'rest', 'health'
561
564
  world.player.heal_damage(result[:data])
562
565
  return
@@ -132,14 +132,14 @@ module Gemwarrior
132
132
  battle_items
133
133
  end
134
134
 
135
- def describe_item(item_name)
135
+ def describe_item(item_name, world)
136
136
  if contains_item?(item_name)
137
137
  self.items.each do |i|
138
138
  if i.name.eql?(item_name)
139
139
  if GameOptions.data['debug_mode']
140
- return i.describe_detailed
140
+ return i.describe_detailed(world)
141
141
  else
142
- return i.describe
142
+ return i.describe(world)
143
143
  end
144
144
  end
145
145
  end
@@ -147,6 +147,9 @@ module Gemwarrior
147
147
  puts '* Basic functions: look, go, character, inventory, attack *'
148
148
  puts '* Type \'help\' while in-game for complete list of commands *'
149
149
  puts '* Most commands can be abbreviated to their first letter *'
150
+ puts '* Note: if something isn\'t working, try: *'
151
+ puts '* 1) starting a new game *'
152
+ puts '* 2) updating the game *'
150
153
  end
151
154
 
152
155
  def display_log_of_attempts
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.14.8'
5
+ VERSION = '0.15.0'
6
6
  end
@@ -70,9 +70,9 @@ module Gemwarrior
70
70
  point.items.each do |i|
71
71
  if i.name.downcase.eql?(entity_name)
72
72
  if GameOptions.data['debug_mode']
73
- return i.describe_detailed
73
+ return i.describe_detailed(self)
74
74
  else
75
- return i.describe
75
+ return i.describe(self)
76
76
  end
77
77
  end
78
78
  end
@@ -80,9 +80,9 @@ module Gemwarrior
80
80
  point.monsters_abounding.each do |m|
81
81
  if m.name.downcase.eql?(entity_name)
82
82
  if GameOptions.data['debug_mode']
83
- return m.describe_detailed
83
+ return m.describe_detailed(self)
84
84
  else
85
- return m.describe
85
+ return m.describe(self)
86
86
  end
87
87
  end
88
88
  end
@@ -90,14 +90,14 @@ module Gemwarrior
90
90
  point.bosses_abounding.each do |b|
91
91
  if b.name.downcase.eql?(entity_name)
92
92
  if GameOptions.data['debug_mode']
93
- return b.describe_detailed
93
+ return b.describe_detailed(self)
94
94
  else
95
- return b.describe
95
+ return b.describe(self)
96
96
  end
97
97
  end
98
98
  end
99
99
  elsif player.inventory.contains_item?(entity_name)
100
- player.inventory.describe_item(entity_name)
100
+ player.inventory.describe_item(entity_name, self)
101
101
  else
102
102
  ERROR_DESCRIBE_ENTITY_INVALID
103
103
  end
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.14.8
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick
@@ -272,12 +272,16 @@ files:
272
272
  - lib/gemwarrior/entities/items/keystone.rb
273
273
  - lib/gemwarrior/entities/items/ladder.rb
274
274
  - lib/gemwarrior/entities/items/letter.rb
275
+ - lib/gemwarrior/entities/items/locker.rb
276
+ - lib/gemwarrior/entities/items/locker_corner.rb
275
277
  - lib/gemwarrior/entities/items/map.rb
276
278
  - lib/gemwarrior/entities/items/massive_door.rb
277
279
  - lib/gemwarrior/entities/items/pedestal.rb
278
280
  - lib/gemwarrior/entities/items/pond.rb
281
+ - lib/gemwarrior/entities/items/red_key.rb
279
282
  - lib/gemwarrior/entities/items/rope.rb
280
283
  - lib/gemwarrior/entities/items/sand_jewel.rb
284
+ - lib/gemwarrior/entities/items/shovel.rb
281
285
  - lib/gemwarrior/entities/items/small_hole.rb
282
286
  - lib/gemwarrior/entities/items/snowman.rb
283
287
  - lib/gemwarrior/entities/items/sparkly_thing.rb