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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/battle +1 -1
  3. data/lib/battlefield.rb +3 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26151680d3e15a6e6e4d0c7dfab984c51e07be91
4
- data.tar.gz: 5f8d4b54ade88fd7a1626bfa5ab40d41c75e86c9
3
+ metadata.gz: f2f16160c4d075a4275b635bc87ec63ddd5a89d9
4
+ data.tar.gz: 59377d93132acda140b7823c7fdc6090cc25e500
5
5
  SHA512:
6
- metadata.gz: ece9c8ee79f3d6c2c56d7c71d043295c04a696d8e8b12b9fb293fd0b5b57364e438d8c2c2023438bfbef732a32392cb0a23edfc12e51773e499d716eba3bdac7
7
- data.tar.gz: 0400cf0e0c9384092dad1908739c21da8828c553606f2aab475328afec8f5d31451fd6001ad4916f02955e87b696ed9f56714c571ca57fc18c526d2fb6459c4e
6
+ metadata.gz: cf34112cb186abacf6a35d4e7db09b714411c55074785e7bd899f91089973c40bf07d4f4f479fbbca56fcdd9ec87875b84f3ebb4cba1e4e7b0174473044674f0
7
+ data.tar.gz: 91ffe1e9a69f301980d5055583a8044ecfb69d35ad3d7f945001e0a71ba137132944adaeb9605ed4617d281fee42e8f05e0f76d8e1c3aca618118582354bd442
data/bin/battle CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env/ruby
2
2
 
3
3
  require 'Battlefield'
4
- battle Hero(), Creature(ARGV[0].to_i)
4
+ battle Hero(), Creature(ARGV[0].to_i), ARGV[1]
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Battlefield
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Perlmutter