Battlefield 0.1.0 → 1.0.1
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/battlefield.rb +6 -7
- 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: 8a30ab9a0c7ff11032b234a68767c403586a05a5
|
4
|
+
data.tar.gz: 2961494e7746dfac735df88bcedfde8696baf809
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 243d557b3a4299f7e9563d0ed6b7f61cce9b772a43026b45131ddd3a68bc6e7a6d2773d0e51de8bad62e7963b2956305ef092e6ae63f386757a9f2315cbe4783
|
7
|
+
data.tar.gz: a53297bfa090c633b3783ab75c86160000b9a5392df91dfdef804ab76c5b7f9740264ce7a899c556990c1495f9200f3bd9debe0d947d39c8d5c408989c174d1e
|
data/lib/battlefield.rb
CHANGED
@@ -18,12 +18,11 @@ class Creature
|
|
18
18
|
# Damage function
|
19
19
|
def damage(amt); @health -= amt; end
|
20
20
|
# Rolling function - higher # = more power.
|
21
|
-
def roll
|
22
|
-
(1..6).to_a.sample; end
|
21
|
+
def roll; (1..6).to_a.sample; end
|
23
22
|
# Roll twice
|
24
23
|
def droll; self.roll + self.roll; end
|
25
24
|
# The 1st argument is your attack power. The other is the enemy's. self heals c1 - c2 health.
|
26
|
-
def heal(
|
25
|
+
def heal(amt)
|
27
26
|
@health += c1 - c2
|
28
27
|
end
|
29
28
|
end
|
@@ -77,9 +76,9 @@ def battle(hero, enemy, heal = false)
|
|
77
76
|
sleep 2
|
78
77
|
end
|
79
78
|
end
|
80
|
-
# Initializes a new Creature. If no arguments are given, health is set to
|
81
|
-
def Creature(health =
|
82
|
-
# Initializes a new ArmouredCreature. By default, health is set to
|
83
|
-
def ArmouredCreature(health =
|
79
|
+
# Initializes a new Creature. If no arguments are given, health is set to 1.
|
80
|
+
def Creature(health = 1); Creature.new health; end
|
81
|
+
# Initializes a new ArmouredCreature. By default, health is set to 1 and armour is set to 0.5
|
82
|
+
def ArmouredCreature(health = 1, armour = 0.5); ArmouredCreature.new health, armour; end
|
84
83
|
# Alias for Hero.new. Remember to include the ()s if you give no arguments or you will get an error!
|
85
84
|
def Hero(armour = 1); Hero.new(armour); end
|