gemwarrior 0.4.1 → 0.5
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/lib/gemwarrior/entities/creature.rb +13 -18
- data/lib/gemwarrior/entities/entity.rb +3 -9
- data/lib/gemwarrior/entities/item.rb +6 -13
- data/lib/gemwarrior/entities/items/bed.rb +19 -0
- data/lib/gemwarrior/entities/items/feather.rb +19 -0
- data/lib/gemwarrior/entities/items/gun.rb +19 -0
- data/lib/gemwarrior/entities/items/stalactite.rb +19 -0
- data/lib/gemwarrior/entities/items/stone.rb +19 -0
- data/lib/gemwarrior/entities/items/tree.rb +19 -0
- data/lib/gemwarrior/entities/location.rb +38 -74
- data/lib/gemwarrior/entities/monster.rb +12 -35
- data/lib/gemwarrior/entities/monsters/alexandrat.rb +30 -0
- data/lib/gemwarrior/entities/monsters/amberoo.rb +30 -0
- data/lib/gemwarrior/entities/monsters/amethystle.rb +30 -0
- data/lib/gemwarrior/entities/monsters/apatiger.rb +30 -0
- data/lib/gemwarrior/entities/monsters/aquamarine.rb +30 -0
- data/lib/gemwarrior/entities/monsters/bloodstorm.rb +30 -0
- data/lib/gemwarrior/entities/monsters/citrinaga.rb +30 -0
- data/lib/gemwarrior/entities/monsters/coraliz.rb +30 -0
- data/lib/gemwarrior/entities/monsters/cubicat.rb +30 -0
- data/lib/gemwarrior/entities/monsters/diaman.rb +30 -0
- data/lib/gemwarrior/entities/player.rb +117 -154
- data/lib/gemwarrior/evaluator.rb +31 -16
- data/lib/gemwarrior/game.rb +28 -26
- data/lib/gemwarrior/inventory.rb +14 -16
- data/lib/gemwarrior/misc/version.rb +1 -1
- data/lib/gemwarrior/misc/wordlist.rb +7 -1
- data/lib/gemwarrior/repl.rb +2 -2
- data/lib/gemwarrior/world.rb +130 -298
- metadata +20 -7
- data/lib/gemwarrior/defaults.rb +0 -137
data/lib/gemwarrior/evaluator.rb
CHANGED
@@ -15,17 +15,19 @@ module Gemwarrior
|
|
15
15
|
LIST_PARAMS = 'Options: monsters, items, locations'
|
16
16
|
|
17
17
|
## ERRORS
|
18
|
-
ERROR_COMMAND_INVALID = 'That
|
19
|
-
ERROR_LIST_PARAM_MISSING = 'You
|
20
|
-
ERROR_CHANGE_PARAM_MISSING = 'Ch-ch-changes...
|
21
|
-
ERROR_CHANGE_PARAM_INVALID = 'You
|
22
|
-
ERROR_LIST_PARAM_INVALID = 'You
|
18
|
+
ERROR_COMMAND_INVALID = 'That is not something the game yet understands.'
|
19
|
+
ERROR_LIST_PARAM_MISSING = 'You cannot just "list". You gotta choose something to list.'
|
20
|
+
ERROR_CHANGE_PARAM_MISSING = 'Ch-ch-changes...are not happening because you did not specify what to change.'
|
21
|
+
ERROR_CHANGE_PARAM_INVALID = 'You cannot change that...yet.'
|
22
|
+
ERROR_LIST_PARAM_INVALID = 'You cannot list that...yet.'
|
23
23
|
ERROR_GO_PARAM_MISSING = 'Just wander aimlessly? A direction would be nice.'
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
ERROR_GO_PARAM_INVALID = 'The place in that direction is far, far, FAR too dangerous. You should try a different way.'
|
25
|
+
ERROR_ATTACK_PARAM_MISSING = 'You cannot just "attack". You gotta choose something to attack.'
|
26
|
+
ERROR_ATTACK_PARAM_INVALID = 'That monster does not exist here or can\'t be attacked.'
|
27
|
+
ERROR_TAKE_PARAM_MISSING = 'You cannot just "take". You gotta choose something to take.'
|
28
|
+
ERROR_DROP_PARAM_MISSING = 'You cannot just "drop". You gotta choose something to drop.'
|
29
|
+
ERROR_EQUIP_PARAM_MISSING = 'You cannot just "equip". You gotta choose something to equip.'
|
30
|
+
ERROR_UNEQUIP_PARAM_MISSING = 'You cannot just "unequip". You gotta choose something to unequip.'
|
29
31
|
|
30
32
|
attr_accessor :world, :commands, :aliases, :descriptions, :devcmds, :devaliases
|
31
33
|
|
@@ -99,15 +101,15 @@ module Gemwarrior
|
|
99
101
|
world.player.rest
|
100
102
|
when 'look', 'l'
|
101
103
|
if param
|
102
|
-
world.
|
104
|
+
world.describe_entity(param)
|
103
105
|
else
|
104
|
-
world.player.
|
106
|
+
world.describe(world.location_by_coords(world.player.cur_coords))
|
105
107
|
end
|
106
108
|
when 'take', 't'
|
107
109
|
if param.nil?
|
108
110
|
ERROR_TAKE_PARAM_MISSING
|
109
111
|
else
|
110
|
-
world.player.inventory.add_item(world.player.
|
112
|
+
world.player.inventory.add_item(world.location_by_coords(world.player.cur_coords), param)
|
111
113
|
end
|
112
114
|
when 'drop', 'd'
|
113
115
|
if param.nil?
|
@@ -131,13 +133,26 @@ module Gemwarrior
|
|
131
133
|
if param.nil?
|
132
134
|
ERROR_GO_PARAM_MISSING
|
133
135
|
else
|
134
|
-
|
136
|
+
direction = param
|
137
|
+
if world.can_move?(direction)
|
138
|
+
world.player.go(world.locations, param)
|
139
|
+
world.location_by_coords(world.player.cur_coords).checked_for_monsters = false
|
140
|
+
world.describe(world.location_by_coords(world.player.cur_coords))
|
141
|
+
else
|
142
|
+
ERROR_GO_PARAM_INVALID
|
143
|
+
end
|
135
144
|
end
|
136
145
|
when 'attack', 'a'
|
137
146
|
if param.nil?
|
138
147
|
ERROR_ATTACK_PARAM_MISSING
|
139
148
|
else
|
140
|
-
|
149
|
+
monster_name = param
|
150
|
+
if world.has_monster_to_attack?(monster_name)
|
151
|
+
monster = world.location_by_coords(world.player.cur_coords).monster_by_name(monster_name)
|
152
|
+
world.player.attack(world, monster)
|
153
|
+
else
|
154
|
+
ERROR_ATTACK_PARAM_INVALID
|
155
|
+
end
|
141
156
|
end
|
142
157
|
when 'change', 'ch'
|
143
158
|
if param.nil?
|
@@ -175,7 +190,7 @@ module Gemwarrior
|
|
175
190
|
def print_separator
|
176
191
|
puts SEPARATOR
|
177
192
|
end
|
178
|
-
|
193
|
+
|
179
194
|
def list_commands
|
180
195
|
i = 0
|
181
196
|
print_separator
|
data/lib/gemwarrior/game.rb
CHANGED
@@ -5,24 +5,25 @@ require_relative 'entities/player'
|
|
5
5
|
require_relative 'world'
|
6
6
|
require_relative 'evaluator'
|
7
7
|
require_relative 'repl'
|
8
|
+
require_relative 'inventory'
|
8
9
|
|
9
10
|
module Gemwarrior
|
10
11
|
class Game
|
11
12
|
# CONSTANTS
|
12
13
|
## PLAYER DEFAULTS
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
PLAYER_DESC_DEFAULT = 'Picked to do battle against a wizened madman for a shiny something or other for world-saving purposes.'
|
15
|
+
PLAYER_LEVEL_DEFAULT = 1
|
16
|
+
PLAYER_XP_DEFAULT = 0
|
17
|
+
PLAYER_HP_CUR_DEFAULT = 30
|
18
|
+
PLAYER_HP_MAX_DEFAULT = 30
|
19
|
+
PLAYER_STAM_CUR_DEFAULT = 20
|
20
|
+
PLAYER_STAM_MAX_DEFAULT = 20
|
21
|
+
PLAYER_ATK_LO_DEFAULT = 1
|
22
|
+
PLAYER_ATK_HI_DEFAULT = 2
|
23
|
+
PLAYER_DEFENSE_DEFAULT = 5
|
24
|
+
PLAYER_DEXTERITY_DEFAULT = 5
|
25
|
+
PLAYER_INVENTORY_DEFAULT = Inventory.new
|
26
|
+
PLAYER_ROX_DEFAULT = 0
|
26
27
|
|
27
28
|
attr_accessor :world, :eval, :repl
|
28
29
|
|
@@ -30,19 +31,20 @@ module Gemwarrior
|
|
30
31
|
# create new world and player
|
31
32
|
self.world = World.new
|
32
33
|
world.player = Player.new({
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
34
|
+
:description => PLAYER_DESC_DEFAULT,
|
35
|
+
:level => PLAYER_LEVEL_DEFAULT,
|
36
|
+
:xp => PLAYER_XP_DEFAULT,
|
37
|
+
:hp_cur => PLAYER_HP_CUR_DEFAULT,
|
38
|
+
:hp_max => PLAYER_HP_MAX_DEFAULT,
|
39
|
+
:stam_cur => PLAYER_STAM_CUR_DEFAULT,
|
40
|
+
:stam_max => PLAYER_STAM_MAX_DEFAULT,
|
41
|
+
:atk_lo => PLAYER_ATK_LO_DEFAULT,
|
42
|
+
:atk_hi => PLAYER_ATK_HI_DEFAULT,
|
43
|
+
:defense => PLAYER_DEFENSE_DEFAULT,
|
44
|
+
:dexterity => PLAYER_DEXTERITY_DEFAULT,
|
45
|
+
:inventory => PLAYER_INVENTORY_DEFAULT,
|
46
|
+
:rox => PLAYER_ROX_DEFAULT,
|
47
|
+
:cur_coords => world.location_coords_by_name('Home')
|
46
48
|
})
|
47
49
|
|
48
50
|
# create the console
|
data/lib/gemwarrior/inventory.rb
CHANGED
@@ -5,15 +5,14 @@ module Gemwarrior
|
|
5
5
|
class Inventory
|
6
6
|
# CONSTANTS
|
7
7
|
## ERRORS
|
8
|
-
|
9
|
-
ERROR_ITEM_REMOVE_INVALID = 'Your inventory does not contain that item, so you can\'t drop it.'
|
8
|
+
ERROR_ITEM_REMOVE_INVALID = 'Your inventory does not contain that item, so you cannot drop it.'
|
10
9
|
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.'
|
11
|
-
ERROR_ITEM_ADD_INVALID = 'That item
|
12
|
-
ERROR_ITEM_DESCRIBE_INVALID = 'You
|
13
|
-
ERROR_ITEM_EQUIP_INVALID = 'You
|
14
|
-
ERROR_ITEM_EQUIP_NONWEAPON = 'That
|
15
|
-
ERROR_ITEM_UNEQUIP_INVALID = 'You
|
16
|
-
ERROR_ITEM_UNEQUIP_NONWEAPON = 'That
|
10
|
+
ERROR_ITEM_ADD_INVALID = 'That item does not exist here.'
|
11
|
+
ERROR_ITEM_DESCRIBE_INVALID = 'You do not possess that.'
|
12
|
+
ERROR_ITEM_EQUIP_INVALID = 'You do not have anything called that to equip.'
|
13
|
+
ERROR_ITEM_EQUIP_NONWEAPON = 'That cannot be equipped as a weapon.'
|
14
|
+
ERROR_ITEM_UNEQUIP_INVALID = 'You do not have anything called that to unequip.'
|
15
|
+
ERROR_ITEM_UNEQUIP_NONWEAPON = 'That cannot be unequipped.'
|
17
16
|
|
18
17
|
attr_accessor :inventory, :weapon
|
19
18
|
|
@@ -23,11 +22,10 @@ module Gemwarrior
|
|
23
22
|
end
|
24
23
|
|
25
24
|
def list_contents
|
26
|
-
contents_text = "You check your inventory"
|
27
25
|
if inventory.empty?
|
28
|
-
return contents_text
|
26
|
+
return contents_text = '[empty]'
|
29
27
|
else
|
30
|
-
return contents_text
|
28
|
+
return contents_text = "Inventory contains: #{inventory.map(&:name).join ', '}\n"
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
@@ -35,7 +33,7 @@ module Gemwarrior
|
|
35
33
|
if inventory.map(&:name).include?(item_name)
|
36
34
|
inventory.each do |i|
|
37
35
|
if i.name.eql?(item_name)
|
38
|
-
return
|
36
|
+
return i.description
|
39
37
|
end
|
40
38
|
end
|
41
39
|
else
|
@@ -50,7 +48,7 @@ module Gemwarrior
|
|
50
48
|
if i.equippable
|
51
49
|
i.equipped = true
|
52
50
|
self.weapon = i
|
53
|
-
return "#{i.name} has been equipped"
|
51
|
+
return "The #{i.name} has taken charge, and been equipped."
|
54
52
|
else
|
55
53
|
ERROR_ITEM_EQUIP_NONWEAPON
|
56
54
|
end
|
@@ -68,7 +66,7 @@ module Gemwarrior
|
|
68
66
|
if i.equippable
|
69
67
|
i.equipped = false
|
70
68
|
self.weapon = nil
|
71
|
-
return "#{i.name} has been unequipped"
|
69
|
+
return "The #{i.name} has been demoted to unequipped."
|
72
70
|
else
|
73
71
|
ERROR_ITEM_UNEQUIP_NONWEAPON
|
74
72
|
end
|
@@ -85,7 +83,7 @@ module Gemwarrior
|
|
85
83
|
if i.takeable
|
86
84
|
inventory.push(i)
|
87
85
|
cur_loc.remove_item(item_name)
|
88
|
-
return "Added #{item_name} to your increasing collection of bits of tid
|
86
|
+
return "Added #{item_name} to your increasing collection of bits of tid."
|
89
87
|
else
|
90
88
|
return ERROR_ITEM_ADD_UNTAKEABLE
|
91
89
|
end
|
@@ -97,7 +95,7 @@ module Gemwarrior
|
|
97
95
|
def remove_item(item_name)
|
98
96
|
if inventory.map(&:name).include?(item_name)
|
99
97
|
inventory.reject! { |item| item.name == item_name }
|
100
|
-
|
98
|
+
return "The #{item_name} has been thrown on the ground, but far out of reach, and you're much too lazy to go get it now, so it's as good as gone."
|
101
99
|
else
|
102
100
|
ERROR_ITEM_REMOVE_INVALID
|
103
101
|
end
|
data/lib/gemwarrior/repl.rb
CHANGED
@@ -24,7 +24,7 @@ module Gemwarrior
|
|
24
24
|
|
25
25
|
def start(initialCommand = nil)
|
26
26
|
setup_screen(initialCommand)
|
27
|
-
|
27
|
+
|
28
28
|
# main loop
|
29
29
|
loop do
|
30
30
|
prompt
|
@@ -86,7 +86,7 @@ module Gemwarrior
|
|
86
86
|
world.player.stam_cur,
|
87
87
|
world.player.stam_max,
|
88
88
|
world.player.name,
|
89
|
-
world.player.
|
89
|
+
world.location_by_coords(world.player.cur_coords).name
|
90
90
|
]
|
91
91
|
puts (prompt_template % prompt_vars_arr)
|
92
92
|
end
|
data/lib/gemwarrior/world.rb
CHANGED
@@ -1,27 +1,19 @@
|
|
1
1
|
# lib/gemwarrior/world.rb
|
2
2
|
# World where the locations, monsters, items, etc. exist
|
3
3
|
|
4
|
-
require_relative 'entities/monster'
|
5
4
|
require_relative 'entities/item'
|
6
5
|
require_relative 'entities/location'
|
7
|
-
require_relative 'defaults'
|
8
6
|
|
9
7
|
module Gemwarrior
|
10
8
|
class World
|
11
9
|
# CONSTANTS
|
12
|
-
## DEFAULTS
|
13
|
-
include Entities::Monsters
|
14
|
-
include Entities::Items
|
15
|
-
include Entities::Locations
|
16
|
-
|
17
10
|
## ERRORS
|
18
|
-
ERROR_LIST_PARAM_INVALID = 'That
|
11
|
+
ERROR_LIST_PARAM_INVALID = 'That is not something that can be listed.'
|
19
12
|
|
20
|
-
attr_accessor :monsters, :
|
13
|
+
attr_accessor :monsters, :locations, :player
|
21
14
|
|
22
15
|
def initialize
|
23
16
|
self.monsters = init_monsters
|
24
|
-
self.items = init_items
|
25
17
|
self.locations = init_locations
|
26
18
|
self.player = nil
|
27
19
|
end
|
@@ -44,21 +36,30 @@ module Gemwarrior
|
|
44
36
|
when 'monsters'
|
45
37
|
puts '[MONSTERS]'
|
46
38
|
if details
|
47
|
-
|
39
|
+
monsters.map { |m| print m.describe }
|
40
|
+
return
|
48
41
|
else
|
49
42
|
">> #{monsters.map(&:name).join(', ')}"
|
50
43
|
end
|
51
44
|
when 'items'
|
52
45
|
puts '[ITEMS]'
|
53
46
|
if details
|
54
|
-
|
47
|
+
locations.each do |l|
|
48
|
+
l.items.map { |i| print i.status }
|
49
|
+
end
|
50
|
+
return
|
55
51
|
else
|
56
|
-
|
52
|
+
item_list = []
|
53
|
+
locations.each do |l|
|
54
|
+
l.items.map { |i| item_list << i.name }
|
55
|
+
end
|
56
|
+
">> #{item_list.sort.join(', ')}"
|
57
57
|
end
|
58
58
|
when 'locations'
|
59
59
|
puts '[LOCATIONS]'
|
60
60
|
if details
|
61
61
|
locations.map { |l| print l.status }
|
62
|
+
return
|
62
63
|
else
|
63
64
|
">> #{locations.map(&:name).join(', ')}"
|
64
65
|
end
|
@@ -66,333 +67,164 @@ module Gemwarrior
|
|
66
67
|
ERROR_LIST_PARAM_INVALID
|
67
68
|
end
|
68
69
|
end
|
69
|
-
|
70
|
-
def
|
71
|
-
|
72
|
-
if
|
73
|
-
return
|
70
|
+
|
71
|
+
def location_by_coords(coords)
|
72
|
+
locations.each do |l|
|
73
|
+
if l.coords.eql?(coords)
|
74
|
+
return l
|
74
75
|
end
|
75
76
|
end
|
76
77
|
return nil
|
77
78
|
end
|
78
79
|
|
79
|
-
def
|
80
|
-
|
81
|
-
if
|
82
|
-
return
|
80
|
+
def location_coords_by_name(name)
|
81
|
+
locations.each do |l|
|
82
|
+
if l.name.eql? name
|
83
|
+
return l.coords
|
83
84
|
end
|
84
85
|
end
|
85
86
|
return nil
|
86
87
|
end
|
87
|
-
|
88
|
-
def
|
89
|
-
|
90
|
-
|
91
|
-
|
88
|
+
|
89
|
+
def describe(point)
|
90
|
+
desc_text = ""
|
91
|
+
desc_text << "[ #{point.name} ]\n"
|
92
|
+
desc_text << point.description
|
93
|
+
unless point.checked_for_monsters?
|
94
|
+
point.populate_monsters
|
95
|
+
end
|
96
|
+
unless point.list_items.nil?
|
97
|
+
desc_text << point.list_items
|
98
|
+
end
|
99
|
+
unless point.list_monsters.nil?
|
100
|
+
desc_text << point.list_monsters
|
101
|
+
end
|
102
|
+
desc_text << point.list_paths
|
103
|
+
end
|
104
|
+
|
105
|
+
def describe_entity(point, entity_name)
|
106
|
+
if point.items.map(&:name).include?(entity_name)
|
107
|
+
point.items.each do |i|
|
108
|
+
if i.name.eql?(entity_name)
|
109
|
+
return "#{i.description}"
|
110
|
+
end
|
92
111
|
end
|
112
|
+
elsif
|
113
|
+
if point.monsters_abounding.map(&:name).include?(entity_name)
|
114
|
+
point.monsters_abounding.each do |m|
|
115
|
+
if m.name.eql?(entity_name)
|
116
|
+
return "#{m.description}"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
else
|
121
|
+
ERROR_LOCATION_DESCRIBE_ENTITY_INVALID
|
93
122
|
end
|
94
|
-
return nil
|
95
123
|
end
|
96
124
|
|
97
|
-
|
125
|
+
def can_move?(direction)
|
126
|
+
location_by_coords(player.cur_coords).has_loc_to_the?(direction)
|
127
|
+
end
|
98
128
|
|
99
|
-
def
|
100
|
-
|
101
|
-
monsters.push(Monster.new({
|
102
|
-
:id => MOB_ID_ALEXANDRAT,
|
103
|
-
:name => MOB_NAME_ALEXANDRAT,
|
104
|
-
:description => MOB_DESC_ALEXANDRAT,
|
105
|
-
:face => 'ugly',
|
106
|
-
:hands => 'gnarled',
|
107
|
-
:mood => 'unsurprisingly unchipper',
|
108
|
-
:level => (MOB_LEVEL_ALEXANDRAT * 1.5).floor,
|
109
|
-
:hp_cur => (MOB_LEVEL_ALEXANDRAT * 4.25).floor,
|
110
|
-
:hp_max => (MOB_LEVEL_ALEXANDRAT * 4.25).floor,
|
111
|
-
:atk_lo => (MOB_LEVEL_ALEXANDRAT * 1.25).floor,
|
112
|
-
:atk_hi => MOB_LEVEL_ALEXANDRAT * 2,
|
113
|
-
:dexterity => MOB_DEXTERITY_ALEXANDRAT,
|
114
|
-
:inventory => Inventory.new,
|
115
|
-
:rox_to_give => rand(0..10),
|
116
|
-
:xp_to_give => MOB_LEVEL_ALEXANDRAT * rand(1..2),
|
117
|
-
:battlecry => MOB_BATTLECRY_ALEXANDRAT
|
118
|
-
})
|
119
|
-
)
|
120
|
-
monsters.push(Monster.new({
|
121
|
-
:id => MOB_ID_AMBEROO,
|
122
|
-
:name => MOB_NAME_AMBEROO,
|
123
|
-
:description => MOB_DESC_AMBEROO,
|
124
|
-
:face => 'punchy',
|
125
|
-
:hands => 'balled',
|
126
|
-
:mood => 'jumpy',
|
127
|
-
:level => (MOB_LEVEL_AMBEROO * 1.5).floor,
|
128
|
-
:hp_cur => (MOB_LEVEL_AMBEROO * 4.5).floor,
|
129
|
-
:hp_max => (MOB_LEVEL_AMBEROO * 4.5).floor,
|
130
|
-
:atk_lo => (MOB_LEVEL_AMBEROO * 1.25).floor,
|
131
|
-
:atk_hi => MOB_LEVEL_AMBEROO * 2,
|
132
|
-
:dexterity => MOB_DEXTERITY_AMBEROO,
|
133
|
-
:inventory => Inventory.new,
|
134
|
-
:rox_to_give => rand(0..10),
|
135
|
-
:xp_to_give => MOB_LEVEL_AMBEROO * rand(1..2),
|
136
|
-
:battlecry => MOB_BATTLECRY_AMBEROO
|
137
|
-
})
|
138
|
-
)
|
139
|
-
monsters.push(Monster.new({
|
140
|
-
:id => MOB_ID_AMETHYSTLE,
|
141
|
-
:name => MOB_NAME_AMETHYSTLE,
|
142
|
-
:description => MOB_DESC_AMETHYSTLE,
|
143
|
-
:face => 'sharp',
|
144
|
-
:hands => 'loose',
|
145
|
-
:mood => 'mesmerizing',
|
146
|
-
:level => MOB_LEVEL_AMETHYSTLE,
|
147
|
-
:hp_cur => MOB_LEVEL_AMETHYSTLE * 5,
|
148
|
-
:hp_max => MOB_LEVEL_AMETHYSTLE * 5,
|
149
|
-
:atk_lo => (MOB_LEVEL_AMETHYSTLE * 1.25).floor,
|
150
|
-
:atk_hi => MOB_LEVEL_AMETHYSTLE * 2,
|
151
|
-
:dexterity => MOB_DEXTERITY_AMETHYSTLE,
|
152
|
-
:inventory => Inventory.new,
|
153
|
-
:rox_to_give => rand(0..10),
|
154
|
-
:xp_to_give => MOB_LEVEL_AMETHYSTLE * rand(1..2),
|
155
|
-
:battlecry => MOB_BATTLECRY_AMETHYSTLE
|
156
|
-
})
|
157
|
-
)
|
158
|
-
monsters.push(Monster.new({
|
159
|
-
:id => MOB_ID_APATIGER,
|
160
|
-
:name => MOB_NAME_APATIGER,
|
161
|
-
:description => MOB_DESC_APATIGER,
|
162
|
-
:face => 'calloused',
|
163
|
-
:hands => 'soft',
|
164
|
-
:mood => 'apathetic',
|
165
|
-
:level => MOB_LEVEL_APATIGER,
|
166
|
-
:hp_cur => MOB_LEVEL_APATIGER * 5,
|
167
|
-
:hp_max => MOB_LEVEL_APATIGER * 5,
|
168
|
-
:atk_lo => (MOB_LEVEL_APATIGER * 1.25).floor,
|
169
|
-
:atk_hi => MOB_LEVEL_APATIGER * 2,
|
170
|
-
:dexterity => MOB_DEXTERITY_APATIGER,
|
171
|
-
:inventory => Inventory.new,
|
172
|
-
:rox_to_give => rand(0..10),
|
173
|
-
:xp_to_give => MOB_LEVEL_APATIGER * rand(1..2),
|
174
|
-
:battlecry => MOB_BATTLECRY_APATIGER
|
175
|
-
})
|
176
|
-
)
|
177
|
-
monsters.push(Monster.new({
|
178
|
-
:id => MOB_ID_AQUAMARINE,
|
179
|
-
:name => MOB_NAME_AQUAMARINE,
|
180
|
-
:description => MOB_DESC_AQUAMARINE,
|
181
|
-
:face => 'strained',
|
182
|
-
:hands => 'hairy',
|
183
|
-
:mood => 'tempered',
|
184
|
-
:level => MOB_LEVEL_AQUAMARINE,
|
185
|
-
:hp_cur => MOB_LEVEL_AQUAMARINE * 5,
|
186
|
-
:hp_max => MOB_LEVEL_AQUAMARINE * 5,
|
187
|
-
:atk_lo => (MOB_LEVEL_AQUAMARINE * 1.5).floor,
|
188
|
-
:atk_hi => MOB_LEVEL_AQUAMARINE * 2,
|
189
|
-
:dexterity => MOB_DEXTERITY_AQUAMARINE,
|
190
|
-
:inventory => Inventory.new,
|
191
|
-
:rox_to_give => rand(0..10),
|
192
|
-
:xp_to_give => MOB_LEVEL_AQUAMARINE * rand(1..2),
|
193
|
-
:battlecry => MOB_BATTLECRY_AQUAMARINE
|
194
|
-
})
|
195
|
-
)
|
196
|
-
monsters.push(Monster.new({
|
197
|
-
:id => MOB_ID_BLOODSTORM,
|
198
|
-
:name => MOB_NAME_BLOODSTORM,
|
199
|
-
:description => MOB_DESC_BLOODSTORM,
|
200
|
-
:face => 'bloody',
|
201
|
-
:hands => 'bloody',
|
202
|
-
:mood => 'boiling',
|
203
|
-
:level => MOB_LEVEL_BLOODSTORM,
|
204
|
-
:hp_cur => MOB_LEVEL_BLOODSTORM * 5,
|
205
|
-
:hp_max => MOB_LEVEL_BLOODSTORM * 5,
|
206
|
-
:atk_lo => (MOB_LEVEL_BLOODSTORM * 1.5).floor,
|
207
|
-
:atk_hi => MOB_LEVEL_BLOODSTORM * 2,
|
208
|
-
:dexterity => MOB_DEXTERITY_BLOODSTORM,
|
209
|
-
:inventory => Inventory.new,
|
210
|
-
:rox_to_give => rand(0..10),
|
211
|
-
:xp_to_give => MOB_LEVEL_BLOODSTORM * rand(2..3),
|
212
|
-
:battlecry => MOB_BATTLECRY_BLOODSTORM
|
213
|
-
})
|
214
|
-
)
|
215
|
-
monsters.push(Monster.new({
|
216
|
-
:id => MOB_ID_CITRINAGA,
|
217
|
-
:name => MOB_NAME_CITRINAGA,
|
218
|
-
:description => MOB_DESC_CITRINAGA,
|
219
|
-
:face => 'shiny',
|
220
|
-
:hands => 'glistening',
|
221
|
-
:mood => 'staid',
|
222
|
-
:level => MOB_LEVEL_CITRINAGA,
|
223
|
-
:hp_cur => MOB_LEVEL_CITRINAGA * 5,
|
224
|
-
:hp_max => MOB_LEVEL_CITRINAGA * 5,
|
225
|
-
:atk_lo => (MOB_LEVEL_CITRINAGA * 1.3).floor,
|
226
|
-
:atk_hi => MOB_LEVEL_CITRINAGA * 2,
|
227
|
-
:dexterity => MOB_DEXTERITY_CITRINAGA,
|
228
|
-
:inventory => Inventory.new,
|
229
|
-
:rox_to_give => rand(0..10),
|
230
|
-
:xp_to_give => MOB_LEVEL_CITRINAGA * rand(2..3),
|
231
|
-
:battlecry => MOB_BATTLECRY_CITRINAGA
|
232
|
-
})
|
233
|
-
)
|
234
|
-
monsters.push(Monster.new({
|
235
|
-
:id => MOB_ID_CORALIZ,
|
236
|
-
:name => MOB_NAME_CORALIZ,
|
237
|
-
:description => MOB_DESC_CORALIZ,
|
238
|
-
:face => 'spotted',
|
239
|
-
:hands => 'slippery',
|
240
|
-
:mood => 'emotionless',
|
241
|
-
:level => MOB_LEVEL_CORALIZ,
|
242
|
-
:hp_cur => MOB_LEVEL_CORALIZ * 5,
|
243
|
-
:hp_max => MOB_LEVEL_CORALIZ * 5,
|
244
|
-
:atk_lo => (MOB_LEVEL_CORALIZ * 1.5).floor,
|
245
|
-
:atk_hi => MOB_LEVEL_CORALIZ * 2,
|
246
|
-
:dexterity => MOB_DEXTERITY_CORALIZ,
|
247
|
-
:inventory => Inventory.new,
|
248
|
-
:rox_to_give => rand(0..10),
|
249
|
-
:xp_to_give => MOB_LEVEL_CORALIZ * rand(2..3),
|
250
|
-
:battlecry => MOB_BATTLECRY_CORALIZ
|
251
|
-
})
|
252
|
-
)
|
253
|
-
monsters.push(Monster.new({
|
254
|
-
:id => MOB_ID_CUBICAT,
|
255
|
-
:name => MOB_NAME_CUBICAT,
|
256
|
-
:description => MOB_DESC_CUBICAT,
|
257
|
-
:face => 'striking',
|
258
|
-
:hands => 'grippy',
|
259
|
-
:mood => 'salacious',
|
260
|
-
:level => MOB_LEVEL_CUBICAT,
|
261
|
-
:hp_cur => MOB_LEVEL_CUBICAT * 5,
|
262
|
-
:hp_max => MOB_LEVEL_CUBICAT * 5,
|
263
|
-
:atk_lo => (MOB_LEVEL_CUBICAT * 1.75).floor,
|
264
|
-
:atk_hi => MOB_LEVEL_CUBICAT * 2,
|
265
|
-
:dexterity => MOB_DEXTERITY_CUBICAT,
|
266
|
-
:inventory => Inventory.new,
|
267
|
-
:rox_to_give => rand(0..10),
|
268
|
-
:xp_to_give => MOB_LEVEL_CUBICAT * rand(3..4),
|
269
|
-
:battlecry => MOB_BATTLECRY_CUBICAT
|
270
|
-
})
|
271
|
-
)
|
272
|
-
monsters.push(Monster.new({
|
273
|
-
:id => MOB_ID_DIAMAN,
|
274
|
-
:name => MOB_NAME_DIAMAN,
|
275
|
-
:description => MOB_DESC_DIAMAN,
|
276
|
-
:face => 'bright',
|
277
|
-
:hands => 'jagged',
|
278
|
-
:mood => 'adamant',
|
279
|
-
:level => MOB_LEVEL_DIAMAN,
|
280
|
-
:hp_cur => MOB_LEVEL_DIAMAN * 5,
|
281
|
-
:hp_max => MOB_LEVEL_DIAMAN * 5,
|
282
|
-
:atk_lo => (MOB_LEVEL_DIAMAN * 1.75).floor,
|
283
|
-
:atk_hi => MOB_LEVEL_DIAMAN * 2,
|
284
|
-
:dexterity => MOB_DEXTERITY_DIAMAN,
|
285
|
-
:inventory => Inventory.new,
|
286
|
-
:rox_to_give => rand(0..10),
|
287
|
-
:xp_to_give => MOB_LEVEL_DIAMAN * rand(3..5),
|
288
|
-
:battlecry => MOB_BATTLECRY_DIAMAN
|
289
|
-
})
|
290
|
-
)
|
129
|
+
def has_monster_to_attack?(monster_name)
|
130
|
+
location_by_coords(player.cur_coords).monsters_abounding.map(&:name).include?(monster_name.downcase)
|
291
131
|
end
|
132
|
+
|
133
|
+
private
|
292
134
|
|
293
|
-
def
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
:name => ITEM_NAME_STALACTITE,
|
318
|
-
:description => ITEM_DESC_STALACTITE,
|
319
|
-
:atk_lo => ITEM_ATK_LO_STALACTITE,
|
320
|
-
:atk_hi => ITEM_ATK_HI_STALACTITE,
|
321
|
-
:takeable => true,
|
322
|
-
:equippable => true
|
323
|
-
})
|
324
|
-
)
|
325
|
-
items.push(Item.new({
|
326
|
-
:id => ITEM_ID_FEATHER,
|
327
|
-
:name => ITEM_NAME_FEATHER,
|
328
|
-
:description => ITEM_DESC_FEATHER,
|
329
|
-
:atk_lo => ITEM_ATK_LO_FEATHER,
|
330
|
-
:atk_hi => ITEM_ATK_HI_FEATHER,
|
331
|
-
:takeable => true,
|
332
|
-
:equippable => false
|
333
|
-
})
|
334
|
-
)
|
335
|
-
items.push(Item.new({
|
336
|
-
:id => ITEM_ID_GUN,
|
337
|
-
:name => ITEM_NAME_GUN,
|
338
|
-
:description => ITEM_DESC_GUN,
|
339
|
-
:atk_lo => ITEM_ATK_LO_GUN,
|
340
|
-
:atk_hi => ITEM_ATK_HI_GUN,
|
341
|
-
:takeable => true,
|
342
|
-
:equippable => true
|
343
|
-
})
|
344
|
-
)
|
135
|
+
def init_monsters
|
136
|
+
require_relative 'entities/monsters/alexandrat'
|
137
|
+
require_relative 'entities/monsters/amberoo'
|
138
|
+
require_relative 'entities/monsters/amethystle'
|
139
|
+
require_relative 'entities/monsters/apatiger'
|
140
|
+
require_relative 'entities/monsters/aquamarine'
|
141
|
+
require_relative 'entities/monsters/bloodstorm'
|
142
|
+
require_relative 'entities/monsters/citrinaga'
|
143
|
+
require_relative 'entities/monsters/coraliz'
|
144
|
+
require_relative 'entities/monsters/cubicat'
|
145
|
+
require_relative 'entities/monsters/diaman'
|
146
|
+
|
147
|
+
self.monsters = [
|
148
|
+
Alexandrat.new,
|
149
|
+
Amberoo.new,
|
150
|
+
Amethystle.new,
|
151
|
+
Apatiger.new,
|
152
|
+
Aquamarine.new,
|
153
|
+
Bloodstorm.new,
|
154
|
+
Citrinaga.new,
|
155
|
+
Coraliz.new,
|
156
|
+
Cubicat.new,
|
157
|
+
Diaman.new
|
158
|
+
]
|
345
159
|
end
|
346
|
-
|
160
|
+
|
347
161
|
def init_locations
|
162
|
+
require_relative 'entities/items/bed'
|
163
|
+
require_relative 'entities/items/feather'
|
164
|
+
require_relative 'entities/items/gun'
|
165
|
+
require_relative 'entities/items/stalactite'
|
166
|
+
require_relative 'entities/items/stone'
|
167
|
+
require_relative 'entities/items/tree'
|
168
|
+
|
348
169
|
locations = []
|
170
|
+
|
349
171
|
locations.push(Location.new({
|
350
|
-
:
|
351
|
-
:
|
352
|
-
:
|
353
|
-
:locs_connected =>
|
172
|
+
:name => 'Home',
|
173
|
+
:description => 'The little, unimportant, decrepit hut that you live in.',
|
174
|
+
:coords => {:x => 5, :y => 0},
|
175
|
+
:locs_connected => {:north => true, :east => true, :south => false, :west => true},
|
354
176
|
:danger_level => :none,
|
355
|
-
:items => [
|
177
|
+
:items => [Bed.new, Stone.new],
|
356
178
|
:monsters_available => monsters
|
357
179
|
})
|
358
180
|
)
|
359
181
|
locations.push(Location.new({
|
360
|
-
:
|
361
|
-
:
|
362
|
-
:
|
363
|
-
:locs_connected =>
|
182
|
+
:name => 'Cave (Entrance)',
|
183
|
+
:description => 'A nearby, dank entrance to a cavern, surely filled with stacktites, stonemites, and rocksites.',
|
184
|
+
:coords => {:x => 6, :y => 0},
|
185
|
+
:locs_connected => {:north => false, :east => true, :south => false, :west => true},
|
364
186
|
:danger_level => :low,
|
365
187
|
:items => [],
|
366
188
|
:monsters_available => monsters
|
367
189
|
})
|
368
190
|
)
|
369
191
|
locations.push(Location.new({
|
370
|
-
:
|
371
|
-
:
|
372
|
-
:
|
373
|
-
:locs_connected =>
|
192
|
+
:name => 'Cave (Room1)',
|
193
|
+
:description => 'Now inside the first cavernous room, you confirm that there are stacktites, stonemites, rocksites, and even one or two pebblejites.',
|
194
|
+
:coords => {:x => 7, :y => 0},
|
195
|
+
:locs_connected => {:north => false, :east => false, :south => false, :west => true},
|
374
196
|
:danger_level => :moderate,
|
375
|
-
:items => [
|
197
|
+
:items => [Stalactite.new],
|
376
198
|
:monsters_available => monsters
|
377
199
|
})
|
378
200
|
)
|
379
201
|
locations.push(Location.new({
|
380
|
-
:
|
381
|
-
:
|
382
|
-
:
|
383
|
-
:locs_connected =>
|
202
|
+
:name => 'Forest',
|
203
|
+
:description => 'Trees exist here, in droves.',
|
204
|
+
:coords => {:x => 4, :y => 0},
|
205
|
+
:locs_connected => {:north => false, :east => true, :south => false, :west => false},
|
384
206
|
:danger_level => :low,
|
385
|
-
:items => [
|
207
|
+
:items => [Feather.new, Tree.new],
|
208
|
+
:monsters_available => monsters
|
209
|
+
})
|
210
|
+
)
|
211
|
+
locations.push(Location.new({
|
212
|
+
:name => 'Plains',
|
213
|
+
:description => 'A lot of grass and nothing, but you see a mysterious tower further north, and your home to the south.',
|
214
|
+
:coords => {:x => 5, :y => 1},
|
215
|
+
:locs_connected => {:north => true, :east => false, :south => true, :west => false},
|
216
|
+
:danger_level => :low,
|
217
|
+
:items => [],
|
386
218
|
:monsters_available => monsters
|
387
219
|
})
|
388
220
|
)
|
389
221
|
locations.push(Location.new({
|
390
|
-
:
|
391
|
-
:
|
392
|
-
:
|
393
|
-
:locs_connected =>
|
222
|
+
:name => 'Emerald\'s Sky Tower',
|
223
|
+
:description => 'The craziest guy that ever existed is around here somewhere amongst the cloud floors, snow walls, and ethereal vibe.',
|
224
|
+
:coords => {:x => 5, :y => 2},
|
225
|
+
:locs_connected => {:north => false, :east => false, :south => true, :west => false},
|
394
226
|
:danger_level => :assured,
|
395
|
-
:items => [
|
227
|
+
:items => [Gun.new],
|
396
228
|
:monsters_available => monsters
|
397
229
|
})
|
398
230
|
)
|