gemwarrior 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gemwarrior +0 -0
- data/data/default_world.yaml +38 -23
- data/lib/gemwarrior/battle.rb +22 -9
- data/lib/gemwarrior/entities/creature.rb +1 -1
- data/lib/gemwarrior/entities/items/sand_jewel.rb +21 -0
- data/lib/gemwarrior/entities/monster.rb +6 -2
- data/lib/gemwarrior/entities/monsters/bosses/emerald.rb +3 -1
- data/lib/gemwarrior/entities/people/shifty_woman.rb +42 -3
- data/lib/gemwarrior/evaluator.rb +114 -47
- data/lib/gemwarrior/version.rb +1 -1
- data/lib/gemwarrior/world.rb +8 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff8474b226f235786ac195ba7caf4fbeef9cbb1c
|
4
|
+
data.tar.gz: 343641b13eaac3315e3c489a1d9329f27f64eded
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90ea27cc4e68f7cb58cba9a972f62039c86328c99101a17373e682a165d1f5dbab56cf578637fc141d2412310c1a1e036559c76ef24f18ea2b7883f4b2234e63
|
7
|
+
data.tar.gz: c88db1ad5118a232e10b08515700d04e1c10c456493fb2a2da7de2fc7b871837b8e8727d3fd97953d071df9574828bb0d72da33f49c9889338c8ee25b4f6389d
|
data/bin/gemwarrior
CHANGED
File without changes
|
data/data/default_world.yaml
CHANGED
@@ -1090,7 +1090,19 @@ locations:
|
|
1090
1090
|
begin: 5
|
1091
1091
|
end: 20
|
1092
1092
|
excl: false
|
1093
|
-
items:
|
1093
|
+
items:
|
1094
|
+
- !ruby/object:Gemwarrior::SandJewel
|
1095
|
+
equipped: false
|
1096
|
+
consumable: false
|
1097
|
+
used: false
|
1098
|
+
number_of_uses:
|
1099
|
+
talkable: false
|
1100
|
+
name: sand_jewel
|
1101
|
+
name_display: Sand Jewel
|
1102
|
+
description: As blue (or is it violet? or brown?) as it is brittle, this shiny rock feels warm to the touch.
|
1103
|
+
takeable: true
|
1104
|
+
useable: true
|
1105
|
+
equippable: false
|
1094
1106
|
monsters_abounding: []
|
1095
1107
|
bosses_abounding:
|
1096
1108
|
- !ruby/object:Gemwarrior::Garynetty
|
@@ -1274,7 +1286,7 @@ locations:
|
|
1274
1286
|
- !ruby/object:Gemwarrior::Location
|
1275
1287
|
name: plains-south_southeast
|
1276
1288
|
name_display: Plains (South-Southeast)
|
1277
|
-
description:
|
1289
|
+
description: A path north of you descends into a valley, but otherwise the plains stretch out all
|
1278
1290
|
around. The noise from the east is quite loud, and a building can be seen in the
|
1279
1291
|
near distance.
|
1280
1292
|
coords:
|
@@ -1282,7 +1294,7 @@ locations:
|
|
1282
1294
|
:y: 3
|
1283
1295
|
:z: 0
|
1284
1296
|
locs_connected:
|
1285
|
-
:north:
|
1297
|
+
:north: true
|
1286
1298
|
:east: true
|
1287
1299
|
:south: false
|
1288
1300
|
:west: true
|
@@ -1472,15 +1484,14 @@ locations:
|
|
1472
1484
|
name: plains-north_of_bridge
|
1473
1485
|
name_display: Plains (North of Bridge)
|
1474
1486
|
description: North of the river feels similar to south of the river, as you continue
|
1475
|
-
to be surrounded by grass and grass and, well, grass.
|
1476
|
-
out into a valley.
|
1487
|
+
to be surrounded by grass and grass and, well, grass.
|
1477
1488
|
coords:
|
1478
1489
|
:x: 4
|
1479
1490
|
:y: 5
|
1480
1491
|
:z: 0
|
1481
1492
|
locs_connected:
|
1482
1493
|
:north: false
|
1483
|
-
:east:
|
1494
|
+
:east: false
|
1484
1495
|
:south: true
|
1485
1496
|
:west: true
|
1486
1497
|
danger_level: :low
|
@@ -1493,19 +1504,19 @@ locations:
|
|
1493
1504
|
bosses_abounding: []
|
1494
1505
|
checked_for_monsters: false
|
1495
1506
|
- !ruby/object:Gemwarrior::Location
|
1496
|
-
name: peridover_valley-
|
1497
|
-
name_display: Peridover Valley (
|
1507
|
+
name: peridover_valley-south
|
1508
|
+
name_display: Peridover Valley (South)
|
1498
1509
|
description: The road slopes down slightly here, but in the near distance you can
|
1499
|
-
see that it slopes way more slopily.
|
1510
|
+
see that it slopes way more slopily. A mighty river ends in a bay to your west.
|
1500
1511
|
coords:
|
1501
|
-
:x:
|
1502
|
-
:y:
|
1512
|
+
:x: 6
|
1513
|
+
:y: 4
|
1503
1514
|
:z: 0
|
1504
1515
|
locs_connected:
|
1505
|
-
:north:
|
1506
|
-
:east:
|
1507
|
-
:south:
|
1508
|
-
:west:
|
1516
|
+
:north: true
|
1517
|
+
:east: false
|
1518
|
+
:south: true
|
1519
|
+
:west: false
|
1509
1520
|
danger_level: :low
|
1510
1521
|
monster_level_range: !ruby/range
|
1511
1522
|
begin: 2
|
@@ -1527,8 +1538,8 @@ locations:
|
|
1527
1538
|
locs_connected:
|
1528
1539
|
:north: false
|
1529
1540
|
:east: true
|
1530
|
-
:south:
|
1531
|
-
:west:
|
1541
|
+
:south: true
|
1542
|
+
:west: false
|
1532
1543
|
danger_level: :moderate
|
1533
1544
|
monster_level_range: !ruby/range
|
1534
1545
|
begin: 3
|
@@ -1539,8 +1550,8 @@ locations:
|
|
1539
1550
|
bosses_abounding: []
|
1540
1551
|
checked_for_monsters: false
|
1541
1552
|
- !ruby/object:Gemwarrior::Location
|
1542
|
-
name: peridover_valley-
|
1543
|
-
name_display: Peridover Valley (
|
1553
|
+
name: peridover_valley-northeast
|
1554
|
+
name_display: Peridover Valley (Northeast)
|
1544
1555
|
description: Sloping way down to the west, but leveling off here, a din of civilization
|
1545
1556
|
calls from the north.
|
1546
1557
|
coords:
|
@@ -1749,7 +1760,7 @@ locations:
|
|
1749
1760
|
number_of_uses:
|
1750
1761
|
talkable: true
|
1751
1762
|
name: shifty_woman
|
1752
|
-
|
1763
|
+
name_display: Shifty Woman
|
1753
1764
|
description: Sharply dressed with impeccable style, you still can't shake the feeling that this
|
1754
1765
|
otherwise ordinary woman is up to something. It might be the way she almost impulsively looks
|
1755
1766
|
back and forth along the town street while rubbing her hands together menacingly.
|
@@ -2104,11 +2115,11 @@ locations:
|
|
2104
2115
|
hands: tantalizing
|
2105
2116
|
mood: enraged
|
2106
2117
|
level: 15
|
2107
|
-
hp_cur:
|
2108
|
-
hp_max:
|
2118
|
+
hp_cur: 100
|
2119
|
+
hp_max: 100
|
2109
2120
|
atk_lo: 28
|
2110
2121
|
atk_hi: 44
|
2111
|
-
defense:
|
2122
|
+
defense: 6
|
2112
2123
|
dexterity: 9
|
2113
2124
|
inventory: !ruby/object:Gemwarrior::Inventory
|
2114
2125
|
armor:
|
@@ -2131,6 +2142,8 @@ locations:
|
|
2131
2142
|
ha ha ha! Prepare yourself fool: today your whole life crumbles!'
|
2132
2143
|
is_boss: true
|
2133
2144
|
is_dead: false
|
2145
|
+
talkable: true
|
2146
|
+
useable: true
|
2134
2147
|
checked_for_monsters: false
|
2135
2148
|
- !ruby/object:Gemwarrior::Location
|
2136
2149
|
name: sky_tower-lounge
|
@@ -2299,4 +2312,6 @@ player: !ruby/object:Gemwarrior::Player
|
|
2299
2312
|
rests_taken: 0
|
2300
2313
|
deaths: 0
|
2301
2314
|
emerald_beaten: false
|
2315
|
+
shifty_jeweled: false
|
2316
|
+
shifty_to_jewel: false
|
2302
2317
|
duration:
|
data/lib/gemwarrior/battle.rb
CHANGED
@@ -10,7 +10,10 @@ module Gemwarrior
|
|
10
10
|
BEAST_MODE_ATTACK = 100
|
11
11
|
ESCAPE_TEXT = '** POOF **'
|
12
12
|
|
13
|
-
attr_accessor :world,
|
13
|
+
attr_accessor :world,
|
14
|
+
:player,
|
15
|
+
:monster,
|
16
|
+
:player_is_defending
|
14
17
|
|
15
18
|
def initialize(options)
|
16
19
|
self.world = options.fetch(:world)
|
@@ -19,12 +22,13 @@ module Gemwarrior
|
|
19
22
|
self.player_is_defending = false
|
20
23
|
end
|
21
24
|
|
22
|
-
def start(is_arena =
|
25
|
+
def start(is_arena = false, is_event = false)
|
23
26
|
Audio.play_synth(:battle_start)
|
24
27
|
|
25
28
|
# begin battle!
|
26
29
|
print_battle_header unless is_arena
|
27
30
|
|
31
|
+
# print opponent announcement, depending on reason for battle
|
28
32
|
if is_arena
|
29
33
|
print ' Your opponent is now...'
|
30
34
|
Animation.run(phrase: "#{monster.name.upcase}", speed: :slow, oneline: true)
|
@@ -37,12 +41,21 @@ module Gemwarrior
|
|
37
41
|
|
38
42
|
puts " #{monster.name} cries out: \"#{monster.battlecry}\""
|
39
43
|
|
40
|
-
# first strike!
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
# first strike! (unless arena or emerald)
|
45
|
+
# shifty woman time, if emerald
|
46
|
+
if monster.name.eql?('emerald')
|
47
|
+
if world.shifty_to_jewel && !world.shifty_has_jeweled
|
48
|
+
puts
|
49
|
+
puts ' Suddenly, the Shifty Woman appears out of nowhere, and stands between you and Emerald!'
|
50
|
+
STDIN.getc
|
51
|
+
Person.new.speak('Hey! The developer hasn\'t figured out what I\'m here to do, but I really hope you can defeat Emerald! Also, thanks for the shiny jewel!')
|
52
|
+
STDIN.getc
|
53
|
+
puts ' The Shifty Woman\'s perplexing speech now over, she disappears.'
|
54
|
+
world.shifty_has_jeweled = true
|
45
55
|
end
|
56
|
+
elsif monster_strikes_first?(arena_battle: is_arena, event_battle: is_event)
|
57
|
+
puts " #{monster.name} strikes first!".colorize(:yellow)
|
58
|
+
monster_attacks_player
|
46
59
|
end
|
47
60
|
|
48
61
|
# main battle loop
|
@@ -259,8 +272,8 @@ module Gemwarrior
|
|
259
272
|
end
|
260
273
|
|
261
274
|
# MONSTER
|
262
|
-
def monster_strikes_first?(
|
263
|
-
if (monster.dexterity > player.dexterity) ||
|
275
|
+
def monster_strikes_first?(arena_battle = false, event_battle = false)
|
276
|
+
if (monster.dexterity > player.dexterity) || event_battle || !arena_battle
|
264
277
|
return true
|
265
278
|
else
|
266
279
|
dex_diff = player.dexterity - monster.dexterity
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# lib/gemwarrior/entities/items/sand_jewel.rb
|
2
|
+
# Entity::Item::SandJewel
|
3
|
+
|
4
|
+
require_relative '../item'
|
5
|
+
|
6
|
+
module Gemwarrior
|
7
|
+
class SandJewel < Item
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
|
11
|
+
self.name = 'sand_jewel'
|
12
|
+
self.name_display = 'Sand Jewel'
|
13
|
+
self.description = 'As blue (or is it violet? or brown?) as it is brittle, this shiny rock feels warm to the touch.'
|
14
|
+
end
|
15
|
+
|
16
|
+
def use(world)
|
17
|
+
puts 'You lift the sand jewel to the sky; rays of sunlight refract through it and nearly blind you.'
|
18
|
+
{ type: nil, data: nil }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -9,14 +9,16 @@ module Gemwarrior
|
|
9
9
|
class Monster < Creature
|
10
10
|
ITEM_POOL = [Herb.new, Bullet.new]
|
11
11
|
|
12
|
-
attr_accessor :battlecry,
|
13
|
-
:is_boss,
|
12
|
+
attr_accessor :battlecry,
|
13
|
+
:is_boss,
|
14
14
|
:is_dead
|
15
15
|
|
16
16
|
def initialize
|
17
17
|
super
|
18
18
|
|
19
19
|
self.inventory = Inventory.new
|
20
|
+
self.useable = true
|
21
|
+
self.talkable = true
|
20
22
|
self.is_dead = false
|
21
23
|
3.times do
|
22
24
|
if [true, false].sample
|
@@ -43,6 +45,8 @@ module Gemwarrior
|
|
43
45
|
desc_text << "DEX : #{dexterity}\n".colorize(:white)
|
44
46
|
desc_text << "ROX : #{rox}\n".colorize(:white)
|
45
47
|
desc_text << "INV : #{inventory.list_contents}\n".colorize(:white)
|
48
|
+
desc_text << "TALK? #{talkable}\n".colorize(:white)
|
49
|
+
desc_text << "USE? #{useable}\n".colorize(:white)
|
46
50
|
desc_text
|
47
51
|
end
|
48
52
|
end
|
@@ -21,7 +21,7 @@ module Gemwarrior
|
|
21
21
|
self.mood = 'enraged'
|
22
22
|
|
23
23
|
self.level = 15
|
24
|
-
self.hp_cur = rand((level *
|
24
|
+
self.hp_cur = rand((level * 6)..(level * 7))
|
25
25
|
self.hp_max = hp_cur
|
26
26
|
self.atk_lo = rand(level..(level * 2.5).floor)
|
27
27
|
self.atk_hi = rand((level * 2.5).floor..(level * 3).floor)
|
@@ -32,6 +32,8 @@ module Gemwarrior
|
|
32
32
|
self.rox = rand((level * 9)..(level * 11))
|
33
33
|
self.xp = rand((level * 13)..(level * 15))
|
34
34
|
|
35
|
+
self.talkable = true
|
36
|
+
self.useable = true
|
35
37
|
self.is_boss = true
|
36
38
|
end
|
37
39
|
|
@@ -5,6 +5,9 @@ require_relative '../person'
|
|
5
5
|
|
6
6
|
module Gemwarrior
|
7
7
|
class ShiftyWoman < Person
|
8
|
+
# CONSTANTS
|
9
|
+
SHOO_TEXT = '** BAMF **'
|
10
|
+
|
8
11
|
def initialize
|
9
12
|
super
|
10
13
|
|
@@ -16,11 +19,47 @@ module Gemwarrior
|
|
16
19
|
def use(world)
|
17
20
|
if self.used
|
18
21
|
puts 'Attempting a friendly overture again, the woman turns and looks directly at you. Her brown eyes glint in the sun, almost turning an ochre hue. Her look burns you to the core, causing you to physically recoil a little.'
|
19
|
-
|
20
|
-
puts '
|
22
|
+
STDIN.getc
|
23
|
+
puts 'She then growls in a low voice at you:'
|
24
|
+
speak('Have you heard of Emerald, the good-for-nothing wizard that doomed our little world of Jool by absconding with the SparklyThing(tm)?')
|
25
|
+
STDIN.getc
|
26
|
+
puts 'Before you can even begin to answer she throws up her hands and continues, stealing a look off to the side:'
|
27
|
+
speak('My life was fine before that idiot decided he needed MORE power than he already has.')
|
28
|
+
STDIN.getc
|
29
|
+
puts 'She crosses her arms and looks down, seemingly in thought. One of her hands rolls around, a small flicker of light dancing around it as it moves.'
|
30
|
+
STDIN.getc
|
31
|
+
speak("If only I had some #{"tanzanite".colorize(:blue)}...I could cook up a spell that would take down ol' Em faster than he could lift a wand!")
|
32
|
+
STDIN.getc
|
33
|
+
if world.player.inventory.contains_item?('sand_jewel')
|
34
|
+
puts 'Her head tilts upward, ever so slightly, and she looks at you, one eyebrow cocked:'
|
35
|
+
speak('I can sense you might have what I need. I know you want to get rid of Emerald and take back the SparklyThing(tm) to give to our beloved queen, too.')
|
36
|
+
STDIN.getc
|
37
|
+
speak('I can help. Just give me that little piece of shiny you somehow came across in your travels, and I\'ll do everything in my power to make our shared goal a reality.')
|
38
|
+
print 'Give the shifty woman your Sand Jewel? (y/n) '
|
39
|
+
answer = gets.chomp.downcase
|
40
|
+
|
41
|
+
case answer
|
42
|
+
when 'y', 'yes'
|
43
|
+
world.player.inventory.remove_item('sand_jewel')
|
44
|
+
world.shifty_to_jewel = true
|
45
|
+
speak('Yes...this will do nicely.')
|
46
|
+
STDIN.getc
|
47
|
+
speak('Forgive me, but I must take my leave for now. When the time is right, I will return!')
|
48
|
+
puts 'And with that, she disappears. No puff of smoke or magical to-do...she is just no more.'
|
49
|
+
else
|
50
|
+
speak('Bah! Begone, fool!')
|
51
|
+
|
52
|
+
Animation.run(phrase: SHOO_TEXT)
|
53
|
+
puts
|
54
|
+
|
55
|
+
puts "An aura of electric light surrounds her as you are physically pushed back a foot or so. You feel instantly, uh, #{WordList.new('adjective').get_random_value}."
|
56
|
+
end
|
57
|
+
else
|
58
|
+
puts 'She grumbles to herself a little before giving you a little "shoo" and recommences looking shifty.'
|
59
|
+
end
|
21
60
|
else
|
22
61
|
puts 'The woman averts her eyes from you as you commence with a greeting, giving a little scowl while she is at it.'
|
23
|
-
|
62
|
+
|
24
63
|
self.used = true
|
25
64
|
end
|
26
65
|
|
data/lib/gemwarrior/evaluator.rb
CHANGED
@@ -8,42 +8,43 @@ require_relative 'game_options'
|
|
8
8
|
module Gemwarrior
|
9
9
|
class Evaluator
|
10
10
|
# CONSTANTS
|
11
|
-
PROGRAM_NAME
|
12
|
-
QUIT_MESSAGE
|
13
|
-
RESUME_MESSAGE
|
14
|
-
|
15
|
-
GO_PARAMS
|
16
|
-
CHANGE_PARAMS
|
17
|
-
DEBUG_LIST_PARAMS
|
18
|
-
DEBUG_STAT_PARAMS
|
19
|
-
|
20
|
-
ERROR_COMMAND_INVALID
|
21
|
-
ERROR_LOOK_AT_PARAM_MISSING
|
22
|
-
ERROR_TALK_PARAM_INVALID
|
23
|
-
ERROR_TALK_PARAM_UNTALKABLE
|
24
|
-
ERROR_TALK_TO_PARAM_MISSING
|
25
|
-
ERROR_GO_PARAM_MISSING
|
26
|
-
ERROR_GO_PARAM_INVALID
|
27
|
-
ERROR_DIRECTION_PARAM_INVALID
|
28
|
-
ERROR_ATTACK_PARAM_MISSING
|
29
|
-
ERROR_ATTACK_PARAM_INVALID
|
30
|
-
ERROR_TAKE_PARAM_MISSING
|
31
|
-
ERROR_USE_PARAM_MISSING
|
32
|
-
ERROR_USE_PARAM_INVALID
|
33
|
-
ERROR_USE_PARAM_UNUSEABLE
|
34
|
-
ERROR_DROP_PARAM_MISSING
|
35
|
-
ERROR_EQUIP_PARAM_MISSING
|
36
|
-
ERROR_UNEQUIP_PARAM_MISSING
|
37
|
-
ERROR_CHANGE_PARAM_MISSING
|
38
|
-
ERROR_CHANGE_PARAM_INVALID
|
39
|
-
ERROR_LIST_PARAM_MISSING
|
40
|
-
ERROR_LIST_PARAM_INVALID
|
41
|
-
ERROR_DEBUG_STAT_PARAM_MISSING
|
42
|
-
ERROR_DEBUG_STAT_PARAM_INVALID
|
43
|
-
ERROR_DEBUG_STAT_INV_PARAM_INVALID
|
44
|
-
|
45
|
-
|
46
|
-
|
11
|
+
PROGRAM_NAME = 'Gem Warrior'
|
12
|
+
QUIT_MESSAGE = 'Thanks for playing the game. Until next time...'.colorize(:yellow)
|
13
|
+
RESUME_MESSAGE = 'Back to adventuring!'.colorize(:green)
|
14
|
+
|
15
|
+
GO_PARAMS = 'Options: north, east, south, west'
|
16
|
+
CHANGE_PARAMS = 'Options: name'
|
17
|
+
DEBUG_LIST_PARAMS = 'Options: players, creatures, items, locations, monsters, weapons'
|
18
|
+
DEBUG_STAT_PARAMS = 'Options: hp_cur, atk_lo, atk_hi, experience, rox, strength, dexterity, defense, inventory'
|
19
|
+
|
20
|
+
ERROR_COMMAND_INVALID = 'That is not something the game yet understands.'
|
21
|
+
ERROR_LOOK_AT_PARAM_MISSING = 'You cannot just "look at". You gotta choose something to look at.'
|
22
|
+
ERROR_TALK_PARAM_INVALID = 'Are you talking to yourself? That person is not here.'
|
23
|
+
ERROR_TALK_PARAM_UNTALKABLE = 'That cannnot be conversed with.'
|
24
|
+
ERROR_TALK_TO_PARAM_MISSING = 'You cannot just "talk to". You gotta choose someone to talk to.'
|
25
|
+
ERROR_GO_PARAM_MISSING = 'Just wander aimlessly? A direction would be nice.'
|
26
|
+
ERROR_GO_PARAM_INVALID = 'The place in that direction is far, far, FAR too dangerous. You should try a different way.'
|
27
|
+
ERROR_DIRECTION_PARAM_INVALID = 'You cannot go to that place.'
|
28
|
+
ERROR_ATTACK_PARAM_MISSING = 'You cannot just "attack". You gotta choose something to attack.'
|
29
|
+
ERROR_ATTACK_PARAM_INVALID = 'That monster does not exist here or can\'t be attacked.'
|
30
|
+
ERROR_TAKE_PARAM_MISSING = 'You cannot just "take". You gotta choose something to take.'
|
31
|
+
ERROR_USE_PARAM_MISSING = 'You cannot just "use". You gotta choose something to use.'
|
32
|
+
ERROR_USE_PARAM_INVALID = 'You cannot use that, as it does not exist here or in your inventory.'
|
33
|
+
ERROR_USE_PARAM_UNUSEABLE = 'That object is not useable.'
|
34
|
+
ERROR_DROP_PARAM_MISSING = 'You cannot just "drop". You gotta choose something to drop.'
|
35
|
+
ERROR_EQUIP_PARAM_MISSING = 'You cannot just "equip". You gotta choose something to equip.'
|
36
|
+
ERROR_UNEQUIP_PARAM_MISSING = 'You cannot just "unequip". You gotta choose something to unequip.'
|
37
|
+
ERROR_CHANGE_PARAM_MISSING = 'You cannot just "change". You gotta choose something to change.'
|
38
|
+
ERROR_CHANGE_PARAM_INVALID = 'You cannot change that...yet.'
|
39
|
+
ERROR_LIST_PARAM_MISSING = 'You cannot just "list". You gotta choose something to list.'
|
40
|
+
ERROR_LIST_PARAM_INVALID = 'You cannot list that...yet.'
|
41
|
+
ERROR_DEBUG_STAT_PARAM_MISSING = 'You cannot just "change stats". You gotta choose a stat to change.'
|
42
|
+
ERROR_DEBUG_STAT_PARAM_INVALID = 'You cannot change that stat...yet.'
|
43
|
+
ERROR_DEBUG_STAT_INV_PARAM_INVALID = 'You cannot add that to your inventory...yet.'
|
44
|
+
ERROR_DEBUG_GLOBAL_VAR_INVALID = 'That global variable does not exist.'
|
45
|
+
ERROR_DEBUG_TELEPORT_PARAMS_MISSING = 'You cannot just "teleport". You gotta specify an x AND y coordinate, at least.'
|
46
|
+
ERROR_DEBUG_TELEPORT_PARAMS_NEEDED = 'You cannot just "teleport" to an x coordinate without a y coordinate.'
|
47
|
+
ERROR_DEBUG_TELEPORT_PARAMS_INVALID = 'You cannot teleport there...yet.'
|
47
48
|
|
48
49
|
attr_accessor :world,
|
49
50
|
:commands,
|
@@ -58,16 +59,18 @@ module Gemwarrior
|
|
58
59
|
def initialize(world)
|
59
60
|
self.world = world
|
60
61
|
|
61
|
-
self.devcommands = %w(god beast list vars map stat teleport spawn levelbump restfight)
|
62
|
-
self.devaliases = %w(gd bs ls vs m st tp sp lb rf)
|
62
|
+
self.devcommands = %w(god beast constants list vars map stat global teleport spawn levelbump restfight)
|
63
|
+
self.devaliases = %w(gd bs cn ls vs m st gl tp sp lb rf)
|
63
64
|
self.devextras = %w()
|
64
65
|
self.devcmd_descriptions = [
|
65
66
|
'Toggle god mode (i.e. invincible)',
|
66
67
|
'Toggle beast mode (i.e. super strength)',
|
68
|
+
'List all GameAssets',
|
67
69
|
'List all instances of a specific entity type',
|
68
70
|
'List all the variables in the world',
|
69
71
|
'Show a map of the world',
|
70
72
|
'Change player stat',
|
73
|
+
'Change world global variable',
|
71
74
|
'Teleport to coordinates (5 0 0) or name (\'Home\')',
|
72
75
|
'Spawn random monster',
|
73
76
|
'Bump your character to the next level',
|
@@ -131,6 +134,24 @@ module Gemwarrior
|
|
131
134
|
when 'beast', 'bs'
|
132
135
|
GameOptions.data['beast_mode'] = !GameOptions.data['beast_mode']
|
133
136
|
return "Beast mode set to #{GameOptions.data['beast_mode']}"
|
137
|
+
when 'constants', 'cn'
|
138
|
+
puts 'GameCreatures'.colorize(:yellow)
|
139
|
+
puts GameCreatures.data
|
140
|
+
STDIN.getc
|
141
|
+
puts 'GameMonsters'.colorize(:yellow)
|
142
|
+
puts GameMonsters.data
|
143
|
+
STDIN.getc
|
144
|
+
puts 'GamePeople'.colorize(:yellow)
|
145
|
+
puts GamePeople.data
|
146
|
+
STDIN.getc
|
147
|
+
puts 'GameItems'.colorize(:yellow)
|
148
|
+
puts GameItems.data
|
149
|
+
STDIN.getc
|
150
|
+
puts 'GameArmor'.colorize(:yellow)
|
151
|
+
puts GameArmor.data
|
152
|
+
STDIN.getc
|
153
|
+
puts 'GameWeapons'.colorize(:yellow)
|
154
|
+
puts GameWeapons.data
|
134
155
|
when 'vars', 'vs'
|
135
156
|
if param1
|
136
157
|
world.print_vars(param1)
|
@@ -228,7 +249,7 @@ module Gemwarrior
|
|
228
249
|
when 'inventory', 'inv'
|
229
250
|
unless param2.nil?
|
230
251
|
begin
|
231
|
-
item_const_name = Gemwarrior.const_get(Formatting.upstyle(param2))
|
252
|
+
item_const_name = Gemwarrior.const_get(Formatting.upstyle(param2, no_space: true))
|
232
253
|
item = item_const_name.new
|
233
254
|
world.player.inventory.items.push(item)
|
234
255
|
return "#{item.name} added to player inventory."
|
@@ -240,6 +261,20 @@ module Gemwarrior
|
|
240
261
|
return ERROR_DEBUG_STAT_PARAM_INVALID
|
241
262
|
end
|
242
263
|
end
|
264
|
+
when 'global', 'gl'
|
265
|
+
if param1.nil?
|
266
|
+
return world.instance_variables.join(', ')
|
267
|
+
elsif world.instance_variable_get("@#{param1}").nil?
|
268
|
+
return ERROR_DEBUG_GLOBAL_VAR_INVALID
|
269
|
+
elsif param2.nil?
|
270
|
+
return world.instance_variable_get("@#{param1}").to_s
|
271
|
+
else
|
272
|
+
val = false
|
273
|
+
val = param2.eql?('true') ? true : val
|
274
|
+
|
275
|
+
world.instance_variable_set("@#{param1}", val)
|
276
|
+
return "Instance variable #{param1} has been set to #{val}."
|
277
|
+
end
|
243
278
|
when 'spawn', 'sp'
|
244
279
|
player_cur_location = world.location_by_coords(world.player.cur_coords)
|
245
280
|
player_cur_location.populate_monsters(GameMonsters.data, spawn: true)
|
@@ -369,7 +404,7 @@ module Gemwarrior
|
|
369
404
|
end
|
370
405
|
when 'talk', 'tk'
|
371
406
|
if param1.nil?
|
372
|
-
return
|
407
|
+
return ERROR_TALK_TO_PARAM_MISSING
|
373
408
|
elsif param1.eql?('to')
|
374
409
|
if param2
|
375
410
|
param1 = param2
|
@@ -378,25 +413,45 @@ module Gemwarrior
|
|
378
413
|
end
|
379
414
|
end
|
380
415
|
|
381
|
-
|
416
|
+
talkable_name = param1
|
382
417
|
|
383
418
|
player_inventory = world.player.inventory
|
384
419
|
|
385
|
-
if player_inventory.contains_item?(
|
420
|
+
if player_inventory.contains_item?(talkable_name)
|
386
421
|
player_inventory.items.each do |person|
|
387
|
-
if person.name.eql?(
|
422
|
+
if person.name.eql?(talkable_name)
|
388
423
|
if person.talkable
|
389
|
-
return self.parse("use #{
|
424
|
+
return self.parse("use #{talkable_name}")
|
390
425
|
else
|
391
426
|
return ERROR_TALK_PARAM_UNTALKABLE
|
392
427
|
end
|
393
428
|
end
|
394
429
|
end
|
395
|
-
elsif player_cur_location.contains_item?(
|
430
|
+
elsif player_cur_location.contains_item?(talkable_name)
|
396
431
|
player_cur_location.items.each do |person|
|
397
|
-
if person.name.eql?(
|
432
|
+
if person.name.eql?(talkable_name)
|
398
433
|
if person.talkable
|
399
|
-
return self.parse("use #{
|
434
|
+
return self.parse("use #{talkable_name}")
|
435
|
+
else
|
436
|
+
return ERROR_TALK_PARAM_UNTALKABLE
|
437
|
+
end
|
438
|
+
end
|
439
|
+
end
|
440
|
+
elsif player_cur_location.has_monster?(talkable_name)
|
441
|
+
player_cur_location.monsters_abounding.each do |monster|
|
442
|
+
if monster.name.eql?(talkable_name)
|
443
|
+
if monster.talkable
|
444
|
+
return self.parse("use #{talkable_name}")
|
445
|
+
else
|
446
|
+
return ERROR_TALK_PARAM_UNTALKABLE
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|
450
|
+
elsif player_cur_location.has_boss?(talkable_name)
|
451
|
+
player_cur_location.bosses_abounding.each do |boss|
|
452
|
+
if boss.name.eql?(talkable_name)
|
453
|
+
if boss.talkable
|
454
|
+
return self.parse("use #{talkable_name}")
|
400
455
|
else
|
401
456
|
return ERROR_TALK_PARAM_UNTALKABLE
|
402
457
|
end
|
@@ -458,6 +513,18 @@ module Gemwarrior
|
|
458
513
|
end
|
459
514
|
end
|
460
515
|
end
|
516
|
+
elsif player_cur_location.has_monster?(item_name)
|
517
|
+
player_cur_location.monsters_abounding.each do |i|
|
518
|
+
if i.name.eql?(item_name)
|
519
|
+
return i.use(world)
|
520
|
+
end
|
521
|
+
end
|
522
|
+
elsif player_cur_location.has_boss?(item_name)
|
523
|
+
player_cur_location.bosses_abounding.each do |i|
|
524
|
+
if i.name.eql?(item_name)
|
525
|
+
return i.use(world)
|
526
|
+
end
|
527
|
+
end
|
461
528
|
end
|
462
529
|
|
463
530
|
if result.nil?
|
data/lib/gemwarrior/version.rb
CHANGED
data/lib/gemwarrior/world.rb
CHANGED
@@ -17,7 +17,14 @@ module Gemwarrior
|
|
17
17
|
WORLD_DIM_WIDTH = 10
|
18
18
|
WORLD_DIM_HEIGHT = 10
|
19
19
|
|
20
|
-
attr_accessor :monsters,
|
20
|
+
attr_accessor :monsters,
|
21
|
+
:locations,
|
22
|
+
:weapons,
|
23
|
+
:player,
|
24
|
+
:duration,
|
25
|
+
:emerald_beaten,
|
26
|
+
:shifty_to_jewel,
|
27
|
+
:shifty_has_jeweled
|
21
28
|
|
22
29
|
def describe(point)
|
23
30
|
desc_text = "[>>> #{point.name_display.upcase} <<<]".colorize(:cyan)
|
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.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Chadwick
|
@@ -302,6 +302,7 @@ files:
|
|
302
302
|
- lib/gemwarrior/entities/items/pedestal.rb
|
303
303
|
- lib/gemwarrior/entities/items/pond.rb
|
304
304
|
- lib/gemwarrior/entities/items/rope.rb
|
305
|
+
- lib/gemwarrior/entities/items/sand_jewel.rb
|
305
306
|
- lib/gemwarrior/entities/items/small_hole.rb
|
306
307
|
- lib/gemwarrior/entities/items/snowman.rb
|
307
308
|
- lib/gemwarrior/entities/items/sparkly_thing.rb
|
@@ -385,6 +386,4 @@ rubygems_version: 2.4.8
|
|
385
386
|
signing_key:
|
386
387
|
specification_version: 4
|
387
388
|
summary: RubyGem text adventure
|
388
|
-
test_files:
|
389
|
-
- spec/gemwarrior_spec.rb
|
390
|
-
- spec/spec_helper.rb
|
389
|
+
test_files: []
|