destiny 0.0.3 → 0.0.4

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.
Files changed (7) hide show
  1. checksums.yaml +5 -13
  2. data/bin/destiny +25 -25
  3. data/lib/destiny.rb +95 -101
  4. data/lib/game_mechanics.rb +316 -250
  5. data/lib/mobs.rb +153 -74
  6. data/lib/places.rb +159 -96
  7. metadata +3 -3
@@ -1,74 +1,153 @@
1
- class Mobs
2
-
3
- attr_accessor :str, :agi, :int, :dmg, :armor, :hp, :cur_hp, :dodge, :mana, :cur_mana, :xp, :lvl, :coin, :name
4
-
5
- def initialize(str, agi, int, dmg, armor, hp, cur_hp, dodge, mana, cur_mana, xp, lvl, coin, name="MOB")
6
- @str = str
7
- @agi = agi
8
- @int = int
9
- @dmg = dmg
10
- @armor = armor
11
- @hp = hp
12
- @cur_hp = cur_hp
13
- @dodge = dodge
14
- @mana = mana
15
- @cur_mana = cur_mana
16
- @xp = xp
17
- @lvl = lvl
18
- @coin = coin
19
- @name = name
20
- end
21
-
22
- end
23
-
24
- # playable character roles
25
-
26
- class Knight < Mobs
27
-
28
- 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")
29
- super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
30
- end
31
-
32
- end
33
-
34
- class Wizard < Mobs
35
-
36
- 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")
37
- super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
38
- end
39
-
40
- end
41
-
42
- # Opponents below
43
-
44
- class GiantRat < Mobs
45
-
46
- def initialize(str=12, agi=10, int=4, dmg=5, armor=6, hp=8, cur_hp=8, dodge=5, mana=0, cur_mana=0, xp=200, lvl=1, coin=1, name="ROUS")
47
- super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
48
- end
49
-
50
- end
51
-
52
- class Goblin < Mobs
53
-
54
- def initialize(str=10, agi=10, int=8, dmg=4, armor=6, hp=6, cur_hp=6, dodge=15, mana=2, cur_mana=2, xp=100, lvl=1, coin=1, name="Goblin")
55
- super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
56
- end
57
-
58
- end
59
-
60
- class Kobold < Mobs
61
-
62
- def initialize(str=12, agi=8, int=8, dmg=5, armor=5, hp=6, cur_hp=6, dodge=10, mana=2, cur_mana=2, xp=150, lvl=1, coin=2, name="Kobold")
63
- super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
64
- end
65
-
66
- end
67
-
68
- class Skeleton < Mobs
69
-
70
- def initialize(str=12, agi=12, int=8, dmg=6, armor=6, hp=10, cur_hp=10, dodge=5, mana=0, cur_mana=0, xp=300, lvl=1, coin=4, name="Skeleton")
71
- super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
72
- end
73
-
74
- end
1
+ class Mobs
2
+
3
+ attr_accessor :str, :agi, :int, :dmg, :armor, :hp, :cur_hp, :dodge, :mana, :cur_mana, :xp, :lvl, :coin, :name
4
+
5
+ def initialize(str, agi, int, dmg, armor, hp, cur_hp, dodge, mana, cur_mana, xp, lvl, coin, name="MOB")
6
+ @str = str
7
+ @agi = agi
8
+ @int = int
9
+ @dmg = dmg
10
+ @armor = armor
11
+ @hp = hp
12
+ @cur_hp = cur_hp
13
+ @dodge = dodge
14
+ @mana = mana
15
+ @cur_mana = cur_mana
16
+ @xp = xp
17
+ @lvl = lvl
18
+ @coin = coin
19
+ @name = name
20
+ end
21
+
22
+ end
23
+
24
+ # playable character roles
25
+ # each role will have a focus, like healing or magic spells
26
+
27
+ class Cleric < Mobs
28
+ # clerics can heal themselves, and even put their HP's above max during combat, as a buffer
29
+ 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
+ super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
31
+ end
32
+
33
+ end
34
+
35
+ class Knight < Mobs
36
+ # the knight has the highest melee damage, strength, and armor
37
+ 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
+ super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
39
+ end
40
+
41
+ end
42
+
43
+ class Rogue < Mobs
44
+ # rogues have good melee damage and the highest dodge, they get extra coin too :)
45
+ 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
+ super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
47
+ end
48
+
49
+ end
50
+
51
+ class Wizard < Mobs
52
+ # wizards can cast damaging spells
53
+ 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
+ super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
55
+ end
56
+
57
+ end
58
+
59
+ # Opponents below
60
+
61
+ class GiantRat < Mobs
62
+
63
+ def initialize(str=12, agi=10, int=4, dmg=5, armor=6, hp=8, cur_hp=8, dodge=5, mana=0, cur_mana=0, xp=150, lvl=1, coin=1, name="Giant Rat")
64
+ rat_type = dice(10)
65
+ case
66
+ when (1..8).include?(rat_type)
67
+ # no change, you just get the generic giant rat
68
+ when (9..10).include?(rat_type)
69
+ # this feller is much harder to defeat
70
+ str = 16
71
+ dmg = 8
72
+ hp = 10
73
+ cur_hp = 10
74
+ xp = 400
75
+ coin = 3
76
+ name = "ROUS"
77
+ end
78
+ super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
79
+ end
80
+
81
+ end
82
+
83
+ class Goblin < Mobs
84
+
85
+ def initialize(str=10, agi=10, int=8, dmg=4, armor=6, hp=6, cur_hp=6, dodge=15, mana=2, cur_mana=2, xp=100, lvl=1, coin=1, name="Goblin")
86
+ # Should probably create a method that does the below
87
+ goblin_type = dice(10)
88
+ case
89
+ when (1..6).include?(goblin_type)
90
+ # no change, you just get the generic goblin
91
+ when (7..10).include?(goblin_type)
92
+ # this feller is stronger, but less nimble
93
+ str = 16
94
+ dmg = 6
95
+ armor = 8
96
+ hp = 8
97
+ cur_hp = 8
98
+ dodge = 10
99
+ xp = 200
100
+ coin = 2
101
+ name = "Goblin Warrior"
102
+ end
103
+ super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
104
+ end
105
+
106
+ end
107
+
108
+ class Kobold < Mobs
109
+
110
+ def initialize(str=12, agi=8, int=8, dmg=5, armor=5, hp=6, cur_hp=6, dodge=10, mana=2, cur_mana=2, xp=150, lvl=1, coin=2, name="Kobold")
111
+ kobold_type = dice(10)
112
+ case
113
+ when (1..6).include?(kobold_type)
114
+ # no change, you just get the generic kobold
115
+ when (7..10).include?(kobold_type)
116
+ # this one has double the chance to dodge as a regular kobold
117
+ agi = 16
118
+ dmg = 6
119
+ armor = 6
120
+ hp = 8
121
+ cur_hp = 8
122
+ dodge = 20
123
+ xp = 300
124
+ coin = 4
125
+ name = "Kobold Thief"
126
+ end
127
+ super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
128
+ end
129
+
130
+ end
131
+
132
+ class Skeleton < Mobs
133
+
134
+ def initialize(str=12, agi=10, int=8, dmg=5, armor=6, hp=8, cur_hp=8, dodge=5, mana=0, cur_mana=0, xp=200, lvl=1, coin=3, name="Skeleton")
135
+ skeleton_type = dice(10)
136
+ case
137
+ when (1..7).include?(skeleton_type)
138
+ # no change, you just get the generic skeleton
139
+ when (8..10).include?(skeleton_type)
140
+ # this feller is considerably tougher
141
+ str = 16
142
+ dmg = 6
143
+ armor = 8
144
+ hp = 10
145
+ cur_hp = 10
146
+ xp = 300
147
+ coin = 5
148
+ name = "Skeletal Knight"
149
+ end
150
+ super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
151
+ end
152
+
153
+ end
@@ -1,96 +1,159 @@
1
- # This file will contain the various places the player can go
2
- # Town, Tavern, Dungeon and options in each
3
-
4
- class Town
5
-
6
- def initialize
7
- # Town is only available as an option in the Dungeon (to return to)
8
- # initialize is only called the first time, so this greeting is only seen once
9
- puts "These things always start the same way and your adventure is no exception..."
10
- puts "You walk into town, scanning each nook and cranny. Most faces are friendly,"
11
- puts "some are not..."
12
- end
13
-
14
- def choices
15
- move = 0
16
- until move == "3"
17
- begin
18
- load_data
19
- puts # formatting
20
- puts bar_top
21
- puts stat_bar(@player.name, @player.xp, @player.lvl, @player.coin, @player.cur_hp, @player.cur_mana)
22
- puts bar_low
23
- puts # formatting
24
- puts "Please choose where you will head next:"
25
- puts "[1]. Ye Old Tavern"
26
- puts "[2]. Dungeon"
27
- puts "[3]. Exit game"
28
- prompt; move = gets.chomp
29
- end while not (move == "1" or move == "2" or move == "3")
30
- case
31
- when move == "1"
32
- # Put this in Tavern class???
33
- # also Tavern should restore the cur_hp and cur_mana to max values!
34
- puts # formatting
35
- puts "You enter the tavern. The air is thick with smoke, but you find a place"
36
- puts "near a window and after a bowl of hearty soup and a bit of rest, you feel"
37
- puts "greatly replenished."
38
- puts # formatting
39
- restore_player
40
- when move == "2"
41
- Dungeon.new.choices
42
- when move == "3"
43
- # save the player's stats before exit
44
- save_data
45
- exit
46
- end
47
- end
48
- end
49
-
50
- end
51
-
52
- class Tavern
53
-
54
- # only available as an option in the Town
55
- # This class will essentially "heal" the player by restoring mana and hp
56
-
57
- end
58
-
59
- class Dungeon
60
-
61
- # can go here from town, will spawn random encounters, etc.
62
- def initialize
63
- puts # formatting
64
- puts "You have entered the dungeon! DUM DUM DUM!!"
65
- end
66
-
67
- def choices
68
- move = 0
69
- load_data
70
- until move == "2"
71
- begin
72
- puts # formatting
73
- puts bar_top
74
- puts stat_bar(@player.name, @player.xp, @player.lvl, @player.coin, @player.cur_hp, @player.cur_mana)
75
- puts bar_low
76
- puts # formatting
77
- puts "Now #{@player.name}, what will you do next?"
78
- puts "[1]. Go deeper into the dungeon."
79
- puts "[2]. Return to town."
80
- prompt; move = gets.chomp
81
- end while not (move == "1" or move == "2")
82
- case
83
- when move == "1"
84
- puts # formatting
85
- puts "You walk further into the dark, dank, dirty, dungeon,"
86
- puts "smirking slightly at your awesome alliteration ability."
87
- puts # formatting
88
- random_encounter
89
- when move == "2"
90
- save_data
91
- return
92
- end
93
- end
94
- end
95
-
96
- end
1
+ # This file will contain the various places the player can go
2
+ # Town, Tavern, Dungeon and options in each
3
+
4
+ class Town
5
+
6
+ def initialize
7
+ # Town is only available as an option in the Dungeon (to return to)
8
+ # initialize is only called the first time, so this greeting is only seen once
9
+ puts "These things always start the same way and your adventure is no exception..."
10
+ puts "You walk into town, scanning each nook and cranny. Most faces are friendly,"
11
+ puts "some are not..."
12
+ end
13
+
14
+ def choices
15
+ move = 0
16
+ until move == "3"
17
+ begin
18
+ load_data
19
+ puts # formatting
20
+ puts bar_top
21
+ puts stat_bar(@player.name, @player.xp, @player.lvl, @player.coin, @player.cur_hp, @player.cur_mana)
22
+ puts bar_low
23
+ puts # formatting
24
+ puts "Please choose where you will head next:"
25
+ puts "[1]. The Dungeon"
26
+ puts "[2]. Ye Old Tavern"
27
+ puts "[3]. Exit Game"
28
+ prompt; move = gets.chomp
29
+ end while not (move == "1" or move == "2" or move == "3")
30
+ case
31
+ when move == "1"
32
+ Dungeon.new.choices
33
+ when move == "2"
34
+ Tavern.new.choices
35
+ when move == "3"
36
+ # save the player's stats before exit
37
+ save_data
38
+ exit
39
+ end
40
+ end
41
+ end
42
+
43
+ end
44
+
45
+ class Dungeon
46
+
47
+ # can go here from town, will spawn random encounters, etc.
48
+ def initialize
49
+ puts # formatting
50
+ puts "You have entered the dungeon! DUM DUM DUM!!"
51
+ end
52
+
53
+ def choices
54
+ move = 0
55
+ load_data
56
+ bread_crumb = 0
57
+ until move == "2" and bread_crumb == 0
58
+ begin
59
+ puts # formatting
60
+ puts bar_top
61
+ puts stat_bar(@player.name, @player.xp, @player.lvl, @player.coin, @player.cur_hp, @player.cur_mana)
62
+ puts bar_low
63
+ puts # formatting
64
+ puts "Now #{@player.name}, what will you do next?"
65
+ puts "[1]. Go deeper into the dungeon."
66
+ puts "[2]. Return to town."
67
+ prompt; move = gets.chomp
68
+ end while not (move == "1" or move == "2")
69
+ case
70
+ when move == "1"
71
+ puts # formatting
72
+ puts "You walk further into the dark, dank, dirty, dungeon,"
73
+ puts "smirking slightly at your awesome alliteration ability."
74
+ puts # formatting
75
+ bread_crumb = bread_crumb + 1
76
+ random_encounter
77
+ when move == "2"
78
+ if bread_crumb < 1
79
+ puts "You make it back to town in one piece!"
80
+ puts # formatting
81
+ save_data
82
+ return
83
+ end
84
+ bread_crumb = bread_crumb - 1
85
+ puts # formatting
86
+ puts "You head back toward town."
87
+ puts # formatting
88
+ random_encounter
89
+ end
90
+ end
91
+ end
92
+
93
+ end
94
+
95
+ class Tavern
96
+
97
+ # only available as an option in the Town
98
+ # The tavern will "heal" the player by restoring mana and hp
99
+ def initialize
100
+ load_data
101
+ puts # formatting
102
+ puts "You enter the tavern. The air is thick with smoke, but the fire in the hearth"
103
+ puts "is warm and inviting."
104
+ puts if @player.cur_hp < @player.hp # formatting
105
+ puts "Some rest would probably do you good, #{@player.name}." if @player.cur_hp < @player.hp
106
+ puts # formatting
107
+ end
108
+
109
+ def choices
110
+ move = 0
111
+ until move == "4"
112
+ begin
113
+ puts # formatting
114
+ puts bar_top
115
+ puts stat_bar(@player.name, @player.xp, @player.lvl, @player.coin, @player.cur_hp, @player.cur_mana)
116
+ puts bar_low
117
+ puts # formatting
118
+ room_cost = @player.lvl*2
119
+ 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. | Cost: #{room_cost} coins."
123
+ puts "[4]. Leave the tavern."
124
+ prompt; move = gets.chomp
125
+ end while not (move == "1" or move == "2" or move == "3" or move == "4")
126
+ case
127
+ when move == "1"
128
+ puts # formatting
129
+ puts "You find a seat at an open table and the waiter approaches to take your order."
130
+ puts # formatting
131
+ 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
+ if @player.coin >= @player.lvl*2
137
+ health = @player.cur_hp
138
+ mana = @player.cur_mana
139
+ restore_player
140
+ health = @player.cur_hp - health
141
+ mana = @player.cur_mana - mana
142
+ puts # formatting
143
+ puts "You pay for a small room and get a good night of rest."
144
+ puts "Resting has restored #{health} health points and #{mana} points of mana."
145
+ @player.coin = @player.coin - @player.lvl*2
146
+ else
147
+ puts # formatting
148
+ puts "You can't afford a room! Hit the dungeon and earn some money!"
149
+ end
150
+ when move == "4"
151
+ puts # formatting
152
+ puts "Feeling much better, you step out of the tavern and back into town."
153
+ save_data
154
+ return
155
+ end
156
+ end
157
+ end
158
+
159
+ end