gemwarrior 0.10.4 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/data/default_world.yaml +2 -0
- data/lib/gemwarrior/arena.rb +2 -2
- data/lib/gemwarrior/entities/item.rb +3 -1
- data/lib/gemwarrior/entities/items/arena_master.rb +5 -1
- data/lib/gemwarrior/entities/items/letter.rb +4 -6
- data/lib/gemwarrior/entities/items/ware_hawker.rb +2 -1
- data/lib/gemwarrior/evaluator.rb +87 -13
- data/lib/gemwarrior/inventory.rb +4 -3
- data/lib/gemwarrior/repl.rb +2 -2
- data/lib/gemwarrior/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e003f1c361b29e19bf92a5d6041cdf41625ffee
|
4
|
+
data.tar.gz: 1aa44590aa8d6d79460d64910509519482dffc03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27726ab0025e81e5a9b1863f772ff2cd5d99bb468ce1609414c4c4bf97ad1e1cac906e04923cda45183680b7e737ec96490ca1ed0fe0f48671a78a2e5b37da63
|
7
|
+
data.tar.gz: 9f6f72ad094d442b8064ab21c3c22ef186563a88958b9ae363e3322f52ca69de6b458a88078a5c002e0c12fdb8c737a238ccb4b15c03c610698d160516fec87f
|
data/data/default_world.yaml
CHANGED
@@ -1556,6 +1556,7 @@ locations:
|
|
1556
1556
|
consumable: false
|
1557
1557
|
used: false
|
1558
1558
|
number_of_uses:
|
1559
|
+
talkable: true
|
1559
1560
|
name: arena_master
|
1560
1561
|
description: She wears simple clothing, but carries herself with an air of authority.
|
1561
1562
|
You think she may be the person to talk with if you want to engage in battle.
|
@@ -1761,6 +1762,7 @@ locations:
|
|
1761
1762
|
consumable: false
|
1762
1763
|
used: false
|
1763
1764
|
number_of_uses:
|
1765
|
+
talkable: true
|
1764
1766
|
name: ware_hawker
|
1765
1767
|
description: A literal anthropomorphic hawk has set up shop behind a crudely-made
|
1766
1768
|
table. Some wares are scattered atop its surface, seemingly within anyone's
|
data/lib/gemwarrior/arena.rb
CHANGED
@@ -30,11 +30,11 @@ module Gemwarrior
|
|
30
30
|
arena_monsters_vanquished += 1
|
31
31
|
|
32
32
|
puts
|
33
|
-
|
33
|
+
print 'Do you wish to continue fighting in the Arena? (y/n) '
|
34
34
|
answer = gets.chomp.downcase
|
35
35
|
|
36
36
|
case answer
|
37
|
-
when '
|
37
|
+
when 'y', 'yes'
|
38
38
|
next
|
39
39
|
else
|
40
40
|
bonus_rox = arena_monsters_vanquished * 25
|
@@ -6,13 +6,14 @@ require_relative 'entity'
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Item < Entity
|
8
8
|
attr_accessor :atk_lo, :atk_hi, :takeable, :useable, :equippable, :equipped,
|
9
|
-
:consumable, :use, :used, :number_of_uses
|
9
|
+
:consumable, :use, :used, :number_of_uses, :talkable
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
self.equipped = false
|
13
13
|
self.consumable = false
|
14
14
|
self.used = false
|
15
15
|
self.number_of_uses = nil
|
16
|
+
self.talkable = false
|
16
17
|
end
|
17
18
|
|
18
19
|
def use(inventory = nil)
|
@@ -28,6 +29,7 @@ module Gemwarrior
|
|
28
29
|
status_text << "EQUIPPABLE? #{equippable}\n".colorize(:white)
|
29
30
|
status_text << "CONSUMABLE? #{consumable}\n".colorize(:white)
|
30
31
|
status_text << "NUMBER OF USES? #{number_of_uses}\n".colorize(:white) unless number_of_uses.nil?
|
32
|
+
status_text << "TALKABLE? #{talkable}\n".colorize(:white)
|
31
33
|
status_text << "\n"
|
32
34
|
end
|
33
35
|
end
|
@@ -19,6 +19,7 @@ module Gemwarrior
|
|
19
19
|
self.takeable = false
|
20
20
|
self.useable = true
|
21
21
|
self.equippable = false
|
22
|
+
self.talkable = true
|
22
23
|
end
|
23
24
|
|
24
25
|
def use(player = nil)
|
@@ -26,17 +27,20 @@ module Gemwarrior
|
|
26
27
|
puts
|
27
28
|
|
28
29
|
if player.rox >= 50
|
29
|
-
|
30
|
+
print "She asks for the requisite payment: #{ARENA_FEE} rox. Do you pay up? (y/n) "
|
30
31
|
answer = gets.chomp.downcase
|
32
|
+
|
31
33
|
case answer
|
32
34
|
when 'y', 'yes'
|
33
35
|
player.rox -= 50
|
36
|
+
puts
|
34
37
|
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.'
|
35
38
|
puts
|
36
39
|
puts 'She finishes by wishing you good luck!'
|
37
40
|
|
38
41
|
return { type: 'arena', data: nil }
|
39
42
|
else
|
43
|
+
puts
|
40
44
|
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.'
|
41
45
|
return { type: nil, data: nil }
|
42
46
|
end
|
@@ -19,13 +19,11 @@ module Gemwarrior
|
|
19
19
|
|
20
20
|
def use(player = nil)
|
21
21
|
if self.used
|
22
|
-
|
23
|
-
|
22
|
+
print 'Do you want to read the letter again? (y/n) '
|
23
|
+
answer = gets.chomp.downcase
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
case choice
|
28
|
-
when 'y'
|
25
|
+
case answer
|
26
|
+
when 'y', 'yes'
|
29
27
|
print "\n"
|
30
28
|
print_letter(player)
|
31
29
|
else
|
@@ -24,6 +24,7 @@ module Gemwarrior
|
|
24
24
|
self.takeable = false
|
25
25
|
self.useable = true
|
26
26
|
self.equippable = false
|
27
|
+
self.talkable = true
|
27
28
|
end
|
28
29
|
|
29
30
|
def use(player = nil)
|
@@ -54,7 +55,7 @@ module Gemwarrior
|
|
54
55
|
puts ' 2 - Spear'
|
55
56
|
puts ' x - leave'
|
56
57
|
print '[HAWK]> '
|
57
|
-
choice = gets.chomp
|
58
|
+
choice = gets.chomp.downcase
|
58
59
|
|
59
60
|
case choice
|
60
61
|
when '1'
|
data/lib/gemwarrior/evaluator.rb
CHANGED
@@ -14,10 +14,13 @@ module Gemwarrior
|
|
14
14
|
GO_PARAMS = 'Options: north, east, south, west'
|
15
15
|
CHANGE_PARAMS = 'Options: name'
|
16
16
|
DEBUG_LIST_PARAMS = 'Options: monsters, items, locations'
|
17
|
-
DEBUG_STAT_PARAMS = 'Options: atk_lo, atk_hi, strength, dexterity'
|
17
|
+
DEBUG_STAT_PARAMS = 'Options: hp_cur, atk_lo, atk_hi, experience, rox, strength, dexterity, defense, inventory'
|
18
18
|
|
19
19
|
ERROR_COMMAND_INVALID = 'That is not something the game yet understands.'
|
20
20
|
ERROR_LOOK_AT_PARAM_MISSING = 'You cannot just "look at". You gotta choose something to look at.'
|
21
|
+
ERROR_TALK_PARAM_INVALID = 'Are you talking to yourself? That person is not here.'
|
22
|
+
ERROR_TALK_PARAM_UNTALKABLE = 'That cannnot be conversed with.'
|
23
|
+
ERROR_TALK_TO_PARAM_MISSING = 'You cannot just "talk to". You gotta choose someone to talk to.'
|
21
24
|
ERROR_GO_PARAM_MISSING = 'Just wander aimlessly? A direction would be nice.'
|
22
25
|
ERROR_GO_PARAM_INVALID = 'The place in that direction is far, far, FAR too dangerous. You should try a different way.'
|
23
26
|
ERROR_DIRECTION_PARAM_INVALID = 'You cannot go to that place.'
|
@@ -57,14 +60,14 @@ module Gemwarrior
|
|
57
60
|
'List all the variables in the world',
|
58
61
|
'Show a map of the world',
|
59
62
|
'Change player stat',
|
60
|
-
'Teleport to coordinates (5 0 0) or
|
63
|
+
'Teleport to coordinates (5 0 0) or name (\'Home\')',
|
61
64
|
'Spawn random monster',
|
62
|
-
'Bump your character to the next
|
65
|
+
'Bump your character to the next level',
|
63
66
|
'Rest, but ensure battle for testing'
|
64
67
|
]
|
65
68
|
|
66
|
-
self.commands = %w(character inventory rest look take use drop equip unequip go north east south west attack change version checkupdate help quit quit!)
|
67
|
-
self.aliases = %w(c i r l t u d eq ue g n e s w a ch v cu h q qq)
|
69
|
+
self.commands = %w(character inventory rest look take talk use drop equip unequip go north east south west attack change version checkupdate help quit quit!)
|
70
|
+
self.aliases = %w(c i r l t tk u d eq ue g n e s w a ch v cu h q qq)
|
68
71
|
self.extras = %w(exit exit! x xx fight f ? ?? ???)
|
69
72
|
self.cmd_descriptions = [
|
70
73
|
'Display character information',
|
@@ -72,6 +75,7 @@ module Gemwarrior
|
|
72
75
|
'Take a load off and regain HP',
|
73
76
|
'Look around your current location',
|
74
77
|
'Take item',
|
78
|
+
'Talk to person',
|
75
79
|
'Use item (in inventory or environment)',
|
76
80
|
'Drop item',
|
77
81
|
'Equip item',
|
@@ -81,11 +85,11 @@ module Gemwarrior
|
|
81
85
|
'Go east (shortcut)',
|
82
86
|
'Go south (shortcut)',
|
83
87
|
'Go west (shortcut)',
|
84
|
-
'Attack a monster',
|
88
|
+
'Attack a monster (also fight)',
|
85
89
|
'Change something',
|
86
90
|
'Display game version',
|
87
91
|
'Check for newer game releases',
|
88
|
-
'This help menu',
|
92
|
+
'This help menu (also ?)',
|
89
93
|
'Quit w/ confirmation (also exit/x)',
|
90
94
|
'Quit w/o confirmation (also exit!/xx)'
|
91
95
|
]
|
@@ -172,7 +176,7 @@ module Gemwarrior
|
|
172
176
|
end
|
173
177
|
end
|
174
178
|
end
|
175
|
-
when 'dexterity', 'dex'
|
179
|
+
when 'dexterity', 'dex'
|
176
180
|
unless param2.nil?
|
177
181
|
param2 = param2.to_i
|
178
182
|
if param2.is_a? Numeric
|
@@ -181,6 +185,15 @@ module Gemwarrior
|
|
181
185
|
end
|
182
186
|
end
|
183
187
|
end
|
188
|
+
when 'defense', 'def'
|
189
|
+
unless param2.nil?
|
190
|
+
param2 = param2.to_i
|
191
|
+
if param2.is_a? Numeric
|
192
|
+
if param2 >= 0
|
193
|
+
world.player.defense = param2
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
184
197
|
when 'rox', 'r', '$'
|
185
198
|
unless param2.nil?
|
186
199
|
param2 = param2.to_i
|
@@ -333,6 +346,62 @@ module Gemwarrior
|
|
333
346
|
else
|
334
347
|
world.player.inventory.add_item(world.location_by_coords(world.player.cur_coords), param1, world.player)
|
335
348
|
end
|
349
|
+
when 'talk', 'tk'
|
350
|
+
if param1.nil?
|
351
|
+
return ERROR_USE_PARAM_MISSING
|
352
|
+
elsif param1.eql?('to')
|
353
|
+
if param2
|
354
|
+
param1 = param2
|
355
|
+
else
|
356
|
+
return ERROR_TALK_TO_PARAM_MISSING
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
person_name = param1
|
361
|
+
result = nil
|
362
|
+
|
363
|
+
player_inventory = world.player.inventory.items
|
364
|
+
location = world.location_by_coords(world.player.cur_coords)
|
365
|
+
location_inventory = location.items
|
366
|
+
|
367
|
+
if player_inventory.map(&:name).include?(person_name)
|
368
|
+
player_inventory.each do |person|
|
369
|
+
if person.name.eql?(person_name)
|
370
|
+
if person.talkable
|
371
|
+
result = person.use(world.player)
|
372
|
+
else
|
373
|
+
return ERROR_TALK_PARAM_UNTALKABLE
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
elsif location_inventory.map(&:name).include?(person_name)
|
378
|
+
location_inventory.each do |person|
|
379
|
+
if person.name.eql?(person_name)
|
380
|
+
if person.talkable
|
381
|
+
result = person.use(world.player)
|
382
|
+
else
|
383
|
+
return ERROR_TALK_PARAM_UNTALKABLE
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
return ERROR_TALK_PARAM_INVALID if result.nil?
|
390
|
+
|
391
|
+
case result[:type]
|
392
|
+
when 'arena'
|
393
|
+
arena_result = Arena.new(world: world, player: world.player)
|
394
|
+
arena_result = arena.start
|
395
|
+
|
396
|
+
if arena_result.eql?('death')
|
397
|
+
player_death_resurrection
|
398
|
+
end
|
399
|
+
when 'purchase'
|
400
|
+
result[:data].each do |i|
|
401
|
+
world.player.inventory.items.push(i)
|
402
|
+
end
|
403
|
+
return
|
404
|
+
end
|
336
405
|
when 'use', 'u'
|
337
406
|
if param1.nil?
|
338
407
|
ERROR_USE_PARAM_MISSING
|
@@ -341,7 +410,8 @@ module Gemwarrior
|
|
341
410
|
result = nil
|
342
411
|
|
343
412
|
player_inventory = world.player.inventory.items
|
344
|
-
|
413
|
+
location = world.location_by_coords(world.player.cur_coords)
|
414
|
+
location_inventory = location.items
|
345
415
|
|
346
416
|
if player_inventory.map(&:name).include?(item_name)
|
347
417
|
player_inventory.each do |i|
|
@@ -380,7 +450,7 @@ module Gemwarrior
|
|
380
450
|
end
|
381
451
|
elsif i.consumable
|
382
452
|
result = i.use(world.player)
|
383
|
-
|
453
|
+
location.remove_item(i.name)
|
384
454
|
else
|
385
455
|
result = i.use(world.player)
|
386
456
|
end
|
@@ -527,7 +597,9 @@ module Gemwarrior
|
|
527
597
|
when 'quit', 'exit', 'q', 'x'
|
528
598
|
print 'You sure you want to quit? (y/n) '
|
529
599
|
response = gets.chomp.downcase
|
530
|
-
|
600
|
+
|
601
|
+
case answer
|
602
|
+
when 'y', 'yes'
|
531
603
|
puts QUIT_MESSAGE
|
532
604
|
return 'exit'
|
533
605
|
else
|
@@ -582,8 +654,10 @@ module Gemwarrior
|
|
582
654
|
def list_commands
|
583
655
|
i = 0
|
584
656
|
print_separator
|
657
|
+
puts ' COMMAND | ALIAS | DESCRIPTION '
|
658
|
+
print_separator
|
585
659
|
commands.each do |cmd|
|
586
|
-
puts " #{cmd.ljust(
|
660
|
+
puts " #{cmd.ljust(11)} | #{aliases[i].ljust(5)} | #{cmd_descriptions[i]}"
|
587
661
|
i += 1
|
588
662
|
end
|
589
663
|
print_separator
|
@@ -593,7 +667,7 @@ module Gemwarrior
|
|
593
667
|
print_separator
|
594
668
|
i = 0
|
595
669
|
devcommands.each do |cmd|
|
596
|
-
puts " #{cmd.ljust(
|
670
|
+
puts " #{cmd.ljust(11)} | #{devaliases[i].ljust(5)} | #{devcmd_descriptions[i]}"
|
597
671
|
i += 1
|
598
672
|
end
|
599
673
|
print_separator
|
data/lib/gemwarrior/inventory.rb
CHANGED
@@ -113,10 +113,11 @@ module Gemwarrior
|
|
113
113
|
|
114
114
|
def drop_item(item_name)
|
115
115
|
if contains_item?(item_name)
|
116
|
-
|
117
|
-
answer = gets.downcase
|
116
|
+
print "Are you sure you want to permanently throw away #{item_name}? (y/n) "
|
117
|
+
answer = gets.chomp.downcase
|
118
118
|
|
119
|
-
|
119
|
+
case answer
|
120
|
+
when 'y', 'yes'
|
120
121
|
remove_item(item_name)
|
121
122
|
|
122
123
|
return "The #{item_name} has been thrown on the ground, but far out of reach, and you're much too lazy to go get it now, so it's as good as gone."
|
data/lib/gemwarrior/repl.rb
CHANGED
@@ -210,7 +210,7 @@ module Gemwarrior
|
|
210
210
|
answer = gets.chomp.downcase
|
211
211
|
|
212
212
|
case answer
|
213
|
-
when 'y'
|
213
|
+
when 'y', 'yes'
|
214
214
|
File.truncate(GameOptions.data['log_file_path'], 0)
|
215
215
|
puts 'Log of attempts: erased!'
|
216
216
|
end
|
@@ -418,7 +418,7 @@ module Gemwarrior
|
|
418
418
|
answer = gets.chomp.downcase
|
419
419
|
|
420
420
|
case answer
|
421
|
-
when 'y'
|
421
|
+
when 'y', 'yes'
|
422
422
|
puts 'New game started! Press any key to continue.'
|
423
423
|
gets
|
424
424
|
return true
|
data/lib/gemwarrior/version.rb
CHANGED