Example #1
0
    def test_creating_creature_with_effect(self):
        """
        Test that creature with effect can be created
        """
        creature = self.creatures(name='skeleton warrior')

        assert_that(creature, has_effect())
    def test_creating_creature_with_effect(self):
        """
        Test that creature with effect can be created
        """
        creature = self.creatures(name='skeleton warrior')

        assert_that(creature, has_effect())
    def test_add_multiple_effects_of_same_type(self):
        """
        Adding multiple effects of same type should not be possible
        """
        effect_1 = (EffectBuilder()
                    .with_effect_name('spell')
                    .build())
        effect_2 = (EffectBuilder()
                    .with_effect_name('spell')
                    .build())

        self.character.add_effect(effect_1)
        self.character.add_effect(effect_2)

        assert_that(self.character, has_effect(effect_1))
        assert_that(self.character, is_not(has_effect(effect_2)))
    def test_effect_is_not_removed(self):
        """
        Eternal effects should not be removed due to time out
        """
        self.model.get_next_creature(mock())

        assert_that(self.character2, has_effect(self.effect))
    def test_add_multiple_effects(self):
        """
        It should be possible to add multiple effects of different type
        """
        effect_1 = (EffectBuilder()
                    .with_effect_name('spell')
                    .build())
        effect_2 = (EffectBuilder()
                    .with_effect_name('curse')
                    .build())

        self.character.add_effect(effect_1)
        self.character.add_effect(effect_2)

        assert_that(self.character, has_effect(effect_1))
        assert_that(self.character, has_effect(effect_2))
Example #6
0
    def test_add_effect_in_melee(self):
        """
        Test that effect can be added as a result of unarmed combat
        """
        self.attacker.perform_attack(1)

        assert_that(self.defender, has_effect())
    def test_adding_effects(self):
        """
        Test that an effect can be added
        """
        effect = EffectBuilder().build()

        self.collection.add_effect(effect)

        assert_that(self.collection, has_effect(effect))
    def test_add_multiple_effects_of_same_type_when_allowed(self):
        """
        In special cases, adding multiple effects of same type is allowed
        """
        effect_1 = (EffectBuilder()
                    .with_effect_name('spell')
                    .with_multiple_allowed()
                    .build())
        effect_2 = (EffectBuilder()
                    .with_effect_name('spell')
                    .with_multiple_allowed()
                    .build())

        self.character.add_effect(effect_1)
        self.character.add_effect(effect_2)

        assert_that(self.character, has_effect(effect_1))
        assert_that(self.character, has_effect(effect_2))
    def test_add_effect(self):
        """
        Adding a single effect should be possible
        """
        effect = EffectBuilder().build()

        self.character.add_effect(effect)

        assert_that(self.character, has_effect(effect))
Example #10
0
    def test_adding_effect(self):
        """
        Test that poison effect can be added to a character
        """
        character = CharacterBuilder().build()
        poison = mock(Poison)

        character.add_effect(poison)

        assert_that(character, has_effect(poison))
Example #11
0
    def test_adding_effect(self):
        """
        Test that poison effect can be added to a character
        """
        character = CharacterBuilder().build()
        poison = mock(Poison)

        character.add_effect(poison)

        assert_that(character, has_effect(poison))
Example #12
0
    def test_add_effect_in_melee(self):
        """
        Test that effect can be added as a result of unarmed combat
        """
        rng = mock()
        when(rng).randint(1, 6).thenReturn(1)

        pyherc.vtable['\ufdd0:attack'](self.attacker,
                                       1)

        assert_that(self.defender, has_effect())
Example #13
0
    def test_removing_expired_effects(self):
        """
        Test that expired effects are removed
        """
        effect = (EffectBuilder()
                    .with_duration(0)
                    .build())

        self.collection.add_effect(effect)
        self.collection.remove_expired_effects()

        assert_that(self.collection, is_not(has_effect(effect)))
Example #14
0
    def test_worn_boots_effects(self):
        """
        Boots' effects are reported as user's effects
        """
        effect = (EffectBuilder()
                  .build())

        item = (ItemBuilder()
                .with_effect(effect)
                .build())

        self.character.inventory.boots = item

        assert_that(self.character, has_effect(effect))