Exemplo n.º 1
0
 private bool IsMoveOffensive(PokemonMove move, MovesManager.MoveData moveData)
 {
     return(moveData?.Power > 0 || move.Id == DragonRage || move.Id == SeismicToss || move.Id == NightShade || move.Id == Psywave);
 }
Exemplo n.º 2
0
        private bool UseAttack(bool useBestAttack)
        {
            PokemonMove bestMove  = null;
            int         bestIndex = 0;
            double      bestPower = 0;

            PokemonMove worstMove  = null;
            int         worstIndex = 0;
            double      worstPower = 0;

            for (int i = 0; i < ActivePokemon.Moves.Length; ++i)
            {
                PokemonMove move = ActivePokemon.Moves[i];
                if (move.CurrentPoints == 0)
                {
                    continue;
                }

                MovesManager.MoveData moveData = MovesManager.Instance.GetMoveData(move.Id);

                if (move.Id + 1 == DreamEater && _client.ActiveBattle.OpponentStatus != "slp")
                {
                    continue;
                }

                if (move.Id + 1 == Explosion || move.Id + 1 == Selfdestruct ||
                    (move.Id + 1 == DoubleEdge && ActivePokemon.BattleCurrentHealth < _client.ActiveBattle.CurrentHealth / 3))
                {
                    continue;
                }

                if (!IsMoveOffensive(move, moveData) || _client.ActiveBattle.GetActivePokemon?.moves[i]?.disabled == true)
                {
                    continue;
                }

                PokemonType attackType = PokemonTypeExtensions.FromName(moveData.Type);

                PokemonType playerType1 = TypesManager.Instance.Type1[ActivePokemon.Id];
                PokemonType playerType2 = TypesManager.Instance.Type2[ActivePokemon.Id];

                PokemonType opponentType1 = TypesManager.Instance.Type1[_client.ActiveBattle.OpponentId];
                PokemonType opponentType2 = TypesManager.Instance.Type2[_client.ActiveBattle.OpponentId];

                double accuracy = (moveData.Accuracy < 0 ? 101.0 : moveData.Accuracy);

                double power = moveData.RealPower * accuracy;

                if (attackType == playerType1 || attackType == playerType2)
                {
                    power *= 1.5;
                }

                power *= TypesManager.Instance.GetMultiplier(attackType, opponentType1);
                power *= TypesManager.Instance.GetMultiplier(attackType, opponentType2);

                if (attackType == PokemonType.Ground && PokemonManager.Instance.IsLavitatingPokemon(_client.ActiveBattle.OpponentId))
                {
                    power = 0;
                }

                power = ApplySpecialEffects(move, power);

                if (move.Id + 1 == Synchronoise)
                {
                    if (playerType1 != opponentType1 && playerType1 != opponentType2 &&
                        (playerType2 == PokemonType.None || playerType2 != opponentType1) &&
                        (playerType2 == PokemonType.None || playerType2 != opponentType2))
                    {
                        power = 0;
                    }
                }

                if (power < 0.01)
                {
                    continue;
                }

                if (bestMove == null || power > bestPower)
                {
                    bestMove  = move;
                    bestPower = power;
                    bestIndex = i;
                }

                if (worstMove == null || power < worstPower)
                {
                    worstMove  = move;
                    worstPower = power;
                    worstIndex = i;
                }
            }

            if (useBestAttack && bestMove != null)
            {
                _client.UseAttack(bestIndex + 1);
                return(true);
            }
            if (!useBestAttack && worstMove != null)
            {
                _client.UseAttack(worstIndex + 1);
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
 public void UseAbility(PokemonMove ability)
 {//TODO: verify if more logic needs to be processed here
     ability.Use();
 }
Exemplo n.º 4
0
        private bool UseAttack(bool useBestAttack)
        {
            PokemonMove bestMove  = null;
            int         bestIndex = 0;
            double      bestPower = 0;

            PokemonMove worstMove  = null;
            int         worstIndex = 0;
            double      worstPower = 0;

            for (int i = 0; i < ActivePokemon.Moves.Length; ++i)
            {
                PokemonMove move = ActivePokemon.Moves[i];
                if (move.CurrentPoints == 0)
                {
                    continue;
                }

                MovesManager.MoveData moveData = MovesManager.Instance.GetMoveData(move.Id);

                if (move.Id == DreamEater && _client.ActiveBattle.OpponentStatus != "SLEEP")
                {
                    continue;
                }

                if (move.Id == Explosion || move.Id == Selfdestruct)
                {
                    continue;
                }

                if (!IsMoveOffensive(move, moveData))
                {
                    continue;
                }

                PokemonType attackType = PokemonTypeExtensions.FromName(moveData.Type);

                PokemonType playerType1 = TypesManager.Instance.Type1[ActivePokemon.Id];
                PokemonType playerType2 = TypesManager.Instance.Type2[ActivePokemon.Id];

                PokemonType opponentType1 = TypesManager.Instance.Type1[_client.ActiveBattle.OpponentId];
                PokemonType opponentType2 = TypesManager.Instance.Type2[_client.ActiveBattle.OpponentId];

                double accuracy = (moveData.Accuracy < 0 ? 101.0 : moveData.Accuracy);

                double power = moveData.Power * accuracy;

                if (attackType == playerType1 || attackType == playerType2)
                {
                    power *= 1.5;
                }

                power *= TypesManager.Instance.GetMultiplier(attackType, opponentType1);
                power *= TypesManager.Instance.GetMultiplier(attackType, opponentType2);

                if (attackType == PokemonType.Ground && _levitatingPokemons.Contains(_client.ActiveBattle.OpponentId))
                {
                    power = 0;
                }

                if (power < 0.01)
                {
                    continue;
                }

                power = ApplySpecialEffects(move, power);

                if (power < 0.01)
                {
                    continue;
                }

                if (bestMove == null || power > bestPower)
                {
                    bestMove  = move;
                    bestPower = power;
                    bestIndex = i;
                }

                if (worstMove == null || power < worstPower)
                {
                    worstMove  = move;
                    worstPower = power;
                    worstIndex = i;
                }
            }

            if (useBestAttack && bestMove != null)
            {
                _lastAttackId = bestIndex + 1;
                _client.UseAttack(bestIndex + 1);
                return(true);
            }
            if (!useBestAttack && worstMove != null)
            {
                _lastAttackId = worstIndex + 1;
                _client.UseAttack(worstIndex + 1);
                return(true);
            }
            return(false);
        }
Exemplo n.º 5
0
 private bool IsMoveOffensive(PokemonMove move)
 {
     return(move.Power > 0);
 }
Exemplo n.º 6
0
 public void GotNewPokemon(ulong uid, PokemonId pokemonId, int cp, double iv, PokemonFamilyId family, int candy, bool fav, bool inGym, double level, PokemonMove move1, PokemonMove move2, PokemonType type1, PokemonType type2, int maxCp, int stamina, int maxStamina, int possibleCp, int candyToEvolve)
 {
     PokemonList.Add(new PokemonUiData(
                         this,
                         uid,
                         pokemonId,
                         //pokemonId.ToInventorySource(),
                         pokemonId.ToString(),
                         cp,
                         iv,
                         family,
                         candy,
                         (ulong)DateTime.UtcNow.ToUnixTime(),
                         fav,
                         inGym,
                         level,
                         move1,
                         move2,
                         type1,
                         type2,
                         maxCp,
                         PokemonInfo.GetBaseStats(pokemonId),
                         stamina,
                         maxStamina,
                         possibleCp,
                         candyToEvolve));
     foreach (var pokemon in PokemonList.Where(x => x.Family == family))
     {
         pokemon.Candy = candy;
         pokemon.UpdateTags(Logic);
     }
 }
Exemplo n.º 7
0
 private bool IsMoveOffensive(PokemonMove move, MovesManager.MoveData moveData, PokemonType opponentType1, PokemonType opponentType2)
 {
     return(moveData.Power > 0 ||
            move.Id == DragonRage && opponentType1 != PokemonType.Fairy && opponentType2 != PokemonType.Fairy ||
            move.Id == SeismicToss || move.Id == NightShade || move.Id == Psywave);
 }
Exemplo n.º 8
0
        private double ApplySpecialEffects(PokemonMove move, double power)
        {
            if (move.Id == DragonRage)
            {
                return _client.ActiveBattle.CurrentHealth <= 40 ? 10000.0 : 1.0;
            }

            if (move.Id == SeismicToss || move.Id == NightShade)
            {
                return _client.ActiveBattle.CurrentHealth <= ActivePokemon.Level ? 10000.0 : 1.0;
            }

            if (move.Id == Psywave)
            {
                return _client.ActiveBattle.CurrentHealth <= (ActivePokemon.Level / 2) ? 10000.0 : 1.0;
            }

            if (move.Id == FalseSwipe)
            {
                return 0.1;
            }

            return power;
        }
Exemplo n.º 9
0
 public static MoveSettings GetMoveSettings(PokemonMove move)
 {
     return(MoveSettings[move]);
 }
Exemplo n.º 10
0
        private bool UseAttack(bool useBestAttack)
        {
            PokemonMove bestMove  = null;
            var         bestIndex = 0;
            double      bestPower = 0;

            PokemonMove worstMove  = null;
            var         worstIndex = 0;
            double      worstPower = 0;

            for (var i = 0; i < ActivePokemon.Moves.Length; ++i)
            {
                var move = ActivePokemon.Moves[i];
                if (move.CurrentPoints == 0)
                {
                    continue;
                }
                if (move.Name is null || move.Data is null)
                {
                    continue;
                }

                var moveData = MovesManager.Instance.GetMoveData(move.Id);
                if (move.Id == DreamEater && (_client.ActiveBattle.FullWildPokemon != null ? _client.ActiveBattle.FullWildPokemon.Status.ToUpperInvariant() != "SLEEP" : _client.ActiveBattle.WildPokemon.Status.ToUpperInvariant() != "SLEEP"))
                {
                    continue;
                }
                if (move.Id == Explosion || move.Id == Selfdestruct ||
                    (move.Id == DoubleEdge && ActivePokemon.CurrentHealth < (_client.ActiveBattle.FullWildPokemon?.MaxHealth / 3 ?? _client.ActiveBattle.WildPokemon.MaxHealth / 3)))
                {
                    continue;
                }

                var attackType = PokemonTypeExtensions.FromName(moveData.Type);

                var playerType1 = TypesManager.Instance.Type1[ActivePokemon.Id];
                var playerType2 = TypesManager.Instance.Type2[ActivePokemon.Id];

                var opponentType1 = TypesManager.Instance.Type1[_client.ActiveBattle.WildPokemon.Id];
                var opponentType2 = TypesManager.Instance.Type2[_client.ActiveBattle.WildPokemon.Id];

                if (!IsMoveOffensive(move, moveData, opponentType1, opponentType2))
                {
                    continue;
                }

                var accuracy = moveData.Accuracy < 0 ? 101.0 : moveData.Accuracy;

                var power = moveData.Power * accuracy;

                if (attackType == playerType1 || attackType == playerType2)
                {
                    power *= 1.5;
                }

                power *= TypesManager.Instance.GetMultiplier(attackType, opponentType1);
                power *= TypesManager.Instance.GetMultiplier(attackType, opponentType2);

                if (attackType == PokemonType.Ground && LevitatingPokemons.Contains(_client.ActiveBattle.WildPokemon.Id))
                {
                    power = 0;
                }

                power = ApplySpecialEffects(move, power);

                if (move.Id == Synchronoise)
                {
                    if (playerType1 != opponentType1 && playerType1 != opponentType2 &&
                        (playerType2 == PokemonType.None || playerType2 != opponentType1) &&
                        (playerType2 == PokemonType.None || playerType2 != opponentType2))
                    {
                        power = 0;
                    }
                }

                if (power < 0.01)
                {
                    continue;
                }

                if (bestMove == null || power > bestPower)
                {
                    bestMove  = move;
                    bestPower = power;
                    bestIndex = i;
                }

                if (worstMove == null || power < worstPower)
                {
                    worstMove  = move;
                    worstPower = power;
                    worstIndex = i;
                }
            }

            if (useBestAttack && bestMove != null)
            {
                _client.UseAttack(bestIndex);
                return(true);
            }
            if (!useBestAttack && worstMove != null)
            {
                _client.UseAttack(worstIndex);
                return(true);
            }
            return(false);
        }
Exemplo n.º 11
0
 public PokemonUiData(BotWindowData ownerBot, ulong id, PokemonId pokemonid, BitmapSource img, string name,
                      int cp, double iv, PokemonFamilyId family, int candy, ulong stamp, bool fav, bool inGym, double level, PokemonMove move1, PokemonMove move2)
 {
     OwnerBot  = ownerBot;
     Favoured  = fav;
     InGym     = inGym;
     Id        = id;
     PokemonId = pokemonid;
     Image     = img;
     Name      = name;
     Cp        = cp;
     Iv        = iv;
     Candy     = candy;
     Family    = family;
     Timestamp = stamp;
     Level     = level;
     Move1     = move1;
     Move2     = move2;
 }
Exemplo n.º 12
0
 public OwnedPokemonMove(PokemonMove pMove)
 {
     Move      = pMove;
     CurrentPP = Move.BasePP;
 }
Exemplo n.º 13
0
 public void GotNewPokemon(ulong uid, PokemonId pokemonId, int cp, double iv, PokemonFamilyId family, int candy, bool fav, bool inGym, double level, PokemonMove move1, PokemonMove move2)
 {
     PokemonList.Add(new PokemonUiData(
                         this,
                         uid,
                         pokemonId,
                         pokemonId.ToInventorySource(),
                         pokemonId.ToString(),
                         cp,
                         iv,
                         family,
                         candy,
                         (ulong)DateTime.UtcNow.ToUnixTime(),
                         fav,
                         inGym,
                         level,
                         move1,
                         move2));
     foreach (var pokemon in PokemonList.Where(x => x.Family == family))
     {
         pokemon.Candy = candy;
         pokemon.UpdateTags(Logic);
     }
 }
Exemplo n.º 14
0
    private IEnumerator LearnMove(OwnedPokemon selectedPokemon, PokemonMove pMoveToLearn)
    {
        int chosenIndex = 1;

        if (chosenIndex == 1)
        {
            bool learning = true;
            while (learning)
            {
                //Moveset is full
                if (selectedPokemon.GetMoveCount() == 4)
                {
                    dialog.DrawDialogBox();
                    yield return
                        (StartCoroutine(
                             dialog.DrawText(selectedPokemon.GetName() + " wants to learn the \nmove " + pMoveToLearn.Name + ".")));

                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    dialog.DrawDialogBox();
                    yield return
                        (StartCoroutine(
                             dialog.DrawText("However, " + selectedPokemon.GetName() + " already \nknows four moves.")));

                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    dialog.DrawDialogBox();
                    yield return
                        (StartCoroutine(dialog.DrawText("Should a move be deleted and \nreplaced with " + pMoveToLearn.Name + "?")));

                    yield return(StartCoroutine(dialog.DrawChoiceBox()));

                    chosenIndex = dialog.chosenIndex;
                    dialog.UndrawChoiceBox();
                    if (chosenIndex == 1)
                    {
                        dialog.DrawDialogBox();
                        yield return(StartCoroutine(dialog.DrawText("Which move should \nbe forgotten?")));

                        while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                        {
                            yield return(null);
                        }

                        yield return(StartCoroutine(ScreenFade.main.Fade(false, ScreenFade.defaultSpeed)));

                        //Set SceneSummary to be active so that it appears
                        PKUScene.main.Summary.gameObject.SetActive(true);
                        StartCoroutine(PKUScene.main.Summary.control(selectedPokemon, pMoveToLearn.Name));
                        //Start an empty loop that will only stop when SceneSummary is no longer active (is closed)
                        while (PKUScene.main.Summary.gameObject.activeSelf)
                        {
                            yield return(null);
                        }

                        string replacedMove = PKUScene.main.Summary.replacedMove;
                        yield return(StartCoroutine(ScreenFade.main.Fade(true, ScreenFade.defaultSpeed)));

                        if (!string.IsNullOrEmpty(replacedMove))
                        {
                            dialog.DrawDialogBox();
                            yield return(StartCoroutine(dialog.DrawTextSilent("1, ")));

                            yield return(new WaitForSeconds(0.4f));

                            yield return(StartCoroutine(dialog.DrawTextSilent("2, ")));

                            yield return(new WaitForSeconds(0.4f));

                            yield return(StartCoroutine(dialog.DrawTextSilent("and... ")));

                            yield return(new WaitForSeconds(0.4f));

                            yield return(StartCoroutine(dialog.DrawTextSilent("... ")));

                            yield return(new WaitForSeconds(0.4f));

                            yield return(StartCoroutine(dialog.DrawTextSilent("... ")));

                            yield return(new WaitForSeconds(0.4f));

                            SfxHandler.Play(forgetMoveClip);
                            yield return(StartCoroutine(dialog.DrawTextSilent("Poof!")));

                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                            {
                                yield return(null);
                            }

                            dialog.DrawDialogBox();
                            yield return
                                (StartCoroutine(
                                     dialog.DrawText(selectedPokemon.GetName() + " forgot how to \nuse " + replacedMove +
                                                     ".")));

                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                            {
                                yield return(null);
                            }
                            dialog.DrawDialogBox();
                            yield return(StartCoroutine(dialog.DrawText("And...")));

                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                            {
                                yield return(null);
                            }

                            dialog.DrawDialogBox();
                            AudioClip mfx = Resources.Load <AudioClip>("Audio/mfx/GetAverage");
                            BgmHandler.main.PlayMFX(mfx);
                            StartCoroutine(dialog.DrawTextSilent(selectedPokemon.GetName() + " learned \n" + pMoveToLearn.Name + "!"));
                            yield return(new WaitForSeconds(mfx.length));

                            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                            {
                                yield return(null);
                            }
                            dialog.UndrawDialogBox();
                            learning = false;
                        }
                        else
                        {
                            //give up?
                            chosenIndex = 0;
                        }
                    }
                    if (chosenIndex == 0)
                    {
                        //NOT ELSE because this may need to run after (chosenIndex == 1) runs
                        dialog.DrawDialogBox();
                        yield return(StartCoroutine(dialog.DrawText("Give up on learning the move \n" + pMoveToLearn.Name + "?")));

                        yield return(StartCoroutine(dialog.DrawChoiceBox()));

                        chosenIndex = dialog.chosenIndex;
                        dialog.UndrawChoiceBox();
                        if (chosenIndex == 1)
                        {
                            learning    = false;
                            chosenIndex = 0;
                        }
                    }
                }
                //Moveset is not full, can fit the new move easily
                else
                {
                    selectedPokemon.TryAddMove(pMoveToLearn);

                    dialog.DrawDialogBox();
                    AudioClip mfx = Resources.Load <AudioClip>("Audio/mfx/GetAverage");
                    BgmHandler.main.PlayMFX(mfx);
                    StartCoroutine(dialog.DrawTextSilent(selectedPokemon.GetName() + " learned \n" + pMoveToLearn + "!"));
                    yield return(new WaitForSeconds(mfx.length));

                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    dialog.UndrawDialogBox();
                    learning = false;
                }
            }
        }
        if (chosenIndex == 0)
        {
            //NOT ELSE because this may need to run after (chosenIndex == 1) runs
            //cancel learning loop
            dialog.DrawDialogBox();
            yield return(StartCoroutine(dialog.DrawText(selectedPokemon.GetName() + " did not learn \n" + pMoveToLearn + ".")));

            while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
            {
                yield return(null);
            }
        }
    }
Exemplo n.º 15
0
        public static BaseAttack GetAttack(PokemonMove id)
        {
            switch ((int)id)
            {
            //Empty = Normal Attacks
            case 0: return(new BaseAttack());

            case 1: return(new BaseAttack());

            case 2: return(new BaseAttack());

            case 3: return(new BaseAttack());

            case 4: return(new BaseAttack());

            case 5: return(new BaseAttack());

            case 6: return(new BaseAttack());

            case 7: return(new BaseAttack());

            case 8: return(new BaseAttack());

            case 9: return(new BaseAttack());

            case 10: return(new BaseAttack());

            case 11: return(new BaseAttack());

            case 12: return(new BaseAttack());

            case 13: return(new BaseAttack(6.25));

            case 14: return(new BaseAttack(24));

            case 15: return(new BaseAttack());

            case 16: return(new BaseAttack(12.89));

            case 17: return(new BaseAttack());

            case 18: return(new BaseAttack(11.54));

            case 19: return(new BaseAttack());

            case 20: return(new BaseAttack(11.9));

            case 21: return(new BaseAttack(8.7));

            case 22: return(new BaseAttack(25));

            case 23: return(new BaseAttack());

            case 24: return(new BaseAttack(18.97));

            case 25: return(new BaseAttack());

            case 26: return(new BaseAttack(12.07));

            case 27: return(new BaseAttack());

            case 28: return(new BaseAttack(30));

            case 29: return(new BaseAttack());

            case 30: return(new BaseAttack(10.53));

            case 31: return(new BaseAttack(23.81));

            case 32: return(new BaseAttack(25.81));

            case 33: return(new BaseAttack(12.86));

            case 34: return(new BaseAttack(9.8));

            case 35: return(new BaseAttack(14));

            case 36: return(new BaseAttack(15.38));

            case 37: return(new BaseAttack());

            case 38: return(new BaseAttack(14.81));

            case 39: return(new BaseAttack(17.81));

            case 40: return(new BaseAttack(25.64));

            case 41: return(new BaseAttack());

            case 42: return(new BaseAttack(21.05));

            case 43: return(new BaseAttack());

            case 44: return(new BaseAttack());

            case 45: return(new BaseAttack(10.34));

            case 46: return(new BaseAttack(14.71));

            case 47: return(new BaseAttack(20.31));

            case 48: return(new BaseAttack(7.81));

            case 49: return(new BaseAttack(17.65));

            case 50: return(new BaseAttack(10.42));

            case 51: return(new BaseAttack(11.11));

            case 52: return(new BaseAttack());

            case 53: return(new BaseAttack(10.34));

            case 54: return(new BaseAttack(14.29));

            case 55: return(new BaseAttack());

            case 56: return(new BaseAttack(13.33));

            case 57: return(new BaseAttack(11.64));

            case 58: return(new BaseAttack(19.15));

            case 59: return(new BaseAttack(16.67));

            case 60: return(new BaseAttack(14.81));

            case 61: return(new BaseAttack());

            case 62: return(new BaseAttack(9.72));

            case 63: return(new BaseAttack(8.82));

            case 64: return(new BaseAttack(15.63));

            case 65: return(new BaseAttack(13.79));

            case 66: return(new BaseAttack(8.06));

            case 67: return(new BaseAttack(11.9));

            case 68: return(new BaseAttack());

            case 69: return(new BaseAttack(9.68));

            case 70: return(new BaseAttack(14.61));

            case 71: return(new BaseAttack());

            case 72: return(new BaseAttack(10.71));

            case 73: return(new BaseAttack());

            case 74: return(new BaseAttack(15));

            case 75: return(new BaseAttack(11.9));

            case 76: return(new BaseAttack());

            case 77: return(new BaseAttack(16.67));

            case 78: return(new BaseAttack());

            case 79: return(new BaseAttack(20.37));

            case 80: return(new BaseAttack(9.26));

            case 81: return(new BaseAttack());

            case 82: return(new BaseAttack(18.06));

            case 83: return(new BaseAttack(23.33));

            case 84: return(new BaseAttack(6.41));

            case 85: return(new BaseAttack(8.93));

            case 86: return(new BaseAttack(13.1));

            case 87: return(new BaseAttack(20.73));

            case 88: return(new BaseAttack(18.97));

            case 89: return(new BaseAttack(16.67));

            case 90: return(new BaseAttack(21.15));

            case 91: return(new BaseAttack(20.59));

            case 92: return(new BaseAttack(21.67));

            case 93: return(new BaseAttack());

            case 94: return(new BaseAttack(15.63));

            case 95: return(new BaseAttack(10.29));

            case 96: return(new BaseAttack(11.54));

            case 97: return(new BaseAttack());

            case 98: return(new BaseAttack());

            case 99: return(new BaseAttack(14.52));

            case 100: return(new BaseAttack(16.67));

            case 101: return(new BaseAttack(8.06));

            case 102: return(new BaseAttack(14.29));

            case 103: return(new BaseAttack(24.39));

            case 104: return(new BaseAttack(10.42));

            case 105: return(new BaseAttack(10.61));

            case 106: return(new BaseAttack(13.75));

            case 107: return(new BaseAttack(23.68));

            case 108: return(new BaseAttack(19.64));

            case 109: return(new BaseAttack(19.61));

            case 110: return(new BaseAttack());

            case 111: return(new BaseAttack(6.58));

            case 112: return(new BaseAttack());

            case 113: return(new BaseAttack());

            case 114: return(new BaseAttack(13.89));

            case 115: return(new BaseAttack(14.29));

            case 116: return(new BaseAttack(24.49));

            case 117: return(new BaseAttack(19.64));

            case 118: return(new BaseAttack(25));

            case 119: return(new BaseAttack());

            case 120: return(new BaseAttack());

            case 121: return(new BaseAttack(9.09));

            case 122: return(new BaseAttack(25));

            case 123: return(new BaseAttack(18.75));

            case 124: return(new BaseAttack());

            case 125: return(new BaseAttack(10));

            case 126: return(new BaseAttack(11.36));

            case 127: return(new BaseAttack(14.29));

            case 128: return(new BaseAttack());

            case 129: return(new BaseAttack(16.67));

            case 130: return(new BaseAttack());

            case 131: return(new BaseAttack(25.64));

            case 132: return(new BaseAttack(16.13));

            case 133: return(new BaseAttack(8.85));

            case 134: return(new BaseAttack(12.5));

            case 135: return(new BaseAttack(23.68));

            case 136: return(new BaseAttack(6.76));

            case 137: return(new BaseAttack(6.76));

            case 200: return(new BaseAttack());

            case 201: return(new BaseAttack());

            case 202: return(new BaseAttack());

            case 203: return(new BaseAttack());

            case 204: return(new BaseAttack());

            case 205: return(new BaseAttack(23.26));

            case 206: return(new BaseAttack());

            case 207: return(new BaseAttack());

            case 208: return(new BaseAttack());

            case 209: return(new BaseAttack());

            case 210: return(new BaseAttack());

            case 211: return(new BaseAttack());

            case 212: return(new BaseAttack());

            case 213: return(new BaseAttack());

            case 214: return(new BaseAttack());

            case 215: return(new BaseAttack());

            case 216: return(new BaseAttack());

            case 217: return(new BaseAttack());

            case 218: return(new BaseAttack());

            case 219: return(new BaseAttack());

            case 220: return(new BaseAttack());

            case 221: return(new BaseAttack());

            case 222: return(new BaseAttack());

            case 223: return(new BaseAttack());

            case 224: return(new BaseAttack());

            case 225: return(new BaseAttack());

            case 226: return(new BaseAttack());

            case 227: return(new BaseAttack());

            case 228: return(new BaseAttack());

            case 229: return(new BaseAttack());

            case 230: return(new BaseAttack());

            case 231: return(new BaseAttack());

            case 232: return(new BaseAttack());

            case 233: return(new BaseAttack());

            case 234: return(new BaseAttack());

            case 235: return(new BaseAttack());

            case 236: return(new BaseAttack());

            case 237: return(new BaseAttack());

            case 238: return(new BaseAttack());

            case 239: return(new BaseAttack());

            case 240: return(new BaseAttack());

            case 241: return(new BaseAttack());

            default: return(new BaseAttack());
            }
        }
Exemplo n.º 16
0
 protected PokemonMove[] GetMoves() => GetSelectedPokemon()
 .moveIds
 .Where(x => !PokemonMove.MoveIdIsUnset(x))
 .Select(x => PokemonMove.GetPokemonMoveById(x))
 .ToArray();
 public void SetMove(PokemonMove move)
 {
     Move = move;
 }
Exemplo n.º 18
0
 private bool IsMoveOffensive(PokemonMove move, MovesManager.MoveData moveData)
 {
     return moveData.Power > 0 || move.Id == DragonRage || move.Id == SeismicToss || move.Id == NightShade || move.Id == Psywave;
 }
Exemplo n.º 19
0
        private bool UseAttack(bool useBestAttack)
        {
            PokemonMove bestMove  = null;
            int         bestIndex = 0;
            double      bestPower = 0;

            PokemonMove worstMove  = null;
            int         worstIndex = 0;
            double      worstPower = 0;

            for (int i = 0; i < ActivePokemon.Moves.Length; ++i)
            {
                PokemonMove move = ActivePokemon.Moves[i];
                if (move.CurrentPoints > 0)
                {
                    if (IsMoveOffensive(move))
                    {
                        PokemonType attackType = move.Type;

                        PokemonType playerType1 = TypesManager.Instance.Type1[ActivePokemon.PokedexId];
                        PokemonType playerType2 = TypesManager.Instance.Type2[ActivePokemon.PokedexId];

                        PokemonType opponentType1 = TypesManager.Instance.Type1[_client.Battle.OpponentPokedexId];
                        PokemonType opponentType2 = TypesManager.Instance.Type2[_client.Battle.OpponentPokedexId];

                        double accuracy = (move.Accuracy < 0 ? 101.0 : move.Accuracy);

                        double power = move.Power * accuracy;

                        if (attackType == playerType1 || attackType == playerType2)
                        {
                            power *= 1.5;
                        }

                        power *= TypesManager.Instance.GetMultiplier(attackType, opponentType1);
                        power *= TypesManager.Instance.GetMultiplier(attackType, opponentType2);

                        if (power > 0)
                        {
                            if (bestMove == null || power > bestPower)
                            {
                                bestMove  = move;
                                bestPower = power;
                                bestIndex = i;
                            }

                            if (worstMove == null || power < worstPower)
                            {
                                worstMove  = move;
                                worstPower = power;
                                worstIndex = i;
                            }
                        }
                    }
                }
            }

            if (useBestAttack && bestMove != null)
            {
                _client.Attack(bestIndex + 1);
                return(true);
            }
            if (!useBestAttack && worstMove != null)
            {
                _client.Attack(worstIndex + 1);
                return(true);
            }
            return(false);
        }