Skip to content

Commit

Permalink
attackers hit
Browse files Browse the repository at this point in the history
  • Loading branch information
guyroyse committed Aug 1, 2015
1 parent bb46807 commit baa5135
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions evercraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def hit_points(self):
class Combat():

def __init__(self, attacker, defender):
pass
self.defender = defender

def resolve(self, roll):
self.hit = False
self.hit = roll >= self.defender.armor_class
8 changes: 8 additions & 0 deletions tests/test_evercraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ def setUp(self):
def test_attacker_misses_when_roll_less_than_armor_class(self):
self.subject.resolve(5)
self.assertFalse(self.subject.hit)

def test_attacker_hits_when_roll_equals_armor_class(self):
self.subject.resolve(10)
self.assertTrue(self.subject.hit)

def test_attacker_hits_when_roll_greater_than_armor_class(self):
self.subject.resolve(15)
self.assertTrue(self.subject.hit)

0 comments on commit baa5135

Please sign in to comment.