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,34 +1,29 @@
|
|
1
|
-
# lib/gemwarrior/entities/
|
2
|
-
#
|
1
|
+
# lib/gemwarrior/entities/people/thin_man.rb
|
2
|
+
# Entity::Creature::Person::ThinMan
|
3
3
|
|
4
|
-
require_relative '../
|
4
|
+
require_relative '../person'
|
5
5
|
|
6
6
|
module Gemwarrior
|
7
|
-
class ThinMan <
|
7
|
+
class ThinMan < Person
|
8
8
|
def initialize
|
9
9
|
super
|
10
10
|
|
11
11
|
self.name = 'thin_man'
|
12
|
+
self.name_display = 'Thin Man'
|
12
13
|
self.description = 'An almost shockingly gaunt man is sitting on the ground, resting against a wall. He wears a patchwork quilt of a hat, and his slender frame is covered by a simple brown tunic. His feet point comically toward the sky in brown boots while his head dips down slightly, eyes watching something in the distance you can\'t see.'
|
13
|
-
self.atk_lo = nil
|
14
|
-
self.atk_hi = nil
|
15
|
-
self.takeable = false
|
16
|
-
self.useable = true
|
17
|
-
self.equippable = false
|
18
|
-
self.talkable = true
|
19
14
|
end
|
20
15
|
|
21
|
-
def use(
|
16
|
+
def use(world)
|
22
17
|
if self.used
|
23
18
|
puts 'The thin man barely moves his head as he puts up a single grim hand, motioning you to back off.'
|
24
19
|
else
|
25
20
|
puts 'The thin man lifts his head up slightly, meets your gaze, and responds to your greeting:'
|
26
|
-
|
27
|
-
|
21
|
+
speak('I may be incredibly spare right now, but I was once a strapping young person, such as yourself. Just in case you ever fall during your journey, be sure to approach unlikely sources, as you may find those who will help you.')
|
22
|
+
speak('Now, please, allow me my peace.')
|
28
23
|
|
29
24
|
self.used = true
|
30
25
|
end
|
31
|
-
|
26
|
+
|
32
27
|
{ type: nil, data: nil }
|
33
28
|
end
|
34
29
|
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
# lib/gemwarrior/entities/people/ware_hawker.rb
|
2
|
+
# Entity::Creature::Person::WareHawker
|
3
|
+
|
4
|
+
require_relative '../person'
|
5
|
+
require_relative '../weapons/mace'
|
6
|
+
require_relative '../weapons/spear'
|
7
|
+
require_relative '../armor/iron_helmet'
|
8
|
+
|
9
|
+
module Gemwarrior
|
10
|
+
class WareHawker < Person
|
11
|
+
# CONSTANTS
|
12
|
+
PRICE_IRON_HELMET = 100
|
13
|
+
PRICE_MACE = 200
|
14
|
+
PRICE_SPEAR = 250
|
15
|
+
PLAYER_ROX_INSUFFICIENT = 'You have insufficient rox to purchase that. Quit testing me, human.'
|
16
|
+
PLAYER_ITEMS_ADDITIONAL = 'Will there be something else?'
|
17
|
+
PLAYER_COMMAND_INVALID = 'That means nothing to me.'
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
super
|
21
|
+
|
22
|
+
self.name = 'ware_hawker'
|
23
|
+
self.name_display = 'Ware Hawker'
|
24
|
+
self.description = 'A literal anthropomorphic hawk has set up shop behind a crudely-made table. Some wares are scattered atop its surface, seemingly within anyone\'s grasp, but the hawk\'s piercing eyes seem to belie this observation.'
|
25
|
+
end
|
26
|
+
|
27
|
+
def use(world)
|
28
|
+
if !self.used
|
29
|
+
puts 'You greet the hawk, mentioning that you are interested in the objects presented.'
|
30
|
+
STDIN.getc
|
31
|
+
puts 'The hawk speaks in a beautiful, yet commanding, tone:'
|
32
|
+
end
|
33
|
+
|
34
|
+
hawk_shop(world)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def hawk_shop(world)
|
40
|
+
player_rox_remaining = world.player.rox
|
41
|
+
amount_spent = 0
|
42
|
+
items_purchased = []
|
43
|
+
|
44
|
+
iron_helmet = IronHelmet.new
|
45
|
+
mace = Mace.new
|
46
|
+
spear = Spear.new
|
47
|
+
|
48
|
+
speak('I hope you have rox, human. My time affords business transactions, not idle chit chat. What do you want?')
|
49
|
+
STDIN.getc
|
50
|
+
|
51
|
+
puts 'A feathered arm quickly moves across the table in an arc suggesting to you that a choice is to be made. Each object has a price tag underneath it, painstakingly written in ink.'
|
52
|
+
puts
|
53
|
+
|
54
|
+
puts 'Hawk Shop'.colorize(:cyan)
|
55
|
+
puts '---------'
|
56
|
+
puts "(1) #{'Iron Helmet'.colorize(:yellow)} - #{PRICE_IRON_HELMET} rox"
|
57
|
+
puts " #{iron_helmet.description}"
|
58
|
+
puts " Defense: +#{iron_helmet.defense} (current: #{world.player.defense})"
|
59
|
+
puts "(2) #{'Mace'.colorize(:yellow)} - #{PRICE_MACE} rox"
|
60
|
+
puts " #{mace.description}"
|
61
|
+
puts " Attack: +#{mace.atk_lo}-#{mace.atk_hi} (current: #{world.player.atk_lo}-#{world.player.atk_hi})"
|
62
|
+
puts "(3) #{'Spear'.colorize(:yellow)} - #{PRICE_SPEAR} rox"
|
63
|
+
puts " #{spear.description}"
|
64
|
+
puts " Attack: +#{spear.atk_lo}-#{spear.atk_hi} (current: #{world.player.atk_lo}-#{world.player.atk_hi})"
|
65
|
+
puts
|
66
|
+
speak('Choose. Now.')
|
67
|
+
|
68
|
+
loop do
|
69
|
+
puts " 1 - Iron Helmet (#{PRICE_IRON_HELMET})"
|
70
|
+
puts " 2 - Mace (#{PRICE_MACE})"
|
71
|
+
puts " 3 - Spear (#{PRICE_SPEAR})"
|
72
|
+
print ' x - leave'
|
73
|
+
if items_purchased.length > 0
|
74
|
+
print ", and buy items\n"
|
75
|
+
else
|
76
|
+
print "\n"
|
77
|
+
end
|
78
|
+
puts
|
79
|
+
print 'REMAINING GOLD: '
|
80
|
+
Animation.run(phrase: player_rox_remaining.to_s, oneline: true)
|
81
|
+
print "\n"
|
82
|
+
display_shopping_cart(items_purchased)
|
83
|
+
print '[HAWK]> '
|
84
|
+
|
85
|
+
choice = gets.chomp.downcase
|
86
|
+
|
87
|
+
case choice
|
88
|
+
when '1'
|
89
|
+
if player_rox_remaining >= PRICE_IRON_HELMET
|
90
|
+
player_rox_remaining -= PRICE_IRON_HELMET
|
91
|
+
items_purchased.push(IronHelmet.new)
|
92
|
+
amount_spent += PRICE_IRON_HELMET
|
93
|
+
|
94
|
+
speak('The iron helmet? I see.')
|
95
|
+
speak(PLAYER_ITEMS_ADDITIONAL)
|
96
|
+
next
|
97
|
+
else
|
98
|
+
speak(PLAYER_ROX_INSUFFICIENT)
|
99
|
+
next
|
100
|
+
end
|
101
|
+
when '2'
|
102
|
+
if player_rox_remaining >= PRICE_MACE
|
103
|
+
player_rox_remaining -= PRICE_MACE
|
104
|
+
items_purchased.push(Mace.new)
|
105
|
+
amount_spent += PRICE_MACE
|
106
|
+
|
107
|
+
speak('Yes, fine. Buy a mace.')
|
108
|
+
speak(PLAYER_ITEMS_ADDITIONAL)
|
109
|
+
next
|
110
|
+
else
|
111
|
+
speak(PLAYER_ROX_INSUFFICIENT)
|
112
|
+
next
|
113
|
+
end
|
114
|
+
when '3'
|
115
|
+
if player_rox_remaining >= PRICE_SPEAR
|
116
|
+
player_rox_remaining -= PRICE_SPEAR
|
117
|
+
items_purchased.push(Spear.new)
|
118
|
+
amount_spent += PRICE_SPEAR
|
119
|
+
|
120
|
+
speak('Hmm. Very well, then. If the spear is what you wish.')
|
121
|
+
speak(PLAYER_ITEMS_ADDITIONAL)
|
122
|
+
next
|
123
|
+
else
|
124
|
+
speak(PLAYER_ROX_INSUFFICIENT)
|
125
|
+
next
|
126
|
+
end
|
127
|
+
when 'x'
|
128
|
+
if items_purchased.length > 0
|
129
|
+
display_shopping_cart(items_purchased)
|
130
|
+
speak('Are you certain you wish to buy these things? (y/n)')
|
131
|
+
print '[HAWK]> '
|
132
|
+
answer = gets.chomp.downcase
|
133
|
+
|
134
|
+
return_type = nil
|
135
|
+
case answer
|
136
|
+
when 'y', 'yes'
|
137
|
+
world.player.rox -= amount_spent
|
138
|
+
speak('Take them.')
|
139
|
+
return_type = { type: 'purchase', data: items_purchased }
|
140
|
+
else
|
141
|
+
return_type = { type: nil, data: nil }
|
142
|
+
end
|
143
|
+
end
|
144
|
+
speak('Our business is complete then.')
|
145
|
+
return return_type
|
146
|
+
else
|
147
|
+
speak(PLAYER_COMMAND_INVALID)
|
148
|
+
next
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# lib/gemwarrior/entities/person.rb
|
2
|
+
# Entity::Creature::Person base class
|
3
|
+
|
4
|
+
require_relative 'creature'
|
5
|
+
|
6
|
+
module Gemwarrior
|
7
|
+
class Person < Creature
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
|
11
|
+
self.name = 'person.'
|
12
|
+
self.name_display = Formatting::upstyle(name)
|
13
|
+
self.description = 'It appears to be a person of some kind.'
|
14
|
+
end
|
15
|
+
|
16
|
+
def use(world)
|
17
|
+
'That person does not seem to want to talk to you right now.'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require_relative 'creature'
|
5
5
|
require_relative '../battle'
|
6
|
+
require_relative '../game_assets'
|
6
7
|
require_relative '../game_options'
|
7
8
|
require_relative '../misc/formatting'
|
8
9
|
require_relative '../misc/name_generator'
|
@@ -15,13 +16,20 @@ module Gemwarrior
|
|
15
16
|
LEVEL_UP_TEXT = '** LEVEL UP! **'
|
16
17
|
REST_FULL_TEXT = '** HMMMM **'
|
17
18
|
REST_NOT_FULL_TEXT = '** ZZZZZ **'
|
18
|
-
|
19
|
+
|
19
20
|
include PlayerLevels
|
20
21
|
include Formatting
|
21
22
|
|
22
|
-
attr_accessor :stam_cur,
|
23
|
-
:
|
24
|
-
:
|
23
|
+
attr_accessor :stam_cur,
|
24
|
+
:stam_max,
|
25
|
+
:cur_coords,
|
26
|
+
:special_abilities,
|
27
|
+
:monsters_killed,
|
28
|
+
:bosses_killed,
|
29
|
+
:items_taken,
|
30
|
+
:movements_made,
|
31
|
+
:rests_taken,
|
32
|
+
:deaths
|
25
33
|
|
26
34
|
def generate_name
|
27
35
|
NameGenerator.new('fantasy').generate_name
|
@@ -44,22 +52,35 @@ module Gemwarrior
|
|
44
52
|
print_char_pic
|
45
53
|
end
|
46
54
|
|
47
|
-
weapon_slot
|
48
|
-
|
49
|
-
|
55
|
+
weapon_slot = '(unarmed)'
|
56
|
+
armor_slot = '(unarmored)'
|
57
|
+
base_atk_lo = self.atk_lo
|
58
|
+
base_atk_hi = self.atk_hi
|
59
|
+
base_defense = self.defense
|
60
|
+
net_atk_lo = nil
|
61
|
+
net_atk_hi = nil
|
62
|
+
net_defense = nil
|
63
|
+
|
64
|
+
# juice the weapon display
|
50
65
|
if has_weapon_equipped?
|
51
66
|
weapon_slot = inventory.weapon.name
|
52
|
-
|
53
|
-
|
54
|
-
else
|
55
|
-
weapon_slot = '(unarmed)'
|
67
|
+
net_atk_lo = base_atk_lo + inventory.weapon.atk_lo
|
68
|
+
net_atk_hi = base_atk_hi + inventory.weapon.atk_hi
|
56
69
|
end
|
57
|
-
|
70
|
+
|
71
|
+
# juice the armor display
|
72
|
+
if has_armor_equipped?
|
73
|
+
armor_slot = inventory.armor.name
|
74
|
+
net_defense = base_defense + inventory.armor.defense
|
75
|
+
end
|
76
|
+
|
58
77
|
abilities = ''
|
59
78
|
if special_abilities.empty?
|
60
79
|
abilities = 'none...yet(?)'
|
61
80
|
else
|
62
|
-
|
81
|
+
special_abilities.each do |sp|
|
82
|
+
abilities << " #{Formatting.upstyle(sp.to_s).ljust(15).colorize(:yellow)}: #{PlayerLevels.get_ability_description(sp)}\n"
|
83
|
+
end
|
63
84
|
end
|
64
85
|
|
65
86
|
self_text = "NAME : #{self.name}\n"
|
@@ -67,15 +88,27 @@ module Gemwarrior
|
|
67
88
|
self_text << "EXPERIENCE: #{self.xp}\n"
|
68
89
|
self_text << "HIT POINTS: #{self.hp_cur}/#{self.hp_max}\n"
|
69
90
|
self_text << "WEAPON : #{weapon_slot}\n"
|
70
|
-
self_text << "
|
91
|
+
self_text << "ARMOR : #{armor_slot}\n"
|
92
|
+
self_text << "ATTACK : #{base_atk_lo}-#{base_atk_hi}"
|
93
|
+
self_text << " (#{net_atk_lo}-#{net_atk_hi} w/ #{weapon_slot})".colorize(:yellow) unless net_atk_lo.nil?
|
94
|
+
self_text << "\n"
|
95
|
+
self_text << "DEFENSE : #{base_defense}"
|
96
|
+
self_text << " (#{net_defense} w/ #{armor_slot})".colorize(:yellow) unless net_defense.nil?
|
97
|
+
self_text << "\n"
|
71
98
|
self_text << "DEXTERITY : #{self.dexterity}\n"
|
72
|
-
self_text << "
|
73
|
-
self_text << "
|
99
|
+
self_text << "ABILITIES :\n"
|
100
|
+
self_text << "#{abilities}"
|
74
101
|
|
75
102
|
if GameOptions.data['debug_mode']
|
76
|
-
self_text << "
|
77
|
-
self_text << "
|
78
|
-
self_text << "
|
103
|
+
self_text << ">> POSITION : #{self.cur_coords.values.to_a}\n"
|
104
|
+
self_text << ">> GOD_MODE : #{GameOptions.data['god_mode']}\n"
|
105
|
+
self_text << ">> BEAST_MODE : #{GameOptions.data['beast_mode']}\n"
|
106
|
+
self_text << ">> MONSTERS_KILLED: #{self.monsters_killed}\n"
|
107
|
+
self_text << ">> BOSSES_KILLED : #{self.bosses_killed}\n"
|
108
|
+
self_text << ">> ITEMS_TAKEN : #{self.items_taken}\n"
|
109
|
+
self_text << ">> MOVEMENTS_MADE : #{self.movements_made}\n"
|
110
|
+
self_text << ">> RESTS_TAKEN : #{self.rests_taken}\n"
|
111
|
+
self_text << ">> DEATHS : #{self.deaths}\n"
|
79
112
|
end
|
80
113
|
|
81
114
|
self_text << "\n"
|
@@ -84,14 +117,14 @@ module Gemwarrior
|
|
84
117
|
|
85
118
|
self_text << "\n\n"
|
86
119
|
|
87
|
-
self_text << "[Current Status]\nBreathing, non-naked, with a #{self.face.colorize(:yellow)} face, #{self.hands.colorize(:yellow)} hands, and
|
120
|
+
self_text << "[Current Status]\nBreathing, non-naked, with a #{self.face.colorize(:yellow)} face, #{self.hands.colorize(:yellow)} hands, and feeling, generally, #{self.mood.colorize(:yellow)}."
|
88
121
|
|
89
122
|
self_text << "\n"
|
90
123
|
end
|
91
124
|
|
92
125
|
def rest(world, tent_uses = 0, ensure_fight = false)
|
93
126
|
if ensure_fight
|
94
|
-
battle = Battle.new(world: world, player: self, monster:
|
127
|
+
battle = Battle.new(world: world, player: self, monster: GameMonsters.data[rand(0..GameMonsters.data.length-1)].clone)
|
95
128
|
result = battle.start(is_arena = false, is_event = true)
|
96
129
|
if result.eql?('death')
|
97
130
|
return 'death'
|
@@ -105,8 +138,6 @@ module Gemwarrior
|
|
105
138
|
if cur_loc.should_spawn_monster?
|
106
139
|
chance_of_ambush = rand(0..100)
|
107
140
|
|
108
|
-
puts "chance_of_ambush: #{chance_of_ambush}" if GameOptions.data['debug_mode']
|
109
|
-
|
110
141
|
if chance_of_ambush < 25
|
111
142
|
battle = Battle.new(world: world, player: self, monster: cur_loc.monsters_abounding[rand(0..cur_loc.monsters_abounding.length-1)].clone)
|
112
143
|
return battle.start(is_arena = false, is_event = true)
|
@@ -126,27 +157,28 @@ module Gemwarrior
|
|
126
157
|
|
127
158
|
if tent_uses > 0
|
128
159
|
if self.at_full_hp?
|
160
|
+
Animation.run(phrase: REST_FULL_TEXT)
|
129
161
|
return 'Despite feeling just fine, health-wise, you decide to set up camp for the ni--well, actually, after a few minutes you realize you don\'t need to sleep and pack things up again, ready to go.'
|
130
162
|
else
|
131
|
-
Animation
|
163
|
+
Animation.run(phrase: REST_NOT_FULL_TEXT)
|
132
164
|
self.hp_cur = self.hp_max
|
133
165
|
|
134
|
-
status_text = "You brandish the trusty magical canvas and, with a flick of the wrist, your home for the evening is set up. Approximately #{hours} #{hours_text}, #{minutes} #{mins_text}, and #{seconds} #{secs_text} later, you wake up, fully rested, ready for adventure
|
135
|
-
status_text << "
|
166
|
+
status_text = "You brandish the trusty magical canvas and, with a flick of the wrist, your home for the evening is set up. Approximately #{hours} #{hours_text}, #{minutes} #{mins_text}, and #{seconds} #{secs_text} later, you wake up, fully rested, ready for adventure.\n"
|
167
|
+
status_text << ">> You regain all of your hit points.".colorize(:green)
|
136
168
|
|
137
169
|
return status_text
|
138
170
|
end
|
139
171
|
else
|
140
172
|
if self.at_full_hp?
|
141
|
-
Animation
|
173
|
+
Animation.run(phrase: REST_FULL_TEXT)
|
142
174
|
return 'You sit down on the ground, make some notes on the back of your hand, test the air, and then return to standing, back at it all again.'
|
143
175
|
else
|
144
|
-
Animation
|
145
|
-
self.hp_cur = self.hp_cur.to_i + rand(
|
176
|
+
Animation.run(phrase: REST_NOT_FULL_TEXT)
|
177
|
+
self.hp_cur = self.hp_cur.to_i + rand(3..5)
|
146
178
|
self.hp_cur = self.hp_max if self.hp_cur > self.hp_max
|
147
179
|
|
148
|
-
status_text = "You lie down somewhere quasi-flat and after a few moments, due to extreme exhaustion, you fall into a deep, yet troubled, slumber. Approximately #{hours} #{hours_text}, #{minutes} #{mins_text}, and #{seconds} #{secs_text} later, you wake up with a start. Upon getting to your feet you look around, notice you feel somewhat better, and wonder why you dreamt about #{WordList.new('noun-plural').get_random_value}
|
149
|
-
status_text << "
|
180
|
+
status_text = "You lie down somewhere quasi-flat and after a few moments, due to extreme exhaustion, you fall into a deep, yet troubled, slumber. Approximately #{hours} #{hours_text}, #{minutes} #{mins_text}, and #{seconds} #{secs_text} later, you wake up with a start. Upon getting to your feet you look around, notice you feel somewhat better, and wonder why you dreamt about #{WordList.new('noun-plural').get_random_value}.\n"
|
181
|
+
status_text << ">> You regain a few hit points.".colorize(:green)
|
150
182
|
|
151
183
|
return status_text
|
152
184
|
end
|
@@ -233,6 +265,10 @@ module Gemwarrior
|
|
233
265
|
self.inventory.weapon
|
234
266
|
end
|
235
267
|
|
268
|
+
def has_armor_equipped?
|
269
|
+
self.inventory.armor
|
270
|
+
end
|
271
|
+
|
236
272
|
def cur_weapon_name
|
237
273
|
if has_weapon_equipped?
|
238
274
|
return " with your #{inventory.weapon.name}"
|
@@ -278,30 +314,40 @@ module Gemwarrior
|
|
278
314
|
|
279
315
|
new_player_level = PlayerLevels::check_level(self.xp)
|
280
316
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
317
|
+
# how many levels did we go up, if any?
|
318
|
+
level_climb = new_player_level - old_player_level
|
319
|
+
|
320
|
+
if level_climb >= 1
|
321
|
+
level_to_get = old_player_level
|
322
|
+
|
323
|
+
level_climb.times do
|
324
|
+
level_to_get += 1
|
325
|
+
Audio.play_synth(:player_level_up)
|
326
|
+
Animation.run(phrase: LEVEL_UP_TEXT)
|
327
|
+
new_stats = PlayerLevels::get_level_stats(level_to_get)
|
328
|
+
|
329
|
+
self.level = new_stats[:level]
|
330
|
+
puts "You are now level #{self.level.to_s.colorize(:white)}!"
|
331
|
+
self.hp_cur = new_stats[:hp_max]
|
332
|
+
self.hp_max = new_stats[:hp_max]
|
333
|
+
puts "You now have #{self.hp_max.to_s.colorize(:white)} hit points!"
|
334
|
+
self.stam_cur = new_stats[:stam_max]
|
335
|
+
self.stam_max = new_stats[:stam_max]
|
336
|
+
puts "You now have #{self.stam_max.to_s.colorize(:white)} stamina points!"
|
337
|
+
self.atk_lo = new_stats[:atk_lo]
|
338
|
+
self.atk_hi = new_stats[:atk_hi]
|
339
|
+
puts "You now have an attack of #{self.atk_lo.to_s.colorize(:white)}-#{self.atk_hi.to_s.colorize(:white)}!"
|
340
|
+
self.defense = new_stats[:defense]
|
341
|
+
puts "You now have #{self.defense.to_s.colorize(:white)} defensive points!"
|
342
|
+
self.dexterity = new_stats[:dexterity]
|
343
|
+
puts "You now have #{self.dexterity.to_s.colorize(:white)} dexterity points!"
|
344
|
+
unless new_stats[:special_abilities].nil?
|
345
|
+
unless self.special_abilities.include?(new_stats[:special_abilities])
|
346
|
+
self.special_abilities.push(new_stats[:special_abilities])
|
347
|
+
puts "You learned a new ability: #{Formatting::upstyle(new_stats[:special_abilities]).colorize(:white)}!"
|
348
|
+
end
|
304
349
|
end
|
350
|
+
STDIN.getc
|
305
351
|
end
|
306
352
|
end
|
307
353
|
end
|
@@ -319,12 +365,8 @@ module Gemwarrior
|
|
319
365
|
end
|
320
366
|
|
321
367
|
def print_traveling_text(direction_text)
|
322
|
-
|
323
|
-
|
324
|
-
{ frequencies: 'D4', duration: 75 },
|
325
|
-
{ frequencies: 'E4', duration: 75 }
|
326
|
-
])
|
327
|
-
Animation::run(phrase: "* #{direction_text} *", oneline: false)
|
368
|
+
Audio.play_synth(:player_travel)
|
369
|
+
Animation.run(phrase: "* #{direction_text} *", oneline: false)
|
328
370
|
end
|
329
371
|
|
330
372
|
def print_char_pic
|