gemwarrior 0.10.8 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gemwarrior +0 -0
- data/data/default_world.yaml +282 -436
- data/gemwarrior.gemspec +1 -1
- data/lib/gemwarrior/arena.rb +17 -17
- data/lib/gemwarrior/battle.rb +146 -77
- data/lib/gemwarrior/entities/armor.rb +34 -0
- data/lib/gemwarrior/entities/armor/iron_helmet.rb +17 -0
- data/lib/gemwarrior/entities/creature.rb +81 -4
- data/lib/gemwarrior/entities/creatures/cow.rb +24 -0
- data/lib/gemwarrior/entities/{items → creatures}/goat.rb +9 -11
- data/lib/gemwarrior/entities/creatures/pig.rb +24 -0
- data/lib/gemwarrior/entities/entity.rb +59 -5
- data/lib/gemwarrior/entities/item.rb +10 -22
- data/lib/gemwarrior/entities/items/apple.rb +2 -5
- data/lib/gemwarrior/entities/items/arena_door.rb +2 -6
- data/lib/gemwarrior/entities/items/bed.rb +7 -11
- data/lib/gemwarrior/entities/items/bookcase.rb +57 -0
- data/lib/gemwarrior/entities/items/bullet.rb +25 -0
- data/lib/gemwarrior/entities/items/couch.rb +6 -10
- data/lib/gemwarrior/entities/items/cup.rb +2 -5
- data/lib/gemwarrior/entities/items/dehumidifier.rb +3 -6
- data/lib/gemwarrior/entities/items/feather.rb +2 -5
- data/lib/gemwarrior/entities/items/floor_tile.rb +6 -10
- data/lib/gemwarrior/entities/items/flower.rb +1 -4
- data/lib/gemwarrior/entities/items/herb.rb +12 -13
- data/lib/gemwarrior/entities/items/keystone.rb +2 -5
- data/lib/gemwarrior/entities/items/ladder.rb +7 -11
- data/lib/gemwarrior/entities/items/letter.rb +20 -23
- data/lib/gemwarrior/entities/items/map.rb +3 -6
- data/lib/gemwarrior/entities/items/massive_door.rb +3 -7
- data/lib/gemwarrior/entities/items/pedestal.rb +6 -10
- data/lib/gemwarrior/entities/items/pond.rb +4 -8
- data/lib/gemwarrior/entities/items/rope.rb +4 -8
- data/lib/gemwarrior/entities/items/small_hole.rb +15 -77
- data/lib/gemwarrior/entities/items/snowman.rb +5 -9
- data/lib/gemwarrior/entities/items/sparkly_thing.rb +3 -7
- data/lib/gemwarrior/entities/items/stonemite.rb +2 -6
- data/lib/gemwarrior/entities/items/tent.rb +3 -6
- data/lib/gemwarrior/entities/items/throne.rb +7 -6
- data/lib/gemwarrior/entities/items/tree.rb +2 -6
- data/lib/gemwarrior/entities/items/waterfall.rb +9 -8
- data/lib/gemwarrior/entities/location.rb +49 -43
- data/lib/gemwarrior/entities/monster.rb +34 -28
- data/lib/gemwarrior/entities/monsters/alexandrat.rb +3 -3
- data/lib/gemwarrior/entities/monsters/amberoo.rb +3 -3
- data/lib/gemwarrior/entities/monsters/amethystle.rb +3 -3
- data/lib/gemwarrior/entities/monsters/apatiger.rb +3 -3
- data/lib/gemwarrior/entities/monsters/aquamarine.rb +3 -3
- data/lib/gemwarrior/entities/monsters/bloodstorm.rb +3 -3
- data/lib/gemwarrior/entities/monsters/bosses/emerald.rb +12 -27
- data/lib/gemwarrior/entities/monsters/bosses/garynetty.rb +17 -5
- data/lib/gemwarrior/entities/monsters/bosses/jaspern.rb +66 -0
- data/lib/gemwarrior/entities/monsters/citrinaga.rb +3 -3
- data/lib/gemwarrior/entities/monsters/coraliz.rb +3 -3
- data/lib/gemwarrior/entities/monsters/cubicat.rb +3 -3
- data/lib/gemwarrior/entities/monsters/diaman.rb +3 -3
- data/lib/gemwarrior/entities/{items → people}/arena_master.rb +8 -13
- data/lib/gemwarrior/entities/{items → people}/drunk_man.rb +14 -35
- data/lib/gemwarrior/entities/people/queen_ruby.rb +71 -0
- data/lib/gemwarrior/entities/people/rockney.rb +132 -0
- data/lib/gemwarrior/entities/{items → people}/shifty_woman.rb +7 -12
- data/lib/gemwarrior/entities/{items → people}/thin_man.rb +9 -14
- data/lib/gemwarrior/entities/people/ware_hawker.rb +153 -0
- data/lib/gemwarrior/entities/person.rb +20 -0
- data/lib/gemwarrior/entities/player.rb +102 -60
- data/lib/gemwarrior/entities/weapon.rb +38 -0
- data/lib/gemwarrior/entities/{items → weapons}/dagger.rb +5 -7
- data/lib/gemwarrior/entities/{items → weapons}/gun.rb +8 -10
- data/lib/gemwarrior/entities/{items → weapons}/mace.rb +6 -9
- data/lib/gemwarrior/entities/{items → weapons}/opalaser.rb +5 -7
- data/lib/gemwarrior/entities/weapons/spear.rb +23 -0
- data/lib/gemwarrior/entities/{items → weapons}/stalactite.rb +5 -7
- data/lib/gemwarrior/entities/weapons/stone.rb +23 -0
- data/lib/gemwarrior/evaluator.rb +111 -107
- data/lib/gemwarrior/game.rb +61 -29
- data/lib/gemwarrior/game_assets.rb +76 -0
- data/lib/gemwarrior/inventory.rb +77 -43
- data/lib/gemwarrior/misc/animation.rb +17 -13
- data/lib/gemwarrior/misc/{music.rb → audio.rb} +15 -7
- data/lib/gemwarrior/misc/audio_cues.rb +133 -0
- data/lib/gemwarrior/misc/formatting.rb +9 -9
- data/lib/gemwarrior/misc/player_levels.rb +21 -0
- data/lib/gemwarrior/repl.rb +32 -31
- data/lib/gemwarrior/version.rb +1 -1
- data/lib/gemwarrior/world.rb +155 -134
- metadata +34 -22
- data/lib/gemwarrior/entities/items/cow.rb +0 -26
- data/lib/gemwarrior/entities/items/pig.rb +0 -26
- data/lib/gemwarrior/entities/items/queen_ruby.rb +0 -62
- data/lib/gemwarrior/entities/items/spear.rb +0 -26
- data/lib/gemwarrior/entities/items/stone.rb +0 -25
- data/lib/gemwarrior/entities/items/ware_hawker.rb +0 -93
@@ -1,5 +1,5 @@
|
|
1
1
|
# lib/gemwarrior/entities/items/pond.rb
|
2
|
-
# Item::Pond
|
2
|
+
# Entity::Item::Pond
|
3
3
|
|
4
4
|
require_relative '../item'
|
5
5
|
|
@@ -12,18 +12,14 @@ module Gemwarrior
|
|
12
12
|
super
|
13
13
|
|
14
14
|
self.name = 'pond'
|
15
|
+
self.name_display = 'Pond'
|
15
16
|
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."'
|
16
|
-
self.atk_lo = nil
|
17
|
-
self.atk_hi = nil
|
18
|
-
self.takeable = false
|
19
|
-
self.useable = true
|
20
|
-
self.equippable = false
|
21
17
|
end
|
22
18
|
|
23
|
-
def use(
|
19
|
+
def use(world)
|
24
20
|
puts 'You gently place your fingers on the pond\'s rippling surface.'
|
25
21
|
|
26
|
-
if (NEEDED_ITEMS - player.inventory.items.map(&:name)).empty?
|
22
|
+
if (NEEDED_ITEMS - world.player.inventory.items.map(&:name)).empty?
|
27
23
|
puts 'The pond water explodes with a force that knocks you back onto the ground. When you come to, you notice the depression in the ground where the pond once was now has a new curious object!'
|
28
24
|
self.description = 'A barren depression in the ground is all that is left of the pond.'
|
29
25
|
return { type: 'item', data: 'Opalaser' }
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# lib/gemwarrior/entities/items/rope.rb
|
2
|
-
# Item::Rope
|
2
|
+
# Entity::Item::Rope
|
3
3
|
|
4
4
|
require_relative '../item'
|
5
5
|
|
@@ -9,15 +9,11 @@ module Gemwarrior
|
|
9
9
|
super
|
10
10
|
|
11
11
|
self.name = 'rope'
|
12
|
+
self.name_display = 'Rope'
|
12
13
|
self.description = 'For some reason, a sturdy rope hangs down from a small opening in the metal tunnel\'s ceiling. It appears to hold your weight when taut.'
|
13
|
-
self.atk_lo = nil
|
14
|
-
self.atk_hi = nil
|
15
|
-
self.takeable = false
|
16
|
-
self.useable = true
|
17
|
-
self.equippable = false
|
18
14
|
end
|
19
15
|
|
20
|
-
def use(
|
16
|
+
def use(world)
|
21
17
|
puts 'You hold on to the rope with both hands and begin to climb upwards towards the small opening in the ceiling.'
|
22
18
|
puts
|
23
19
|
|
@@ -25,7 +21,7 @@ module Gemwarrior
|
|
25
21
|
puts
|
26
22
|
|
27
23
|
# stats
|
28
|
-
player.movements_made += 1
|
24
|
+
world.player.movements_made += 1
|
29
25
|
|
30
26
|
{ type: 'move', data: 'Snow Fields (Southeast)' }
|
31
27
|
end
|
@@ -1,95 +1,33 @@
|
|
1
1
|
# lib/gemwarrior/entities/items/small_hole.rb
|
2
|
-
# Item::SmallHole
|
2
|
+
# Entity::Item::SmallHole
|
3
3
|
|
4
|
-
require_relative '../
|
5
|
-
require_relative 'herb'
|
6
|
-
require_relative 'dagger'
|
4
|
+
require_relative '../person'
|
7
5
|
|
8
6
|
module Gemwarrior
|
9
7
|
class SmallHole < Item
|
10
|
-
# CONSTANTS
|
11
|
-
PRICE_HERB = 10
|
12
|
-
PRICE_DAGGER = 150
|
13
|
-
PLAYER_ROX_INSUFFICIENT = '>> "Pity. You are a bit short on funds to purchase that item."'
|
14
|
-
PLAYER_ITEMS_ADDITIONAL = '>> "Anything else?"'
|
15
|
-
PLAYER_COMMAND_INVALID = '>> "Huh?"'
|
16
|
-
|
17
8
|
def initialize
|
18
9
|
super
|
19
10
|
|
20
11
|
self.name = 'small_hole'
|
12
|
+
self.name_display = 'Small Hole'
|
21
13
|
self.description = 'Amongst the rubble of the alcove, a small hole, barely big enough for a rodent, exists in an absently-minded way near the bottom of the wall.'
|
22
|
-
self.atk_lo = nil
|
23
|
-
self.atk_hi = nil
|
24
|
-
self.takeable = false
|
25
|
-
self.useable = true
|
26
|
-
self.equippable = false
|
27
|
-
end
|
28
|
-
|
29
|
-
def use(player = nil)
|
30
|
-
puts 'You lower yourself to the ground and attempt to peer in the hole in the wall. Just as you begin to think this is a fruitless endeavor, a pair of bright, beady eyes manifest, and an unexpectedly low voice begins speaking to you:'
|
31
|
-
puts
|
32
|
-
|
33
|
-
rat_shop(player)
|
34
|
-
end
|
35
|
-
|
36
|
-
def reuse(player = nil)
|
37
|
-
rat_shop(player)
|
38
14
|
end
|
39
15
|
|
40
|
-
def
|
41
|
-
|
42
|
-
|
43
|
-
puts '>> "Hello, wanderer. Welcome to my establishment, as it were. Are you in need of anything?"'
|
44
|
-
puts
|
45
|
-
puts 'The creature gently shoves a small slip of paper out of his hole and towards you. You take a peek and notice it has a list of things with prices on it.'
|
46
|
-
puts
|
47
|
-
puts 'Rockney\'s Hole in the Wall'
|
48
|
-
puts '--------------------------'
|
49
|
-
puts "(1) Herb - #{PRICE_HERB} rox"
|
50
|
-
puts "(2) Dagger - #{PRICE_DAGGER} rox"
|
51
|
-
puts
|
52
|
-
puts '>> "What are you in need of?"'
|
16
|
+
def use(world)
|
17
|
+
if !self.used
|
18
|
+
self.used = true
|
53
19
|
|
54
|
-
|
55
|
-
|
56
|
-
puts ' 2 - Dagger'
|
57
|
-
puts ' x - leave'
|
58
|
-
print '[ROCKNEY]>? '
|
20
|
+
puts 'You lower yourself to the ground and attempt to peer in the hole in the wall. Just as you begin to think this is a fruitless endeavor, a pair of bright, beady eyes manifest, and an unexpectedly low voice speaks:'
|
21
|
+
Person.new.speak('Hello. I\'m Rockney, of Rockney\'s Hole in the Wall. Pleasure!')
|
59
22
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
player.rox -= 10
|
66
|
-
items_purchased.push(Herb.new)
|
67
|
-
puts '>> "Excellent choice."'
|
68
|
-
puts PLAYER_ITEMS_ADDITIONAL
|
69
|
-
next
|
70
|
-
else
|
71
|
-
puts PLAYER_ROX_INSUFFICIENT
|
72
|
-
next
|
73
|
-
end
|
74
|
-
when '2'
|
75
|
-
if player.rox >= 150
|
76
|
-
player.rox -= 150
|
77
|
-
items_purchased.push(Dagger.new)
|
78
|
-
puts '>> "A fine blade, indeed."'
|
79
|
-
puts PLAYER_ITEMS_ADDITIONAL
|
80
|
-
next
|
81
|
-
else
|
82
|
-
puts PLAYER_ROX_INSUFFICIENT
|
83
|
-
next
|
84
|
-
end
|
85
|
-
when 'x'
|
86
|
-
puts '>> "If you need anything further, I\'m always in this hole..."'
|
87
|
-
return { type: 'purchase', data: items_purchased }
|
88
|
-
else
|
89
|
-
puts PLAYER_COMMAND_INVALID
|
90
|
-
next
|
91
|
-
end
|
23
|
+
tunnel_alcove = world.location_by_name('tunnel_alcove')
|
24
|
+
tunnel_alcove.items.push(Rockney.new)
|
25
|
+
puts world.describe(tunnel_alcove)
|
26
|
+
else
|
27
|
+
puts 'Rockney appears to still be in the small hole, patiently waiting for you.'
|
92
28
|
end
|
29
|
+
|
30
|
+
{ type: nil, data: nil }
|
93
31
|
end
|
94
32
|
end
|
95
33
|
end
|
@@ -1,30 +1,26 @@
|
|
1
1
|
# lib/gemwarrior/entities/items/snowman.rb
|
2
|
-
# Item::Snowman
|
2
|
+
# Entity::Item::Snowman
|
3
3
|
|
4
4
|
require_relative '../item'
|
5
5
|
|
6
6
|
module Gemwarrior
|
7
7
|
class Snowman < Item
|
8
8
|
# CONSTANTS
|
9
|
-
USE_TEXT = '
|
9
|
+
USE_TEXT = '** FOOOOSH **'
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
super
|
13
13
|
|
14
14
|
self.name = 'snowman'
|
15
|
+
self.name_display = 'Snowman'
|
15
16
|
self.description = 'Standing solemnly in the snow, a man of snow solemnly stands.'
|
16
|
-
self.atk_lo = nil
|
17
|
-
self.atk_hi = nil
|
18
|
-
self.takeable = false
|
19
|
-
self.useable = true
|
20
|
-
self.equippable = false
|
21
17
|
end
|
22
18
|
|
23
|
-
def use(
|
19
|
+
def use(world)
|
24
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.'
|
25
21
|
puts
|
26
22
|
|
27
|
-
Animation
|
23
|
+
Animation.run(phrase: USE_TEXT)
|
28
24
|
|
29
25
|
{ type: 'move_dangerous', data: 'Home' }
|
30
26
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# lib/gemwarrior/entities/items/sparklything.rb
|
2
|
-
# Item::SparklyThing
|
2
|
+
# Entity::Item::SparklyThing
|
3
3
|
|
4
4
|
require_relative '../item'
|
5
5
|
|
@@ -9,17 +9,13 @@ module Gemwarrior
|
|
9
9
|
super
|
10
10
|
|
11
11
|
self.name = 'sparkly_thing'
|
12
|
+
self.name_display = 'SparklyThing(tm)'
|
12
13
|
self.description = 'The sparkling that this thing does is unimaginably brilliant.'
|
13
|
-
self.atk_lo = nil
|
14
|
-
self.atk_hi = nil
|
15
14
|
self.takeable = true
|
16
|
-
self.useable = true
|
17
|
-
self.equippable = false
|
18
15
|
end
|
19
16
|
|
20
|
-
def use(
|
17
|
+
def use(world)
|
21
18
|
puts 'Everything, and I mean *everything*, begins to sparkle. Huh.'
|
22
|
-
puts
|
23
19
|
{ type: nil, data: nil }
|
24
20
|
end
|
25
21
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# lib/gemwarrior/entities/items/stonemite.rb
|
2
|
-
# Item::Stonemite
|
2
|
+
# Entity::Item::Stonemite
|
3
3
|
|
4
4
|
require_relative '../item'
|
5
5
|
|
@@ -9,13 +9,9 @@ module Gemwarrior
|
|
9
9
|
super
|
10
10
|
|
11
11
|
self.name = 'stonemite'
|
12
|
+
self.name_display = 'Stonemite'
|
12
13
|
self.description = 'Stubby cave debris that is neat to look at, as it is off-grey and sparkly, but the size makes it unusable as anything but skipping on a lake.'
|
13
|
-
self.atk_lo = nil
|
14
|
-
self.atk_hi = nil
|
15
14
|
self.takeable = true
|
16
|
-
self.useable = false
|
17
|
-
self.equippable = false
|
18
|
-
self.equipped = false
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# lib/gemwarrior/entities/items/tent.rb
|
2
|
-
# Item::Tent
|
2
|
+
# Entity::Item::Tent
|
3
3
|
|
4
4
|
require_relative '../item'
|
5
5
|
|
@@ -9,16 +9,13 @@ module Gemwarrior
|
|
9
9
|
super
|
10
10
|
|
11
11
|
self.name = 'tent'
|
12
|
+
self.name_display = 'Tent'
|
12
13
|
self.description = 'A magical, two-room suite pops up when you flick this otherwise folded piece of canvas just right, perfect for a night\'s rest.'
|
13
|
-
self.atk_lo = nil
|
14
|
-
self.atk_hi = nil
|
15
14
|
self.takeable = true
|
16
|
-
self.useable = true
|
17
|
-
self.equippable = false
|
18
15
|
self.number_of_uses = 5
|
19
16
|
end
|
20
17
|
|
21
|
-
def use(
|
18
|
+
def use(world)
|
22
19
|
{ type: 'tent', data: self.number_of_uses }
|
23
20
|
end
|
24
21
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# lib/gemwarrior/entities/items/throne.rb
|
2
|
-
# Item::Throne
|
2
|
+
# Entity::Item::Throne
|
3
3
|
|
4
4
|
require_relative '../item'
|
5
5
|
|
@@ -9,12 +9,13 @@ module Gemwarrior
|
|
9
9
|
super
|
10
10
|
|
11
11
|
self.name = 'throne'
|
12
|
+
self.name_display = 'Throne'
|
12
13
|
self.description = 'Made of what appears to be unfulfilled desires and latent, flawed happiness, the well-crafted seat still looks kinda comfy. The wizard Emerald sits in it, glaring at you.'
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
end
|
15
|
+
|
16
|
+
def use
|
17
|
+
puts 'Your words fall on deaf chairs. Emerald continues to stare at you.'
|
18
|
+
{ type: nil, data: nil }
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# lib/gemwarrior/entities/items/tree.rb
|
2
|
-
# Item::Tree
|
2
|
+
# Entity::Item::Tree
|
3
3
|
|
4
4
|
require_relative '../item'
|
5
5
|
|
@@ -9,12 +9,8 @@ module Gemwarrior
|
|
9
9
|
super
|
10
10
|
|
11
11
|
self.name = 'tree'
|
12
|
+
self.name_display = 'Tree'
|
12
13
|
self.description = 'A mighty representation of nature, older than your father\'s father\'s second great-uncle.'
|
13
|
-
self.atk_lo = nil
|
14
|
-
self.atk_hi = nil
|
15
|
-
self.takeable = false
|
16
|
-
self.useable = false
|
17
|
-
self.equippable = false
|
18
14
|
end
|
19
15
|
end
|
20
16
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# lib/gemwarrior/entities/items/waterfall.rb
|
2
|
-
# Item::Waterfall
|
2
|
+
# Entity::Item::Waterfall
|
3
3
|
|
4
4
|
require_relative '../item'
|
5
5
|
|
@@ -9,17 +9,18 @@ module Gemwarrior
|
|
9
9
|
super
|
10
10
|
|
11
11
|
self.name = 'waterfall'
|
12
|
+
self.name_display = 'Waterfall'
|
12
13
|
self.description = 'Gallons of murky, sparkling water fall downward from an unknown spot in the sky, ending in a pool on the ground, yet never overflowing.'
|
13
|
-
self.atk_lo = nil
|
14
|
-
self.atk_hi = nil
|
15
|
-
self.takeable = false
|
16
|
-
self.useable = true
|
17
|
-
self.equippable = false
|
18
14
|
end
|
19
15
|
|
20
|
-
def use(
|
16
|
+
def use(world)
|
21
17
|
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.'
|
22
|
-
|
18
|
+
|
19
|
+
dmg = rand(0..1)
|
20
|
+
|
21
|
+
puts '>> You lose a hit point.'.colorize(:red) if dmg > 0
|
22
|
+
|
23
|
+
{ type: 'dmg', data: dmg }
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# lib/gemwarrior/entities/location.rb
|
2
|
+
# Entity::Location
|
2
3
|
# Place in the game
|
3
4
|
|
4
5
|
require_relative 'entity'
|
@@ -8,10 +9,36 @@ module Gemwarrior
|
|
8
9
|
class Location < Entity
|
9
10
|
# CONSTANTS
|
10
11
|
DANGER_LEVEL = { none: 0, low: 15, moderate: 30, high: 55, assured: 100 }
|
12
|
+
ERROR_ITEM_ADD_INVALID = 'That item cannot be added to the location\'s inventory.'
|
11
13
|
ERROR_ITEM_REMOVE_INVALID = 'That item cannot be removed as it does not exist here.'
|
12
14
|
|
13
|
-
attr_accessor :coords,
|
14
|
-
:
|
15
|
+
attr_accessor :coords,
|
16
|
+
:locs_connected,
|
17
|
+
:danger_level,
|
18
|
+
:monster_level_range,
|
19
|
+
:items,
|
20
|
+
:monsters_abounding,
|
21
|
+
:bosses_abounding,
|
22
|
+
:checked_for_monsters
|
23
|
+
|
24
|
+
def describe
|
25
|
+
desc_text = name.ljust(30).upcase.colorize(:green)
|
26
|
+
desc_text << coords.values.to_a.to_s.colorize(:white)
|
27
|
+
desc_text << " DL[#{danger_level.to_s.ljust(8)}] ".colorize(:white) if GameOptions.data['debug_mode']
|
28
|
+
desc_text << " MLR[#{monster_level_range.to_s.ljust(6)}] ".colorize(:white) if GameOptions.data['debug_mode']
|
29
|
+
desc_text << "\n"
|
30
|
+
desc_text << "#{description}".colorize(:white)
|
31
|
+
desc_text
|
32
|
+
end
|
33
|
+
|
34
|
+
def describe_detailed
|
35
|
+
desc_text = "#{name_display.ljust(36).colorize(:yellow)} #{coords.values.to_a.to_s.colorize(:white)}\n"
|
36
|
+
desc_text << "(#{name})\n".colorize(:green)
|
37
|
+
desc_text << "#{description}\n".colorize(:white)
|
38
|
+
desc_text << "DANGER_LEVEL : #{danger_level}\n".colorize(:white)
|
39
|
+
desc_text << "MONSTER_LEVEL_RANGE: #{monster_level_range}\n".colorize(:white)
|
40
|
+
desc_text
|
41
|
+
end
|
15
42
|
|
16
43
|
def initialize(options)
|
17
44
|
self.name = options.fetch(:name)
|
@@ -21,41 +48,36 @@ module Gemwarrior
|
|
21
48
|
self.danger_level = options.fetch(:danger_level)
|
22
49
|
self.monster_level_range = options.fetch(:monster_level_range)
|
23
50
|
self.items = options.fetch(:items)
|
24
|
-
self.monsters_abounding =
|
25
|
-
self.bosses_abounding = options[:bosses_abounding]
|
51
|
+
self.monsters_abounding = options.fetch(:monsters_abounding)
|
52
|
+
self.bosses_abounding = options.fetch[:bosses_abounding]
|
26
53
|
self.checked_for_monsters = false
|
27
54
|
end
|
28
55
|
|
29
|
-
def
|
30
|
-
|
31
|
-
status_text << coords.values.to_a.to_s.colorize(:white)
|
32
|
-
status_text << " DL[#{danger_level.to_s.ljust(8)}] ".colorize(:white) if GameOptions.data['debug_mode']
|
33
|
-
status_text << " MLR[#{monster_level_range.to_s.ljust(6)}] ".colorize(:white) if GameOptions.data['debug_mode']
|
34
|
-
status_text << "\n#{description}\n".colorize(:white)
|
35
|
-
end
|
36
|
-
|
37
|
-
def has_item?(item_name)
|
38
|
-
items.map{|i| i.name.downcase}.include?(item_name)
|
56
|
+
def contains_item?(item_name)
|
57
|
+
self.items.map{|i| i.name.downcase}.include?(item_name.downcase)
|
39
58
|
end
|
40
59
|
|
41
60
|
def has_monster?(monster_name)
|
42
|
-
monsters_abounding.map{|m| m.name.downcase}.include?(monster_name)
|
61
|
+
monsters_abounding.map{|m| m.name.downcase}.include?(monster_name.downcase)
|
43
62
|
end
|
44
63
|
|
45
64
|
def has_boss?(boss_name)
|
46
|
-
bosses_abounding.map{|b| b.name.downcase}.include?(boss_name)
|
65
|
+
bosses_abounding.map{|b| b.name.downcase}.include?(boss_name.downcase)
|
47
66
|
end
|
48
67
|
|
49
|
-
def add_item(
|
50
|
-
|
51
|
-
|
68
|
+
def add_item(item_name_to_add)
|
69
|
+
all_items = GameItems.data || GameWeapons.data
|
70
|
+
all_items.each do |game_item|
|
71
|
+
if game_item.name.eql?(item_name_to_add)
|
72
|
+
self.items.push(game_item)
|
73
|
+
return
|
74
|
+
end
|
52
75
|
end
|
53
|
-
|
54
|
-
self.items.push(eval(item_name).new)
|
76
|
+
return LOCATION_INVENTORY_ADD_ITEM_INVALID
|
55
77
|
end
|
56
78
|
|
57
79
|
def remove_item(item_name)
|
58
|
-
if
|
80
|
+
if contains_item?(item_name)
|
59
81
|
items.reject! { |item| item.name == item_name }
|
60
82
|
else
|
61
83
|
ERROR_ITEM_REMOVE_INVALID
|
@@ -64,7 +86,7 @@ module Gemwarrior
|
|
64
86
|
|
65
87
|
def remove_monster(name)
|
66
88
|
monsters_abounding.reject! { |monster| monster.name == name }
|
67
|
-
bosses_abounding.reject! { |
|
89
|
+
bosses_abounding.reject! { |boss| boss.name == name }
|
68
90
|
end
|
69
91
|
|
70
92
|
def has_loc_to_the?(direction)
|
@@ -102,10 +124,6 @@ module Gemwarrior
|
|
102
124
|
trigger_values = 0..max
|
103
125
|
actual_value = rand(1..100)
|
104
126
|
|
105
|
-
if GameOptions.data['debug_mode']
|
106
|
-
puts "should_spawn_monster? #{trigger_values} : #{actual_value}"
|
107
|
-
end
|
108
|
-
|
109
127
|
if trigger_values.include?(actual_value)
|
110
128
|
found = true
|
111
129
|
end
|
@@ -114,27 +132,15 @@ module Gemwarrior
|
|
114
132
|
end
|
115
133
|
|
116
134
|
def list_items
|
117
|
-
|
118
|
-
items.map(&:name)
|
119
|
-
else
|
120
|
-
[]
|
121
|
-
end
|
135
|
+
items.length > 0 ? items.map(&:name) : []
|
122
136
|
end
|
123
137
|
|
124
138
|
def list_monsters
|
125
|
-
|
126
|
-
monsters_abounding.map(&:name)
|
127
|
-
else
|
128
|
-
[]
|
129
|
-
end
|
139
|
+
monsters_abounding.length > 0 ? monsters_abounding.map(&:name) : []
|
130
140
|
end
|
131
141
|
|
132
142
|
def list_bosses
|
133
|
-
|
134
|
-
bosses_abounding.map(&:name)
|
135
|
-
else
|
136
|
-
[]
|
137
|
-
end
|
143
|
+
bosses_abounding.length > 0 ? bosses_abounding.map(&:name_display) : []
|
138
144
|
end
|
139
145
|
|
140
146
|
def list_paths
|
@@ -148,7 +154,7 @@ module Gemwarrior
|
|
148
154
|
end
|
149
155
|
|
150
156
|
def list_actionable_words
|
151
|
-
actionable_words =
|
157
|
+
actionable_words = []
|
152
158
|
actionable_words.push(monsters_abounding.map(&:name)) unless monsters_abounding.empty?
|
153
159
|
actionable_words.push(bosses_abounding.map(&:name)) unless bosses_abounding.empty?
|
154
160
|
actionable_words.push(items.map(&:name)) unless items.empty?
|