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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fd4f2829fa36f0e9733feaeb0af9a3736b4e01c
4
- data.tar.gz: 4fef9b71b92f45d5922a6af56cd01733221eac6c
3
+ metadata.gz: a2ee6dadfaa5663c15f0ae742fa52ea05d18d079
4
+ data.tar.gz: 09eacbb70a2e4c5f2c234754ac0fa5671f7e2946
5
5
  SHA512:
6
- metadata.gz: 6c334208a7d95f2d6ff4f838b07b46f3de2793c6f3d050c4a0923f16d84fa035564b76a969699e67b7d91b194fc6284e84a165054f84e3718d565c48878ddca9
7
- data.tar.gz: 484df509d4ea830a7f0bd538ad98e8980b5de3bbf37dbcd623f0bf5087e2bc640b715cf0e5cbd293f9bead938c12cd1819191ea32ecf048e21123917e1095d17
6
+ metadata.gz: 2496610b4c3e6902a74f8c1aab43dab7d9f4fb4bce407ad8962110bc5c3e346222282d1d6d47303d2ee0570d38715ab857d7389fdc77fd1a53c6beedcabd7f1f
7
+ data.tar.gz: add25926fc69c94024d67eb2a9e8f2b242386ba4b78cb91de9ce974c66b9840b675f4d84a3c438a5f71f421382cdd7441f64d12888256c8056229c22c95e8137
@@ -13,6 +13,7 @@
13
13
  west: true
14
14
  items:
15
15
  - Bed
16
+ - Letter
16
17
  - Stone
17
18
  - Tent
18
19
 
@@ -13,7 +13,7 @@ module Gemwarrior
13
13
  :equipped,
14
14
  :consumable,
15
15
  :use,
16
- :reuse
16
+ :used
17
17
 
18
18
  def use(inventory = nil)
19
19
  'That item does not do anything...yet.'
@@ -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
@@ -310,7 +310,7 @@ module Gemwarrior
310
310
  end
311
311
  end
312
312
  end
313
- binding.pry
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
@@ -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
- print_splash_message
122
- print_fortune
123
- print_help unless world.debug_mode
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?
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.9.3'
5
+ VERSION = '0.9.4'
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.9.3
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