gemwarrior 0.8.6 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/bin/gemwarrior +15 -9
  3. data/gemwarrior.gemspec +1 -0
  4. data/lib/gemwarrior/arena.rb +10 -10
  5. data/lib/gemwarrior/battle.rb +41 -36
  6. data/lib/gemwarrior/entities/item.rb +2 -2
  7. data/lib/gemwarrior/entities/items/arena_master.rb +4 -4
  8. data/lib/gemwarrior/entities/items/bed.rb +1 -1
  9. data/lib/gemwarrior/entities/items/couch.rb +1 -1
  10. data/lib/gemwarrior/entities/items/floor_tile.rb +3 -3
  11. data/lib/gemwarrior/entities/items/gun.rb +1 -1
  12. data/lib/gemwarrior/entities/items/herb.rb +1 -1
  13. data/lib/gemwarrior/entities/items/ladder.rb +2 -2
  14. data/lib/gemwarrior/entities/items/map.rb +2 -2
  15. data/lib/gemwarrior/entities/items/massive_door.rb +1 -1
  16. data/lib/gemwarrior/entities/items/opalaser.rb +1 -1
  17. data/lib/gemwarrior/entities/items/pond.rb +2 -2
  18. data/lib/gemwarrior/entities/items/rope.rb +2 -2
  19. data/lib/gemwarrior/entities/items/snowman.rb +1 -1
  20. data/lib/gemwarrior/entities/items/sparklything.rb +1 -1
  21. data/lib/gemwarrior/entities/items/tent.rb +1 -1
  22. data/lib/gemwarrior/entities/items/tower_switch.rb +1 -1
  23. data/lib/gemwarrior/entities/items/waterfall.rb +1 -1
  24. data/lib/gemwarrior/entities/location.rb +19 -19
  25. data/lib/gemwarrior/entities/monster.rb +2 -2
  26. data/lib/gemwarrior/entities/monsters/alexandrat.rb +3 -3
  27. data/lib/gemwarrior/entities/monsters/amberoo.rb +3 -3
  28. data/lib/gemwarrior/entities/monsters/amethystle.rb +3 -3
  29. data/lib/gemwarrior/entities/monsters/apatiger.rb +2 -2
  30. data/lib/gemwarrior/entities/monsters/aquamarine.rb +3 -3
  31. data/lib/gemwarrior/entities/monsters/bloodstorm.rb +3 -3
  32. data/lib/gemwarrior/entities/monsters/bosses/emerald.rb +4 -4
  33. data/lib/gemwarrior/entities/monsters/bosses/garynetty.rb +2 -2
  34. data/lib/gemwarrior/entities/monsters/citrinaga.rb +3 -3
  35. data/lib/gemwarrior/entities/monsters/coraliz.rb +3 -3
  36. data/lib/gemwarrior/entities/monsters/cubicat.rb +3 -3
  37. data/lib/gemwarrior/entities/monsters/diaman.rb +3 -3
  38. data/lib/gemwarrior/entities/player.rb +275 -263
  39. data/lib/gemwarrior/evaluator.rb +448 -448
  40. data/lib/gemwarrior/game.rb +5 -5
  41. data/lib/gemwarrior/inventory.rb +14 -10
  42. data/lib/gemwarrior/misc/animation.rb +1 -1
  43. data/lib/gemwarrior/misc/music.rb +1 -1
  44. data/lib/gemwarrior/misc/name_generator.rb +8 -8
  45. data/lib/gemwarrior/misc/player_levels.rb +1 -1
  46. data/lib/gemwarrior/misc/timer.rb +50 -0
  47. data/lib/gemwarrior/misc/wordlist.rb +7 -7
  48. data/lib/gemwarrior/repl.rb +55 -21
  49. data/lib/gemwarrior/version.rb +1 -1
  50. data/lib/gemwarrior/world.rb +21 -21
  51. metadata +17 -2
@@ -15,7 +15,7 @@ module Gemwarrior
15
15
  self.equippable = true
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
20
20
  puts 'You pull the trigger on the gun, but realize there are no bullets in it. So, it does not do much except cause a barely audible *click* sound.'
21
21
  {:type => nil, :data => nil}
@@ -15,7 +15,7 @@ module Gemwarrior
15
15
  self.equippable = false
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
20
20
  puts 'You place the herb in your mouth, testing its texture. The mysterious herb is easily chewable, and you are able to swallow it without much effort. Slight tingles travel up and down your spine.'
21
21
  puts '>> You regain a few hit points.'
@@ -15,7 +15,7 @@ module Gemwarrior
15
15
  self.equippable = false
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
20
20
  puts 'You grab onto the shaky, rough-hewn, wooden ladder with all your might and start to descend, being extra careful not to loose your grip, which with every moment becomes shakier and shakier.'
21
21
  puts
@@ -24,7 +24,7 @@ module Gemwarrior
24
24
 
25
25
  puts 'The last couple of steps are more slippery than you anticipated, so you end up fumbling them, falling a few feet onto the hard ground below. When you regain your composure, you notice your conveyance for descending is now far above you and it is, unfortunately, your closest known exit.'
26
26
  puts
27
-
27
+
28
28
  {:type => 'move_dangerous', :data => 'Metal Tunnel (South Entrance)'}
29
29
  end
30
30
  end
@@ -15,10 +15,10 @@ module Gemwarrior
15
15
  self.equippable = false
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
20
20
  puts 'You unfold the piece of worn canvas, and study the markings upon it.'
21
-
21
+
22
22
  {:type => 'action', :data => 'map'}
23
23
  end
24
24
  end
@@ -15,7 +15,7 @@ module Gemwarrior
15
15
  self.equippable = false
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
20
20
  puts 'You attempt to open the seriously massive door that separates you from Emerald himself.'
21
21
  if player.inventory.has_item?('keystone')
@@ -15,7 +15,7 @@ module Gemwarrior
15
15
  self.equippable = true
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
20
20
  puts 'You pull the "trigger" on the opalaser, but nothing happens.'
21
21
  {:type => nil, :data => nil}
@@ -7,7 +7,7 @@ module Gemwarrior
7
7
  class Pond < Item
8
8
  # CONTACTS
9
9
  NEEDED_ITEMS = ['dehumidifier', 'feather', 'gun', 'stalactite']
10
-
10
+
11
11
  def initialize
12
12
  self.name = 'pond'
13
13
  self.description = 'This tiny pool of water self-ripples every minute or so. Small, floating insects buzz around merrily. A small plaque lays at the foot, reading: "If the right objects curious doth possess, touch the water\'s surface and you\'ll get redress."'
@@ -18,7 +18,7 @@ module Gemwarrior
18
18
  self.equippable = false
19
19
  self.equipped = false
20
20
  end
21
-
21
+
22
22
  def use(player = nil)
23
23
  puts 'You gently place your fingers on the pond\'s rippling surface.'
24
24
  binding.pry
@@ -15,14 +15,14 @@ module Gemwarrior
15
15
  self.equippable = false
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
20
20
  puts 'You hold on to the rope with both hands and begin to climb upwards towards the small opening in the ceiling.'
21
21
  puts
22
22
 
23
23
  puts 'After a few minutes you pull yourself up onto a field of pure driven snow. Without warning, the rope and opening in the floor vanish.'
24
24
  puts
25
-
25
+
26
26
  {:type => 'move', :data => 'Snow Fields (Southeast)'}
27
27
  end
28
28
  end
@@ -15,7 +15,7 @@ module Gemwarrior
15
15
  self.equippable = false
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
20
20
  puts 'You go to touch the snowy softness of the snowman when it magically comes to life! The frozen homunculus grabs you by the wrist and tosses you to the ground, only to follow this up by jumping onto you with its full, freezing, force. Your body, and mind, go numb.'
21
21
  puts
@@ -15,7 +15,7 @@ module Gemwarrior
15
15
  self.equippable = false
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
20
20
  puts 'Everything, and I mean *everything*, begins to sparkle. Huh.'
21
21
  puts
@@ -15,7 +15,7 @@ module Gemwarrior
15
15
  self.equippable = false
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
20
20
  {:type => 'action', :data => 'rest'}
21
21
  end
@@ -15,7 +15,7 @@ module Gemwarrior
15
15
  self.equippable = false
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
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
@@ -15,7 +15,7 @@ module Gemwarrior
15
15
  self.equippable = false
16
16
  self.equipped = false
17
17
  end
18
-
18
+
19
19
  def use(player = nil)
20
20
  puts 'You stretch out your hand and touch the waterfall. It stings you with its cold and forceful gushing. Your hand is now wet and rougher than before. In time, it will dry.'
21
21
  {:type => 'dmg', :data => rand(0..1)}
@@ -8,13 +8,13 @@ module Gemwarrior
8
8
  # CONSTANTS
9
9
  ## HASHES
10
10
  DANGER_LEVEL = {:none => 0, :low => 15, :moderate => 30, :high => 55, :assured => 100}
11
-
11
+
12
12
  ## ERRORS
13
13
  ERROR_LOCATION_ITEM_REMOVE_INVALID = 'That item cannot be removed as it does not exist here.'
14
14
 
15
15
  attr_accessor :coords, :locs_connected, :danger_level, :monster_level_range, :items,
16
16
  :monsters_abounding, :bosses_abounding, :checked_for_monsters
17
-
17
+
18
18
  def initialize(options)
19
19
  self.name = options.fetch(:name)
20
20
  self.description = options.fetch(:description)
@@ -27,7 +27,7 @@ module Gemwarrior
27
27
  self.bosses_abounding = options[:bosses_abounding]
28
28
  self.checked_for_monsters = false
29
29
  end
30
-
30
+
31
31
  def status(debug_mode = false)
32
32
  status_text = name.ljust(30).upcase.colorize(:green)
33
33
  status_text << coords.values.to_a.to_s.colorize(:white)
@@ -35,19 +35,19 @@ module Gemwarrior
35
35
  status_text << " MLR[#{monster_level_range.to_s.ljust(6)}] ".colorize(:white) if debug_mode
36
36
  status_text << "\n#{description}\n".colorize(:white)
37
37
  end
38
-
38
+
39
39
  def has_item?(item_name)
40
40
  items.map{|i| i.name.downcase}.include?(item_name)
41
41
  end
42
-
42
+
43
43
  def has_monster?(monster_name)
44
44
  monsters_abounding.map{|m| m.name.downcase}.include?(monster_name)
45
45
  end
46
-
46
+
47
47
  def has_boss?(boss_name)
48
48
  bosses_abounding.map{|b| b.name.downcase}.include?(boss_name)
49
49
  end
50
-
50
+
51
51
  def add_item(item_name)
52
52
  Dir.glob('lib/gemwarrior/items/*.rb').each do |item|
53
53
  require_relative item[item.index('/', item.index('/')+1)+1..item.length]
@@ -55,7 +55,7 @@ module Gemwarrior
55
55
 
56
56
  self.items.push(eval(item_name).new)
57
57
  end
58
-
58
+
59
59
  def remove_item(item_name)
60
60
  if has_item?(item_name)
61
61
  items.reject! { |item| item.name == item_name }
@@ -68,7 +68,7 @@ module Gemwarrior
68
68
  monsters_abounding.reject! { |monster| monster.name == name }
69
69
  bosses_abounding.reject! { |monster| monster.name == name }
70
70
  end
71
-
71
+
72
72
  def has_loc_to_the?(direction)
73
73
  case direction
74
74
  when 'n'
@@ -92,25 +92,25 @@ module Gemwarrior
92
92
  end
93
93
  end
94
94
  end
95
-
95
+
96
96
  def checked_for_monsters?
97
97
  checked_for_monsters
98
98
  end
99
-
99
+
100
100
  def should_spawn_monster?
101
101
  found = false
102
102
  unless danger_level.eql?(:none)
103
103
  max = DANGER_LEVEL[danger_level]
104
104
  trigger_values = 0..max
105
105
  actual_value = rand(1..100)
106
-
106
+
107
107
  if trigger_values.include?(actual_value)
108
108
  found = true
109
109
  end
110
110
  end
111
111
  return found
112
112
  end
113
-
113
+
114
114
  def list_items
115
115
  if items.length > 0
116
116
  items.map(&:name)
@@ -118,7 +118,7 @@ module Gemwarrior
118
118
  []
119
119
  end
120
120
  end
121
-
121
+
122
122
  def list_monsters
123
123
  if monsters_abounding.length > 0
124
124
  monsters_abounding.map(&:name)
@@ -126,7 +126,7 @@ module Gemwarrior
126
126
  []
127
127
  end
128
128
  end
129
-
129
+
130
130
  def list_bosses
131
131
  if bosses_abounding.length > 0
132
132
  bosses_abounding.map(&:name)
@@ -134,7 +134,7 @@ module Gemwarrior
134
134
  []
135
135
  end
136
136
  end
137
-
137
+
138
138
  def list_paths
139
139
  valid_paths = []
140
140
  locs_connected.each do |key, value|
@@ -144,7 +144,7 @@ module Gemwarrior
144
144
  end
145
145
  return valid_paths
146
146
  end
147
-
147
+
148
148
  def list_actionable_words
149
149
  actionable_words = []
150
150
  actionable_words.push(monsters_abounding.map(&:name)) unless monsters_abounding.empty?
@@ -152,7 +152,7 @@ module Gemwarrior
152
152
  actionable_words.push(items.map(&:name)) unless items.empty?
153
153
  actionable_words.join(', ')
154
154
  end
155
-
155
+
156
156
  def populate_monsters(monsters_available, spawn = false)
157
157
  if should_spawn_monster? || spawn
158
158
  self.checked_for_monsters = true unless spawn
@@ -162,7 +162,7 @@ module Gemwarrior
162
162
  # get random non-boss monster
163
163
  loop do
164
164
  random_monster = monsters_available[rand(0..monsters_available.length-1)]
165
-
165
+
166
166
  if spawn
167
167
  break
168
168
  else
@@ -7,7 +7,7 @@ require_relative 'items/herb'
7
7
  module Gemwarrior
8
8
  class Monster < Creature
9
9
  INVENTORY_ITEMS_DEFAULT = [Herb.new]
10
-
10
+
11
11
  attr_accessor :inventory, :battlecry, :is_boss
12
12
 
13
13
  def initialize
@@ -17,7 +17,7 @@ module Gemwarrior
17
17
  self.inventory = Inventory.new
18
18
  end
19
19
  end
20
-
20
+
21
21
  def describe
22
22
  status_text = name.upcase.ljust(13).colorize(:green)
23
23
  status_text << "#{description}\n".colorize(:white)
@@ -7,13 +7,13 @@ module Gemwarrior
7
7
  class Alexandrat < Monster
8
8
  def initialize
9
9
  super
10
-
10
+
11
11
  self.name = 'alexandrat'
12
12
  self.description = 'Tiny, but fierce, color-changing rodent.'
13
13
  self.face = 'ugly'
14
14
  self.hands = 'gnarled'
15
15
  self.mood = 'unchipper'
16
-
16
+
17
17
  self.level = rand(1..2)
18
18
  self.hp_cur = rand((level * 2)..(level * 3))
19
19
  self.hp_max = hp_cur
@@ -24,7 +24,7 @@ module Gemwarrior
24
24
 
25
25
  self.rox = rand((level * 2)..(level * 3))
26
26
  self.xp = rand(level..(level * 2))
27
-
27
+
28
28
  self.battlecry = 'Bitey, bitey!'
29
29
  end
30
30
  end
@@ -7,13 +7,13 @@ module Gemwarrior
7
7
  class Amberoo < Monster
8
8
  def initialize
9
9
  super
10
-
10
+
11
11
  self.name = 'amberoo'
12
12
  self.description = 'Fossilized and jumping around like an adorably dangerous threat from the past.'
13
13
  self.face = 'punchy'
14
14
  self.hands = 'balled'
15
15
  self.mood = 'jumpy'
16
-
16
+
17
17
  self.level = rand(1..2)
18
18
  self.hp_cur = rand((level * 2)..(level * 3))
19
19
  self.hp_max = hp_cur
@@ -24,7 +24,7 @@ module Gemwarrior
24
24
 
25
25
  self.rox = rand((level * 2)..(level * 3))
26
26
  self.xp = rand(level..(level * 2))
27
-
27
+
28
28
  self.battlecry = 'I\'m hoppin\' mad!'
29
29
  end
30
30
  end
@@ -7,13 +7,13 @@ module Gemwarrior
7
7
  class Amethystle < Monster
8
8
  def initialize
9
9
  super
10
-
10
+
11
11
  self.name = 'amethystle'
12
12
  self.description = 'Sober and contemplative, it moves with purplish tentacles swaying in the breeze.'
13
13
  self.face = 'sharp'
14
14
  self.hands = 'loose'
15
15
  self.mood = 'mesmerizing'
16
-
16
+
17
17
  self.level = rand(2..3)
18
18
  self.hp_cur = rand((level * 2)..(level * 3))
19
19
  self.hp_max = hp_cur
@@ -24,7 +24,7 @@ module Gemwarrior
24
24
 
25
25
  self.rox = rand((level * 2)..(level * 3))
26
26
  self.xp = rand(level..(level * 2))
27
-
27
+
28
28
  self.battlecry = 'You\'ve found yourself in quite the thorny issue!'
29
29
  end
30
30
  end
@@ -13,7 +13,7 @@ module Gemwarrior
13
13
  self.face = 'calloused'
14
14
  self.hands = 'soft'
15
15
  self.mood = 'apathetic'
16
-
16
+
17
17
  self.level = rand(4..5)
18
18
  self.hp_cur = rand((level * 2)..(level * 3))
19
19
  self.hp_max = hp_cur
@@ -24,7 +24,7 @@ module Gemwarrior
24
24
 
25
25
  self.rox = rand((level * 2)..(level * 3))
26
26
  self.xp = rand(level..(level * 2))
27
-
27
+
28
28
  self.battlecry = 'Gggggggggrrrrrrrrrrrrrrrrooooooooooowwwwwwwwwwwwlllllllll!'
29
29
  end
30
30
  end
@@ -7,13 +7,13 @@ module Gemwarrior
7
7
  class Aquamarine < Monster
8
8
  def initialize
9
9
  super
10
-
10
+
11
11
  self.name = 'aquamarine'
12
12
  self.description = 'It is but one of the few, the proud, the underwater.'
13
13
  self.face = 'strained'
14
14
  self.hands = 'hairy'
15
15
  self.mood = 'tempered'
16
-
16
+
17
17
  self.level = rand(3..4)
18
18
  self.hp_cur = rand((level * 2)..(level * 3))
19
19
  self.hp_max = hp_cur
@@ -24,7 +24,7 @@ module Gemwarrior
24
24
 
25
25
  self.rox = rand((level * 2)..(level * 3))
26
26
  self.xp = rand(level..(level * 2))
27
-
27
+
28
28
  self.battlecry = 'Attention! You are about to get smashed!'
29
29
  end
30
30
  end
@@ -7,13 +7,13 @@ module Gemwarrior
7
7
  class Bloodstorm < Monster
8
8
  def initialize
9
9
  super
10
-
10
+
11
11
  self.name = 'bloodstorm'
12
12
  self.description = 'A literal swirling, maniacal vortex of human hemoglobin.'
13
13
  self.face = 'bloody'
14
14
  self.hands = 'bloody'
15
15
  self.mood = 'boiling'
16
-
16
+
17
17
  self.level = rand(5..6)
18
18
  self.hp_cur = rand((level * 2)..(level * 3))
19
19
  self.hp_max = hp_cur
@@ -24,7 +24,7 @@ module Gemwarrior
24
24
 
25
25
  self.rox = rand((level * 2)..(level * 3))
26
26
  self.xp = rand(level..(level * 2))
27
-
27
+
28
28
  self.battlecry = '/swirls'
29
29
  end
30
30
  end