Exemple #1
0
    def test_no_battle_abilities(self):
        actor_1, actor_2 = self.get_actors()

        self.assertTrue(actor_1.has_companion)
        self.assertFalse(actor_2.has_companion)

        self.assertFalse(battle.try_companion_strike(attacker=actor_1, defender=actor_2, messenger=self.hero))
Exemple #2
0
    def test_strike(self):
        actor_1, actor_2 = self.prepair_strike_test()

        self.assertTrue(
            battle.try_companion_strike(attacker=actor_1,
                                        defender=actor_2,
                                        messenger=self.hero))
Exemple #3
0
    def test_no_companion(self):
        self.hero.remove_companion()

        actor_1, actor_2 = self.get_actors()

        self.assertFalse(actor_1.has_companion)
        self.assertFalse(actor_2.has_companion)

        self.assertFalse(battle.try_companion_strike(attacker=actor_1, defender=actor_2, messenger=self.hero))
Exemple #4
0
    def test_strike__companion_dead(self):
        actor_1, actor_2 = self.prepair_strike_test()

        self.hero.companion.health = 0

        self.assertFalse(
            battle.try_companion_strike(attacker=actor_1,
                                        defender=actor_2,
                                        messenger=self.hero))
Exemple #5
0
    def test_strike(self):
        from the_tale.game.companions.abilities import effects
        from the_tale.game.companions.abilities import container

        battle_ability = random.choice([ability
                                        for ability in effects.ABILITIES.records
                                        if isinstance(ability.effect, effects.BaseBattleAbility)])
        self.hero.companion.record.abilities = container.Container(start=(battle_ability,))
        self.hero.reset_accessors_cache()

        actor_1, actor_2 = self.get_actors()

        self.assertTrue(actor_1.has_companion)
        self.assertFalse(actor_2.has_companion)

        self.assertTrue(battle.try_companion_strike(attacker=actor_1, defender=actor_2, messenger=self.hero))