Example #1
0
    static Pokedex()
    {
        //Create some pokemon

        //Missingno
        PokemonStats missingnoBaseStats = new PokemonStats
                                          (
            56,
            35,
            25,
            35,
            72,
            30
                                          );

        PokedexEntry missingno = new PokedexEntry
                                 (
            new DexID("", 0),
            "Missingno.",
            missingnoBaseStats,
            PokemonType.bug
                                 );

        AddEntry(missingno);
    }
Example #2
0
        /// <summary>
        /// Populate the encounter list with all posible encounters
        /// </summary>
        public void PopulateEncounterList()
        {
            Sprite           sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/Sprite/pkmgsc_suicune.png");
            PokemonStats     stats  = AssetDatabase.LoadAssetAtPath <PokemonStats>("Assets/Scriptable Objects/Pokemon Definitions/Suicune.asset");
            List <MoveModel> moves  = new List <MoveModel>();

            moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Bubble-beam.asset")));
            moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Growl.asset")));
            AgentModel model = new AgentModel(sprite, stats, moves);

            EncounterList.Add(model);
            moves.Clear();
            sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/Sprite/pkmgsc_sneasel_front.png");
            stats  = AssetDatabase.LoadAssetAtPath <PokemonStats>("Assets/Scriptable Objects/Pokemon Definitions/Sneasel.asset");
            moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Slash.asset")));
            moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Growl.asset")));
            model = new AgentModel(sprite, stats, moves);
            EncounterList.Add(model);
            moves.Clear();
            sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/Sprite/pkmgsc_geodude_front.png");
            stats  = AssetDatabase.LoadAssetAtPath <PokemonStats>("Assets/Scriptable Objects/Pokemon Definitions/Geodude.asset");
            moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Rock-throw.asset")));
            moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Growl.asset")));
            model = new AgentModel(sprite, stats, moves);
            EncounterList.Add(model);
        }
Example #3
0
    public PokedexEntry(DexID id, string speciesName, PokemonStats baseStats, PokemonType typeA, PokemonType typeB = PokemonType.none)
    {
        this.id          = id;
        this.speciesName = speciesName;
        this.baseStats   = baseStats;

        this.typeA = typeA;
        this.typeB = typeB;
    }
    void Start()
    {
        Graph();
        stats = GetComponent <PokemonStats>();

        ResetCharacterAnimator();

        myType = stats.MyType;
    }
Example #5
0
 public static string ConvertStatToString(PokemonStats stat, bool capitalize = true)
 {
     return((stat == PokemonStats.Attack) ? "Attack"
         : (stat == PokemonStats.Defense) ? "Defense"
         : (stat == PokemonStats.SpecialAttack) ? "Special Attack"
         : (stat == PokemonStats.SpecialDefense) ? "Special Defense"
         : (stat == PokemonStats.Speed) ? "Speed"
         : (stat == PokemonStats.Accuracy) ? "Accuracy"
         : (stat == PokemonStats.Evasion) ? "Evasion"
         : "HP");
 }
Example #6
0
 public void IncrementPokemonStats(int pokemonId)
 {
     if (PokemonStats.ContainsKey(pokemonId))
     {
         PokemonStats[pokemonId]++;
     }
     else
     {
         PokemonStats.Add(pokemonId, 1);
     }
 }
Example #7
0
 public void Reset()
 {
     PokemonStats.Clear();
     RaidStats.Clear();
     PokemonSent               = 0;
     RaidsSent                 = 0;
     QuestsSent                = 0;
     SubscriptionPokemonSent   = 0;
     SubscriptionRaidsSent     = 0;
     SubscriptionQuestsSent    = 0;
     SubscriptionInvasionsSent = 0;
 }
Example #8
0
        /// <summary>
        /// Generate the Players party as AgentModels
        /// </summary>
        public void GeneratePlayerParty()
        {
            Sprite           sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/Sprite/pkmgsc_sudowoodo.png");
            PokemonStats     stats  = AssetDatabase.LoadAssetAtPath <PokemonStats>("Assets/Scriptable Objects/Pokemon Definitions/Sudowoodo.asset");
            List <MoveModel> moves  = new List <MoveModel>();

            moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Tackle.asset")));
            moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Growl.asset")));
            AgentModel model_1 = new AgentModel(sprite, stats, moves);

            partyModels.Add(model_1);
        }
Example #9
0
    //[Command] public void CmdRequestTrainerBattle(NetworkInstanceId otherTrainerNetId)
    //{
    //    NetworkServer.FindLocalObject(otherTrainerNetId).GetComponent<Trainer>().RpcIncomingBattleRequest(TrainersName, netId);
    //}
    //[Command] public void CmdAcceptBattleRequest(NetworkInstanceId otherTrainerNetId)
    //{
    //    NetworkServer.FindLocalObject(otherTrainerNetId).GetComponent<Trainer>().RpcRequestAcceted(TrainersName);
    //    NetworkServer.FindLocalObject(otherTrainerNetId).GetComponent<Trainer>().RpcInitTrainerBattle(netId);
    //    RpcInitTrainerBattle(otherTrainerNetId);
    //}
    //[Command] public void CmdDeclineBattleRequest(NetworkInstanceId otherTrainerNetId)
    //{
    //    NetworkServer.FindLocalObject(otherTrainerNetId).GetComponent<Trainer>().RpcRequestDenied(TrainersName);
    //}
    //[Command] public void CmdInitWildPokemonBattle(NetworkInstanceId netId)
    //{
    //    GameObject wildPokemon = NetworkServer.FindLocalObject(netId);

    //    pokemon.enemy = NetworkServer.FindLocalObject(netId);
    //    pokemon.inBattle = true;
    //    pokemon.RpcSetEnemy(netId);

    //    //wildPokemon.GetComponent<Pokemon_AI>().target = activePokemon.gameObject;
    //    wildPokemon.GetComponent<Pokemon>().inBattle = true;
    //    wildPokemon.GetComponent<Pokemon>().enemy = pokemon.gameObject;
    //    //wildPokemon.GetComponent<Pokemon_AI>().worldState = Pokemon_AI.WorldStates.Battle;
    //}
    //#endregion

    private void GetStatsBack()
    {
        PokemonHPPP  hpPP  = pokemon.components.hpPP;
        PokemonStats stats = pokemon.components.stats;

        PokemonData data = new PokemonData(pokemon.pokemonName, pokemon.nickname, pokemon.equippedItem, (int)pokemon.gender, (int)pokemon.nature, pokemon.level, hpPP.curMaxHP, hpPP.curMaxPP,
                                           stats.curMaxATK, stats.curMaxDEF, stats.curMaxSPATK, stats.curMaxSPDEF, stats.curMaxSPD, hpPP.curHP, hpPP.curPP, stats.curATK, stats.curDEF, stats.curSPATK, stats.curSPDEF, stats.curSPD,
                                           hpPP.hpEV, hpPP.ppEV, stats.atkEV, stats.defEV, stats.spatkEV, stats.spdefEV, stats.spdEV, hpPP.hpIV, hpPP.ppIV, stats.atkIV, stats.defIV, stats.spatkIV, stats.spdefIV, stats.spdIV,
                                           pokemon.curEXP, pokemon.id, pokemon.fromTrade);

        int index = PokemonRoster.FindIndex(x => x.id == data.id);

        PokemonRoster[index] = data;
    }
Example #10
0
    //Constructors

    public IndividualPokemon(DexID species, PokemonStats individualValues, List <IndividualPokemonMove> knownMoves, int level)
    {
        //Basic constructor for a pokemon encountered in the wild

        this.species          = species;
        this.individualValues = individualValues;
        this.knownMoves       = knownMoves;
        this.level            = level;

        effortValues = new PokemonStats();
        exp          = 0;

        currentHP        = CalculateStat(PokemonStatID.maxHP);
        currentCondition = StatusCondition.none;
    }
Example #11
0
 public void AddMember(BasePokemon bp)
 {
     this.PName        = bp.PName;
     this.image        = bp.image;
     this.type         = bp.type;
     this.rarity       = bp.rarity;
     this.HP           = bp.HP;
     this.maxHP        = bp.maxHP;
     this.AttackStat   = bp.AttackStat;
     this.DefenceStat  = bp.DefenceStat;
     this.pokemonStats = bp.pokemonStats;
     this.canEvolve    = bp.canEvolve;
     this.evolveTo     = bp.evolveTo;
     this.level        = bp.level;
 }
Example #12
0
 public void AddMember(BasePokemon bp)
 {
     this.PName        = bp.PName;
     this.image        = bp.image;
     this.biomeFound   = bp.biomeFound;
     this.type         = bp.type;
     this.rarity       = bp.rarity;
     this.HP           = bp.HP;
     this.maxHP        = bp.maxHP;
     this.attackStat   = bp.attackStat;
     this.defenceStat  = bp.defenceStat;
     this.pokemonStats = bp.pokemonStats;
     this.canEvolve    = bp.canEvolve;
     this.level        = bp.level;
 }
        public static int EqualStatsAmount(PokemonStats stats)
        {
            var list = new List <int>
            {
                stats.HP,
                stats.Attack,
                stats.Defense,
                stats.Special_Attack,
                stats.Special_Defense,
                stats.Speed
            };

            int mostCommon = list.GroupBy(item => item).Max(item => item.Count());

            return(mostCommon);
        }
Example #14
0
 public void AddMember(BasePokemon bp)
 {
     this.PName = bp.PName;
     this.image = bp.image;
     this.biomeFound = bp.biomeFound;
     this.type = bp.type;
     this.rarity = bp.rarity;
     this.HP = bp.HP;
     this.maxHP = bp.maxHP;
     this.AttackStat = bp.AttackStat;
     this.DefenceStat = bp.DefenceStat;
     this.pokemonStats = bp.pokemonStats;
     this.canEvolve = bp.canEvolve;
     this.evolveTo = bp.evolveTo;
     this.level = bp.level;
 }
        static void Main(string[] args)
        {
            Dictionary <string, List <PokemonStats> > dict = new Dictionary <string, List <PokemonStats> >();

            while (true)
            {
                string[] input       = Console.ReadLine().Split(new char[] { ' ', '-', '>' }, StringSplitOptions.RemoveEmptyEntries);
                string   pokemonName = input[0];
                if (input[0] == "wubbalubbadubdub")
                {
                    break;
                }
                if (input.Length < 2 && dict.ContainsKey(pokemonName))
                {
                    Console.WriteLine($"# {pokemonName}");
                    foreach (var pokemon in dict[pokemonName])
                    {
                        Console.WriteLine($"{pokemon.evolutionType} <-> {pokemon.evolutionIndex}");
                    }
                }
                else
                if (input.Length == 3)
                {
                    PokemonStats pokemon = new PokemonStats();
                    pokemon.evolutionType  = input[1];
                    pokemon.evolutionIndex = long.Parse(input[2]);
                    if (dict.ContainsKey(pokemonName))
                    {
                        dict[pokemonName].Add(pokemon);
                    }
                    else
                    {
                        dict.Add(pokemonName, new List <PokemonStats>());
                        dict[pokemonName].Add(pokemon);
                    }
                }
            }
            foreach (var pokemon in dict)
            {
                Console.WriteLine($"# {pokemon.Key}");
                foreach (var stat in dict[pokemon.Key].OrderByDescending(x => x.evolutionIndex))
                {
                    Console.WriteLine($"{stat.evolutionType} <-> {stat.evolutionIndex}");
                }
            }
        }
Example #16
0
    public void Reset()
    {
        target = gameObject;

        if (_instantiated != null)
        {
            DestroyImmediate(_instantiated);
        }

        _instantiated = Instantiate(HP_PREFAB);
        _instantiated.transform.SetParent(GameObject.Find("Canvas").transform.Find("HP_Container").transform, false);
        _rect = _instantiated.GetComponent <RectTransform>();

        _stats     = GetComponent <PokemonStats>();
        _currentHp = _stats.CurrentHealth;

        SetColor(c);
        SetHP();
    }
        public static EmbedBuilder PokeEmbed(Pokemon poke, PokemonStats stats, string image)
        {
            var embed = new EmbedBuilder();

            embed.WithAuthor($"{poke.DexNr}. {poke.Name} {poke.japName}");
            embed.WithThumbnailUrl(image);

            embed.WithDescription(
                $"**Type:** {poke.Type}\n\n" +
                $"{poke.Classification} Pokémon\n\n" +
                $"**HP:** {stats.HP}\n" +
                $"**Attack:** {stats.Attack}\n" +
                $"**Defense:** {stats.Defense}\n" +
                $"**Special Attack:** {stats.Special_Attack}\n" +
                $"**Special Defense:** {stats.Special_Defense}\n" +
                $"**Speed:** {stats.Speed}"
                );

            return(embed);
        }
Example #18
0
 public void AddMember(BasePokemon bp)
 {
     this.Name         = bp.Name;
     this.image        = bp.image;
     this.biomeFound   = bp.biomeFound;
     this.type1        = bp.type1;
     this.type2        = bp.type2;
     this.rarity       = bp.rarity;
     this.HP           = bp.HP;
     this.currentHP    = bp.currentHP;
     this.attStat      = bp.attStat;
     this.defStat      = bp.defStat;
     this.spAttStat    = bp.spAttStat;
     this.spDefStat    = bp.spDefStat;
     this.speedStat    = bp.speedStat;
     this.pokemonStats = bp.pokemonStats;
     this.level        = bp.level;
     this.canEvolve    = bp.canEvolve;
     this.evolveTo     = bp.evolveTo;
 }
    private IndividualPokemon GenerateTestMissingno(int level)
    {
        //Generates a missingno to be used for testing purposes

        //Set each IV to 15
        PokemonStats ivs = new PokemonStats();

        for (int i = 0; i < PokemonStats.NUM_STATS; i++)
        {
            ivs[(PokemonStatID)i] = 15;
        }

        //Give it tackle
        List <IndividualPokemonMove> moves = new List <IndividualPokemonMove>();

        moves.Add(new IndividualPokemonMove(new DexID("", 1)));

        //Create the pokemon
        IndividualPokemon pokemon = new IndividualPokemon(new DexID("", 0), ivs, moves, level);

        return(pokemon);
    }
Example #20
0
        public static PokemonStats ConvertToBaseStats(this PokeAPI.PokemonStats[] pokeAPIpokemonStats)
        {
            PokemonStats stats = new PokemonStats();

            foreach (var stat in pokeAPIpokemonStats)
            {
                switch (stat.Stat.Name)
                {
                case ("hp"):
                    stats.HP = stat.BaseValue;
                    break;

                case ("attack"):
                    stats.Atk = stat.BaseValue;
                    break;

                case ("defense"):
                    stats.Def = stat.BaseValue;
                    break;

                case ("special-attack"):
                    stats.SpA = stat.BaseValue;
                    break;

                case ("special-defense"):
                    stats.SpD = stat.BaseValue;
                    break;

                case ("speed"):
                    stats.Spe = stat.BaseValue;
                    break;

                default:
                    break;
                }
            }
            return(stats);
        }
    public void ShowStats(Character c)
    {
        if (_currentStats != c.gameObject)
        {
            RemoveStats();
            _currentStats = c.gameObject;
            Transform    canvas = GameObject.Find("Canvas").transform;
            PokemonStats stats  = c.GetComponent <PokemonStats>();
            Experience   exp    = c.GetComponent <Experience>();
            var          n      = c.name.Split("("[0]);

            string statsString =
                n[0] +
                "\nType: " + stats.MyType +
                "\n Level: " + stats.Level +
                "\n Health: " + stats._currentHealth + "/" + stats.MaxHealth +
                "\n Attack: " + stats.Attack +
                "\n Defense: " + stats.Defense +
                (exp == null || exp.NextLevelXP == 0 ? "":
                 string.Format("\n EXP: {0}%", exp.experience / (float)exp.NextLevelXP * 100));

            InstantiatePanel(statsString, canvas);
        }
    }
Example #22
0
 public AgentModel(Sprite sprite, PokemonStats statsSource, List <MoveModel> moveSet)
 {
     if (moveSet.Count > 4)
     {
         return;
     }
     this.sprite       = sprite;
     this.statsSource  = statsSource;
     this.moveSet      = moveSet;
     this.currentStats = new AgentStats()
     {
         agentName      = statsSource.pokemonName,
         healthPoints   = statsSource.hp,
         attack         = statsSource.attack,
         defense        = statsSource.defense,
         magic_attack   = statsSource.attack,
         magic_defense  = statsSource.magic_defense,
         speed          = statsSource.speed,
         luck           = statsSource.luck,
         totalExp       = 0,
         expToNextLevel = 25,
         level          = 5
     };
 }
Example #23
0
    /// <summary>
    /// Breadth first search
    /// </summary>
    /// <param name="reach"></param>
    /// <param name="attack"></param>
    /// <param name="takePlayerIntoAccount">Set to false to ignore players</param>
    /// <returns></returns>
    Dictionary <Tile, int> GetTilesB(int reach, int attack, bool takePlayerIntoAccount)
    {
        // Variables
        takePlayerIntoAccount &= HasPlayer;

        PokemonStats stats = null;

        if (HasPlayer)
        {
            stats = _character.GetComponent <PokemonStats>();
        }
        bool handleObstacle = stats != null && takePlayerIntoAccount;

        int total = reach + attack;
        int r     = 0; // r is Tile current reach

        List <KeyValuePair <Tile, int> > open   = new List <KeyValuePair <Tile, int> >();
        Dictionary <Tile, int>           closed = new Dictionary <Tile, int>();

        open.Add(new KeyValuePair <Tile, int>(this, 0));

        // Open list should contain only reachable + attackable
        while (open.Count != 0)
        {
            // Take and remove first
            var kvp = open[0];
            open.RemoveAt(0);
            r = kvp.Value;

            // Out of bounds (This limits the open list)
            if (r > total)
            {
                continue;
            }

            // Handle obstacle
            if (kvp.Key.HasObstacle && handleObstacle)
            {
                if (!stats.MyType.Equals(TileStats.type.Flying) || r == reach)
                {
                    r = Mathf.Max(reach + 1, r);
                }
            }

            // Tile contains an enemy, no point doing anything. Set reach to total to be seen as attack
            if (takePlayerIntoAccount && ContainsEnemy(kvp.Key, _character.ControllingPlayer))
            {
                closed.Add(kvp.Key, total);
                if (r <= reach)
                {
                    r = total - attack + 1;
                }
            }
            else
            {
                // Add to the closed list with current reach
                closed.Add(kvp.Key, r);

                // If it's a movement tile, reduce depending on neighbours
                if (takePlayerIntoAccount && r <= reach)
                {
                    foreach (var n in kvp.Key.neighbours)
                    {
                        if (ContainsEnemy(n, _character.ControllingPlayer))
                        {
                            ++r;
                        }
                    }
                    // Went to far, but still want to consider 'attack' count of Tiles to add
                    if (r >= (total - attack))
                    {
                        r = total - attack;
                    }
                }
            }

            // +1 for the next tile
            ++r;

            // Go through all neighbours. Add or update open list
            foreach (var n in kvp.Key.neighbours)
            {
                if (!closed.ContainsKey(n))
                {
                    int index = open.FindIndex(x => x.Key == n);
                    if (index != -1)
                    {
                        if (open[index].Value > r)
                        {
                            open[index] = new KeyValuePair <Tile, int>(n, r);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        open.Add(new KeyValuePair <Tile, int>(n, r));
                    }
                }
            }
        }

        // Finished!
        return(closed);
    }
Example #24
0
        public void BattleUpdated()
        {
            Dispatcher.InvokeAsync(delegate
            {
                lock (_bot)
                {
                    if (_bot.Game != null && _bot.Game.ActiveBattle != null)
                    {
                        OpponentName.Text = PokemonNamesManager.Instance.Names[_bot.Game.ActiveBattle.OpponentId];
                        if (_bot.Game.ActiveBattle.IsShiny)
                        {
                            OpponentName.Text = "Shiny " + OpponentName.Text;
                        }
                        if (_bot.Game.ActiveBattle.IsWild)
                        {
                            OpponentName.Text = "Wild " + OpponentName.Text;
                        }
                        OpponentCaughtIcon.Visibility = _bot.Game.ActiveBattle.AlreadyCaught ? Visibility.Visible : Visibility.Hidden;
                        OpponentLevel.Text            = _bot.Game.ActiveBattle.OpponentLevel.ToString();
                        OpponentMaxHealth.Text        = _bot.Game.ActiveBattle.OpponentHealth.ToString();
                        OpponentCurrentHealth.Text    = _bot.Game.ActiveBattle.CurrentHealth.ToString();

                        if (_bot.Game.ActiveBattle.OpponentStatus.ToLowerInvariant() == "none")
                        {
                            OpponentStatus.Text = "";
                        }
                        else
                        {
                            OpponentStatus.Text = _bot.Game.ActiveBattle.OpponentStatus;
                        }

                        OpponentType1.Text = TypesManager.Instance.Type1[_bot.Game.ActiveBattle.OpponentId].ToString();
                        OpponentType2.Text = TypesManager.Instance.Type2[_bot.Game.ActiveBattle.OpponentId].ToString();

                        string gender       = _bot.Game.ActiveBattle.OpponentGender;
                        OpponentGender.Icon = gender == "M" ? FontAwesomeIcon.Mars : gender == "F" ? FontAwesomeIcon.Venus : FontAwesomeIcon.Question;
                        OpponentForm.Text   = _bot.Game.ActiveBattle.AlternateForm.ToString();

                        PokemonStats stats = EffortValuesManager.Instance.BattleValues[_bot.Game.ActiveBattle.OpponentId];
                        List <string> evs  = new List <string>();

                        foreach (StatType type in Enum.GetValues(typeof(StatType)).Cast <StatType>())
                        {
                            int ev = stats.GetStat(type);
                            if (ev > 0)
                            {
                                evs.Add($"{type}: {ev}");
                            }
                        }

                        OpponentEVs.ToolTip = string.Join(Environment.NewLine, evs);

                        Pokemon active           = _bot.Game.Team[_bot.Game.ActiveBattle.SelectedPokemonIndex];
                        ActiveName.Text          = active.Name;
                        ActiveLevel.Text         = active.Level.ToString();
                        ActiveMaxHealth.Text     = active.MaxHealth.ToString();
                        ActiveCurrentHealth.Text = active.CurrentHealth.ToString();

                        if (active.Experience.CurrentLevel == 100)
                        {
                            NextLevel.Visibility = Visibility.Hidden;
                        }
                        else
                        {
                            NextLevel.Visibility = Visibility.Visible;
                            NextLevel.Text       = $"To level {active.Experience.CurrentLevel + 1}: {active.Experience.RemainingExperience}";
                        }

                        if (active.Status.ToLowerInvariant() == "none")
                        {
                            ActiveStatus.Text = "";
                        }
                        else
                        {
                            ActiveStatus.Text = active.Status;
                        }

                        ActiveType1.Text = TypesManager.Instance.Type1[active.Id].ToString();
                        ActiveType2.Text = TypesManager.Instance.Type2[active.Id].ToString();

                        ActiveGender.Icon = active.Gender == "M" ? FontAwesomeIcon.Mars : active.Gender == "F" ? FontAwesomeIcon.Venus : FontAwesomeIcon.Question;
                    }
                }
            });
        }
Example #25
0
        public void BattleUpdated()
        {
            Dispatcher.InvokeAsync(delegate
            {
                lock (_bot)
                {
                    if (_bot.Game != null && _bot.Game.ActiveBattle != null)
                    {
                        string opponent = PokemonNamesManager.Instance.Names[_bot.Game.ActiveBattle.OpponentId];

                        if (_lastOpponentName != opponent)
                        {
                            _lastOpponentName = opponent;
                            string sprite     = _nameCleaner.Replace(opponent.ToLowerInvariant(), "");
                            //sprite = sprite.Replace("-", "_");
                            if (_bot.Game.ActiveBattle.IsShiny)
                            {
                                sprite = $"{_spriteDatabasePrefix}/animados-shiny/{sprite}.gif";
                            }
                            else
                            {
                                sprite = $"{_spriteDatabasePrefix}/animados/{sprite}.gif";
                            }
                            AnimationBehavior.SetSourceUri(OpponentGraphic, new Uri(sprite));
                        }

                        if (_bot.Game.ActiveBattle.IsShiny)
                        {
                            opponent = "Shiny " + opponent;
                        }
                        if (_bot.Game.ActiveBattle.IsWild)
                        {
                            opponent = "Wild " + opponent;
                        }
                        OpponentName.Text             = opponent;
                        OpponentCaughtIcon.Visibility = _bot.Game.ActiveBattle.AlreadyCaught ? Visibility.Visible : Visibility.Hidden;
                        OpponentLevel.Text            = _bot.Game.ActiveBattle.OpponentLevel.ToString();
                        OpponentMaxHealth.Text        = _bot.Game.ActiveBattle.OpponentHealth.ToString();
                        OpponentCurrentHealth.Text    = _bot.Game.ActiveBattle.CurrentHealth.ToString();

                        if (_bot.Game.ActiveBattle.OpponentStatus.ToLowerInvariant() == "none")
                        {
                            OpponentStatus.Text = "";
                        }
                        else
                        {
                            OpponentStatus.Text = _bot.Game.ActiveBattle.OpponentStatus;
                        }

                        OpponentType1.Text = TypesManager.Instance.Type1[_bot.Game.ActiveBattle.OpponentId].ToString();
                        OpponentType2.Text = TypesManager.Instance.Type2[_bot.Game.ActiveBattle.OpponentId].ToString();

                        string gender       = _bot.Game.ActiveBattle.OpponentGender;
                        OpponentGender.Icon = gender == "M" ? FontAwesomeIcon.Mars : gender == "F" ? FontAwesomeIcon.Venus : FontAwesomeIcon.Question;
                        OpponentForm.Text   = _bot.Game.ActiveBattle.AlternateForm.ToString();

                        PokemonStats stats = EffortValuesManager.Instance.BattleValues[_bot.Game.ActiveBattle.OpponentId];
                        List <string> evs  = new List <string>();

                        foreach (StatType type in Enum.GetValues(typeof(StatType)).Cast <StatType>())
                        {
                            int ev = stats.GetStat(type);
                            if (ev > 0)
                            {
                                evs.Add($"{type}: {ev}");
                            }
                        }

                        OpponentEVs.ToolTip = string.Join(Environment.NewLine, evs);

                        Pokemon active           = _bot.Game.Team[_bot.Game.ActiveBattle.SelectedPokemonIndex];
                        ActiveName.Text          = active.Name;
                        ActiveLevel.Text         = active.Level.ToString();
                        ActiveMaxHealth.Text     = active.MaxHealth.ToString();
                        ActiveCurrentHealth.Text = active.CurrentHealth.ToString();

                        if (_lastActiveName != active.Name)
                        {
                            _lastActiveName = active.Name;
                            string sprite   = _nameCleaner.Replace(active.Name.ToLowerInvariant(), "");
                            //sprite = sprite.Replace("-", "_");
                            if (active.IsShiny)
                            {
                                sprite = $"{_spriteDatabasePrefix}/animados-espalda-shiny/{sprite}.gif"; // shiny back
                            }
                            else
                            {
                                sprite = $"{_spriteDatabasePrefix}/animados-espalda/{sprite}.gif";
                            }
                            AnimationBehavior.SetSourceUri(PlayerGraphic, new Uri(sprite));
                        }

                        if (active.Experience.CurrentLevel == 100)
                        {
                            NextLevel.Visibility = Visibility.Hidden;
                        }
                        else
                        {
                            NextLevel.Visibility = Visibility.Visible;
                            NextLevel.Text       = $"To level {active.Experience.CurrentLevel + 1}: {active.Experience.RemainingExperience}";
                        }

                        if (active.Status.ToLowerInvariant() == "none")
                        {
                            ActiveStatus.Text = "";
                        }
                        else
                        {
                            ActiveStatus.Text = active.Status;
                        }

                        ActiveType1.Text = TypesManager.Instance.Type1[active.Id].ToString();
                        ActiveType2.Text = TypesManager.Instance.Type2[active.Id].ToString();

                        ActiveGender.Icon = active.Gender == "M" ? FontAwesomeIcon.Mars : active.Gender == "F" ? FontAwesomeIcon.Venus : FontAwesomeIcon.Question;
                    }
                }
            });
        }
Example #26
0
 // Use this for initialization
 void Awake()
 {
     S = this;
 }