destiny 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/destiny.rb +1 -3
- data/lib/game_mechanics.rb +99 -49
- data/lib/mobs.rb +32 -3
- data/lib/places.rb +78 -19
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2495d4b0effe8a244327c9b09c6c0aec2f613e36
|
|
4
|
+
data.tar.gz: c8b5259d2475af0a3f21d2fa3921971111a98467
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 96cff8084be0603aff5066b8fbd1c01430961f634be55d83745a141c3f955eb717e4300bce641b98b746ae9dd0a63dfd19900c108c1e78bf1614138e8c318096
|
|
7
|
+
data.tar.gz: 351e328f3821e4265f4b9031f665ede5b88a6675a3790ee36a750eaa247ff27d70d7eafc16b764251a3526307dfb679f75c5a7b1db5586e2bf5d54ea445ddb2b
|
data/lib/destiny.rb
CHANGED
|
@@ -25,7 +25,7 @@ class GameSelect
|
|
|
25
25
|
attr_accessor :game_select
|
|
26
26
|
|
|
27
27
|
def initialize default="default"
|
|
28
|
-
#rspec with user input is more tricky, this allows me to test
|
|
28
|
+
#rspec with user input is more tricky, this allows me to test no response
|
|
29
29
|
@default = default
|
|
30
30
|
return @yes_no = @default if @default != "default"
|
|
31
31
|
yes_no
|
|
@@ -33,8 +33,6 @@ class GameSelect
|
|
|
33
33
|
|
|
34
34
|
def outcome
|
|
35
35
|
if @yes_no == "yes"
|
|
36
|
-
# this is purely for rspec
|
|
37
|
-
# return "Starting a new game, please answer the following questions:" if @default != "default"
|
|
38
36
|
begin
|
|
39
37
|
puts # formatting
|
|
40
38
|
puts "_"*50
|
data/lib/game_mechanics.rb
CHANGED
|
@@ -33,13 +33,16 @@ module GameMechanics
|
|
|
33
33
|
@player.lvl = 7
|
|
34
34
|
end
|
|
35
35
|
save_info = {
|
|
36
|
-
role:
|
|
37
|
-
cur_hp:
|
|
38
|
-
cur_mana:
|
|
39
|
-
xp:
|
|
40
|
-
lvl:
|
|
41
|
-
coin:
|
|
42
|
-
|
|
36
|
+
role: @player.class,
|
|
37
|
+
cur_hp: @player.cur_hp,
|
|
38
|
+
cur_mana: @player.cur_mana,
|
|
39
|
+
xp: @player.xp,
|
|
40
|
+
lvl: @player.lvl,
|
|
41
|
+
coin: @player.coin,
|
|
42
|
+
buff_food: @player.buff_food,
|
|
43
|
+
buff_drink: @player.buff_drink,
|
|
44
|
+
spell_buff: @player.spell_buff,
|
|
45
|
+
name: @player.name
|
|
43
46
|
}
|
|
44
47
|
File.open(@@save_file, "w") do |f|
|
|
45
48
|
f.write(save_info.to_json)
|
|
@@ -59,12 +62,15 @@ module GameMechanics
|
|
|
59
62
|
@player = Rogue.new
|
|
60
63
|
end
|
|
61
64
|
# Set stats based off information in load_info
|
|
62
|
-
@player.lvl
|
|
63
|
-
@player.xp
|
|
64
|
-
@player.coin
|
|
65
|
-
@player.name
|
|
66
|
-
@player.cur_hp
|
|
67
|
-
@player.cur_mana
|
|
65
|
+
@player.lvl = load_info['lvl']
|
|
66
|
+
@player.xp = load_info['xp']
|
|
67
|
+
@player.coin = load_info['coin']
|
|
68
|
+
@player.name = load_info['name']
|
|
69
|
+
@player.cur_hp = load_info['cur_hp']
|
|
70
|
+
@player.cur_mana = load_info['cur_mana']
|
|
71
|
+
@player.buff_food = load_info['buff_food']
|
|
72
|
+
@player.buff_drink = load_info['buff_drink']
|
|
73
|
+
@player.spell_buff = load_info['spell_buff']
|
|
68
74
|
# Adjust stats based off of player level
|
|
69
75
|
@player.hp = @player.hp*@player.lvl
|
|
70
76
|
@player.mana = @player.mana*@player.lvl
|
|
@@ -95,6 +101,10 @@ module GameMechanics
|
|
|
95
101
|
"-"*61
|
|
96
102
|
end
|
|
97
103
|
|
|
104
|
+
def is_even?(x)
|
|
105
|
+
x % 2 == 0 ? true : false
|
|
106
|
+
end
|
|
107
|
+
|
|
98
108
|
def player_croaks
|
|
99
109
|
puts # formatting
|
|
100
110
|
puts "It happens to the best of us #{@player.name}."
|
|
@@ -111,11 +121,12 @@ module GameMechanics
|
|
|
111
121
|
# scale power of opponent to level of player
|
|
112
122
|
@bad_guy.cur_hp = @bad_guy.hp*@player.lvl
|
|
113
123
|
@bad_guy.cur_mana = @bad_guy.mana*@player.lvl
|
|
114
|
-
@bad_guy.dmg
|
|
124
|
+
@bad_guy.dmg = @bad_guy.dmg*@player.lvl
|
|
115
125
|
puts @bad_guy.name + " says, you kill my father, now you will die!!" unless (@bad_guy.name == "Giant Rat" or @bad_guy.name == "Skeleton")
|
|
116
126
|
move = 0
|
|
117
127
|
until move == "2"
|
|
118
128
|
begin
|
|
129
|
+
@heal = false
|
|
119
130
|
puts # formatting
|
|
120
131
|
puts bar_low + "--"
|
|
121
132
|
puts " #{@player.name} - HP: #{@player.cur_hp} - Mana: #{@player.cur_mana} | - VS - | #{@bad_guy.name} - HP: #{@bad_guy.cur_hp} - Mana: #{@bad_guy.cur_mana}"
|
|
@@ -124,8 +135,12 @@ module GameMechanics
|
|
|
124
135
|
puts "#{@bad_guy.name} vs. #{@player.name}, what will you do?"
|
|
125
136
|
puts "[1]. Attack."
|
|
126
137
|
puts "[2]. Run."
|
|
138
|
+
puts "[3]. Cast Heal and Attack." if @player.class.to_s == "Cleric"
|
|
127
139
|
prompt; move = gets.chomp
|
|
128
|
-
|
|
140
|
+
move = "4" if move == "3" and @player.class.to_s != "Cleric"
|
|
141
|
+
end while not (move == "1" or move == "2" or move == "3")
|
|
142
|
+
@heal = true if move == "3" # set cleric heal flag to true
|
|
143
|
+
move = "1" if move == "3" # now that flag is set, set move to 1 for the attack part
|
|
129
144
|
case
|
|
130
145
|
when move == "1"
|
|
131
146
|
puts # formatting
|
|
@@ -137,7 +152,7 @@ module GameMechanics
|
|
|
137
152
|
elsif @player.class.to_s == "Wizard"
|
|
138
153
|
begin
|
|
139
154
|
puts "How many magic darts will you shoot?"
|
|
140
|
-
puts "[1]."
|
|
155
|
+
puts "[1]." # always allow wizard one dart even without enough mana
|
|
141
156
|
puts "[2]." if @player.cur_mana - 2*@player.lvl >= 0
|
|
142
157
|
puts "[3]." if @player.cur_mana - 3*@player.lvl >= 0
|
|
143
158
|
prompt; darts = gets.chomp.to_i
|
|
@@ -153,10 +168,23 @@ module GameMechanics
|
|
|
153
168
|
# prevent negative mana, but always allow wizard to shoot at least one dart, no matter what
|
|
154
169
|
@player.cur_mana = 0 if @player.cur_mana < 0
|
|
155
170
|
elsif @player.class.to_s == "Cleric"
|
|
171
|
+
if @heal == true
|
|
172
|
+
heal_bonus = 0
|
|
173
|
+
if @player.cur_mana - @player.lvl*2 >= 0
|
|
174
|
+
heal_bonus = dice(4)*@player.lvl
|
|
175
|
+
@player.cur_mana = @player.cur_mana - @player.lvl*2
|
|
176
|
+
end
|
|
177
|
+
@heal_amount = dice(2)*@player.lvl + heal_bonus + 1 # testing with the +1, what I am going for here
|
|
178
|
+
# is to balance the heal with their lower damage and hp
|
|
179
|
+
puts "Praying intently, you add #{@heal_amount} health points as you prepare to strike."
|
|
180
|
+
puts "#{@player.name}, any health points above your normal maximum will fade after combat." if @player.cur_hp > @player.hp
|
|
181
|
+
puts # formatting
|
|
182
|
+
@player.cur_hp = @player.cur_hp + @heal_amount
|
|
183
|
+
end
|
|
156
184
|
puts "#{@player.name} brings the holy mace thundering down upon #{@bad_guy.name}!"
|
|
157
185
|
puts # formatting
|
|
158
186
|
dmg_mod = (@player.str-10)/2 # clerics use their str for damage mod
|
|
159
|
-
@dmg_dlt = dice(@player.dmg) + dmg_mod
|
|
187
|
+
@dmg_dlt = dice(@player.dmg) + dmg_mod
|
|
160
188
|
elsif @player.class.to_s == "Rogue"
|
|
161
189
|
puts "#{@player.name} whirls the razor daggers and strikes at #{@bad_guy.name}!"
|
|
162
190
|
puts # formatting
|
|
@@ -181,7 +209,12 @@ module GameMechanics
|
|
|
181
209
|
puts "You have slain the #{@bad_guy.name} and won the day!"
|
|
182
210
|
# rewards for winning the battle!
|
|
183
211
|
@player.xp = @player.xp + @bad_guy.xp
|
|
184
|
-
|
|
212
|
+
if @player.class.to_s == "Rogue"
|
|
213
|
+
@player.coin = @player.coin + @bad_guy.coin + @player.lvl # rogues get bonus cash
|
|
214
|
+
else
|
|
215
|
+
@player.coin = @player.coin + @bad_guy.coin
|
|
216
|
+
end
|
|
217
|
+
@player.cur_hp = @player.hp if @player.cur_hp > @player.hp # this is done to remove extra hp from cleric
|
|
185
218
|
save_data
|
|
186
219
|
return
|
|
187
220
|
else
|
|
@@ -193,10 +226,20 @@ module GameMechanics
|
|
|
193
226
|
puts @player.name + " totally leaps out of the way, avoiding being hit by " + @bad_guy.name + "!"
|
|
194
227
|
else
|
|
195
228
|
dmg_taken = dice(@bad_guy.dmg) - @player.armor/4
|
|
229
|
+
if @player.class.to_s == "Wizard" and @player.spell_buff == true and dmg_taken > 1
|
|
230
|
+
draco_helps = @player.lvl
|
|
231
|
+
dmg_taken = dmg_taken - draco_helps
|
|
232
|
+
puts "Draco helps shield you absorbing some of the potential damage."
|
|
233
|
+
puts # formatting
|
|
234
|
+
end
|
|
196
235
|
dmg_taken = 0 if dmg_taken < 1
|
|
197
236
|
@player.cur_hp = @player.cur_hp - dmg_taken
|
|
198
|
-
|
|
199
|
-
|
|
237
|
+
if dmg_taken > 0
|
|
238
|
+
puts "#{@bad_guy.name} hits YOU for #{dmg_taken} damage!"
|
|
239
|
+
puts "OUCH!"
|
|
240
|
+
else
|
|
241
|
+
puts "You deflect the blow and take no damage."
|
|
242
|
+
end
|
|
200
243
|
end
|
|
201
244
|
puts #formatting
|
|
202
245
|
end
|
|
@@ -214,36 +257,42 @@ module GameMechanics
|
|
|
214
257
|
puts "The #{@bad_guy.name} turns to look and you high tail it away!"
|
|
215
258
|
puts # formatting
|
|
216
259
|
run_away = dice(10)
|
|
260
|
+
run_away = dice(15) if @player.class.to_s == "Rogue" # rogues have a higher chance of getting away
|
|
217
261
|
case
|
|
218
262
|
when (1..8).include?(run_away)
|
|
219
|
-
|
|
220
|
-
|
|
263
|
+
# you got away this time
|
|
264
|
+
puts "You escape from the #{@bad_guy.name} while it foolishly looks away."
|
|
221
265
|
when (9..10).include?(run_away)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
266
|
+
# not so lucky this time
|
|
267
|
+
puts "#{@bad_guy.name} says, do you think I was spawned yesterday?"
|
|
268
|
+
puts # formatting
|
|
269
|
+
puts "#{@bad_guy.name} viciously attacks #{@player.name}!"
|
|
270
|
+
puts # formatting
|
|
271
|
+
miss_chance = dice(100)
|
|
272
|
+
agi_boost = (@player.agi-10)*2 + @player.dodge
|
|
273
|
+
if (1..agi_boost).include?(miss_chance)
|
|
274
|
+
puts @player.name + " totally leaps out of the way, avoiding being hit by " + @bad_guy.name + "!"
|
|
275
|
+
else
|
|
276
|
+
dmg_taken = dice(@bad_guy.dmg) - @player.armor/4
|
|
277
|
+
dmg_taken = 0 if dmg_taken < 1
|
|
278
|
+
@player.cur_hp = @player.cur_hp - dmg_taken
|
|
279
|
+
puts "#{@bad_guy.name} hits YOU for #{dmg_taken} damage!" unless dmg_taken < 1
|
|
280
|
+
puts "OUCH!" unless dmg_taken < 1
|
|
281
|
+
end
|
|
282
|
+
puts #formatting
|
|
283
|
+
if @player.cur_hp <= 0
|
|
284
|
+
puts "You knew when to fold em, but the #{@bad_guy.name} got the better of you anyway."
|
|
285
|
+
player_croaks
|
|
286
|
+
end
|
|
287
|
+
puts "You manage to accidentally stick a boot firmly in the #{@bad_guy.name}'s face"
|
|
288
|
+
puts "allowing you to escape!"
|
|
289
|
+
puts # formatting
|
|
290
|
+
when (11..15).include?(run_away)
|
|
291
|
+
# only a rogue could be so lucky
|
|
292
|
+
puts "Ah, the life of a rogue, so free, so evasive!"
|
|
293
|
+
puts "#{@player.name}, using your roguish powers you slip away unseen, leaving"
|
|
294
|
+
puts "#{@bad_guy.name} cursing and muttering in the dark."
|
|
295
|
+
end
|
|
247
296
|
save_data
|
|
248
297
|
return
|
|
249
298
|
end
|
|
@@ -292,8 +341,8 @@ module GameMechanics
|
|
|
292
341
|
combat(Kobold)
|
|
293
342
|
when (16..18).include?(chance)
|
|
294
343
|
puts #format
|
|
295
|
-
puts "
|
|
296
|
-
puts "
|
|
344
|
+
puts "There is a sudden chill in the air and you hear scraping sounds."
|
|
345
|
+
puts "You know without a doubt what approaches..."
|
|
297
346
|
puts #format
|
|
298
347
|
combat(Skeleton)
|
|
299
348
|
when (19..20).include?(chance)
|
|
@@ -311,6 +360,7 @@ module GameMechanics
|
|
|
311
360
|
puts "You have tripped and died."
|
|
312
361
|
player_croaks
|
|
313
362
|
end
|
|
363
|
+
save_data
|
|
314
364
|
end
|
|
315
365
|
end
|
|
316
366
|
|
data/lib/mobs.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class Mobs
|
|
2
2
|
|
|
3
|
-
attr_accessor :str, :agi, :int, :dmg, :armor, :hp, :cur_hp, :dodge, :mana, :cur_mana, :xp, :lvl, :coin, :name
|
|
3
|
+
attr_accessor :str, :agi, :int, :dmg, :armor, :hp, :cur_hp, :dodge, :mana, :cur_mana, :xp, :lvl, :coin, :name, :buff_food, :buff_drink
|
|
4
4
|
|
|
5
5
|
def initialize(str, agi, int, dmg, armor, hp, cur_hp, dodge, mana, cur_mana, xp, lvl, coin, name="MOB")
|
|
6
6
|
@str = str
|
|
@@ -25,33 +25,61 @@ end
|
|
|
25
25
|
# each role will have a focus, like healing or magic spells
|
|
26
26
|
|
|
27
27
|
class Cleric < Mobs
|
|
28
|
+
|
|
28
29
|
# clerics can heal themselves, and even put their HP's above max during combat, as a buffer
|
|
30
|
+
|
|
31
|
+
attr_accessor :spell_buff # will be a slight modifier to dodge and reduced chance of being attacked first
|
|
32
|
+
|
|
29
33
|
def initialize(str=12, agi=12, int=10, dmg=5, armor=8, hp=6, cur_hp=6, dodge=5, mana=12, cur_mana=12, xp=0, lvl=1, coin=0, name="Cleric")
|
|
30
34
|
super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
|
|
35
|
+
@buff_food = false
|
|
36
|
+
@buff_drink = false
|
|
37
|
+
@spell_buff = false
|
|
31
38
|
end
|
|
32
39
|
|
|
33
40
|
end
|
|
34
41
|
|
|
35
42
|
class Knight < Mobs
|
|
43
|
+
|
|
36
44
|
# the knight has the highest melee damage, strength, and armor
|
|
45
|
+
|
|
46
|
+
attr_accessor :spell_buff # will be a special smite attack
|
|
47
|
+
|
|
37
48
|
def initialize(str=14, agi=12, int=8, dmg=6, armor=10, hp=8, cur_hp=8, dodge=10, mana=8, cur_mana=8, xp=0, lvl=1, coin=0, name="Knight")
|
|
38
49
|
super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
|
|
50
|
+
@buff_food = false # could have made a PlayerClass class and had these like Knight < PlayerClass and then PlayerClass would have < Mobs
|
|
51
|
+
@buff_drink = false
|
|
52
|
+
@spell_buff = false
|
|
39
53
|
end
|
|
40
54
|
|
|
41
55
|
end
|
|
42
56
|
|
|
43
57
|
class Rogue < Mobs
|
|
44
|
-
|
|
58
|
+
|
|
59
|
+
# rogues have good melee damage and the highest dodge, they get extra coin and other perks too :)
|
|
60
|
+
|
|
61
|
+
attr_accessor :spell_buff # for the rogue this will be a special evasion ability on a timer
|
|
62
|
+
|
|
45
63
|
def initialize(str=12, agi=16, int=12, dmg=6, armor=6, hp=6, cur_hp=6, dodge=20, mana=0, cur_mana=0, xp=0, lvl=1, coin=0, name="Rogue")
|
|
46
64
|
super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
|
|
65
|
+
@buff_food = false
|
|
66
|
+
@buff_drink = false
|
|
67
|
+
@spell_buff = false
|
|
47
68
|
end
|
|
48
69
|
|
|
49
70
|
end
|
|
50
71
|
|
|
51
72
|
class Wizard < Mobs
|
|
52
|
-
|
|
73
|
+
|
|
74
|
+
# wizards can cast damaging spells and have a pet familiar
|
|
75
|
+
|
|
76
|
+
attr_accessor :spell_buff # used for pet familiar
|
|
77
|
+
|
|
53
78
|
def initialize(str=8, agi=10, int=16, dmg=4, armor=4, hp=4, cur_hp=4, dodge=5, mana=16, cur_mana=16, xp=0, lvl=1, coin=0, name="Wizard")
|
|
54
79
|
super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
|
|
80
|
+
@buff_food = false
|
|
81
|
+
@buff_drink = false
|
|
82
|
+
@spell_buff = false
|
|
55
83
|
end
|
|
56
84
|
|
|
57
85
|
end
|
|
@@ -71,6 +99,7 @@ class GiantRat < Mobs
|
|
|
71
99
|
dmg = 8
|
|
72
100
|
hp = 10
|
|
73
101
|
cur_hp = 10
|
|
102
|
+
dodge = 10
|
|
74
103
|
xp = 400
|
|
75
104
|
coin = 3
|
|
76
105
|
name = "ROUS"
|
data/lib/places.rb
CHANGED
|
@@ -44,16 +44,20 @@ end
|
|
|
44
44
|
|
|
45
45
|
class Dungeon
|
|
46
46
|
|
|
47
|
-
# can
|
|
47
|
+
# can get here from town, initialize just gives a one time (per visit) message
|
|
48
48
|
def initialize
|
|
49
49
|
puts # formatting
|
|
50
|
-
|
|
50
|
+
rand_greet = dice(3)
|
|
51
|
+
rand_greet = "You have entered the dungeon! DUM DUM DUM!!" if rand_greet == 1
|
|
52
|
+
rand_greet = "Stepping into the dungeon, you prepare for adventure." if rand_greet == 2
|
|
53
|
+
rand_greet = "As you enter the dungeon, you notice strange markings along the walls..." if rand_greet == 3
|
|
54
|
+
puts rand_greet
|
|
51
55
|
end
|
|
52
56
|
|
|
53
57
|
def choices
|
|
54
58
|
move = 0
|
|
55
59
|
load_data
|
|
56
|
-
bread_crumb = 0
|
|
60
|
+
bread_crumb = 0 # helps track how deep you go into the dungeon
|
|
57
61
|
until move == "2" and bread_crumb == 0
|
|
58
62
|
begin
|
|
59
63
|
puts # formatting
|
|
@@ -64,20 +68,42 @@ class Dungeon
|
|
|
64
68
|
puts "Now #{@player.name}, what will you do next?"
|
|
65
69
|
puts "[1]. Go deeper into the dungeon."
|
|
66
70
|
puts "[2]. Return to town."
|
|
71
|
+
puts "[3]. Conjure Wizard Familiar" if @player.class.to_s == "Wizard" and @player.spell_buff == false
|
|
67
72
|
prompt; move = gets.chomp
|
|
68
|
-
|
|
73
|
+
move = "4" if move == "3" and (@player.class.to_s != "Wizard" or @player.spell_buff == true)
|
|
74
|
+
end while not (move == "1" or move == "2" or move == "3")
|
|
75
|
+
# apply food buff
|
|
76
|
+
@player.cur_hp = @player.cur_hp + @player.lvl if @player.buff_food == true
|
|
77
|
+
# prevent food buff from raising current health points above maximum
|
|
78
|
+
@player.cur_hp = @player.hp if @player.cur_hp > @player.hp
|
|
79
|
+
# now apply drink buff
|
|
80
|
+
@player.cur_mana = @player.cur_mana + @player.lvl if @player.buff_drink == true
|
|
81
|
+
# prevent drink buff from raising current mana points above maximum
|
|
82
|
+
@player.cur_mana = @player.mana if @player.cur_mana > @player.mana
|
|
69
83
|
case
|
|
70
84
|
when move == "1"
|
|
71
85
|
puts # formatting
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
rand_msg = dice(3)
|
|
87
|
+
rand_msg = "You walk further into the dark, dank, dirty, dungeon, smirking slightly at your awesome alliteration ability." if rand_msg == 1
|
|
88
|
+
rand_msg = "You feel a slight draft and your torch flickers briefly..." if rand_msg == 2
|
|
89
|
+
rand_msg = "More strange markings, they seem to mean something, but what and who wrote them?" if rand_msg == 3
|
|
90
|
+
puts rand_msg
|
|
74
91
|
puts # formatting
|
|
75
92
|
bread_crumb = bread_crumb + 1
|
|
76
93
|
random_encounter
|
|
77
94
|
when move == "2"
|
|
78
|
-
if bread_crumb
|
|
95
|
+
if bread_crumb <= 1
|
|
96
|
+
puts # formatting
|
|
79
97
|
puts "You make it back to town in one piece!"
|
|
80
98
|
puts # formatting
|
|
99
|
+
# remove food buffs from player when they leave the dungeon
|
|
100
|
+
@player.buff_food = false
|
|
101
|
+
@player.buff_drink = false
|
|
102
|
+
if @player.class.to_s == "Wizard" and @player.spell_buff == true
|
|
103
|
+
puts "Drako wishes you well and fades away, ready to help another day."
|
|
104
|
+
puts #formatting
|
|
105
|
+
@player.spell_buff = false
|
|
106
|
+
end
|
|
81
107
|
save_data
|
|
82
108
|
return
|
|
83
109
|
end
|
|
@@ -86,6 +112,14 @@ class Dungeon
|
|
|
86
112
|
puts "You head back toward town."
|
|
87
113
|
puts # formatting
|
|
88
114
|
random_encounter
|
|
115
|
+
when move == "3"
|
|
116
|
+
puts # formatting
|
|
117
|
+
puts "#{@player.name} concentrates intently while waving the magic wand and casting the spell..."
|
|
118
|
+
puts # formatting
|
|
119
|
+
puts "A tiny dragon appears and curls up on your shoulder, snoring loudly."
|
|
120
|
+
@player.spell_buff = true
|
|
121
|
+
@player.cur_mana = @player.cur_mana - @player.lvl*2
|
|
122
|
+
save_data
|
|
89
123
|
end
|
|
90
124
|
end
|
|
91
125
|
end
|
|
@@ -115,34 +149,59 @@ class Tavern
|
|
|
115
149
|
puts stat_bar(@player.name, @player.xp, @player.lvl, @player.coin, @player.cur_hp, @player.cur_mana)
|
|
116
150
|
puts bar_low
|
|
117
151
|
puts # formatting
|
|
118
|
-
room_cost = @player.lvl*
|
|
152
|
+
room_cost = @player.lvl*3
|
|
153
|
+
nourish_cost = @player.lvl*2
|
|
119
154
|
puts "What would you like to do in the tavern, #{@player.name}?"
|
|
120
|
-
puts "[1]. Buy some food."
|
|
121
|
-
puts "[2]. Buy a drink."
|
|
122
|
-
puts "[3]. Rest.
|
|
155
|
+
puts "[1]. Buy some food. | Cost: #{nourish_cost} coins."
|
|
156
|
+
puts "[2]. Buy a drink. | Cost: #{nourish_cost} coins."
|
|
157
|
+
puts "[3]. Rest. | Cost: #{room_cost} coins."
|
|
123
158
|
puts "[4]. Leave the tavern."
|
|
124
159
|
prompt; move = gets.chomp
|
|
125
160
|
end while not (move == "1" or move == "2" or move == "3" or move == "4")
|
|
126
161
|
case
|
|
127
162
|
when move == "1"
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
163
|
+
if @player.coin >= @player.lvl*2
|
|
164
|
+
@player.buff_food = true
|
|
165
|
+
puts # formatting
|
|
166
|
+
puts "You find a seat at an open table and the waiter approaches to take your order."
|
|
167
|
+
puts # formatting
|
|
168
|
+
puts "The waiter tells you the food is so darn good, that it will help sustain your"
|
|
169
|
+
puts "health as you travel in the dungeon."
|
|
170
|
+
puts # formatting
|
|
171
|
+
puts "You order and enjoy a delicious meal, #{@player.name}, you really do feel swell!"
|
|
172
|
+
@player.coin = @player.coin - @player.lvl*2
|
|
173
|
+
save_data
|
|
174
|
+
else
|
|
175
|
+
puts # formatting
|
|
176
|
+
puts "You can't afford a meal! Go to the dungeon and earn some money!"
|
|
177
|
+
end
|
|
131
178
|
when move == "2"
|
|
132
|
-
puts # formatting
|
|
133
|
-
puts "You sally up to the bar and have a drink."
|
|
134
|
-
puts # formatting
|
|
135
|
-
when move == "3"
|
|
136
179
|
if @player.coin >= @player.lvl*2
|
|
180
|
+
@player.buff_drink = true
|
|
181
|
+
puts # formatting
|
|
182
|
+
puts "You sally up to the bar and the barkeep approaches to take your order."
|
|
183
|
+
puts # formatting
|
|
184
|
+
puts "The barkeep tells you the wine is so fancy, that it will help sustain your"
|
|
185
|
+
puts "mana as you travel in the dungeon."
|
|
186
|
+
puts # formatting
|
|
187
|
+
puts "You swirl the wine, sniff, then take a sip, #{@player.name}, you really do feel superior!"
|
|
188
|
+
@player.coin = @player.coin - @player.lvl*2
|
|
189
|
+
save_data
|
|
190
|
+
else
|
|
191
|
+
puts # formatting
|
|
192
|
+
puts "You can't afford wine, you churl! Go to the dungeon and earn some money!"
|
|
193
|
+
end
|
|
194
|
+
when move == "3"
|
|
195
|
+
if @player.coin >= @player.lvl*3
|
|
137
196
|
health = @player.cur_hp
|
|
138
197
|
mana = @player.cur_mana
|
|
198
|
+
@player.coin = @player.coin - @player.lvl*3
|
|
139
199
|
restore_player
|
|
140
200
|
health = @player.cur_hp - health
|
|
141
201
|
mana = @player.cur_mana - mana
|
|
142
202
|
puts # formatting
|
|
143
203
|
puts "You pay for a small room and get a good night of rest."
|
|
144
204
|
puts "Resting has restored #{health} health points and #{mana} points of mana."
|
|
145
|
-
@player.coin = @player.coin - @player.lvl*2
|
|
146
205
|
else
|
|
147
206
|
puts # formatting
|
|
148
207
|
puts "You can't afford a room! Hit the dungeon and earn some money!"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: destiny
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kody Wilson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-03-
|
|
11
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Role playing game with distinct classes and character development
|
|
14
14
|
email: kodywilson@gmail.com
|
|
@@ -22,7 +22,7 @@ files:
|
|
|
22
22
|
- lib/game_mechanics.rb
|
|
23
23
|
- lib/mobs.rb
|
|
24
24
|
- lib/places.rb
|
|
25
|
-
homepage:
|
|
25
|
+
homepage: https://github.com/kodywilson/destiny
|
|
26
26
|
licenses:
|
|
27
27
|
- MIT
|
|
28
28
|
metadata: {}
|