gemwarrior 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/locations.yml +1 -0
- data/lib/gemwarrior/entities/item.rb +1 -1
- data/lib/gemwarrior/entities/items/letter.rb +65 -0
- data/lib/gemwarrior/evaluator.rb +5 -2
- data/lib/gemwarrior/repl.rb +56 -4
- data/lib/gemwarrior/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2ee6dadfaa5663c15f0ae742fa52ea05d18d079
|
4
|
+
data.tar.gz: 09eacbb70a2e4c5f2c234754ac0fa5671f7e2946
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2496610b4c3e6902a74f8c1aab43dab7d9f4fb4bce407ad8962110bc5c3e346222282d1d6d47303d2ee0570d38715ab857d7389fdc77fd1a53c6beedcabd7f1f
|
7
|
+
data.tar.gz: add25926fc69c94024d67eb2a9e8f2b242386ba4b78cb91de9ce974c66b9840b675f4d84a3c438a5f71f421382cdd7441f64d12888256c8056229c22c95e8137
|
data/data/locations.yml
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
# lib/gemwarrior/entities/items/letter.rb
|
2
|
+
# Item::Letter
|
3
|
+
|
4
|
+
require_relative '../item'
|
5
|
+
|
6
|
+
module Gemwarrior
|
7
|
+
class Letter < Item
|
8
|
+
def initialize
|
9
|
+
self.name = 'letter'
|
10
|
+
self.description = 'A single page of thin paper, folded at the middle, with some excellent penmanship impressed upon it.'
|
11
|
+
self.atk_lo = nil
|
12
|
+
self.atk_hi = nil
|
13
|
+
self.takeable = true
|
14
|
+
self.useable = true
|
15
|
+
self.equippable = false
|
16
|
+
self.equipped = false
|
17
|
+
self.used = false
|
18
|
+
end
|
19
|
+
|
20
|
+
def use(player = nil)
|
21
|
+
if self.used
|
22
|
+
puts 'Do you want to read the letter again? (Y/N)'
|
23
|
+
print '> '
|
24
|
+
|
25
|
+
choice = STDIN.getch
|
26
|
+
|
27
|
+
case choice
|
28
|
+
when 'y'
|
29
|
+
print "\n"
|
30
|
+
print_letter(player)
|
31
|
+
else
|
32
|
+
{:type => nil, :data => nil}
|
33
|
+
end
|
34
|
+
else
|
35
|
+
self.used = true
|
36
|
+
print_letter(player)
|
37
|
+
{:type => 'xp', :data => 3}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def print_letter(player)
|
44
|
+
puts 'The words of the queen echo in your head as you read the royal note sent to you again:'
|
45
|
+
puts
|
46
|
+
Animation::run({phrase: " Dear #{player.name},", speed: :insane})
|
47
|
+
puts
|
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 terrible with it!", speed: :insane})
|
51
|
+
puts
|
52
|
+
Animation::run({phrase: " Remember that one time you came to the castle, trying to sell stones you pilfered from a nearby cave? ", speed: :insane})
|
53
|
+
Animation::run({phrase: " Remember how I laughed and told you to leave at once or I\'d have the royal guard take your head off? Ha! ", speed: :insane})
|
54
|
+
Animation::run({phrase: " What a fool I was to cast such a special person out, as a mysterious stranger in the night told me, before ", speed: :insane})
|
55
|
+
Animation::run({phrase: " mysteriously disappearing, that you, #{player.name}, are actually the only one who can save us (for some reason, ", speed: :insane})
|
56
|
+
Animation::run({phrase: " but that's mysterious strangers for you, right?)!", speed: :insane})
|
57
|
+
puts
|
58
|
+
Animation::run({phrase: " Please, I beg of you, save Jool from the potential terror that Emerald could possibly wreak on all ", speed: :insane})
|
59
|
+
Animation::run({phrase: " of us before it is too late! If you do, you, #{player.name}, will be rewarded handsomely!", speed: :insane})
|
60
|
+
puts
|
61
|
+
Animation::run({phrase: ' Sincerely,', speed: :insane});
|
62
|
+
Animation::run({phrase: ' Queen Ruby', speed: :insane});
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/lib/gemwarrior/evaluator.rb
CHANGED
@@ -310,7 +310,7 @@ module Gemwarrior
|
|
310
310
|
end
|
311
311
|
end
|
312
312
|
end
|
313
|
-
|
313
|
+
|
314
314
|
if result.nil?
|
315
315
|
ERROR_USE_PARAM_INVALID
|
316
316
|
else
|
@@ -328,6 +328,9 @@ binding.pry
|
|
328
328
|
when 'rest', 'health'
|
329
329
|
world.player.heal_damage(result[:data])
|
330
330
|
return
|
331
|
+
when 'xp'
|
332
|
+
world.player.xp += result[:data]
|
333
|
+
return
|
331
334
|
when 'action'
|
332
335
|
case result[:data]
|
333
336
|
when 'rest'
|
@@ -432,7 +435,7 @@ binding.pry
|
|
432
435
|
private
|
433
436
|
|
434
437
|
def print_separator
|
435
|
-
puts "
|
438
|
+
puts "========================================================="
|
436
439
|
end
|
437
440
|
|
438
441
|
def list_commands
|
data/lib/gemwarrior/repl.rb
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
require 'readline'
|
5
5
|
require 'os'
|
6
6
|
require 'clocker'
|
7
|
+
require 'io/console'
|
7
8
|
|
8
9
|
require_relative 'misc/timer'
|
9
10
|
require_relative 'misc/wordlist'
|
@@ -93,11 +94,62 @@ module Gemwarrior
|
|
93
94
|
|
94
95
|
def print_help
|
95
96
|
puts '* Basic functions: look, go, character, inventory, attack *'
|
96
|
-
puts '* Type \'help\' for complete command list'
|
97
|
+
puts '* Type \'help\' while in-game for complete command list'
|
97
98
|
puts '* Most commands can be abbreviated to their first letter *'
|
98
99
|
puts
|
99
100
|
end
|
100
101
|
|
102
|
+
def print_about_text
|
103
|
+
puts 'Gem Warrior - A Game of Fortune and Mayhem'
|
104
|
+
puts '=========================================='
|
105
|
+
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.'
|
106
|
+
puts
|
107
|
+
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.'
|
108
|
+
puts
|
109
|
+
end
|
110
|
+
|
111
|
+
def print_main_menu
|
112
|
+
puts '======================='
|
113
|
+
puts ' (N)ew Game'
|
114
|
+
puts ' (A)bout'
|
115
|
+
puts ' (H)elp'
|
116
|
+
puts ' (E)xit'
|
117
|
+
puts '======================='
|
118
|
+
puts
|
119
|
+
end
|
120
|
+
|
121
|
+
def print_main_menu_prompt
|
122
|
+
print '> '
|
123
|
+
end
|
124
|
+
|
125
|
+
def run_main_menu(show_choices = true)
|
126
|
+
print_main_menu if show_choices
|
127
|
+
print_main_menu_prompt if show_choices
|
128
|
+
|
129
|
+
choice = STDIN.getch
|
130
|
+
|
131
|
+
case choice
|
132
|
+
when 'n'
|
133
|
+
clear_screen
|
134
|
+
print_splash_message
|
135
|
+
print_fortune
|
136
|
+
return
|
137
|
+
when 'a'
|
138
|
+
puts choice
|
139
|
+
print_about_text
|
140
|
+
run_main_menu
|
141
|
+
when 'h'
|
142
|
+
puts choice
|
143
|
+
print_help
|
144
|
+
run_main_menu
|
145
|
+
when 'e', 'x'
|
146
|
+
puts choice
|
147
|
+
exit(0)
|
148
|
+
else
|
149
|
+
run_main_menu(show_choices = false)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
101
153
|
def print_stats(duration, pl)
|
102
154
|
puts '######################################################################'
|
103
155
|
print 'Gem Warrior'.colorize(:color => :white, :background => :black)
|
@@ -118,9 +170,9 @@ module Gemwarrior
|
|
118
170
|
# welcome player to game
|
119
171
|
clear_screen
|
120
172
|
print_logo
|
121
|
-
|
122
|
-
|
123
|
-
|
173
|
+
|
174
|
+
# main menu loop until new game or exit
|
175
|
+
run_main_menu
|
124
176
|
|
125
177
|
# hook to do something right off the bat
|
126
178
|
puts eval.evaluate(initialCommand) unless initialCommand.nil?
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Chadwick
|
@@ -223,6 +223,7 @@ files:
|
|
223
223
|
- lib/gemwarrior/entities/items/herb.rb
|
224
224
|
- lib/gemwarrior/entities/items/keystone.rb
|
225
225
|
- lib/gemwarrior/entities/items/ladder.rb
|
226
|
+
- lib/gemwarrior/entities/items/letter.rb
|
226
227
|
- lib/gemwarrior/entities/items/map.rb
|
227
228
|
- lib/gemwarrior/entities/items/massive_door.rb
|
228
229
|
- lib/gemwarrior/entities/items/opalaser.rb
|