gemwarrior 0.9.27 → 0.9.28
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/lib/gemwarrior/battle.rb +4 -4
- data/lib/gemwarrior/entities/items/arena_master.rb +4 -4
- data/lib/gemwarrior/entities/items/bed.rb +6 -3
- data/lib/gemwarrior/entities/items/couch.rb +1 -1
- data/lib/gemwarrior/entities/items/floor_tile.rb +5 -2
- data/lib/gemwarrior/entities/items/gun.rb +1 -1
- data/lib/gemwarrior/entities/items/herb.rb +2 -2
- data/lib/gemwarrior/entities/items/ladder.rb +5 -2
- data/lib/gemwarrior/entities/items/letter.rb +19 -19
- data/lib/gemwarrior/entities/items/map.rb +1 -1
- data/lib/gemwarrior/entities/items/massive_door.rb +2 -2
- data/lib/gemwarrior/entities/items/opalaser.rb +1 -1
- data/lib/gemwarrior/entities/items/pedestal.rb +7 -4
- data/lib/gemwarrior/entities/items/pond.rb +2 -2
- data/lib/gemwarrior/entities/items/rope.rb +1 -1
- data/lib/gemwarrior/entities/items/small_hole.rb +1 -1
- data/lib/gemwarrior/entities/items/snowman.rb +5 -2
- data/lib/gemwarrior/entities/items/sparklything.rb +1 -1
- data/lib/gemwarrior/entities/items/tent.rb +1 -1
- data/lib/gemwarrior/entities/items/waterfall.rb +1 -1
- data/lib/gemwarrior/entities/location.rb +1 -1
- data/lib/gemwarrior/entities/player.rb +32 -27
- data/lib/gemwarrior/game.rb +17 -17
- data/lib/gemwarrior/misc/animation.rb +11 -11
- data/lib/gemwarrior/misc/music.rb +10 -10
- data/lib/gemwarrior/misc/player_levels.rb +35 -35
- data/lib/gemwarrior/misc/wordlist.rb +13 -13
- data/lib/gemwarrior/repl.rb +6 -6
- data/lib/gemwarrior/version.rb +1 -1
- metadata +2 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ea92ecd92e82bed49ccbc32262db0d5410da498
|
4
|
+
data.tar.gz: aa0cacc9f2ad4a9862e18ea9e322cef2c9f66b98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7057723058e0dc831025149a631e85575887f4e7833294c6c18abfb106c9a2342f6d49ad96e0dc093d8943ff1f0ff2bf862c00822179765c3080f4845285a1bb
|
7
|
+
data.tar.gz: fcd919287955783ab06085a282c358ea1b07dd4bf96277971912c44f18048b147e7f99d018bc50917259402f8133c5f295db6b77861120019573c5e231b5a490
|
data/bin/gemwarrior
CHANGED
File without changes
|
data/lib/gemwarrior/battle.rb
CHANGED
@@ -11,7 +11,7 @@ module Gemwarrior
|
|
11
11
|
BEAST_MODE_ATTACK = 100
|
12
12
|
|
13
13
|
## MESSAGES
|
14
|
-
|
14
|
+
ESCAPE_TEXT = '** POOF **'
|
15
15
|
|
16
16
|
attr_accessor :world, :player, :monster, :player_is_defending
|
17
17
|
|
@@ -38,7 +38,7 @@ module Gemwarrior
|
|
38
38
|
|
39
39
|
if is_arena
|
40
40
|
print 'Your opponent is now...'
|
41
|
-
Animation::run(phrase: "#{monster.name.upcase}!", speed: slow)
|
41
|
+
Animation::run(phrase: "#{monster.name.upcase}!", speed: :slow)
|
42
42
|
elsif is_event
|
43
43
|
puts "You are attacked by #{monster.name}!"
|
44
44
|
else
|
@@ -218,7 +218,7 @@ module Gemwarrior
|
|
218
218
|
end
|
219
219
|
|
220
220
|
print who_gets_wounded
|
221
|
-
Animation::run(
|
221
|
+
Animation::run(phrase: dmg.to_s, speed: :slow, oneline: true, alpha: false, random: false)
|
222
222
|
print " point(s)!\n"
|
223
223
|
end
|
224
224
|
|
@@ -355,7 +355,7 @@ module Gemwarrior
|
|
355
355
|
# STATUS TEXT
|
356
356
|
|
357
357
|
def print_escape_text
|
358
|
-
Animation::run(phrase:
|
358
|
+
Animation::run(phrase: ESCAPE_TEXT, oneline: true)
|
359
359
|
end
|
360
360
|
|
361
361
|
def print_battle_line
|
@@ -21,7 +21,7 @@ module Gemwarrior
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def use(player = nil)
|
24
|
-
puts "You approach #{ARENA_MASTER_NAME.colorize(:
|
24
|
+
puts "You approach #{ARENA_MASTER_NAME.colorize(color: :white, background: :black)}, the Arena Master, and ask to prove your mettle in the arena. She snickers to herself, but sees you have a good spirit about you."
|
25
25
|
puts
|
26
26
|
|
27
27
|
if player.rox >= 50
|
@@ -34,15 +34,15 @@ module Gemwarrior
|
|
34
34
|
puts
|
35
35
|
puts 'She finishes by wishing you good luck!'
|
36
36
|
|
37
|
-
return {:
|
37
|
+
return { type: 'arena', data: nil }
|
38
38
|
else
|
39
39
|
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.'
|
40
|
-
return {:
|
40
|
+
return { type: nil, data: nil }
|
41
41
|
end
|
42
42
|
else
|
43
43
|
puts 'She can tell you seem particularly poor today and says to come back when that has changed.'
|
44
44
|
puts
|
45
|
-
return {:
|
45
|
+
return { type: nil, data: nil }
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -5,6 +5,9 @@ require_relative '../item'
|
|
5
5
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Bed < Item
|
8
|
+
# CONSTANTS
|
9
|
+
USE_TEXT = '** ZZZZZ **'
|
10
|
+
|
8
11
|
def initialize
|
9
12
|
self.name = 'bed'
|
10
13
|
self.description = 'The place where you sleep when you are not adventuring.'
|
@@ -19,12 +22,12 @@ module Gemwarrior
|
|
19
22
|
def use(player = nil)
|
20
23
|
if player.at_full_hp?
|
21
24
|
puts 'You feel perfectly healthy and decide not to actually use the bed. Besides, the trail of fire ants currently leading up to and around the furniture seem somehow uninviting.'
|
22
|
-
{:
|
25
|
+
{ type: nil, data: nil }
|
23
26
|
else
|
24
|
-
Animation::run(
|
27
|
+
Animation::run(phrase: USE_TEXT)
|
25
28
|
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.'
|
26
29
|
puts '>> You regain a few hit points.'
|
27
|
-
{:
|
30
|
+
{ type: 'rest', data: 5 }
|
28
31
|
end
|
29
32
|
end
|
30
33
|
end
|
@@ -22,7 +22,7 @@ module Gemwarrior
|
|
22
22
|
else
|
23
23
|
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.'
|
24
24
|
puts '>> You regain a hit point.'
|
25
|
-
{:
|
25
|
+
{ type: 'rest', data: 1 }
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -4,6 +4,9 @@
|
|
4
4
|
require_relative '../item'
|
5
5
|
|
6
6
|
module Gemwarrior
|
7
|
+
# CONSTANTS
|
8
|
+
MOVE_TEXT = '*** SHOOOOOM ***'
|
9
|
+
|
7
10
|
class FloorTile < Item
|
8
11
|
def initialize
|
9
12
|
self.name = 'floor_tile'
|
@@ -23,9 +26,9 @@ module Gemwarrior
|
|
23
26
|
# stats
|
24
27
|
player.movements_made += 1
|
25
28
|
|
26
|
-
Animation::run(
|
29
|
+
Animation::run(phrase: MOVE_TEXT)
|
27
30
|
|
28
|
-
{:
|
31
|
+
{ type: 'move', data: 'Rock Piles' }
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
@@ -18,7 +18,7 @@ module Gemwarrior
|
|
18
18
|
|
19
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
|
23
23
|
end
|
24
24
|
end
|
@@ -21,10 +21,10 @@ module Gemwarrior
|
|
21
21
|
puts 'You place the entire, smallish plant 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.'
|
22
22
|
if player.at_full_hp?
|
23
23
|
puts '>> The herb has no medicinal effect, as you already feel perfectly healthy, but it was kind of tasty.'
|
24
|
-
{:
|
24
|
+
{ type: nil, data: nil }
|
25
25
|
else
|
26
26
|
puts '>> You regain a few hit points.'
|
27
|
-
{:
|
27
|
+
{ type: 'health', data: rand(3..5) }
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -5,6 +5,9 @@ require_relative '../item'
|
|
5
5
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Ladder < Item
|
8
|
+
# CONSTANTS
|
9
|
+
USE_TEXT = '*** THUMP ***'
|
10
|
+
|
8
11
|
def initialize
|
9
12
|
self.name = 'ladder'
|
10
13
|
self.description = 'Rickety and crudely-fashioned, this ladder descends down into the dropoff, hopefully heading towards something...anything.'
|
@@ -23,12 +26,12 @@ module Gemwarrior
|
|
23
26
|
# stats
|
24
27
|
player.movements_made += 1
|
25
28
|
|
26
|
-
Animation::run(
|
29
|
+
Animation::run(phrase: USE_TEXT)
|
27
30
|
|
28
31
|
puts 'The last couple of steps are more slippery than you anticipated, so you end up fumbling them, falling a few feet onto the hard ground below. When you regain your composure, you notice your conveyance for descending is now far above you and it is, unfortunately, your closest known exit.'
|
29
32
|
puts
|
30
33
|
|
31
|
-
{:
|
34
|
+
{ type: 'move_dangerous', data: 'Metal Tunnel (South Entrance)' }
|
32
35
|
end
|
33
36
|
end
|
34
37
|
end
|
@@ -29,12 +29,12 @@ module Gemwarrior
|
|
29
29
|
print "\n"
|
30
30
|
print_letter(player)
|
31
31
|
else
|
32
|
-
{:
|
32
|
+
{ type: nil, data: nil }
|
33
33
|
end
|
34
34
|
else
|
35
35
|
self.used = true
|
36
36
|
print_letter(player)
|
37
|
-
{:
|
37
|
+
{ type: 'xp', data: 3 }
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -43,28 +43,28 @@ module Gemwarrior
|
|
43
43
|
def print_letter(player)
|
44
44
|
puts 'The words of the queen echo in your head as you read the royal note sent to you again:'
|
45
45
|
puts
|
46
|
-
Animation::run(
|
46
|
+
Animation::run(phrase: " Dear #{player.name},", speed: :insane)
|
47
47
|
puts
|
48
|
-
Animation::run(
|
49
|
-
Animation::run(
|
50
|
-
Animation::run(
|
51
|
-
Animation::run(
|
48
|
+
Animation::run(phrase: ' Oh, my! Jool is in trouble! The evil wizard/sorceror/conjuror/rocksmith/wily ', speed: :insane)
|
49
|
+
Animation::run(phrase: " Emerald has absconded with our ShinyThing(tm)! It is vital that you, #{player.name}, ", speed: :insane)
|
50
|
+
Animation::run(phrase: ' go to his tower in the sky in order to retrieve it before he does something', speed: :insane)
|
51
|
+
Animation::run(phrase: ' terrible with it!', speed: :insane)
|
52
52
|
puts
|
53
|
-
Animation::run(
|
54
|
-
Animation::run(
|
55
|
-
Animation::run(
|
53
|
+
Animation::run(phrase: ' Remember that one time you came to the castle, trying to sell stones you', speed: :insane)
|
54
|
+
Animation::run(phrase: ' pilfered from a nearby cave? Remember how I laughed and told you to leave', speed: :insane)
|
55
|
+
Animation::run(phrase: ' at once or I\'d have the royal guard take your head off? Ha!', speed: :insane)
|
56
56
|
puts
|
57
|
-
Animation::run(
|
58
|
-
Animation::run(
|
59
|
-
Animation::run(
|
60
|
-
Animation::run(
|
57
|
+
Animation::run(phrase: ' What a fool I was to cast such a special person out, as a mysterious stranger', speed: :insane)
|
58
|
+
Animation::run(phrase: " in the night told me, before mysteriously disappearing, that you, #{player.name},", speed: :insane)
|
59
|
+
Animation::run(phrase: ' are actually the only one who can save us (for some reason, but that\'s', speed: :insane)
|
60
|
+
Animation::run(phrase: ' mysterious strangers for you, right?)!', speed: :insane)
|
61
61
|
puts
|
62
|
-
Animation::run(
|
63
|
-
Animation::run(
|
64
|
-
Animation::run(
|
62
|
+
Animation::run(phrase: ' Please, I beg of you, save Jool from the potential terror that Emerald could', speed: :insane)
|
63
|
+
Animation::run(phrase: " possibly wreak on all of us before it is too late! If you do, you, #{player.name},", speed: :insane)
|
64
|
+
Animation::run(phrase: ' will be rewarded handsomely!', speed: :insane)
|
65
65
|
puts
|
66
|
-
Animation::run(
|
67
|
-
Animation::run(
|
66
|
+
Animation::run(phrase: ' Sincerely,', speed: :insane);
|
67
|
+
Animation::run(phrase: ' Queen Ruby', speed: :insane);
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -20,10 +20,10 @@ module Gemwarrior
|
|
20
20
|
puts 'You attempt to open the seriously massive door that separates you from Emerald himself.'
|
21
21
|
if player.inventory.contains_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
|
25
25
|
puts 'Your hand just goes right through the astonishingly gigantic door, but the rest of your body does not. A moment later, your hand is shoved backwards by some unknown force, and you remain where you were before your unsuccessful attempt.'
|
26
|
-
{:
|
26
|
+
{ type: nil, data: nil }
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -4,7 +4,10 @@
|
|
4
4
|
require_relative '../item'
|
5
5
|
|
6
6
|
module Gemwarrior
|
7
|
-
class Pedestal < Item
|
7
|
+
class Pedestal < Item
|
8
|
+
# CONSTANTS
|
9
|
+
USE_TEXT = '*** WHOOOOOSH ***'
|
10
|
+
|
8
11
|
attr_accessor :switches
|
9
12
|
|
10
13
|
def initialize
|
@@ -98,14 +101,14 @@ module Gemwarrior
|
|
98
101
|
# stats
|
99
102
|
player.movements_made += 1
|
100
103
|
|
101
|
-
Animation::run(
|
102
|
-
return {:
|
104
|
+
Animation::run(phrase: USE_TEXT)
|
105
|
+
return { type: 'move', data: 'Sky Tower (Entryway)' }
|
103
106
|
else
|
104
107
|
puts 'You attempt to push the large gem, but it puts up quite the resistance, and nothing much else happens. Your attention once again returns to the pedestal and its switches.'.colorize(:red)
|
105
108
|
end
|
106
109
|
when '8'
|
107
110
|
puts 'You step away from the mysterious pedestal.'
|
108
|
-
return {:
|
111
|
+
return { type: nil, data: nil }
|
109
112
|
else
|
110
113
|
next
|
111
114
|
end
|
@@ -25,10 +25,10 @@ module Gemwarrior
|
|
25
25
|
if (NEEDED_ITEMS - player.inventory.items.map(&:name)).empty?
|
26
26
|
puts 'The pond water explodes with a force that knocks you back onto the ground. When you come to, you notice the depression in the ground where the pond once was now has a new curious object!'
|
27
27
|
self.description = 'A barren depression in the ground is all that is left of the pond.'
|
28
|
-
return {:
|
28
|
+
return { type: 'item', data: 'Opalaser' }
|
29
29
|
else
|
30
30
|
puts 'You graze your fingers within the pond for a moment, feeling the coolness. You feel zen.'
|
31
|
-
return {:
|
31
|
+
return { type: nil, data: nil }
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -5,6 +5,9 @@ require_relative '../item'
|
|
5
5
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Snowman < Item
|
8
|
+
# CONSTANTS
|
9
|
+
USE_TEXT = '*** FOOOOSH ***'
|
10
|
+
|
8
11
|
def initialize
|
9
12
|
self.name = 'snowman'
|
10
13
|
self.description = 'Standing solemnly in the snow, a man of snow solemnly stands.'
|
@@ -20,9 +23,9 @@ module Gemwarrior
|
|
20
23
|
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
24
|
puts
|
22
25
|
|
23
|
-
Animation::run(
|
26
|
+
Animation::run(phrase: USE_TEXT)
|
24
27
|
|
25
|
-
{:
|
28
|
+
{ type: 'move_dangerous', data: 'Home' }
|
26
29
|
end
|
27
30
|
end
|
28
31
|
end
|
@@ -18,7 +18,7 @@ module Gemwarrior
|
|
18
18
|
|
19
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
|
23
23
|
end
|
24
24
|
end
|
@@ -7,7 +7,7 @@ module Gemwarrior
|
|
7
7
|
class Location < Entity
|
8
8
|
# CONSTANTS
|
9
9
|
## HASHES
|
10
|
-
DANGER_LEVEL = {:
|
10
|
+
DANGER_LEVEL = { none: 0, low: 15, moderate: 30, high: 55, assured: 100 }
|
11
11
|
|
12
12
|
## ERRORS
|
13
13
|
ERROR_LOCATION_ITEM_REMOVE_INVALID = 'That item cannot be removed as it does not exist here.'
|
@@ -10,6 +10,11 @@ require_relative '../misc/wordlist'
|
|
10
10
|
|
11
11
|
module Gemwarrior
|
12
12
|
class Player < Creature
|
13
|
+
# CONSTANTS
|
14
|
+
LEVEL_UP_TEXT = '** LEVEL UP! **'
|
15
|
+
REST_FULL_TEXT = '** HMMMM **'
|
16
|
+
REST_NOT_FULL_TEXT = '** ZZZZZ **'
|
17
|
+
|
13
18
|
include PlayerLevels
|
14
19
|
include Formatting
|
15
20
|
|
@@ -103,7 +108,7 @@ module Gemwarrior
|
|
103
108
|
|
104
109
|
def rest(world, tent_uses = nil, ensure_fight = false)
|
105
110
|
if ensure_fight
|
106
|
-
battle = Battle.new(
|
111
|
+
battle = Battle.new(world: world, player: self, monster: world.monsters[rand(0..world.monsters.length-1)].clone)
|
107
112
|
result = battle.start(is_arena = false, is_event = true)
|
108
113
|
if result.eql?('death')
|
109
114
|
return 'death'
|
@@ -118,7 +123,7 @@ module Gemwarrior
|
|
118
123
|
chance_of_ambush = rand(0..100)
|
119
124
|
|
120
125
|
if chance_of_ambush < 25
|
121
|
-
battle = Battle.new(
|
126
|
+
battle = Battle.new(world: world, player: self, monster: cur_loc.monsters_abounding[rand(0..cur_loc.monsters_abounding.length-1)].clone)
|
122
127
|
return battle.start(is_arena = false, is_event = true)
|
123
128
|
end
|
124
129
|
end
|
@@ -138,16 +143,16 @@ module Gemwarrior
|
|
138
143
|
if self.at_full_hp?
|
139
144
|
puts 'Despite feeling just fine, health-wise, you decide to set up camp for the ni--well, actually, after a few minutes you realize you don\'t need to sleep and pack things up again, ready to go.'
|
140
145
|
else
|
141
|
-
Animation::run(
|
146
|
+
Animation::run(phrase: REST_NOT_FULL_TEXT)
|
142
147
|
puts "You brandish the trusty magical canvas and, with a flick of the wrist, your home for the evening is set up. Approximately #{hours} #{hours_text}, #{minutes} #{mins_text}, and #{seconds} #{secs_text} later, you wake up, fully rested, ready for adventure."
|
143
148
|
self.hp_cur = self.hp_max
|
144
149
|
end
|
145
150
|
else
|
146
151
|
if self.at_full_hp?
|
147
|
-
Animation::run(
|
152
|
+
Animation::run(phrase: REST_FULL_TEXT)
|
148
153
|
puts 'You sit down on the ground, make some notes on the back of your hand, test the air, and then return to standing, back at it all again.'
|
149
154
|
else
|
150
|
-
Animation::run(
|
155
|
+
Animation::run(phrase: REST_NOT_FULL_TEXT)
|
151
156
|
puts "You lie down somewhere quasi-flat and after a few moments, due to extreme exhaustion, you fall into a deep, yet troubled, slumber. Approximately #{hours} #{hours_text}, #{minutes} #{mins_text}, and #{seconds} #{secs_text} later, you wake up with a start. Upon getting to your feet you look around, notice you feel somewhat better, and wonder why you dreamt about #{WordList.new(world.use_wordnik, 'noun-plural').get_random_value}."
|
152
157
|
|
153
158
|
self.hp_cur = self.hp_cur.to_i + rand(10..15)
|
@@ -183,30 +188,30 @@ module Gemwarrior
|
|
183
188
|
case direction
|
184
189
|
when 'north', 'n'
|
185
190
|
self.cur_coords = {
|
186
|
-
:
|
187
|
-
:
|
188
|
-
:
|
191
|
+
x: cur_coords[:x],
|
192
|
+
y: cur_coords[:y]+1,
|
193
|
+
z: cur_coords[:z]
|
189
194
|
}
|
190
195
|
direction_text = '^^^'
|
191
196
|
when 'east', 'e'
|
192
197
|
self.cur_coords = {
|
193
|
-
:
|
194
|
-
:
|
195
|
-
:
|
198
|
+
x: cur_coords[:x]+1,
|
199
|
+
y: cur_coords[:y],
|
200
|
+
z: cur_coords[:z]
|
196
201
|
}
|
197
202
|
direction_text = '>>>'
|
198
203
|
when 'south', 's'
|
199
204
|
self.cur_coords = {
|
200
|
-
:
|
201
|
-
:
|
202
|
-
:
|
205
|
+
x: cur_coords[:x],
|
206
|
+
y: cur_coords[:y]-1,
|
207
|
+
z: cur_coords[:z]
|
203
208
|
}
|
204
209
|
direction_text = 'vvv'
|
205
210
|
when 'west', 'w'
|
206
211
|
self.cur_coords = {
|
207
|
-
:
|
208
|
-
:
|
209
|
-
:
|
212
|
+
x: cur_coords[:x]-1,
|
213
|
+
y: cur_coords[:y],
|
214
|
+
z: cur_coords[:z]
|
210
215
|
}
|
211
216
|
direction_text = '<<<'
|
212
217
|
end
|
@@ -221,7 +226,7 @@ module Gemwarrior
|
|
221
226
|
end
|
222
227
|
|
223
228
|
def attack(world, monster)
|
224
|
-
battle = Battle.new(
|
229
|
+
battle = Battle.new(world: world, player: self, monster: monster)
|
225
230
|
result = battle.start
|
226
231
|
if result.eql?('death')
|
227
232
|
return 'death'
|
@@ -280,7 +285,7 @@ module Gemwarrior
|
|
280
285
|
new_player_level = PlayerLevels::check_level(self.xp)
|
281
286
|
|
282
287
|
if new_player_level > old_player_level
|
283
|
-
Animation::run(
|
288
|
+
Animation::run(phrase: LEVEL_UP_TEXT)
|
284
289
|
new_stats = PlayerLevels::get_level_stats(new_player_level)
|
285
290
|
|
286
291
|
self.level = new_stats[:level]
|
@@ -312,10 +317,10 @@ module Gemwarrior
|
|
312
317
|
def player_death
|
313
318
|
if world.sound
|
314
319
|
Music::cue([
|
315
|
-
{:
|
316
|
-
{:
|
317
|
-
{:
|
318
|
-
{:
|
320
|
+
{ frequencies: 'D#5', duration: 100 },
|
321
|
+
{ frequencies: 'A4', duration: 150 },
|
322
|
+
{ frequencies: 'F#4', duration: 200 },
|
323
|
+
{ frequencies: 'F4', duration: 1000 }
|
319
324
|
])
|
320
325
|
end
|
321
326
|
|
@@ -328,12 +333,12 @@ module Gemwarrior
|
|
328
333
|
def print_traveling_text(direction_text, sound)
|
329
334
|
if sound
|
330
335
|
Music::cue([
|
331
|
-
{:
|
332
|
-
{:
|
333
|
-
{:
|
336
|
+
{ frequencies: 'C4', duration: 75 },
|
337
|
+
{ frequencies: 'D4', duration: 75 },
|
338
|
+
{ frequencies: 'E4', duration: 75 }
|
334
339
|
])
|
335
340
|
end
|
336
|
-
Animation::run(
|
341
|
+
Animation::run(phrase: "* #{direction_text} *", oneline: false)
|
337
342
|
end
|
338
343
|
|
339
344
|
# CHARACTER
|
data/lib/gemwarrior/game.rb
CHANGED
@@ -41,24 +41,24 @@ module Gemwarrior
|
|
41
41
|
world.extra_command = options.fetch(:extra_command)
|
42
42
|
|
43
43
|
world.player = Player.new({
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
44
|
+
description: PLAYER_DESC_DEFAULT,
|
45
|
+
level: start_stats[:level],
|
46
|
+
xp: start_stats[:xp_start],
|
47
|
+
hp_cur: start_stats[:hp_max],
|
48
|
+
hp_max: start_stats[:hp_max],
|
49
|
+
stam_cur: start_stats[:stam_max],
|
50
|
+
stam_max: start_stats[:stam_max],
|
51
|
+
atk_lo: start_stats[:atk_lo],
|
52
|
+
atk_hi: start_stats[:atk_hi],
|
53
|
+
defense: start_stats[:defense],
|
54
|
+
dexterity: start_stats[:dexterity],
|
55
|
+
inventory: world.debug_mode ? PLAYER_INVENTORY_DEBUG : PLAYER_INVENTORY_DEFAULT,
|
56
|
+
rox: world.debug_mode ? PLAYER_ROX_DEBUG : PLAYER_ROX_DEFAULT,
|
57
|
+
cur_coords: world.location_coords_by_name('Home'),
|
58
58
|
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
59
|
+
god_mode: options.fetch(:god_mode),
|
60
|
+
beast_mode: options.fetch(:beast_mode),
|
61
|
+
use_wordnik: options.fetch(:use_wordnik)
|
62
62
|
})
|
63
63
|
|
64
64
|
# create options file if not existing
|
@@ -5,21 +5,21 @@ module Gemwarrior
|
|
5
5
|
module Animation
|
6
6
|
def self.run(opts)
|
7
7
|
options = {
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
8
|
+
oneline: false,
|
9
|
+
speed: nil,
|
10
|
+
alpha: true,
|
11
|
+
numeric: true,
|
12
|
+
random: true
|
13
13
|
}.merge(opts)
|
14
14
|
|
15
15
|
th = Thread.new do
|
16
16
|
print Matrext::process({
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
17
|
+
phrase: options.fetch(:phrase),
|
18
|
+
oneline: options.fetch(:oneline),
|
19
|
+
speed: options.fetch(:speed),
|
20
|
+
alpha: options.fetch(:alpha),
|
21
|
+
numeric: options.fetch(:numeric),
|
22
|
+
random: options.fetch(:random)
|
23
23
|
})
|
24
24
|
end
|
25
25
|
|
@@ -25,11 +25,11 @@ module Gemwarrior
|
|
25
25
|
require_relative 'musical_notes'
|
26
26
|
|
27
27
|
feep_defaults = {
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
28
|
+
frequencies: '440',
|
29
|
+
waveform: 'sine',
|
30
|
+
volume: 0.3,
|
31
|
+
duration: 500,
|
32
|
+
notext: true
|
33
33
|
}
|
34
34
|
|
35
35
|
Thread.start {
|
@@ -37,11 +37,11 @@ module Gemwarrior
|
|
37
37
|
seq = feep_defaults.merge(seq)
|
38
38
|
|
39
39
|
Feep::Base.new({
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
40
|
+
freq_or_note: seq[:frequencies],
|
41
|
+
waveform: seq[:waveform],
|
42
|
+
volume: seq[:volume],
|
43
|
+
duration: seq[:duration],
|
44
|
+
notext: seq[:notext]
|
45
45
|
})
|
46
46
|
end
|
47
47
|
}
|
@@ -7,59 +7,59 @@ module Gemwarrior
|
|
7
7
|
case level
|
8
8
|
when 1
|
9
9
|
{
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
10
|
+
level: 1, xp_start: 0,
|
11
|
+
hp_max: 30, stam_max: 20,
|
12
|
+
atk_lo: 1, atk_hi: 2,
|
13
|
+
defense: 5, dexterity: 5,
|
14
|
+
special_abilities: nil
|
15
15
|
}
|
16
16
|
when 2
|
17
17
|
{
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
18
|
+
level: 2, xp_start: 50,
|
19
|
+
hp_max: 35, stam_max: 25,
|
20
|
+
atk_lo: 2, atk_hi: 3,
|
21
|
+
defense: 6, dexterity: 6,
|
22
|
+
special_abilities: :rocking_vision
|
23
23
|
}
|
24
24
|
when 3
|
25
25
|
{
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
26
|
+
level: 3, xp_start: 120,
|
27
|
+
hp_max: 45, stam_max: 30,
|
28
|
+
atk_lo: 3, atk_hi: 5,
|
29
|
+
defense: 7, dexterity: 8,
|
30
|
+
special_abilities: :rock_slide
|
31
31
|
}
|
32
32
|
when 4
|
33
33
|
{
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
34
|
+
level: 4, xp_start: 250,
|
35
|
+
hp_max: 55, stam_max: 35,
|
36
|
+
atk_lo: 5, atk_hi: 6,
|
37
|
+
defense: 8, dexterity: 9,
|
38
|
+
special_abilities: :stone_face
|
39
39
|
}
|
40
40
|
when 5
|
41
41
|
{
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
42
|
+
level: 5, xp_start: 600,
|
43
|
+
hp_max: 70, stam_max: 45,
|
44
|
+
atk_lo: 7, atk_hi: 8,
|
45
|
+
defense: 10, dexterity: 11,
|
46
|
+
special_abilities: :graniton
|
47
47
|
}
|
48
48
|
when 6
|
49
49
|
{
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
50
|
+
level: 6, xp_start: 1000,
|
51
|
+
hp_max: 85, stam_max: 60,
|
52
|
+
atk_lo: 8, atk_hi: 10,
|
53
|
+
defense: 13, dexterity: 13,
|
54
|
+
special_abilities: :gleam
|
55
55
|
}
|
56
56
|
when 7
|
57
57
|
{
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
58
|
+
level: 7, xp_start: 1500,
|
59
|
+
hp_max: 100, stam_max: 80,
|
60
|
+
atk_lo: 10, atk_hi: 12,
|
61
|
+
defense: 15, dexterity: 16,
|
62
|
+
special_abilities: :break_through
|
63
63
|
}
|
64
64
|
end
|
65
65
|
end
|
@@ -55,19 +55,19 @@ module Gemwarrior
|
|
55
55
|
|
56
56
|
json_return = HTTP.get(
|
57
57
|
url,
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:
|
66
|
-
:
|
67
|
-
:
|
68
|
-
:
|
69
|
-
:limit
|
70
|
-
:api_key
|
58
|
+
params: {
|
59
|
+
hasDictionaryDef: true,
|
60
|
+
includePartOfSpeech: type,
|
61
|
+
minCorpusCount: 1,
|
62
|
+
maxCorpusCount: -1,
|
63
|
+
minDictionaryCount: 1,
|
64
|
+
maxDictionaryCount: -1,
|
65
|
+
minLength: 5,
|
66
|
+
maxLength: 12,
|
67
|
+
sortBy: 'alpha',
|
68
|
+
sortOrder: 'asc',
|
69
|
+
limit: limit,
|
70
|
+
api_key: api_key
|
71
71
|
}
|
72
72
|
)
|
73
73
|
|
data/lib/gemwarrior/repl.rb
CHANGED
@@ -104,16 +104,16 @@ module Gemwarrior
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def print_about_text
|
107
|
-
puts 'Gem Warrior - A Game of Fortune and Mayhem'
|
108
|
-
puts '=========================================='
|
107
|
+
puts 'Gem Warrior - A Game of Fortune and Mayhem'.colorize(:yellow)
|
108
|
+
puts '=========================================='.colorize(:yellow)
|
109
109
|
puts 'Gem Warrior is a text adventure roguelike-lite as a RubyGem created by Michael Chadwick (mike@codana.me) and released as open-source on Github. Take on the task set by Queen Ruby to defeat the evil Emerald and get back the ShinyThing(tm) he stole for terrible, dastardly reasons.'
|
110
110
|
puts
|
111
111
|
puts 'Explore the land of Jool with the power of text, fighting enemies to improve your station, grabbing curious items that may or may not come in handy, and finally defeating Mr. Emerald himself to win the game.'
|
112
112
|
end
|
113
113
|
|
114
114
|
def print_help_text
|
115
|
-
puts 'Gem Warrior - Some Basic Help Commands'
|
116
|
-
puts '======================================'
|
115
|
+
puts 'Gem Warrior - Some Basic Help Commands'.colorize(:yellow)
|
116
|
+
puts '======================================'.colorize(:yellow)
|
117
117
|
puts '* Basic functions: look, go, character, inventory, attack *'
|
118
118
|
puts '* Type \'help\' while in-game for complete list of commands *'
|
119
119
|
puts '* Most commands can be abbreviated to their first letter *'
|
@@ -123,8 +123,8 @@ module Gemwarrior
|
|
123
123
|
options = read_options_file
|
124
124
|
|
125
125
|
puts
|
126
|
-
puts 'Gem Warrior Options'
|
127
|
-
puts '======================='
|
126
|
+
puts 'Gem Warrior Options'.colorize(:yellow)
|
127
|
+
puts '======================='.colorize(:yellow)
|
128
128
|
if options.nil?
|
129
129
|
puts 'No options set yet.'
|
130
130
|
else
|
data/lib/gemwarrior/version.rb
CHANGED
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.9.
|
4
|
+
version: 0.9.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Chadwick
|
@@ -323,6 +323,4 @@ rubygems_version: 2.4.8
|
|
323
323
|
signing_key:
|
324
324
|
specification_version: 4
|
325
325
|
summary: RubyGem text adventure
|
326
|
-
test_files:
|
327
|
-
- spec/rubywarrior_spec.rb
|
328
|
-
- spec/spec_helper.rb
|
326
|
+
test_files: []
|