示例#1
0
    def test_013_species_damage_relation_immunities(self):
        permutations = [(pokemon.DamageRelation.NO_DAMAGE_FROM,
                         pokemon.DamageRelation.NORMAL_DAMAGE_FROM),
                        (pokemon.DamageRelation.NO_DAMAGE_FROM,
                         pokemon.DamageRelation.HALF_DAMAGE_FROM),
                        (pokemon.DamageRelation.NO_DAMAGE_FROM,
                         pokemon.DamageRelation.DOUBLE_DAMAGE_FROM),
                        (pokemon.DamageRelation.NO_DAMAGE_FROM,
                         pokemon.DamageRelation.NO_DAMAGE_FROM),
                        (pokemon.DamageRelation.NORMAL_DAMAGE_FROM,
                         pokemon.DamageRelation.NO_DAMAGE_FROM),
                        (pokemon.DamageRelation.HALF_DAMAGE_FROM,
                         pokemon.DamageRelation.NO_DAMAGE_FROM),
                        (pokemon.DamageRelation.DOUBLE_DAMAGE_FROM,
                         pokemon.DamageRelation.NO_DAMAGE_FROM)]

        t1 = pokemon.Type(1, 'normal')
        t2 = pokemon.Type(2, 'flying')
        s = pokemon.Species(1, 'bulbasaur', types=[t1, t2])

        for damage_relations in permutations:
            t1.reset_damage_relations()
            t1.set_damage_relation(damage_relations[0], t1)
            t2.reset_damage_relations()
            t2.set_damage_relation(damage_relations[1], t1)
            assert t1 not in s.vulnerabilities()
            assert not s.is_vulnerable_to(t1)
            assert t1 not in s.resistances()
            assert not s.is_resistant_to(t1)
            assert t1 in s.immunities()
            assert s.is_immune_to(t1)
示例#2
0
    def test_011_species_damage_relation_dual_type_no_damage(self):
        permutations = [(pokemon.DamageRelation.NO_DAMAGE_FROM,
                         pokemon.DamageRelation.NORMAL_DAMAGE_FROM),
                        (pokemon.DamageRelation.NO_DAMAGE_FROM,
                         pokemon.DamageRelation.HALF_DAMAGE_FROM),
                        (pokemon.DamageRelation.NO_DAMAGE_FROM,
                         pokemon.DamageRelation.DOUBLE_DAMAGE_FROM),
                        (pokemon.DamageRelation.NO_DAMAGE_FROM,
                         pokemon.DamageRelation.NO_DAMAGE_FROM),
                        (pokemon.DamageRelation.NORMAL_DAMAGE_FROM,
                         pokemon.DamageRelation.NO_DAMAGE_FROM),
                        (pokemon.DamageRelation.HALF_DAMAGE_FROM,
                         pokemon.DamageRelation.NO_DAMAGE_FROM),
                        (pokemon.DamageRelation.DOUBLE_DAMAGE_FROM,
                         pokemon.DamageRelation.NO_DAMAGE_FROM)]

        t1 = pokemon.Type(1, 'normal')
        t2 = pokemon.Type(2, 'flying')
        s = pokemon.Species(1, 'bulbasaur', types=[t1, t2])

        for damage_relations in permutations:
            t1.reset_damage_relations()
            t1.set_damage_relation(damage_relations[0], t1)
            t2.reset_damage_relations()
            t2.set_damage_relation(damage_relations[1], t1)
            assert s.damage_relation_from_type(
                t1) == pokemon.DamageRelation.NO_DAMAGE_FROM
示例#3
0
 def test_007_species_damage_relation_dual_type_quarter_damage(self):
     t1 = pokemon.Type(1, 'normal')
     t1.set_damage_relation(pokemon.DamageRelation.HALF_DAMAGE_FROM, t1)
     t2 = pokemon.Type(2, 'flying')
     t2.set_damage_relation(pokemon.DamageRelation.HALF_DAMAGE_FROM, t1)
     s = pokemon.Species(1, 'bulbasaur', types=[t1, t2])
     assert s.damage_relation_from_type(
         t1) == pokemon.DamageRelation.QUARTER_DAMAGE_FROM
示例#4
0
    def test_000_species_search(self):
        mock_pokeapi_calls()

        species = pokemon.Species.search(1)
        assert species.name == 'bulbasaur'
        assert species.id == 1
        assert species.evs == pokemon.StatSet(special_attack=1)
        assert species.types == [
            pokemon.Type(4, 'poison'),
            pokemon.Type(12, 'grass')
        ]
示例#5
0
    def test_005_species_damage_relation_dual_type_no_damage(self):
        t1 = pokemon.Type(1, 'normal')
        t1.set_damage_relation(pokemon.DamageRelation.NO_DAMAGE_FROM, t1)

        for damage_relation in [
                pokemon.DamageRelation.NO_DAMAGE_FROM,
                pokemon.DamageRelation.HALF_DAMAGE_FROM,
                pokemon.DamageRelation.NORMAL_DAMAGE_FROM,
                pokemon.DamageRelation.DOUBLE_DAMAGE_FROM
        ]:
            t2 = pokemon.Type(2, 'flying')
            t2.set_damage_relation(damage_relation, t1)
            s = pokemon.Species(1, 'bulbasaur', types=[t1, t2])
            assert s.damage_relation_from_type(
                t1) == pokemon.DamageRelation.NO_DAMAGE_FROM
示例#6
0
 def test_004_species_damage_relation_single_type(self):
     for damage_relation in [
             pokemon.DamageRelation.NO_DAMAGE_FROM,
             pokemon.DamageRelation.HALF_DAMAGE_FROM,
             pokemon.DamageRelation.NORMAL_DAMAGE_FROM,
             pokemon.DamageRelation.DOUBLE_DAMAGE_FROM
     ]:
         t = pokemon.Type(1, damage_relation.name)
         t.set_damage_relation(damage_relation, t)
         s = pokemon.Species(1, 'bulbasaur', types=[t])
         assert s.damage_relation_from_type(t) == damage_relation