예제 #1
0
    def test_MinDmgAlwaysOne(self):
        testCharacter1 = Character()
        testCharacter2 = Character()
        testCharacter1.strength = 1
        roll = 20
        attack = Attack(testCharacter1, testCharacter2, roll)

        attack.attemptAttack()
        self.assertEqual(4, testCharacter2.hitPoints)
예제 #2
0
    def test_ifRollIs20CriticalHitDoubleDamage(self):
        testCharacter1 = Character()
        testCharacter2 = Character()
        roll = 20
        attack = Attack(testCharacter1, testCharacter2, roll)

        attack.attemptAttack()

        self.assertEqual(3, testCharacter2.hitPoints)
예제 #3
0
    def test_CharacterGainsTenExperienceOnSuccessful(self):
        testCharacter1 = Character()
        testCharacter2 = Character()
        roll = testCharacter2.armor + 1
        attack = Attack(testCharacter1, testCharacter2, roll)

        attack.attemptAttack()

        self.assertEqual(10, testCharacter1.experiencePoints)
예제 #4
0
    def test_tripleDmgOnCritHit(self):
        testCharacter1 = Rogue()
        testCharacter2 = Character()
        roll = Roll(testCharacter1, testCharacter2, 20)
        attack = Attack(testCharacter1, testCharacter2, roll.initialRoll)

        attack.attemptAttack()

        self.assertEqual(2, testCharacter2.hitPoints)
예제 #5
0
    def test_ifTargetCharacterHitTakesOneDamage(self):
        testCharacter1 = Character()
        testCharacter2 = Character()
        roll = testCharacter2.armor
        attack = Attack(testCharacter1, testCharacter2, roll)

        attack.attemptAttack()

        self.assertEqual(4, testCharacter2.hitPoints)
예제 #6
0
    def test_CharacterLevelsAfter1000ExperiencePoints(self):
        testCharacter1 = Character()
        testCharacter2 = Character()
        testCharacter1.experiencePoints = 990
        roll = testCharacter2.armor
        attack = Attack(testCharacter1, testCharacter2, roll)

        attack.attemptAttack()

        self.assertEqual(testCharacter1.level, 2)
예제 #7
0
    def test_StrModIsAppliedToAttack(self):
        testCharacter1 = Character()
        testCharacter2 = Character()
        testCharacter1.strength = 12
        roll = testCharacter2.armor - 1
        attack = Attack(testCharacter1, testCharacter2, roll)

        attack.attemptAttack()

        self.assertEqual(3, testCharacter2.hitPoints)
예제 #8
0
    def test_ifOpponentDexModIsPositiveModIsNotAppliedToArmor(self):
        testCharacter1 = Rogue()
        testCharacter2 = Character()
        testCharacter2.dexterity = 12
        roll = Roll(testCharacter1, testCharacter2, 10)
        attack = Attack(testCharacter1, testCharacter2, roll.initialRoll)

        attack.attemptAttack()

        self.assertEqual(4, testCharacter2.hitPoints)
예제 #9
0
    def test_does3DmgInsteadOf1OnSuccessfulAttack(self):
        testCharacter1 = Monk()
        testCharacter2 = Character()
        roll = Roll(testCharacter1, testCharacter2, testCharacter2.armor)

        attack = Attack(testCharacter1, testCharacter2, roll.initialRoll)

        attack.attemptAttack()

        self.assertEqual(2, testCharacter2.hitPoints)
예제 #10
0
    def test_attackRollNotIncreasedIfNot2ndOr3rdLevel(self):
        testCharacter1 = Monk()
        testCharacter2 = Character()
        roll = Roll(testCharacter1, testCharacter2, testCharacter2.armor-1)

        attack = Attack(testCharacter1, testCharacter2, roll.initialRoll)

        attack.attemptAttack()

        self.assertEqual(5, testCharacter2.hitPoints)
예제 #11
0
    def test_addsDexModToAttacksInsteadOfStrength(self):
        testCharacter1 = Rogue()
        testCharacter2 = Character()
        testCharacter1.dexterity = 12
        roll = Roll(testCharacter1, testCharacter2, testCharacter2.armor - 1)
        attack = Attack(testCharacter1, testCharacter2, roll.initialRoll)

        attack.attemptAttack()

        self.assertEqual(3, testCharacter2.hitPoints)
예제 #12
0
    def test_monkGains6HPPerLevel(self):
        testCharacter1 = Monk()
        testCharacter2 = Character()
        testCharacter1.experiencePoints = 990
        roll = Roll(testCharacter1, testCharacter2, testCharacter2.armor)

        attack = Attack(testCharacter1, testCharacter2, roll.initialRoll)

        attack.attemptAttack()

        self.assertEqual(11, testCharacter1.hitPoints)
예제 #13
0
    def test_attackRollIncreasedBy1Every3rdLevel(self):
        testCharacter1 = Monk()
        testCharacter2 = Character()
        testCharacter1.level = 3
        roll = Roll(testCharacter1, testCharacter2, testCharacter2.armor-1)

        attack = Attack(testCharacter1, testCharacter2, roll.initialRoll)

        attack.attemptAttack()

        self.assertEqual(2, testCharacter2.hitPoints)
예제 #14
0
    def test_dontAddWisdomModIfNegativeToArmor(self):
        testCharacter1 = Character()
        testCharacter2 = Monk()
        testCharacter2.wisdom = 8
        roll = Roll(testCharacter1, testCharacter2, testCharacter2.armor)

        attack = Attack(testCharacter1, testCharacter2, roll.initialRoll)

        attack.attemptAttack()

        self.assertEqual(4, testCharacter2.hitPoints)
예제 #15
0
    def test_CharacterOnlyLevelsEvery1000ExperiencePoints(self):
        testCharacter1 = Character()
        testCharacter2 = Character()
        testCharacter1.experiencePoints = 1001
        testCharacter1.level = 2
        roll = testCharacter2.armor
        attack = Attack(testCharacter1, testCharacter2, roll)

        attack.attemptAttack()

        self.assertEqual(testCharacter1.level, 2)
예제 #16
0
    def test_ifTargetCharacterHP0OrLessTargetIsDead(self):
        testCharacter1 = Character()
        testCharacter2 = Character()
        testCharacter2.hitPoints = 1
        roll = testCharacter2.armor
        attack = Attack(testCharacter1, testCharacter2, roll)

        attack.attemptAttack()
        testCharacter2.checkLivingStatus()

        self.assertFalse(testCharacter2.isAlive)
예제 #17
0
    def test_DeadCharacterCannotBeAttacked(self):
        testCharacter1 = Character()
        testCharacter2 = Character()
        testCharacter2.isAlive = False
        testCharacter2.hitPoints = 0
        roll = testCharacter2.armor
        attack = Attack(testCharacter1, testCharacter2, roll)

        attack.attemptAttack()

        self.assertEqual(0, testCharacter2.hitPoints)
예제 #18
0
    def test_StrModIsDoubleOnCritHit(self):
        testCharacter1 = Character()
        testCharacter2 = Character()
        testCharacter1.strength = 12
        testCharacter2.hitPoints = 6
        roll = 20
        attack = Attack(testCharacter1, testCharacter2, roll)

        attack.attemptAttack()
        testCharacter2.checkLivingStatus()

        self.assertFalse(testCharacter2.isAlive)