destiny 0.0.2 → 0.0.3

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 (4) hide show
  1. checksums.yaml +8 -8
  2. data/lib/game_mechanics.rb +57 -14
  3. data/lib/mobs.rb +6 -6
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDFhZDQ1ZTc0NzNkNjhkMjM2NGRmZjFkNDY2OWQwYWMzMzZiNzhiZQ==
4
+ YmJkMmRiZDJhNDNiYjk5ZTdkNzhjZTViY2VmNDc2ZjA0NDkyZDYzZA==
5
5
  data.tar.gz: !binary |-
6
- NTVhZTM3NWRmODlhNjFjNTFlOTA4MDMyMGU1ZGNhZDZmYTY0MGM0MA==
6
+ NGIyNWQzNGJkNGYwMmRhMzVkNzM3NTQyZTIyODAyYzI3MGE5Y2UxZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjY4NGM0YzUzYzkwNGEzNmNmNmU3MmY2YzlkYzA5ZjNmN2ZmYTk3MGEyMjhj
10
- OTIyYjQ1MzgwNGFlZGU2MTljYjFjYTJiZTY1OTU1ZTgzODM2YTMxYmY0OWRk
11
- MDQxM2IwMjdjMzc3OTk2ODc1OWQ3ZjhlZGMzOGZmZGI3MDU5NWE=
9
+ ZjUzMzcwMGMzNGNkYWZiMTFlZWNkMDRhMjYyZjA2YWY2YTU4ZWJjNWVjOWEz
10
+ OGRiNTc1Mzk3OWRhYWUwMjBiZGQ5ZWExMTRmNDkwZTkxZjE3NGZmOWUwMDQy
11
+ NjQwMWMxM2UwN2QxM2MxMTdlZDRjNmMxNGFkN2I3MDI5OGU1NjQ=
12
12
  data.tar.gz: !binary |-
13
- YjE4ODgzODc5NzA4Yjg3NmQ3NzE5OTM5NzNmMDkwOGYzYzM3MjcwYTIwN2Vj
14
- OTk3OTJhMmE5NzQzMWQ4OGYxNzUwNmNkZGY4Nzg2NzRiNDFiMDQ4NGNkOTBm
15
- ZTQyN2ZkMzFmZmYyZGU5YTIyN2M1MmU0ZDc0MTVlMzQ3OTgzODE=
13
+ MDU4YjE2OGRmYzc1ZDY5YWIzMWZhYTU3ZmM1MTY1YTBmY2ZlNmI0NjNiN2Ez
14
+ NTFhYmQ1OGVjMTEwZmJiMDhkOTJjMjFjZTg1ZGM0MTczYmM2ZTg1NGM3ZDU1
15
+ MWYzODdjYjQwZjBiMTcwZmFlNDkwZjU3M2Q2ZjA5NDlmZWU0ZDI=
@@ -15,6 +15,20 @@ module GameMechanics
15
15
  end
16
16
 
17
17
  def save_data
18
+ case
19
+ when (0..1000).include?(@player.xp)
20
+ @player.lvl = 1
21
+ when (1001..2500).include?(@player.xp)
22
+ @player.lvl = 2
23
+ when (2501..5000).include?(@player.xp)
24
+ @player.lvl = 3
25
+ when (5001..8000).include?(@player.xp)
26
+ @player.lvl = 4
27
+ when (8001..11500).include?(@player.xp)
28
+ @player.lvl = 5
29
+ when (11501..15000).include?(@player.xp)
30
+ @player.lvl = 6
31
+ end
18
32
  save_info = {
19
33
  role: @player.class,
20
34
  cur_hp: @player.cur_hp,
@@ -37,13 +51,17 @@ module GameMechanics
37
51
  elsif role == "Wizard"
38
52
  @player = Wizard.new
39
53
  end
40
- # Set attributes based off information in load_info
41
- @player.cur_hp = load_info['cur_hp']
42
- @player.cur_mana = load_info['cur_mana']
43
- @player.xp = load_info['xp']
54
+ # Set stats based off information in load_info
44
55
  @player.lvl = load_info['lvl']
56
+ @player.xp = load_info['xp']
45
57
  @player.coin = load_info['coin']
46
58
  @player.name = load_info['name']
59
+ @player.cur_hp = load_info['cur_hp']
60
+ @player.cur_mana = load_info['cur_mana']
61
+ # Adjust stats based off player level
62
+ @player.hp = @player.hp*@player.lvl
63
+ @player.mana = @player.mana*@player.lvl
64
+ @player.dmg = @player.dmg*@player.lvl
47
65
  @player
48
66
  # I was trying to do the above assignments with iteration, there has to be a way!
49
67
  # load_info.each do |attribute, value|
@@ -70,7 +88,12 @@ module GameMechanics
70
88
  end
71
89
 
72
90
  def combat bad_guy
91
+ # create an opponent
73
92
  @bad_guy = bad_guy.new
93
+ # scale power of opponent to level of player
94
+ @bad_guy.cur_hp = @bad_guy.hp*@player.lvl
95
+ @bad_guy.cur_mana = @bad_guy.mana*@player.lvl
96
+ @bad_guy.dmg = @bad_guy.dmg*@player.lvl
74
97
  puts @bad_guy.name + " says, you kill my father, now you will die!!" unless (@bad_guy.name == "ROUS" or @bad_guy.name == "Skeleton")
75
98
  move = 0
76
99
  until move == "2"
@@ -91,7 +114,8 @@ module GameMechanics
91
114
  if @player.class.to_s == "Knight"
92
115
  puts "#{@player.name} swings the mighty sword at the #{@bad_guy.name}."
93
116
  puts # formatting
94
- @dmg_dlt = dice(@player.dmg)
117
+ dmg_mod = (@player.str-10)/2 # knights use their str for damage mod
118
+ @dmg_dlt = dice(@player.dmg) + dmg_mod
95
119
  elsif @player.class.to_s == "Wizard"
96
120
  begin
97
121
  puts "How many magic darts will you shoot?"
@@ -100,13 +124,25 @@ module GameMechanics
100
124
  puts "[3]."
101
125
  prompt; darts = gets.chomp.to_i
102
126
  end while not (darts == 1 or darts == 2 or darts == 3)
127
+ puts # formatting
103
128
  puts "#{@player.name} conjures #{darts} magic darts that zip toward the #{@bad_guy.name}."
104
- @dmg_dlt = dice(@player.dmg) + darts # more darts more damage
105
- @player.cur_mana = @player.cur_mana - darts # more darts more mana spent
129
+ dmg_mod = (@player.int-10)/2 # wizards use their int for damage mod
130
+ @dmg_dlt = dice(@player.dmg) + darts*@player.lvl + dmg_mod# more darts more damage, scales with level
131
+ @player.cur_mana = @player.cur_mana - darts*@player.lvl # more darts more mana spent, scales with level
132
+ end
133
+ miss_chance = dice(100)
134
+ agi_boost = (@bad_guy.agi-10)*2 + @bad_guy.dodge
135
+ if (1..agi_boost).include?(miss_chance)
136
+ puts @bad_guy.name + " jumps out of the way, avoiding being hit by " + @player.name + "!"
137
+ puts # formatting
138
+ else
139
+ @dmg_dlt = @dmg_dlt - @bad_guy.armor/4
140
+ @dmg_dlt = 0 if @dmg_dlt < 1
141
+ puts #formatting
142
+ puts "You deal #{@dmg_dlt} damage to the #{@bad_guy.name}." unless @dmg_dlt < 1
143
+ puts # formatting
144
+ @bad_guy.cur_hp = @bad_guy.cur_hp - @dmg_dlt
106
145
  end
107
- puts "You deal #{@dmg_dlt} damage to the #{@bad_guy.name}"
108
- puts # formatting
109
- @bad_guy.cur_hp = @bad_guy.cur_hp - @dmg_dlt
110
146
  if @bad_guy.cur_hp <= 0
111
147
  puts "You have slain the #{@bad_guy.name} and won the day!"
112
148
  # rewards for winning the battle!
@@ -117,10 +153,17 @@ module GameMechanics
117
153
  else
118
154
  puts "#{@bad_guy.name} viciously attacks #{@player.name}!"
119
155
  puts # formatting
120
- dmg_taken = dice(@bad_guy.dmg)
121
- @player.cur_hp = @player.cur_hp - dmg_taken
122
- puts "#{@bad_guy.name} hits YOU for #{dmg_taken} damage!"
123
- puts "OUCH!"
156
+ miss_chance = dice(100)
157
+ agi_boost = (@player.agi-10)*2 + @player.dodge
158
+ if (1..agi_boost).include?(miss_chance)
159
+ puts @player.name + " totally leaps out of the way, avoiding being hit by " + @bad_guy.name + "!"
160
+ else
161
+ dmg_taken = dice(@bad_guy.dmg) - @player.armor/4
162
+ dmg_taken = 0 if dmg_taken < 1
163
+ @player.cur_hp = @player.cur_hp - dmg_taken
164
+ puts "#{@bad_guy.name} hits YOU for #{dmg_taken} damage!" unless dmg_taken < 1
165
+ puts "OUCH!" unless dmg_taken < 1
166
+ end
124
167
  puts #formatting
125
168
  end
126
169
  if @player.cur_hp <= 0
@@ -25,7 +25,7 @@ end
25
25
 
26
26
  class Knight < Mobs
27
27
 
28
- def initialize(str=14, agi=12, int=8, dmg=6, armor=10, hp=8, cur_hp=8, dodge=20, mana=8, cur_mana=8, xp=0, lvl=1, coin=0, name="Knight")
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
29
  super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
30
30
  end
31
31
 
@@ -33,7 +33,7 @@ end
33
33
 
34
34
  class Wizard < Mobs
35
35
 
36
- def initialize(str=8, agi=10, int=16, dmg=4, armor=4, hp=4, cur_hp=4, dodge=10, mana=16, cur_mana=16, xp=0, lvl=1, coin=0, name="Wizard")
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
37
  super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
38
38
  end
39
39
 
@@ -43,7 +43,7 @@ end
43
43
 
44
44
  class GiantRat < Mobs
45
45
 
46
- def initialize(str=12, agi=10, int=4, dmg=4, armor=6, hp=8, cur_hp=8, dodge=10, mana=0, cur_mana=0, xp=200, lvl=1, coin=1, name="ROUS")
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
47
  super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
48
48
  end
49
49
 
@@ -51,7 +51,7 @@ end
51
51
 
52
52
  class Goblin < Mobs
53
53
 
54
- def initialize(str=10, agi=10, int=8, dmg=3, armor=6, hp=6, cur_hp=6, dodge=20, mana=2, cur_mana=2, xp=100, lvl=1, coin=1, name="Goblin")
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
55
  super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
56
56
  end
57
57
 
@@ -59,7 +59,7 @@ end
59
59
 
60
60
  class Kobold < Mobs
61
61
 
62
- def initialize(str=12, agi=8, int=8, dmg=4, armor=5, hp=6, cur_hp=6, dodge=10, mana=2, cur_mana=2, xp=150, lvl=1, coin=2, name="Kobold")
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
63
  super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
64
64
  end
65
65
 
@@ -67,7 +67,7 @@ end
67
67
 
68
68
  class Skeleton < Mobs
69
69
 
70
- def initialize(str=12, agi=12, int=8, dmg=5, armor=6, hp=10, cur_hp=10, dodge=10, mana=0, cur_mana=0, xp=300, lvl=1, coin=4, name="Skeleton")
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
71
  super(str,agi,int,dmg,armor,hp,cur_hp,dodge,mana,cur_mana,xp,lvl,coin,name)
72
72
  end
73
73
 
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.2
4
+ version: 0.0.3
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-08 00:00:00.000000000 Z
11
+ date: 2014-03-10 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