Battlefield 1.1.0 → 1.2.0
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/bin/battle +1 -1
- data/lib/battlefield.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2f16160c4d075a4275b635bc87ec63ddd5a89d9
|
4
|
+
data.tar.gz: 59377d93132acda140b7823c7fdc6090cc25e500
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf34112cb186abacf6a35d4e7db09b714411c55074785e7bd899f91089973c40bf07d4f4f479fbbca56fcdd9ec87875b84f3ebb4cba1e4e7b0174473044674f0
|
7
|
+
data.tar.gz: 91ffe1e9a69f301980d5055583a8044ecfb69d35ad3d7f945001e0a71ba137132944adaeb9605ed4617d281fee42e8f05e0f76d8e1c3aca618118582354bd442
|
data/bin/battle
CHANGED
data/lib/battlefield.rb
CHANGED
@@ -26,6 +26,8 @@ class Creature
|
|
26
26
|
@health += c1 - c2
|
27
27
|
end
|
28
28
|
end
|
29
|
+
# Any error you get during a battle. If you get a different one, wait for the next update.
|
30
|
+
class BattleError < Exception; end
|
29
31
|
=begin
|
30
32
|
ArmouredCreatures take a reduced amount of damage.
|
31
33
|
This is a great superclass if you want damage reductions.
|
@@ -51,6 +53,7 @@ If you want your hero to heal, set parameter heal to 'hero'. If you want your en
|
|
51
53
|
|
52
54
|
=end
|
53
55
|
def battle(hero, enemy, heal = false)
|
56
|
+
raise(BattleError, "You must specify which party to heal.") unless heal == "both" || heal == "hero" || heal == "enemy" || heal == false
|
54
57
|
until hero.health <= 0 || enemy.health <= 0
|
55
58
|
roll1, roll2 = hero.droll, enemy.droll
|
56
59
|
# You hit enemy and it takes your roll amount
|