gemwarrior 0.7.1 → 0.7.2

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: 67ea8f41e66cefdb26f55bab9513248528d266dd
4
- data.tar.gz: f4aa74c3a8220b407c712e33e26231415b984c71
3
+ metadata.gz: b3e02eb07b6d2f5d85c69bff99e23d580e61326b
4
+ data.tar.gz: 8cc5438f267d75b010f7645d8da54d3dafa4a9c6
5
5
  SHA512:
6
- metadata.gz: 796d0ac2f729bbf56141ce0c332b624d621b255d700d3612b00e19586c57480126d315d9e585aecbbed20fdf357eb5e129959574798a0a4a68b3677b5443fea2
7
- data.tar.gz: a1d75556f09323bff027fa802e0efad73bebf1581f7d9351e6d8b06d494216cb468e90277e8357c2b441fc95473c3969c25935aee38233083b0512d9d66d8710
6
+ metadata.gz: 5736f18ee87c888f5a0f41ede0fbb6f5246735d6da39c6282e5649568de3d33cb0aa8d3470b0505c214af997ff0f542382dc016be5f169e6547cbf63536ad15b
7
+ data.tar.gz: d3d2fa237f23270f92bfaa0f73529708d9d755646dee38a1199952b7be1296a888c377a412f96073cb7fb04cfc23f2e427bb80ea73db0bb421f05e52c905d645
@@ -143,17 +143,16 @@ module Gemwarrior
143
143
  def take_damage(entity, dmg)
144
144
  entity.hp_cur = entity.hp_cur.to_i - dmg.to_i
145
145
  who_gets_wounded = ''
146
+
146
147
  if entity.eql?(monster)
147
148
  who_gets_wounded = "> You wound #{monster.name} for "
148
149
  else
149
150
  who_gets_wounded = "> You are wounded for "
150
151
  end
151
- hit = Thread.new do
152
- print who_gets_wounded
153
- print "#{Matrext::process({ :phrase => dmg.to_s, :speed => :slow, :oneline => true, :alpha => false, :random => false })}"
154
- print " point(s)!\n"
155
- end
156
- return hit.join
152
+
153
+ print who_gets_wounded
154
+ Animation::run({ :phrase => dmg.to_s, :speed => :slow, :oneline => true, :alpha => false, :random => false })
155
+ print " point(s)!\n"
157
156
  end
158
157
 
159
158
  # MONSTER
@@ -227,7 +226,6 @@ module Gemwarrior
227
226
  player.rox = player.rox + monster.rox
228
227
 
229
228
  monster_items = monster.inventory.items
230
- binding.pry
231
229
  unless monster_items.nil?
232
230
  player.inventory.items.concat monster_items unless monster_items.empty?
233
231
  end
@@ -288,12 +286,7 @@ module Gemwarrior
288
286
  # STATUS TEXT
289
287
 
290
288
  def print_escape_text
291
- escape = Thread.new do
292
- print "* "
293
- print "#{Matrext::process({ :phrase => TEXT_ESCAPE, :oneline => true })}"
294
- print " *\n"
295
- end
296
- return escape.join
289
+ Animation::run({ :phrase => "* #{TEXT_ESCAPE} *", :oneline => true })
297
290
  end
298
291
 
299
292
  def print_battle_line
@@ -20,11 +20,7 @@ module Gemwarrior
20
20
  puts 'You slowly lower your foot onto the tile, and then gently depress it, through the floor. Your whole body begins to feel light, lifeless. You black out.'
21
21
  puts
22
22
 
23
- t = Thread.new do
24
- print "#{Matrext::process({ :phrase => '*** SHOOOOOM ***', :oneline => true })}"
25
- puts
26
- end
27
- t.join
23
+ Animation::run({ :phrase => '*** SHOOOOOM ***' })
28
24
 
29
25
  {:type => 'move', :data => 'Sky Tower (Entrance)'}
30
26
  end
@@ -20,11 +20,7 @@ module Gemwarrior
20
20
  puts 'You move the switch from "No" to "Yes". Suddenly, a great wind picks up and you are gently lifted up by it. The ground moves away and your whole body begins to gently drift towards Emerald\'s compound high in the stratosphere.'
21
21
  puts
22
22
 
23
- t = Thread.new do
24
- print "#{Matrext::process({ :phrase => '*** WHOOOOOSH ***', :oneline => true })}"
25
- puts
26
- end
27
- t.join
23
+ Animation::run({ :phrase => '*** WHOOOOOSH ***' })
28
24
 
29
25
  {:type => 'move', :data => 'Sky Tower (Foyer)'}
30
26
  end
@@ -174,19 +174,14 @@ module Gemwarrior
174
174
  private
175
175
 
176
176
  def player_death
177
- puts 'You\'re actions have reduced you to death.'.colorize(:red)
177
+ puts 'Your actions have reduced you to death.'.colorize(:red)
178
178
  puts 'Your adventure ends here. Try again next time!'.colorize(:red)
179
179
  exit(0)
180
180
  end
181
181
 
182
182
  # TRAVEL
183
183
  def print_traveling_text(direction_text)
184
- loc = Thread.new do
185
- print "* "
186
- print "#{Matrext::process({ :phrase => direction_text, :oneline => true })}"
187
- print " *\n"
188
- end
189
- return loc.join
184
+ Animation::run({:oneline => false, :phrase => "* #{direction_text} *"})
190
185
  end
191
186
 
192
187
  # CHARACTER
@@ -113,7 +113,7 @@ module Gemwarrior
113
113
  end
114
114
  when 'map', 'm'
115
115
  world.print_map
116
- when 'stat', 's'
116
+ when 'stat', 'st', 's'
117
117
  if param1.nil?
118
118
  puts ERROR_DEBUG_STAT_PARAM_MISSING
119
119
  return DEBUG_STAT_PARAMS
@@ -121,7 +121,7 @@ module Gemwarrior
121
121
  case param1
122
122
  when 'atk_lo'
123
123
  unless param2.nil?
124
- param2.to_i!
124
+ param2 = param2.to_i
125
125
  if param2.is_a? Numeric
126
126
  if param2 >= 0
127
127
  world.player.atk_lo = param2
@@ -130,7 +130,7 @@ module Gemwarrior
130
130
  end
131
131
  when 'atk_hi'
132
132
  unless param2.nil?
133
- param2.to_i!
133
+ param2 = param2.to_i
134
134
  if param2.is_a? Numeric
135
135
  if param2 >= 0
136
136
  world.player.atk_hi = param2
@@ -139,7 +139,7 @@ module Gemwarrior
139
139
  end
140
140
  when 'strength', 'str', 'st'
141
141
  unless param2.nil?
142
- param2.to_i!
142
+ param2 = param2.to_i
143
143
  if param2.is_a? Numeric
144
144
  if param2 >= 0
145
145
  world.player.atk_lo = param2
@@ -149,7 +149,7 @@ module Gemwarrior
149
149
  end
150
150
  when 'dexterity', 'dex', 'd'
151
151
  unless param2.nil?
152
- param2.to_i!
152
+ param2 = param2.to_i
153
153
  if param2.is_a? Numeric
154
154
  if param2 >= 0
155
155
  world.player.dexterity = param2
@@ -6,6 +6,7 @@ require 'matrext'
6
6
 
7
7
  require_relative 'entities/player'
8
8
  require_relative 'misc/player_levels'
9
+ require_relative 'misc/animation'
9
10
  require_relative 'world'
10
11
  require_relative 'evaluator'
11
12
  require_relative 'repl'
@@ -0,0 +1,29 @@
1
+ # lib/gemwarrior/animation.rb
2
+ # Animation routine
3
+
4
+ module Gemwarrior
5
+ module Animation
6
+ def self.run(opts)
7
+ options = {
8
+ :oneline => false,
9
+ :speed => nil,
10
+ :alpha => true,
11
+ :numeric => true,
12
+ :random => true
13
+ }.merge(opts)
14
+
15
+ th = Thread.new do
16
+ print Matrext::process({
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
+ })
24
+ end
25
+
26
+ return th.join
27
+ end
28
+ end
29
+ end
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = "0.7.1"
5
+ VERSION = "0.7.2"
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.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick
@@ -214,6 +214,7 @@ files:
214
214
  - lib/gemwarrior/evaluator.rb
215
215
  - lib/gemwarrior/game.rb
216
216
  - lib/gemwarrior/inventory.rb
217
+ - lib/gemwarrior/misc/animation.rb
217
218
  - lib/gemwarrior/misc/player_levels.rb
218
219
  - lib/gemwarrior/misc/version.rb
219
220
  - lib/gemwarrior/misc/wordlist.rb