Пример #1
0
    public void PokemonDatabaseEntryImageTest()
    {
        PKMN.Database.PokemonEntry pokemonEntry = new PKMN.Database.PokemonEntry(PKMN.Species.BULBASAUR, PKMN.Game.RED, "");

        // These calls succeeding is enough to show that the image (or the image
        // generated for Mono) was loaded successfully.
        pokemonEntry.GetIcon(false);
        pokemonEntry.GetSprite(false, false);
    }
Пример #2
0
        public static void Gen2UnownTest(
            PKMN.Game game
            )
        {
            PKMN.Database.PokemonEntry unownEntry = new PKMN.Database.PokemonEntry(
                PKMN.Species.UNOWN,
                game,
                ""
                );
            PKMN.Pokemon unown;

            foreach (string form in unownEntry.Forms)
            {
                unown = new PKMN.Pokemon(PKMN.Species.UNOWN, game, form, 5);
                Assert.AreEqual(unown.Form, form);

                // Make sure IVs are properly set.
                string formFromIVs = PKMN.Calculations.Gen2UnownForm(
                    unown.IVs[PKMN.Stat.ATTACK],
                    unown.IVs[PKMN.Stat.DEFENSE],
                    unown.IVs[PKMN.Stat.SPEED],
                    unown.IVs[PKMN.Stat.SPECIAL]
                    );
                Assert.AreEqual(unown.Form, formFromIVs);

                Assert.IsTrue(System.IO.File.Exists(unown.IconFilepath));
                Assert.IsTrue(System.IO.File.Exists(unown.SpriteFilepath));
            }

            unown = new PKMN.Pokemon(PKMN.Species.UNOWN, game, "A", 5);

            // Make sure setting the form properly changes the IVs.
            foreach (string form in unownEntry.Forms)
            {
                unown.Form = form;
                Assert.AreEqual(unown.Form, form);

                string formFromIVs = PKMN.Calculations.Gen2UnownForm(
                    unown.IVs[PKMN.Stat.ATTACK],
                    unown.IVs[PKMN.Stat.DEFENSE],
                    unown.IVs[PKMN.Stat.SPEED],
                    unown.IVs[PKMN.Stat.SPECIAL]
                    );
                Assert.AreEqual(unown.Form, formFromIVs);

                Assert.IsTrue(System.IO.File.Exists(unown.IconFilepath));
                Assert.IsTrue(System.IO.File.Exists(unown.SpriteFilepath));
            }

            // Make sure setting IVs properly changes the form.
            unown.IVs[PKMN.Stat.ATTACK]  = 10;
            unown.IVs[PKMN.Stat.DEFENSE] = 9;
            unown.IVs[PKMN.Stat.SPEED]   = 1;
            unown.IVs[PKMN.Stat.SPECIAL] = 14;
            Assert.AreEqual(unown.Form, "G");
        }
Пример #3
0
        public static void Gen3UnownTest(
            PKMN.Game game
            )
        {
            PKMN.Database.PokemonEntry unownEntry = new PKMN.Database.PokemonEntry(
                PKMN.Species.UNOWN,
                game,
                ""
                );
            PKMN.Pokemon unown;

            foreach (string form in unownEntry.Forms)
            {
                unown = new PKMN.Pokemon(PKMN.Species.UNOWN, game, form, 5);
                Assert.AreEqual(unown.Form, form);

                // Make sure the personality is properly set.
                string formFromPersonality = PKMN.Calculations.Gen3UnownForm(unown.Personality);
                Assert.AreEqual(unown.Form, formFromPersonality);

                Assert.IsTrue(System.IO.File.Exists(unown.IconFilepath));
                Assert.IsTrue(System.IO.File.Exists(unown.SpriteFilepath));
            }

            unown = new PKMN.Pokemon(PKMN.Species.UNOWN, game, "A", 5);

            foreach (string form in unownEntry.Forms)
            {
                unown.Form = form;
                Assert.AreEqual(unown.Form, form);

                // Make sure the personality is properly set.
                string formFromPersonality = PKMN.Calculations.Gen3UnownForm(unown.Personality);
                Assert.AreEqual(unown.Form, formFromPersonality);

                Assert.IsTrue(System.IO.File.Exists(unown.IconFilepath));
                Assert.IsTrue(System.IO.File.Exists(unown.SpriteFilepath));
            }

            // Make sure setting the personality properly sets the form.
            unown.Personality = 0x4C07DE71;
            Assert.AreEqual(unown.Form, "B");
        }
Пример #4
0
    public void PokemonEntryTest()
    {
        PKMN.Database.PokemonEntry pokemonEntry = new PKMN.Database.PokemonEntry(
            PKMN.Species.VENUSAUR,
            PKMN.Game.OMEGA_RUBY,
            ""
            );

        PKMN.Database.PokemonEntry pokemonEntrySame = new PKMN.Database.PokemonEntry(
            PKMN.Species.VENUSAUR,
            PKMN.Game.OMEGA_RUBY,
            ""
            );
        PKMN.Database.PokemonEntry pokemonEntryDifferentPokemon = new PKMN.Database.PokemonEntry(
            PKMN.Species.CHARIZARD,
            PKMN.Game.OMEGA_RUBY,
            ""
            );
        PKMN.Database.PokemonEntry pokemonEntryDifferentGame = new PKMN.Database.PokemonEntry(
            PKMN.Species.VENUSAUR,
            PKMN.Game.RUBY,
            ""
            );
        PKMN.Database.PokemonEntry pokemonEntryDifferentForm = new PKMN.Database.PokemonEntry(
            PKMN.Species.VENUSAUR,
            PKMN.Game.OMEGA_RUBY,
            "Mega"
            );

        Assert.AreEqual(pokemonEntry, pokemonEntry);
        Assert.AreEqual(pokemonEntry, pokemonEntrySame);
        Assert.AreEqual(pokemonEntry.GetHashCode(), pokemonEntrySame.GetHashCode());

        Assert.AreNotEqual(pokemonEntry, pokemonEntryDifferentPokemon);
        Assert.AreNotEqual(pokemonEntry.GetHashCode(), pokemonEntryDifferentPokemon.GetHashCode());

        Assert.AreNotEqual(pokemonEntry, pokemonEntryDifferentGame);
        Assert.AreNotEqual(pokemonEntry.GetHashCode(), pokemonEntryDifferentGame.GetHashCode());

        Assert.AreNotEqual(pokemonEntry, pokemonEntryDifferentForm);
        Assert.AreNotEqual(pokemonEntry.GetHashCode(), pokemonEntryDifferentForm.GetHashCode());
    }
Пример #5
0
    public void PokemonEntryTest()
    {
        // Make sure trying to create an invalid entry results in an error.
        Assert.Throws <ArgumentOutOfRangeException>(
            delegate {
            new PKMN.Database.PokemonEntry(PKMN.Species.CASTFORM, PKMN.Game.NONE, "Sunny");
        }
            );
        Assert.Throws <ArgumentOutOfRangeException>(
            delegate {
            new PKMN.Database.PokemonEntry(PKMN.Species.CASTFORM, PKMN.Game.BLACK2, "Not a form");
        }
            );

        PKMN.Database.PokemonEntry pokemonEntry = new PKMN.Database.PokemonEntry(PKMN.Species.STUNFISK, PKMN.Game.BLACK2, "");

        Assert.AreEqual(pokemonEntry.Species, PKMN.Species.STUNFISK);
        Assert.AreEqual(pokemonEntry.SpeciesName, "Stunfisk");
        Assert.AreEqual(pokemonEntry.Game, PKMN.Game.BLACK2);
        Assert.AreEqual(pokemonEntry.Category, "Trap");
        Assert.AreEqual(pokemonEntry.Form, "Standard");

        // Just make sure this works
        string pokedexEntry = pokemonEntry.PokedexEntry;

        Assert.That(pokemonEntry.Height, Is.EqualTo(0.7).Within(0.0001));
        Assert.That(pokemonEntry.Weight, Is.EqualTo(11.0).Within(0.0001));
        Assert.That(pokemonEntry.ChanceMale, Is.EqualTo(0.5).Within(0.0001));
        Assert.That(pokemonEntry.ChanceFemale, Is.EqualTo(0.5).Within(0.0001));
        Assert.IsFalse(pokemonEntry.HasGenderDifferences);
        Assert.AreEqual(pokemonEntry.BaseFriendship, 70);
        Assert.AreEqual(
            pokemonEntry.Types,
            new PKMN.TypeEnumPair(PKMN.Type.GROUND, PKMN.Type.ELECTRIC)
            );
        Assert.AreEqual(
            pokemonEntry.Abilities,
            new PKMN.AbilityEnumPair(PKMN.Ability.STATIC, PKMN.Ability.LIMBER)
            );
        Assert.AreEqual(pokemonEntry.HiddenAbility, PKMN.Ability.SAND_VEIL);
        Assert.AreEqual(
            pokemonEntry.EggGroups,
            new PKMN.EggGroupEnumPair(PKMN.EggGroup.WATER1, PKMN.EggGroup.INDETERMINATE)
            );

        PKMN.StatDict baseStats = pokemonEntry.BaseStats;
        Assert.AreEqual(baseStats[PKMN.Stat.HP], 109);
        Assert.AreEqual(baseStats[PKMN.Stat.ATTACK], 66);
        Assert.AreEqual(baseStats[PKMN.Stat.DEFENSE], 84);
        Assert.AreEqual(baseStats[PKMN.Stat.SPEED], 32);
        Assert.AreEqual(baseStats[PKMN.Stat.SPECIAL_ATTACK], 81);
        Assert.AreEqual(baseStats[PKMN.Stat.SPECIAL_DEFENSE], 99);

        PKMN.StatDict evYields = pokemonEntry.EVYields;
        Assert.AreEqual(evYields[PKMN.Stat.HP], 2);
        Assert.AreEqual(evYields[PKMN.Stat.ATTACK], 0);
        Assert.AreEqual(evYields[PKMN.Stat.DEFENSE], 0);
        Assert.AreEqual(evYields[PKMN.Stat.SPEED], 0);
        Assert.AreEqual(evYields[PKMN.Stat.SPECIAL_ATTACK], 0);
        Assert.AreEqual(evYields[PKMN.Stat.SPECIAL_DEFENSE], 0);

        Assert.AreEqual(pokemonEntry.ExperienceYield, 165);
        Assert.AreEqual(pokemonEntry.GetExperienceAtLevel(50), 125000);
        Assert.AreEqual(pokemonEntry.GetLevelAtExperience(200000), 58);
        Assert.Greater(pokemonEntry.LevelupMoves.Count, 0);
        Assert.Greater(pokemonEntry.TMHMMoves.Count, 0);
        Assert.Greater(pokemonEntry.EggMoves.Count, 0);
        Assert.Greater(pokemonEntry.TutorMoves.Count, 0);
        Assert.AreEqual(pokemonEntry.Forms.Count, 1);
        Assert.AreEqual(pokemonEntry.Evolutions.Count, 0);

        Assert.IsTrue(System.IO.File.Exists(pokemonEntry.GetIconFilepath(false)));
        Assert.IsTrue(System.IO.File.Exists(pokemonEntry.GetIconFilepath(true)));
        Assert.IsTrue(System.IO.File.Exists(pokemonEntry.GetSpriteFilepath(false, false)));
        Assert.IsTrue(System.IO.File.Exists(pokemonEntry.GetSpriteFilepath(false, true)));
        Assert.IsTrue(System.IO.File.Exists(pokemonEntry.GetSpriteFilepath(true, false)));
        Assert.IsTrue(System.IO.File.Exists(pokemonEntry.GetSpriteFilepath(true, true)));
    }