gemwarrior 0.8.5 → 0.8.6

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: b862fec430a2b06e6ebf4a31417d5d1d7385680f
4
- data.tar.gz: 21140db445e0c8be1583517093e3e14de1f2d207
3
+ metadata.gz: 4adb293d5ef28ea948ddefa890aba39e892b1f67
4
+ data.tar.gz: abb4df914fa5da5d2300d434d9a5b3c823099f75
5
5
  SHA512:
6
- metadata.gz: c921683ca5e738231745561b35a7be1a60b27e4ba583c1298550d58439f313a1a31dfdc3130240c88215beab4013f1ea02dfa60719aad8235b7fd8e4cff9ecaa
7
- data.tar.gz: dcd3e22b9bd714bb235a24e1b37f7f5f5fd673f429d8e8d38b05ca6fe2b5a0a316783c34aa997bbedf4b368b0eb3e1663cfbabb2d1ace2a5662ce85f09d42ba1
6
+ metadata.gz: 4af0a454c2928b69af31098408600aafcbe20690db64ec49085bac65d494627daab325b5d4fb393a5d7c96f9c31fe98f63a783e02a97ddb0b74ec5b0cbd1070d
7
+ data.tar.gz: ce558c2829a12c6b1bc5ebd3de146ab8f1e9348bf4c4e2bc7c1e042bfd14d239f420f30b45386ede65e1e5eaa6a2054964b424f23a2b5c996592d383b181c15b
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  *.gct
11
11
  /img/
12
+ /assets/
@@ -435,7 +435,7 @@
435
435
 
436
436
  -
437
437
  name: 'Cave (Causeway)'
438
- description: 'Paths lead north and west, but nothing of interest is in this causeway.'
438
+ description: 'Paths lead north and west as a dank, musty smell permeates your sinuses.'
439
439
  danger_level: :moderate
440
440
  coords:
441
441
  x: 8
@@ -449,6 +449,8 @@
449
449
  monster_level_range:
450
450
  lo: 2
451
451
  hi: 3
452
+ items:
453
+ - Map
452
454
  -
453
455
  name: 'Forest (Southeast)'
454
456
  description: 'Trees exist here, in droves.'
@@ -225,7 +225,18 @@ module Gemwarrior
225
225
  puts "You have defeated #{monster.name}!\n".colorize(:green)
226
226
  if monster.is_boss
227
227
  if monster.name.eql?("Emerald")
228
+ Music::cue([
229
+ {:freq_or_note => 'G3', :duration => 50},
230
+ {:freq_or_note => 'A3', :duration => 50},
231
+ {:freq_or_note => 'B3', :duration => 50},
232
+ {:freq_or_note => 'C4', :duration => 50},
233
+ {:freq_or_note => 'D4', :duration => 50},
234
+ {:freq_or_note => 'E4', :duration => 50},
235
+ {:freq_or_note => 'F#4', :duration => 50},
236
+ {:freq_or_note => 'G4', :duration => 50}
237
+ ])
228
238
  puts monster.defeated_text
239
+ gets
229
240
  exit(0)
230
241
  else
231
242
  puts 'You just beat a boss monster. Way to go!'
@@ -16,5 +16,15 @@ module Gemwarrior
16
16
  def use(inventory = nil)
17
17
  'That item does not do anything...yet.'
18
18
  end
19
+
20
+ def describe
21
+ status_text = name.upcase.colorize(:green)
22
+ status_text << "\n#{description} \n".colorize(:white)
23
+ status_text << "ATTACK: #{atk_lo.to_s.rjust(2)}-#{atk_hi.to_s.rjust(2)} ".colorize(:white) unless atk_lo.nil?
24
+ status_text << "TAKEABLE? #{takeable} ".colorize(:white)
25
+ status_text << "USEABLE? #{useable} ".colorize(:white)
26
+ status_text << "EQUIPPABLE? #{equippable} ".colorize(:white)
27
+ status_text << "\n"
28
+ end
19
29
  end
20
30
  end
@@ -0,0 +1,25 @@
1
+ # lib/gemwarrior/entities/items/map.rb
2
+ # Item::Map
3
+
4
+ require_relative '../item'
5
+
6
+ module Gemwarrior
7
+ class Map < Item
8
+ def initialize
9
+ self.name = 'map'
10
+ self.description = 'The land of Jool is contained on this piece of canvas, in a useful, if not very detailed, manner.'
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
+ end
18
+
19
+ def use(player = nil)
20
+ puts 'You unfold the piece of worn canvas, and study the markings upon it.'
21
+
22
+ {:type => 'action', :data => 'map'}
23
+ end
24
+ end
25
+ end
@@ -29,15 +29,23 @@ module Gemwarrior
29
29
  end
30
30
 
31
31
  def status(debug_mode = false)
32
- status_text = name.ljust(26).upcase.colorize(:green)
32
+ status_text = name.ljust(30).upcase.colorize(:green)
33
33
  status_text << coords.values.to_a.to_s.colorize(:white)
34
34
  status_text << " DL[#{danger_level.to_s.ljust(8)}] ".colorize(:white) if debug_mode
35
35
  status_text << " MLR[#{monster_level_range.to_s.ljust(6)}] ".colorize(:white) if debug_mode
36
- status_text << " #{description}\n".colorize(:white)
36
+ status_text << "\n#{description}\n".colorize(:white)
37
37
  end
38
38
 
39
39
  def has_item?(item_name)
40
- items.map(&:name).include?(item_name)
40
+ items.map{|i| i.name.downcase}.include?(item_name)
41
+ end
42
+
43
+ def has_monster?(monster_name)
44
+ monsters_abounding.map{|m| m.name.downcase}.include?(monster_name)
45
+ end
46
+
47
+ def has_boss?(boss_name)
48
+ bosses_abounding.map{|b| b.name.downcase}.include?(boss_name)
41
49
  end
42
50
 
43
51
  def add_item(item_name)
@@ -89,7 +97,7 @@ module Gemwarrior
89
97
  checked_for_monsters
90
98
  end
91
99
 
92
- def has_monster?
100
+ def should_spawn_monster?
93
101
  found = false
94
102
  unless danger_level.eql?(:none)
95
103
  max = DANGER_LEVEL[danger_level]
@@ -146,7 +154,7 @@ module Gemwarrior
146
154
  end
147
155
 
148
156
  def populate_monsters(monsters_available, spawn = false)
149
- if has_monster? || spawn
157
+ if should_spawn_monster? || spawn
150
158
  self.checked_for_monsters = true unless spawn
151
159
  self.monsters_abounding = [] unless spawn
152
160
  random_monster = nil
@@ -19,7 +19,13 @@ module Gemwarrior
19
19
  end
20
20
 
21
21
  def describe
22
- status_text = name.upcase.ljust(26).colorize(:green)
22
+ status_text = name.upcase.ljust(13).colorize(:green)
23
+ status_text << "#{description}\n".colorize(:white)
24
+ if is_boss
25
+ status_text << '(BOSS)'.ljust(13).colorize(:yellow)
26
+ else
27
+ status_text << ''.ljust(13)
28
+ end
23
29
  status_text << "LEVEL: #{level.to_s.rjust(2)}, ".colorize(:white)
24
30
  status_text << "HP: #{hp_cur.to_s.rjust(3)}/#{hp_max.to_s.rjust(3)} ".colorize(:white)
25
31
  status_text << "ATK: #{atk_lo.to_s.rjust(2)}-#{atk_hi.to_s.rjust(2)} ".colorize(:white)
@@ -27,9 +33,10 @@ module Gemwarrior
27
33
  status_text << "DEX: #{dexterity.to_s.rjust(2)} ".colorize(:white)
28
34
  status_text << "ROX: #{rox.to_s.rjust(3)} ".colorize(:white)
29
35
  status_text << "XP: #{xp.to_s.rjust(3)} ".colorize(:white)
30
- status_text << "FACE: #{face.ljust(12)} ".colorize(:white)
31
- status_text << "HANDS: #{hands.ljust(12)} ".colorize(:white)
32
- status_text << "MOOD: #{mood.ljust(12)}".colorize(:white)
36
+ status_text << "\n".ljust(14)
37
+ status_text << "FACE: #{face} ".colorize(:white)
38
+ status_text << "HANDS: #{hands} ".colorize(:white)
39
+ status_text << "MOOD: #{mood} ".colorize(:white)
33
40
  status_text << "INV: #{inventory.list_contents}".colorize(:white)
34
41
  status_text << "\n"
35
42
  end
@@ -216,7 +216,9 @@ module Gemwarrior
216
216
  Animation::run({:oneline => false, :phrase => "* #{direction_text} *"})
217
217
  if sound
218
218
  Music::cue([
219
- {:freq_or_note => 'C3,E3'}
219
+ {:freq_or_note => 'C3', :duration => 75},
220
+ {:freq_or_note => 'D3', :duration => 75},
221
+ {:freq_or_note => 'E3', :duration => 75}
220
222
  ])
221
223
  end
222
224
  end
@@ -65,7 +65,7 @@ module Gemwarrior
65
65
 
66
66
  self.commands = %w(character inventory rest look take use drop equip unequip go attack change help quit quit!)
67
67
  self.aliases = %w(c i r l t u d e ue g a ch h q qq)
68
- self.extras = %w(exit exit! x x)
68
+ self.extras = %w(exit exit! x x fight f)
69
69
  self.cmd_descriptions = [
70
70
  'Display character information',
71
71
  'Look in your inventory',
@@ -111,13 +111,13 @@ module Gemwarrior
111
111
  when 'beast', 'bs'
112
112
  return world.player.beast_mode = !world.player.beast_mode
113
113
  when 'vars', 'v'
114
- world.print_all_vars
114
+ world.print_vars
115
115
  when 'list', 'ls'
116
116
  if param1.nil?
117
117
  puts ERROR_LIST_PARAM_MISSING
118
118
  return DEBUG_LIST_PARAMS
119
119
  else
120
- return world.list(param1)
120
+ return world.list(param1, param2)
121
121
  end
122
122
  when 'map', 'm'
123
123
  world.print_map
@@ -307,8 +307,11 @@ module Gemwarrior
307
307
  world.player.heal_damage(result[:data])
308
308
  return
309
309
  when 'action'
310
- if result[:data].eql?('rest')
310
+ case result[:data]
311
+ when 'rest'
311
312
  world.player.rest(world)
313
+ when 'map'
314
+ world.print_map
312
315
  end
313
316
  when 'arena'
314
317
  arena = Arena.new({:world => world, :player => world.player})
@@ -354,7 +357,7 @@ module Gemwarrior
354
357
  ERROR_GO_PARAM_INVALID
355
358
  end
356
359
  end
357
- when 'attack', 'a'
360
+ when 'attack', 'a', 'fight', 'f'
358
361
  if param1.nil?
359
362
  ERROR_ATTACK_PARAM_MISSING
360
363
  else
@@ -7,12 +7,12 @@ module Gemwarrior
7
7
  defaults = {
8
8
  :freq_or_note => 440,
9
9
  :waveform => 'saw',
10
- :volume => 0.5,
10
+ :volume => 0.3,
11
11
  :duration => 500,
12
12
  :notext => true
13
13
  }
14
14
 
15
- th = Thread.new do
15
+ Thread.start {
16
16
  sequence.each do |note|
17
17
  note_to_play = note[:freq_or_note]
18
18
  waveform = note[:waveform].nil? ? defaults[:waveform] : note[:waveform]
@@ -28,9 +28,7 @@ module Gemwarrior
28
28
  :notext => notext
29
29
  })
30
30
  end
31
- end
32
-
33
- return th.join
31
+ }
34
32
  end
35
33
  end
36
34
  end
@@ -18,8 +18,8 @@ module Gemwarrior
18
18
  attr_accessor :world, :eval
19
19
 
20
20
  def initialize(world, evaluator)
21
- self.world = world
22
- self.eval = evaluator
21
+ self.world = world
22
+ self.eval = evaluator
23
23
  end
24
24
 
25
25
  def start(initialCommand = nil)
@@ -42,27 +42,23 @@ module Gemwarrior
42
42
  private
43
43
 
44
44
  def clear_screen
45
- if OS.windows?
46
- system('cls')
47
- else
48
- system('clear')
49
- end
45
+ OS.windows? ? system('cls') : system('clear')
50
46
  end
51
47
 
52
48
  def print_logo
53
- puts "/-+-+-+ +-+-+-+-+-+-+-\\".colorize(:yellow)
54
- puts '|G|E|M| |W|A|R|R|I|O|R|'.colorize(:yellow)
55
- puts "\\-+-+-+ +-+-+-+-+-+-+-/".colorize(:yellow)
56
-
57
49
  if world.sound
58
50
  Music::cue([
59
51
  {:freq_or_note => 'A3,E4,C#5,F#5', :duration => 1000}
60
52
  ])
61
53
  end
54
+
55
+ puts "/-+-+-+ +-+-+-+-+-+-+-\\".colorize(:yellow)
56
+ puts '|G|E|M| |W|A|R|R|I|O|R|'.colorize(:yellow)
57
+ puts "\\-+-+-+ +-+-+-+-+-+-+-/".colorize(:yellow)
58
+ puts '[[[[[[[DEBUGGING]]]]]]]'.colorize(:white) if world.debug_mode
62
59
  end
63
60
 
64
61
  def print_splash_message
65
- print_logo
66
62
  SPLASH_MESSAGE.length.times do print '=' end
67
63
  puts
68
64
  puts SPLASH_MESSAGE
@@ -88,9 +84,10 @@ module Gemwarrior
88
84
  def setup_screen(initialCommand = nil)
89
85
  # welcome player to game
90
86
  clear_screen
87
+ print_logo
91
88
  print_splash_message
92
89
  print_fortune
93
- print_help
90
+ print_help unless world.debug_mode
94
91
 
95
92
  # hook to do something right off the bat
96
93
  puts eval.evaluate(initialCommand) unless initialCommand.nil?
@@ -98,6 +95,9 @@ module Gemwarrior
98
95
 
99
96
  def prompt
100
97
  prompt_template = "\n[LV:%3s][XP:%3s][ROX:%3s] -- [HP:%3s/%-3s][STM:%2s/%-2s] -- [%s @ %s]"
98
+ if world.debug_mode
99
+ prompt_template += "[%s, %s, %s]"
100
+ end
101
101
  prompt_vars_arr = [
102
102
  world.player.level,
103
103
  world.player.xp,
@@ -109,11 +109,15 @@ module Gemwarrior
109
109
  world.player.name,
110
110
  world.location_by_coords(world.player.cur_coords).name
111
111
  ]
112
+ if world.debug_mode
113
+ prompt_vars_arr.push(world.player.cur_coords[:x], world.player.cur_coords[:y], world.player.cur_coords[:z])
114
+ end
112
115
  puts (prompt_template % prompt_vars_arr).colorize(:yellow)
113
116
  end
114
117
 
115
118
  def read_line
116
- Readline.readline(' GW> ', true).to_s
119
+ prompt_text = world.debug_mode ? ' GW[D]> ' : ' GW> '
120
+ Readline.readline(prompt_text, true).to_s
117
121
  end
118
122
  end
119
123
  end
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = "0.8.5"
5
+ VERSION = "0.8.6"
6
6
  end
@@ -25,7 +25,7 @@ module Gemwarrior
25
25
  self.player = nil
26
26
  end
27
27
 
28
- def print_all_vars
28
+ def print_vars
29
29
  puts "======================\n"
30
30
  puts "All Variables in World\n"
31
31
  puts "======================\n"
@@ -64,6 +64,14 @@ module Gemwarrior
64
64
  0.upto(WORLD_DIM_WIDTH-1) do |count_x|
65
65
  print "#{count_x} "
66
66
  end
67
+ if debug_mode
68
+ puts
69
+ puts
70
+ puts "Current level: #{player.cur_coords[:z]}"
71
+ puts '| | = invalid location'
72
+ puts '|X| = valid location'
73
+ puts '|O| = player'
74
+ end
67
75
  return
68
76
  end
69
77
 
@@ -73,10 +81,9 @@ module Gemwarrior
73
81
  puts '[PLAYERS]'
74
82
  player.check_self(false)
75
83
  when 'monsters'
76
- puts "[MONSTERS](#{monsters.length})"
84
+ puts "[MONSTERS](#{monsters.length})".colorize(:yellow)
77
85
  if details
78
- monsters.map { |m| print m.describe unless m.is_boss}
79
- monsters.map { |m| print m.describe if m.is_boss }
86
+ monsters.map { |m| print m.describe }
80
87
  return
81
88
  else
82
89
  monster_text = ">> monsters: #{monsters.map(&:name).join(', ')}"
@@ -88,10 +95,10 @@ module Gemwarrior
88
95
  item_count = item_count + 1
89
96
  end
90
97
  end
91
- puts "[ITEMS](#{item_count})"
98
+ puts "[ITEMS](#{item_count})".colorize(:yellow)
92
99
  if details
93
100
  locations.each do |l|
94
- l.items.map { |i| print i.status }
101
+ l.items.map { |i| print i.describe }
95
102
  end
96
103
  return
97
104
  else
@@ -102,7 +109,7 @@ module Gemwarrior
102
109
  ">> #{item_list.sort.join(', ')}"
103
110
  end
104
111
  when 'locations'
105
- puts "[LOCATIONS](#{locations.length})"
112
+ puts "[LOCATIONS](#{locations.length})".colorize(:yellow)
106
113
  if details
107
114
  locations.map { |l| print l.status(self.debug_mode) }
108
115
  return
@@ -159,18 +166,18 @@ module Gemwarrior
159
166
  end
160
167
 
161
168
  def describe_entity(point, entity_name)
162
- if point.list_items.map{|i| i.downcase}.include?(entity_name)
169
+ if point.has_item?(entity_name)
163
170
  point.items.each do |i|
164
171
  if i.name.downcase.eql?(entity_name.downcase)
165
172
  if debug_mode
166
- return i.status
173
+ return i.describe
167
174
  else
168
175
  return i.description
169
176
  end
170
177
  end
171
178
  end
172
179
  elsif
173
- if point.list_monsters.map{|m| m.downcase}.include?(entity_name)
180
+ if point.has_monster?(entity_name)
174
181
  point.monsters_abounding.each do |m|
175
182
  if m.name.downcase.eql?(entity_name.downcase)
176
183
  if debug_mode
@@ -182,7 +189,7 @@ module Gemwarrior
182
189
  end
183
190
  end
184
191
  elsif
185
- if point.list_bosses.map{|b| b.downcase}.include?(entity_name)
192
+ if point.has_boss?(entity_name)
186
193
  point.bosses_abounding.each do |b|
187
194
  if b.name.downcase.eql?(entity_name.downcase)
188
195
  if debug_mode
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemwarrior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-29 00:00:00.000000000 Z
11
+ date: 2015-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
@@ -208,6 +208,7 @@ files:
208
208
  - lib/gemwarrior/entities/items/herb.rb
209
209
  - lib/gemwarrior/entities/items/keystone.rb
210
210
  - lib/gemwarrior/entities/items/ladder.rb
211
+ - lib/gemwarrior/entities/items/map.rb
211
212
  - lib/gemwarrior/entities/items/massive_door.rb
212
213
  - lib/gemwarrior/entities/items/opalaser.rb
213
214
  - lib/gemwarrior/entities/items/pond.rb