Ejemplo n.º 1
0
    def _make_effect(self, **kwargs):
        hp_adjustment = 0
        incoming_damage = 0
        outgoing_damage = 0
        stacks = 1
        operator = "+"
        eg = EffectGenerator()
        effect_name = None

        if "effect_name" in kwargs:
            effect_name = kwargs["effect_name"]

        if "operator" in kwargs:
            operator = kwargs["operator"]

        if "hp_adjustment" in kwargs:
            hp_adjustment = kwargs["hp_adjustment"]

        if "stacks" in kwargs:
            stacks = kwargs["stacks"]

        if "incoming_damage_adjustment" in kwargs:
            incoming_damage = kwargs["incoming_damage_adjustment"]

        if "outgoing_damage_adjustment" in kwargs:
            outgoing_damage = kwargs["outgoing_damage_adjustment"]

        effect = eg.generate(operator=operator,
                             hp_adjustment=hp_adjustment,
                             effect_name=effect_name,
                             stacks=stacks,
                             incoming_damage_adjustment=incoming_damage,
                             outgoing_damage_adjustment=outgoing_damage)
        return effect
    def test_generate(self):
        eg = EffectGenerator()
        hp_adjustment = 42
        incoming_damage = 0
        outgoing_damage = 0
        stacks = 1
        interval_seconds = 0

        effect = eg.generate(hp_adjustment=hp_adjustment,
                             incoming_damage_adjustment=incoming_damage,
                             outgoing_damage_adjustment=outgoing_damage,
                             stacks=stacks,
                             interval_seconds=interval_seconds)

        self.assertIsInstance(effect, Effect)
        self.assertTrue(len(effect.name) > 0)
        self.assertTrue(len(effect.description) > 0)
        self.assertTrue(len(effect.operator) > 0)
        self.assertTrue(len(effect.description) > 0)
        self.assertEqual(effect.hp_adjustment, hp_adjustment)
        self.assertEqual(
            effect.incoming_damage_adjustment, incoming_damage)
        self.assertEqual(
            effect.outgoing_damage_adjustment, outgoing_damage)
        self.assertEqual(effect.stacks, stacks)
        self.assertEqual(effect.interval_seconds, interval_seconds)
        self.assertTrue(hasattr(effect, "created_at"))