gemwarrior 0.9.36 → 0.9.37

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: 2aea546b78bf2cba84a7ecd3e059c892dc180ae1
4
- data.tar.gz: 1a55c01aed90707d339fef86724e8727906134e5
3
+ metadata.gz: 431bad9c347069816c31bd1e177b2150a40cc659
4
+ data.tar.gz: edbc3792f12ad73aadef984f5579bcc4ba73371a
5
5
  SHA512:
6
- metadata.gz: c0996702785d7da641fe4d0c88551f8dc73daec3b68307e5fb5e8aa73e213c88a1b04845199af9681c853067ad35aec1a40d1fc83803586570e3c3c9c2c42a88
7
- data.tar.gz: 12bb7240e97fbb57857e89abc733ebeb2c23a0c7d6afca227204d48bbc04f3da9400e1133b5f9793008c574afd6dfc2f19a6a61554ae00556acb55a7b15f1d11
6
+ metadata.gz: 191c3cb62106e38b149ec02cce77cd531bcb28ecaaae7180f820e7125d58f4732c51d1bfc5a1b34c78b804a97823d8bb0314c020e0a4136b6657bcecdcfcef0b
7
+ data.tar.gz: 45efcfcba9b601470e77382f6c30c88d4f9d1e3744547b54469518a466e475573b2464f975238c0bb813e2c0f457e3f44c59fafeef0753b708c265b56d0c0f8c
data/README.md CHANGED
@@ -13,12 +13,12 @@ You take up the mantle of **1.upto(rand(5..10)) {print rand(65..90).chr}**, a gi
13
13
 
14
14
  Start in your poor, super lame cottage, where you live alone, subsisting off the sale of polished rocks you scavenge all day for in the neighboring caves. Once tasked with your quest, travel throughout the land of Jool, eventually reaching the sky tower that Emerald resides in with his stolen goods, laughing to himself, occasionally.
15
15
 
16
- As you travel you will discover sights and sounds of the land, all of which are new to you because you don't really get out much. Visit towns with merchants willing to trade coin for wares they bought off of other adventurers who didn't last the previous attempts at thwartion. Sleep in makeshift huts to regain your health and magic points (or the ground, if that's all that's available), which are conveniently located in your peripheral vision (i.e. the console window). Eventually, if you're skilled (and I actually code it in), you'll reach **Emerald's Sky Tower**, part him from his **ShinyThing<sup>tm</sup>**, and then do what is "right".
16
+ As you travel you will discover sights and sounds of the land, all of which are new to you because you don't really get out much. Visit towns with merchants willing to trade coin for wares they bought off of other adventurers who didn't last the previous attempts at thwartion. Sleep in a tent (or on the ground, if that's all that's available) to regain your enumerated status points, which are conveniently located in your peripheral vision (i.e. the console window). Eventually, if you're skilled, you'll reach **Emerald's Sky Tower**, part him from his **ShinyThing<sup>tm</sup>**, and then do what is "right".
17
17
 
18
18
  ## How to Get to Jool
19
19
 
20
- 1. `ruby -v` should return `ruby 2.`something; else install [Ruby](https://www.ruby-lang.org)
21
- 2. `gem -v` should return `2.`something; else install [RubyGems](https://rubygems.org)
20
+ 1. `ruby -v` should return `ruby 2.something`; else install [Ruby](https://www.ruby-lang.org)
21
+ 2. `gem -v` should return `2.something`; else install [RubyGems](https://rubygems.org)
22
22
  2. `(sudo) gem install gemwarrior`
23
23
  3. `gemwarrior`
24
24
 
@@ -26,26 +26,27 @@ Run the commands above and you'll be whisked away to Jool, ready to start or con
26
26
 
27
27
  ## Main Commands
28
28
 
29
- `> character` - character check for visual identity
30
- `> inventory [object]` - check your inventory (or an individual item within)
31
- `> rest` - take a load off and replenish hp
32
- `> look [object]` - look at current location and its items and monsters
33
- `> take [object]` - take an item from a location
34
- `> use [object]` - use an item from your inventory or current location
35
- `> drop [object]` - drop an item from your inventory
36
- `> equip [object]` - designate an item in your inventory your weapon
37
- `> unequip [object]` - stop using an item in your inventory as your weapon
38
- `> go [direction]` - go in a direction, if possible (north|east|south|west work as shortcuts)
39
- `> attack [monster]` - attack a monster
29
+ `> character` - character check for visual identity
30
+ `> inventory [object]` - check your inventory (or an individual item within)
31
+ `> rest` - take a load off and replenish hp
32
+ `> look [object]` - look at current location and its items and monsters
33
+ `> take [object]` - take an item from a location
34
+ `> use [object]` - use an item from your inventory or current location
35
+ `> drop [object]` - drop an item from your inventory
36
+ `> equip [object]` - designate an item in your inventory your weapon
37
+ `> unequip [object]` - stop using an item in your inventory as your weapon
38
+ `> go [direction]` - go in a direction, if possible (north|east|south|west work as shortcuts)
39
+ `> attack [monster]` - attack a monster
40
40
  `> change [attribute]` - change some things about yourself
41
- `> help` - display available commands
42
- `> quit` - quit this nonsense w/ prompt
43
- `> quit!` - quit this nonsense w/o prompt
41
+ `> help` - display available commands
42
+ `> version` - display current game version
43
+ `> quit` - quit this nonsense w/ prompt
44
+ `> quit!` - quit this nonsense w/o prompt
44
45
 
45
46
  ## In Progress, Yanno
46
47
 
47
- This is in beta testing right now, and if you wish to help out in an official way, please visit [the main Gem Warrior homepage](http://gw.codana.me).
48
+ Gem Warrior is in heavy beta testing right now, and if you wish to help out in an official way, please visit [the main Gem Warrior homepage](http://gw.codana.me) for more information.
48
49
 
49
- ## Current Issues
50
+ ## Current Issues/Requests
50
51
 
51
- My old list of issues/features has been moved to the [Github issues section](https://github.com/michaelchadwick/gemwarrior/issues). Feel free to add any bugs you find while playing, or any requests for new features, over there.
52
+ The old list of issues/features has been moved to the [Github issues section](https://github.com/michaelchadwick/gemwarrior/issues). Feel free to go there to add any bugs you find while playing or any requests for new features.
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'bundler/gem_tasks'
4
4
  # Default directory to look in is `/specs`
5
5
  # Run with `rake spec`
6
6
  RSpec::Core::RakeTask.new(:spec) do |task|
7
- task.rspec_opts = ['--color', '--format', 'nested']
7
+ task.rspec_opts = ['--color', '--format', 'documentation']
8
8
  end
9
9
 
10
- task :default => :spec
10
+ task :default => :spec
data/bin/gemwarrior CHANGED
@@ -97,6 +97,7 @@ end
97
97
 
98
98
  begin
99
99
  GameOptions.add 'log_file_path', "#{Dir.home}/.gemwarrior_log"
100
+ GameOptions.add 'save_file_path', "#{Dir.home}/.gemwarrior_save"
100
101
  GameOptions.add 'options_file_path', "#{Dir.home}/.gemwarrior_options"
101
102
 
102
103
  options = parse_options_cli
data/gemwarrior.gemspec CHANGED
@@ -41,8 +41,5 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency 'rspec-nc'
42
42
  spec.add_development_dependency 'guard'
43
43
  spec.add_development_dependency 'guard-rspec'
44
- spec.add_development_dependency 'pry'
45
- spec.add_development_dependency 'pry-remote'
46
- spec.add_development_dependency 'pry-nav'
47
44
  spec.add_development_dependency 'pry-byebug', '~> 3.0'
48
45
  end
@@ -7,11 +7,8 @@ require_relative 'game_options'
7
7
  module Gemwarrior
8
8
  class Battle
9
9
  # CONSTANTS
10
- ## ERRORS
11
10
  ERROR_ATTACK_OPTION_INVALID = 'That will not do anything against the monster.'
12
11
  BEAST_MODE_ATTACK = 100
13
-
14
- ## MESSAGES
15
12
  ESCAPE_TEXT = '** POOF **'
16
13
 
17
14
  attr_accessor :world, :player, :monster, :player_is_defending
@@ -4,10 +4,10 @@
4
4
  require_relative '../item'
5
5
 
6
6
  module Gemwarrior
7
- # CONSTANTS
8
- MOVE_TEXT = '*** SHOOOOOM ***'
9
-
10
7
  class FloorTile < Item
8
+ # CONSTANTS
9
+ MOVE_TEXT = '*** SHOOOOOM ***'
10
+
11
11
  def initialize
12
12
  self.name = 'floor_tile'
13
13
  self.description = 'One of the floor tiles, rough-hewn but immaculate, looks...off. Pressable, even.'
@@ -7,11 +7,8 @@ require_relative '../game_options'
7
7
  module Gemwarrior
8
8
  class Location < Entity
9
9
  # CONSTANTS
10
- ## HASHES
11
- DANGER_LEVEL = { none: 0, low: 15, moderate: 30, high: 55, assured: 100 }
12
-
13
- ## ERRORS
14
- ERROR_LOCATION_ITEM_REMOVE_INVALID = 'That item cannot be removed as it does not exist here.'
10
+ DANGER_LEVEL = { none: 0, low: 15, moderate: 30, high: 55, assured: 100 }
11
+ ERROR_ITEM_REMOVE_INVALID = 'That item cannot be removed as it does not exist here.'
15
12
 
16
13
  attr_accessor :coords, :locs_connected, :danger_level, :monster_level_range, :items,
17
14
  :monsters_abounding, :bosses_abounding, :checked_for_monsters
@@ -61,7 +58,7 @@ module Gemwarrior
61
58
  if has_item?(item_name)
62
59
  items.reject! { |item| item.name == item_name }
63
60
  else
64
- ERROR_LOCATION_ITEM_REMOVE_INVALID
61
+ ERROR_ITEM_REMOVE_INVALID
65
62
  end
66
63
  end
67
64
 
@@ -7,7 +7,6 @@ require_relative 'game_options'
7
7
  module Gemwarrior
8
8
  class Evaluator
9
9
  # CONSTANTS
10
- ## MESSAGES
11
10
  PROGRAM_NAME = 'Gem Warrior'
12
11
  QUIT_MESSAGE = 'Thanks for playing the game. Until next time...'.colorize(:yellow)
13
12
  RESUME_MESSAGE = 'Back to adventuring!'.colorize(:green)
@@ -17,9 +16,7 @@ module Gemwarrior
17
16
  DEBUG_LIST_PARAMS = 'Options: monsters, items, locations'
18
17
  DEBUG_STAT_PARAMS = 'Options: atk_lo, atk_hi, strength, dexterity'
19
18
 
20
- ## ERRORS
21
19
  ERROR_COMMAND_INVALID = 'That is not something the game yet understands.'
22
-
23
20
  ERROR_LOOK_AT_PARAM_MISSING = 'You cannot just "look at". You gotta choose something to look at.'
24
21
  ERROR_GO_PARAM_MISSING = 'Just wander aimlessly? A direction would be nice.'
25
22
  ERROR_GO_PARAM_INVALID = 'The place in that direction is far, far, FAR too dangerous. You should try a different way.'
@@ -20,7 +20,6 @@ module Gemwarrior
20
20
  include PlayerLevels
21
21
 
22
22
  # CONSTANTS
23
- ## PLAYER DEFAULTS
24
23
  PLAYER_DESC_DEFAULT = 'Picked to do battle against a wizened madman for a shiny something or other for world-saving purposes.'
25
24
  PLAYER_INVENTORY_DEFAULT = Inventory.new
26
25
  PLAYER_INVENTORY_DEBUG = Inventory.new([Herb.new])
@@ -4,7 +4,6 @@
4
4
  module Gemwarrior
5
5
  class Inventory
6
6
  # CONSTANTS
7
- ## ERRORS
8
7
  ERROR_ITEM_REMOVE_INVALID = 'Your inventory does not contain that item, so you cannot drop it.'
9
8
  ERROR_ITEM_ADD_UNTAKEABLE = 'That would be great if you could take that thing, wouldn\'t it? Well, it\'s not so great for you right now.'
10
9
  ERROR_ITEM_ADD_INVALID = 'That item does not exist here.'
@@ -16,7 +16,6 @@ require_relative 'version'
16
16
  module Gemwarrior
17
17
  class Repl
18
18
  # CONSTANTS
19
- ## MESSAGES
20
19
  QUIT_MESSAGE = 'Temporal flux detected. Shutting down...'.colorize(:red)
21
20
  MAIN_MENU_QUIT_MESSAGE = 'Giving up so soon? Jool will be waiting...'.colorize(:yellow)
22
21
  SPLASH_MESSAGE = 'Welcome to *Jool*, where randomized fortune is just as likely as mayhem.'
@@ -162,15 +161,25 @@ module Gemwarrior
162
161
  end
163
162
  end
164
163
 
165
- def display_log
166
- if File.exist?(GameOptions.data['log_file_path'])
164
+ def display_record_of_attempts
165
+ if File.exist?(GameOptions.data['log_file_path']) and !File.zero?(GameOptions.data['log_file_path'])
167
166
  File.open(GameOptions.data['log_file_path']).readlines.each do |line|
168
167
  print "#{line}"
169
168
  end
170
- puts
169
+ if GameOptions.data['debug_mode']
170
+ print 'Clear record of attempts (y/n)? '
171
+ answer = gets.chomp.downcase
172
+
173
+ case answer
174
+ when 'y'
175
+ File.truncate(GameOptions.data['log_file_path'], 0)
176
+ puts 'Record of attempts: erased!'
177
+ end
178
+
179
+ puts
180
+ end
171
181
  else
172
182
  puts 'No attempts made yet!'
173
- puts
174
183
  end
175
184
  end
176
185
 
@@ -198,7 +207,7 @@ module Gemwarrior
198
207
  puts ' (A)bout'
199
208
  puts ' (H)elp'
200
209
  puts ' (O)ptions'
201
- puts ' (L)og'
210
+ puts ' (R)ecord of Attempts'
202
211
  puts ' (C)heck for Updates'
203
212
  puts ' (E)xit'
204
213
  puts '======================='
@@ -234,9 +243,9 @@ module Gemwarrior
234
243
  puts choice
235
244
  print_options
236
245
  run_main_menu
237
- when 'l'
246
+ when 'r'
238
247
  puts choice
239
- display_log
248
+ display_record_of_attempts
240
249
  run_main_menu
241
250
  when 'c'
242
251
  puts choice
@@ -324,5 +333,11 @@ module Gemwarrior
324
333
  print (prompt_template % prompt_vars_arr).colorize(:yellow)
325
334
  print "\n"
326
335
  end
336
+
337
+ def command_exists?(cmd)
338
+ ENV['PATH'].split(File::PATH_SEPARATOR).collect { |d|
339
+ Dir.entries d if Dir.exist? d
340
+ }.flatten.include?(cmd)
341
+ end
327
342
  end
328
343
  end
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.9.36'
5
+ VERSION = '0.9.37'
6
6
  end
@@ -10,13 +10,11 @@ require_relative 'entities/location'
10
10
  module Gemwarrior
11
11
  class World
12
12
  # CONSTANTS
13
- LOCATION_DATA_FILE = File.expand_path('../../../data/locations.yml', __FILE__)
14
- WORLD_DIM_WIDTH = 10
15
- WORLD_DIM_HEIGHT = 10
16
-
17
- ## ERRORS
18
- ERROR_LIST_PARAM_INVALID = 'That is not something that can be listed.'
19
- ERROR_LOCATION_DESCRIBE_ENTITY_INVALID = 'You do not see that here.'
13
+ LOCATION_DATA_FILE = File.expand_path('../../../data/locations.yml', __FILE__)
14
+ ERROR_LIST_PARAM_INVALID = 'That is not something that can be listed.'
15
+ ERROR_DESCRIBE_ENTITY_INVALID = 'You do not see that here.'
16
+ WORLD_DIM_WIDTH = 10
17
+ WORLD_DIM_HEIGHT = 10
20
18
 
21
19
  attr_accessor :monsters, :locations, :player
22
20
 
@@ -206,7 +204,7 @@ module Gemwarrior
206
204
  elsif player.inventory.contains_item?(entity_name)
207
205
  player.inventory.describe_item(entity_name)
208
206
  else
209
- ERROR_LOCATION_DESCRIBE_ENTITY_INVALID
207
+ ERROR_DESCRIBE_ENTITY_INVALID
210
208
  end
211
209
  end
212
210
 
@@ -1,7 +1,42 @@
1
1
  require 'spec_helper'
2
+ include Gemwarrior
2
3
 
3
4
  describe Gemwarrior do
4
- it 'has a version number' do
5
- expect(Gemwarrior::VERSION).not_to be nil
5
+ let(:default_load_options) do
6
+ GameOptions.add 'log_file_path', "#{Dir.home}/.gemwarrior_log"
7
+ GameOptions.add 'options_file_path', "#{Dir.home}/.gemwarrior_options"
8
+
9
+ Game.new(
10
+ beast_mode: false,
11
+ debug_mode: false,
12
+ god_mode: false,
13
+ new_game: false,
14
+ sound_enabled: false,
15
+ sound_volume: 0.3,
16
+ use_wordnik: false,
17
+ extra_command: nil
18
+ )
19
+ end
20
+
21
+ describe 'basic properties' do
22
+ it 'has a version number' do
23
+ expect(VERSION).not_to be nil
24
+ end
25
+ it 'display help menu' do
26
+ pending
27
+ end
28
+ end
29
+
30
+ describe 'game load' do
31
+ context 'default options' do
32
+ it 'displays the main menu' do
33
+ pending
34
+ end
35
+ end
36
+ context 'new game option enabled' do
37
+ it 'displays the main game prompt and runs the look command' do
38
+ pending
39
+ end
40
+ end
6
41
  end
7
42
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1
+ # binary/executable
2
+ $LOAD_PATH.unshift File.expand_path('../../bin', __FILE__)
3
+ # main module
4
+ $LOAD_PATH.unshift File.expand_path('../../lib/gemwarrior', __FILE__)
2
5
  require 'pry'
3
- require 'gemwarrior'
6
+ require 'game'
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.9.36
4
+ version: 0.9.37
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-08-13 00:00:00.000000000 Z
11
+ date: 2015-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
@@ -240,48 +240,6 @@ dependencies:
240
240
  - - ">="
241
241
  - !ruby/object:Gem::Version
242
242
  version: '0'
243
- - !ruby/object:Gem::Dependency
244
- name: pry
245
- requirement: !ruby/object:Gem::Requirement
246
- requirements:
247
- - - ">="
248
- - !ruby/object:Gem::Version
249
- version: '0'
250
- type: :development
251
- prerelease: false
252
- version_requirements: !ruby/object:Gem::Requirement
253
- requirements:
254
- - - ">="
255
- - !ruby/object:Gem::Version
256
- version: '0'
257
- - !ruby/object:Gem::Dependency
258
- name: pry-remote
259
- requirement: !ruby/object:Gem::Requirement
260
- requirements:
261
- - - ">="
262
- - !ruby/object:Gem::Version
263
- version: '0'
264
- type: :development
265
- prerelease: false
266
- version_requirements: !ruby/object:Gem::Requirement
267
- requirements:
268
- - - ">="
269
- - !ruby/object:Gem::Version
270
- version: '0'
271
- - !ruby/object:Gem::Dependency
272
- name: pry-nav
273
- requirement: !ruby/object:Gem::Requirement
274
- requirements:
275
- - - ">="
276
- - !ruby/object:Gem::Version
277
- version: '0'
278
- type: :development
279
- prerelease: false
280
- version_requirements: !ruby/object:Gem::Requirement
281
- requirements:
282
- - - ">="
283
- - !ruby/object:Gem::Version
284
- version: '0'
285
243
  - !ruby/object:Gem::Dependency
286
244
  name: pry-byebug
287
245
  requirement: !ruby/object:Gem::Requirement