gemwarrior 0.7.8 → 0.7.9

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: e8acc1c9ce2018d794446c702f93efb774610129
4
- data.tar.gz: 51f0de0a987f87a73a2bc14ab8ab284aedcd8a30
3
+ metadata.gz: 12fc722dae2f01988303b53b5e3a1c27f0a22487
4
+ data.tar.gz: 502c5204a3625853f80b74f6e1951c767cda4c62
5
5
  SHA512:
6
- metadata.gz: bad25daf8fff7a7c32ca98991183d4f4b7f0fb4b170dbcdd3d5eb59edf1640728edb7a3537ed25986d08c84a76555456b334ba36a4b1b0839b3d45b2d15fa2c5
7
- data.tar.gz: d74d03c9e9941c7061ca5ac720c9700adc1fbe8672b79cffdeb7fa4995f77687a07b356eed65ba89767565632539b989cb43175d3df059fa397fdd2693086bdb
6
+ metadata.gz: f412d1d8c8e8ce60b653e35a858f12b177f756b4aac6cade2c9364b125b2745907118dd0264844166350132782ab75b24125283d1a94050e6e9e73e7ade17338
7
+ data.tar.gz: 9cb728e2d038b00a55162fba7eb1689e5bad4e63dccd9a6fe8f33576e0588449e863d565e2a9fe15bec48e7fba104eb3e950ff8b9203b4b65360b8489b15968e
data/bin/gemwarrior CHANGED
File without changes
data/data/locations.yml CHANGED
@@ -690,7 +690,7 @@
690
690
 
691
691
  -
692
692
  name: 'Plains (South of River)'
693
- description: 'A raging river borders the northern side of this bucolic vista.'
693
+ description: 'A raging river borders the northern side of this bucolic vista. Much raucous noise comes from the east.'
694
694
  danger_level: :low
695
695
  coords:
696
696
  x: 5
@@ -698,13 +698,65 @@
698
698
  z: 0
699
699
  locs_connected:
700
700
  north: false
701
- east: false
701
+ east: true
702
702
  south: true
703
703
  west: true
704
704
  monster_level_range:
705
705
  lo: 2
706
706
  hi: 3
707
-
707
+
708
+ -
709
+ name: 'Plains (South-Southeast)'
710
+ description: 'The river continues to flow north of you, as plains stretch out all around. The noise from the east is quite loud, and a building can be seen in the near distance.'
711
+ danger_level: :low
712
+ coords:
713
+ x: 6
714
+ y: 3
715
+ z: 0
716
+ locs_connected:
717
+ north: false
718
+ east: true
719
+ south: false
720
+ west: true
721
+ monster_level_range:
722
+ lo: 2
723
+ hi: 3
724
+
725
+ -
726
+ name: 'Plains (Arena Entrance)'
727
+ description: 'Well above the noise of the raging river nearby, the din of the mighty Arena reaches its near fever-pitch just outside. The door, and battle, beckons.'
728
+ danger_level: :low
729
+ coords:
730
+ x: 7
731
+ y: 3
732
+ z: 0
733
+ locs_connected:
734
+ north: false
735
+ east: true
736
+ south: false
737
+ west: true
738
+ monster_level_range:
739
+ lo: 2
740
+ hi: 3
741
+ items:
742
+ - ArenaDoor
743
+
744
+ -
745
+ name: 'Arena'
746
+ description: 'Dangerous and risky, the Arena allows would-be monster-slayers and adventurers fight against an infinite number of beasts in order to test their mettle and improve their skill...for a small fee, of course.'
747
+ danger_level: :none
748
+ coords:
749
+ x: 8
750
+ y: 3
751
+ z: 0
752
+ locs_connected:
753
+ north: false
754
+ east: false
755
+ south: false
756
+ west: true
757
+ items:
758
+ - ArenaMaster
759
+
708
760
  -
709
761
  name: 'Plains (South of Bridge)'
710
762
  description: 'To the north of these fields lies a bridge that may be crossable.'
@@ -0,0 +1,19 @@
1
+ # lib/gemwarrior/entities/items/arena_door.rb
2
+ # Item::ArenaDoor
3
+
4
+ require_relative '../item'
5
+
6
+ module Gemwarrior
7
+ class ArenaDoor < Item
8
+ def initialize
9
+ self.name = 'arena_door'
10
+ self.description = 'The Arena is massive, with its numerous columns and stone walls stretching to the sky, but its entrance door is no slouch, keeping apace. Made of reinforced granite and impossible to break down, it nevertheless opens for you while battles are in session.'
11
+ self.atk_lo = nil
12
+ self.atk_hi = nil
13
+ self.takeable = false
14
+ self.useable = false
15
+ self.equippable = false
16
+ self.equipped = false
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,48 @@
1
+ # lib/gemwarrior/entities/items/arena_master.rb
2
+ # Item::ArenaMaster
3
+
4
+ require_relative '../item'
5
+
6
+ module Gemwarrior
7
+ class ArenaMaster < Item
8
+ # CONSTANTS
9
+ ARENA_FEE = 50
10
+
11
+ def initialize
12
+ self.name = 'arena_master'
13
+ self.description = 'She wears simple clothing, but carries herself with an air of authority. You think she may be the person to talk with if you want to engage in battle.'
14
+ self.atk_lo = nil
15
+ self.atk_hi = nil
16
+ self.takeable = false
17
+ self.useable = true
18
+ self.equippable = false
19
+ self.equipped = false
20
+ end
21
+
22
+ def use(player = nil)
23
+ puts 'You approach the Arena Master and ask to fight. She snickers to herself, but sees you have a good spirit about you.'
24
+ puts
25
+
26
+ if player.rox >= 50
27
+ puts "She asks for the requisite payment: #{ARENA_FEE} rox. Do you pay up? (Y/N)"
28
+ answer = gets.chomp.downcase
29
+ case answer
30
+ when 'y', 'yes'
31
+ puts 'She pockets the money and motions toward the center of the arena. She reminds you that you will be facing an ever-worsening onslaught of monsters. Each one you dispatch nets you a bonus cache of rox in addition to whatever the monster gives you. You will also become more experienced the longer you last. Finally, you can give up at any time between battles.'
32
+ puts
33
+ puts 'She finishes by wishing you good luck!'
34
+
35
+ return {:type => 'arena', :data => nil}
36
+ else
37
+ puts 'She gives you a dirty look, as you have obviously wasted her time. You are told not to mess around with her anymore, and she turns away from you.'
38
+ puts
39
+ return {:type => nil, :data => nil}
40
+ end
41
+ else
42
+ puts 'She can tell you seem particularly poor today and says to come back when that has changed.'
43
+ puts
44
+ return {:type => nil, :data => nil}
45
+ end
46
+ end
47
+ end
48
+ end
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  Animation::run({:phrase => '** ZZZZZ **'})
21
21
  puts 'You unmake the bed, get under the covers, close your eyes, and begin to think about all the things you need to do today. You realize sleep is not one of them and quickly get back up, remake the bed, and get on about your day.'
22
22
  puts '>> You regain a few hit points.'
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  puts 'Your body comes to rest somewhere below the surface of the cloudy apparatus, almost as if it were floating *amongst* the couch. The feeling is heavenly, and you actually feel somewhat better after getting back up.'
21
21
  puts '>> You regain a hit point.'
22
22
  {:type => 'rest', :data => 1}
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  puts 'You slowly lower your foot onto the tile, and then gently depress it, through the floor. Your whole body begins to feel light, lifeless. You black out.'
21
21
  puts
22
22
 
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  puts 'You pull the trigger on the gun, but realize there are no bullets in it. So, it does not do much except cause a barely audible *click* sound.'
21
21
  {:type => nil, :data => nil}
22
22
  end
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  puts 'You place the herb in your mouth, testing its texture. The mysterious herb is easily chewable, and you are able to swallow it without much effort. Slight tingles travel up and down your spine.'
21
21
  puts '>> You regain a few hit points.'
22
22
  {:type => 'health', :data => rand(3..5)}
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  puts 'You grab onto the shaky, rough-hewn, wooden ladder with all your might and start to descend, being extra careful not to loose your grip, which with every moment becomes shakier and shakier.'
21
21
  puts
22
22
 
@@ -16,9 +16,9 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  puts 'You attempt to open the seriously massive door that separates you from Emerald himself.'
21
- if inventory.has_item?('keystone')
21
+ if player.inventory.has_item?('keystone')
22
22
  puts 'The keystone in your inventory glows as you approach the incredibly titanic-sized door, so you naturally pull it out and thrust it into the stone-shaped depression within the cloudy obstruction. The door "opens" in a way and you can now pass through.'
23
23
  {:type => 'move', :data => 'Sky Tower (Throne Room)'}
24
24
  else
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  puts 'You hold on to the rope with both hands and begin to climb upwards towards the small opening in the ceiling.'
21
21
  puts
22
22
 
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  puts 'You go to touch the snowy softness of the snowman when it magically comes to life! The frozen homunculus grabs you by the wrist and tosses you to the ground, only to follow this up by jumping onto you with its full, freezing, force. Your body, and mind, go numb.'
21
21
  puts
22
22
 
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  puts 'Everything, and I mean *everything*, begins to sparkle. Huh.'
21
21
  puts
22
22
  {:type => nil, :data => nil}
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  {:type => 'action', :data => 'rest'}
21
21
  end
22
22
  end
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  puts 'You move the switch from "No" to "Yes". Suddenly, a great wind picks up and you are gently lifted up by it. The ground moves away and your whole body begins to gently drift towards Emerald\'s compound high in the stratosphere.'
21
21
  puts
22
22
 
@@ -16,7 +16,7 @@ module Gemwarrior
16
16
  self.equipped = false
17
17
  end
18
18
 
19
- def use(inventory = nil)
19
+ def use(player = nil)
20
20
  puts 'You stretch out your hand and touch the waterfall. It stings you with its cold and forceful gushing. Your hand is now wet and rougher than before. In time, it will dry.'
21
21
  {:type => 'dmg', :data => rand(0..1)}
22
22
  end
@@ -36,7 +36,8 @@ module Gemwarrior
36
36
  ERROR_LIST_PARAM_INVALID = 'You cannot list that...yet.'
37
37
  ERROR_DEBUG_STAT_PARAM_MISSING = 'You cannot just "change stats". You gotta choose a stat to change.'
38
38
  ERROR_DEBUG_STAT_PARAM_INVALID = 'You cannot change that stat...yet.'
39
- ERROR_DEBUG_TELEPORT_PARAMS_MISSING = 'You cannot just "teleport". You gotta choose somewhere to teleport to.'
39
+ ERROR_DEBUG_TELEPORT_PARAMS_MISSING = 'You cannot just "teleport". You gotta specify an x AND y coordinate, at least.'
40
+ ERROR_DEBUG_TELEPORT_PARAMS_NEEDED = 'You cannot just "teleport" to an x coordinate without a y coordinate.'
40
41
  ERROR_DEBUG_TELEPORT_PARAMS_INVALID = 'You cannot teleport there...yet.'
41
42
 
42
43
  attr_accessor :world,
@@ -170,6 +171,15 @@ module Gemwarrior
170
171
  end
171
172
  end
172
173
  end
174
+ when 'rox', 'r', '$'
175
+ unless param2.nil?
176
+ param2 = param2.to_i
177
+ if param2.is_a? Numeric
178
+ if param2 >= 0
179
+ world.player.rox = param2
180
+ end
181
+ end
182
+ end
173
183
  else
174
184
  return ERROR_DEBUG_STAT_PARAM_INVALID
175
185
  end
@@ -182,15 +192,34 @@ module Gemwarrior
182
192
  if param1.nil?
183
193
  return ERROR_DEBUG_TELEPORT_PARAMS_MISSING
184
194
  else
185
- if (param1.to_i.to_s == param1) && (param2.to_i.to_s == param2)
186
- world.player.cur_coords = {:x => param1.to_i, :y => param2.to_i, :z => param3.to_i}
195
+ if (param1.to_i.to_s == param1)
196
+ # we got at least an x coordinate
197
+ if (param2.to_i.to_s == param2)
198
+ # we got a y coordinate, too
199
+ x_coord = param1.to_i
200
+ y_coord = param2.to_i
201
+ # grab the z coordinate, if present, otherwise default to current level
202
+ z_coord = param3.to_i.to_s == param3 ? param3.to_i : world.player.cur_coords[:z]
203
+
204
+ # check to make sure new location exists
205
+ if world.location_by_coords({:x => x_coord, :y => y_coord, :z => z_coord})
206
+ world.player.cur_coords = {:x => x_coord, :y => y_coord, :z => z_coord}
207
+ else
208
+ return ERROR_DEBUG_TELEPORT_PARAMS_INVALID
209
+ end
210
+ else
211
+ # we only got an x coordinate
212
+ return ERROR_DEBUG_TELEPORT_PARAMS_NEEDED
213
+ end
187
214
  else
215
+ # we got a place name instead, potentially
216
+ place_to_match = tokens[1..tokens.length].join(' ').downcase
188
217
  locations = []
189
218
  world.locations.each do |l|
190
219
  locations << l.name.downcase
191
220
  end
192
- if locations.include?(param1.downcase)
193
- world.player.cur_coords = world.location_coords_by_name(param1)
221
+ if locations.include?(place_to_match)
222
+ world.player.cur_coords = world.location_coords_by_name(place_to_match)
194
223
  else
195
224
  return ERROR_DEBUG_TELEPORT_PARAMS_INVALID
196
225
  end
@@ -237,7 +266,7 @@ module Gemwarrior
237
266
  location_inventory.each do |i|
238
267
  if i.name.eql?(item_name)
239
268
  if i.useable
240
- result = i.use(world.player.inventory)
269
+ result = i.use(world.player)
241
270
  else
242
271
  return ERROR_USE_PARAM_UNUSEABLE
243
272
  end
@@ -249,7 +278,7 @@ module Gemwarrior
249
278
  player_inventory.each do |i|
250
279
  if i.name.eql?(item_name)
251
280
  if i.useable
252
- result = i.use(world.player.inventory)
281
+ result = i.use(world.player)
253
282
  else
254
283
  return ERROR_USE_PARAM_UNUSEABLE
255
284
  end
@@ -279,6 +308,8 @@ module Gemwarrior
279
308
  if result[:data].eql?('rest')
280
309
  world.player.rest(world)
281
310
  end
311
+ when 'arena'
312
+ return 'You enter the arena and fight some battles. It was cool, but not as cool as if it were actually implemented.'
282
313
  else
283
314
  return
284
315
  end
@@ -362,7 +393,7 @@ module Gemwarrior
362
393
  private
363
394
 
364
395
  def print_separator
365
- puts "=============================="
396
+ puts "=================================================="
366
397
  end
367
398
 
368
399
  def list_commands
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = "0.7.8"
5
+ VERSION = "0.7.9"
6
6
  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.7.8
4
+ version: 0.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick
@@ -179,6 +179,8 @@ files:
179
179
  - lib/gemwarrior/entities/entity.rb
180
180
  - lib/gemwarrior/entities/item.rb
181
181
  - lib/gemwarrior/entities/items/apple.rb
182
+ - lib/gemwarrior/entities/items/arena_door.rb
183
+ - lib/gemwarrior/entities/items/arena_master.rb
182
184
  - lib/gemwarrior/entities/items/bed.rb
183
185
  - lib/gemwarrior/entities/items/couch.rb
184
186
  - lib/gemwarrior/entities/items/cup.rb
@@ -248,10 +250,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
250
  version: '0'
249
251
  requirements: []
250
252
  rubyforge_project:
251
- rubygems_version: 2.4.8
253
+ rubygems_version: 2.4.6
252
254
  signing_key:
253
255
  specification_version: 4
254
256
  summary: RPG as RubyGem
255
- test_files:
256
- - spec/rubywarrior_spec.rb
257
- - spec/spec_helper.rb
257
+ test_files: []