Esempio n. 1
0
        public Client(ClientIdentifier id)
        {
            Id = id;

            var stats = new Stats { Atk = 10, Def = 10, HP = 30, SpAtk = 10, SpDef = 10, Speed = 10 };
            var data = new PokemonData { Id = 0, Type1 = PokemonType.Normal, BaseStats = stats };

            var moveData = new MoveData
            {
                Name = "Move",
                Accuracy = 100,
                Damage = 120,
                DamageType = DamageCategory.Physical,
                PokemonType = PokemonType.Normal,
                PP = 20
            };

            for (int i = 0; i < 6; i++)
            {
                var pkmn = new Pokemon(data, stats) { Name = Id.Name + "_Pkmn" + i, Level = i + 20};
                for (int j = 0; j < 2; j++)
                    pkmn.SetMove(j, new Move(moveData));
                pkmn.Stats.HP = 30;
                pkmn.HP = 30;

                pokemons.Add(pkmn);
            }
        }
Esempio n. 2
0
 public static double CalculateCpMultiplier(PokemonData poke)
 {
     var baseStats = GetBaseStats(poke.PokemonId);
     return (baseStats.BaseAttack + poke.IndividualAttack)*
            Math.Sqrt(baseStats.BaseDefense + poke.IndividualDefense)*
            Math.Sqrt(baseStats.BaseStamina + poke.IndividualStamina);
 }
Esempio n. 3
0
 public static float CalculatePokemonPerfection(PokemonData poke)
 {
     if (poke != null)
         return (poke.IndividualAttack * 2 + poke.IndividualDefense + poke.IndividualStamina) / (4.0f * 15.0f) * 100.0f;
     else
         return 0;
 }
Esempio n. 4
0
        public static async Task PokemonCaught(PokemonData poke)
        {

            OnPokemonCaught(null, new PokemonCaughtArgs() { CaughtPokemon = poke });

            await PokemonCaughtReset.WaitAsync();
            PokemonCaughtReset.Reset();
        }
Esempio n. 5
0
 public async Task<int> GetHighestCPofType(PokemonData pokemon)
 {
     var myPokemon = await GetPokemons();
     var pokemons = myPokemon.ToList();
     return pokemons.Where(x => x.PokemonId == pokemon.PokemonId)
         .OrderByDescending(x => x.Cp)
         .First().Cp;
 }
Esempio n. 6
0
 public static int CalculateMinCp(PokemonData poke)
 {
     return
         Math.Max(
             (int)
                 Math.Floor(0.1*CalculateMinCpMultiplier(poke)*
                            Math.Pow(poke.CpMultiplier + poke.AdditionalCpMultiplier, 2)), 10);
 }
Esempio n. 7
0
 public async Task<IEnumerable<PokemonData>> GetHighestIVofType(PokemonData pokemon)
 {
     var myPokemon = await GetPokemons();
     var pokemons = myPokemon.ToList();
     return pokemons.Where(x => x.PokemonId == pokemon.PokemonId)
             .OrderByDescending(PokemonInfo.CalculatePokemonPerfection)
             .ThenBy(x => x.Cp)
             .ToList();
 }
        public static double CalculatePokemonPerfection(PokemonData poke)
        {
            if (Math.Abs(poke.CpMultiplier + poke.AdditionalCpMultiplier) <= 0)
                return (poke.IndividualAttack * 2 + poke.IndividualDefense + poke.IndividualStamina) / (4.0 * 15.0) * 100.0;

            var maxCp = CalculateMaxCpMultiplier(poke);
            var minCp = CalculateMinCpMultiplier(poke);
            var curCp = CalculateCpMultiplier(poke);

            return ((curCp - minCp) / (maxCp - minCp)) * 100.0;
        }
Esempio n. 9
0
        public static double CalculatePokemonPerfection(PokemonData poke)
        {
            if (poke.CpMultiplier + poke.AdditionalCpMultiplier == 0)
                return (poke.IndividualAttack * 2 + poke.IndividualDefense + poke.IndividualStamina) / (4.0 * 15.0) * 100.0;

            BaseStats baseStats = GetBaseStats(poke.PokemonId);
            var max_cp = CalculateMaxCPMultiplier(poke);
            var min_cp = CalculateMinCPMultiplier(poke);
            var cur_cp = CalculateCPMultiplier(poke);

            return ((cur_cp - min_cp) / (max_cp - min_cp)) * 100.0;
        }
Esempio n. 10
0
        public async Task<TransferStatus> Transfer(PokemonData pokemon, float keepPerfectPokemonLimit = 80.0f)
        {
            if (Perfect(pokemon) >= keepPerfectPokemonLimit || pokemon.Favorite == 0) return TransferStatus.Ignored;

            var transferPokemonResponse = await PokemonClient.TransferPokemon(pokemon.Id);

            await Task.Delay(3000);
            if (transferPokemonResponse.Status == 1)
            {
                return TransferStatus.Success;
            }

            return TransferStatus.Fail;
        }
 protected void HandleEvent(PokemonData pokemon, TransferStatus status)
 {
     if (status == TransferStatus.Success)
     {
         OnTransferSuccess(pokemon);
     }
     else if (status == TransferStatus.Fail)
     {
         OnTransferFailed(pokemon);
     }
     else if(status == TransferStatus.Ignored)
     {
         OnTransferIgnored(pokemon);
     }
 }
Esempio n. 12
0
        public Pokemon FromPokemonData(PokemonData data)
        {
            if (data == null)
                return null;

            //var iStats = GenerateIV();

//            var stats = new Stats
//            {
//                HP = data.BaseStats.HP + iStats.HP,
//                Atk = data.BaseStats.Atk + iStats.Atk,
//                Def = data.BaseStats.Def + iStats.Def,
//                SpAtk = data.BaseStats.SpAtk + iStats.SpAtk,
//                SpDef = data.BaseStats.SpDef + iStats.SpDef,
//                Speed = data.BaseStats.Speed + iStats.Speed
//            };

            //var builder = new PokemonBuilder(data);
            //builder.SetIV (iStats).SetStats (stats);
            //return builder.Build ();
            throw new NotImplementedException();
        }
Esempio n. 13
0
        public double GetPerfect(PokemonData poke)
        {
            var result = PokemonInfo.CalculatePokemonPerfection(poke);

            return(result);
        }
        private async void TransferPokemon(PokemonData pokemon)
        {
            if (MessageBox.Show($"Are you sure you want to transfer {pokemon.PokemonId.ToString()} with {pokemon.Cp} CP?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                var transferPokemonResponse = await client2.TransferPokemon(pokemon.Id);

                if (transferPokemonResponse.Status == 1)
                {
                    ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} was transferred. {transferPokemonResponse.CandyAwarded} candy awarded");
                    ReloadPokemonList();
                }
                else
                {
                    ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} could not be transferred");
                }
            }
        }
        private async void EvolvePokemon(PokemonData pokemon)
        {
            var evolvePokemonResponse = await client2.EvolvePokemon(pokemon.Id);

            if (evolvePokemonResponse.Result == 1)
            {
                ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} successfully evolved into {evolvePokemonResponse.EvolvedPokemon.PokemonType}\n{evolvePokemonResponse.ExpAwarded} experience awarded\n{evolvePokemonResponse.CandyAwarded} candy awarded");
                ReloadPokemonList();
            }
            else
            {
                ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} could not be evolved");
            }
        }
Esempio n. 16
0
 public static int GetPowerUpLevel(PokemonData poke)
 {
     return (int) (GetLevel(poke)*2.0);
 }
Esempio n. 17
0
 public void DetermineBackSprite()
 {
     backportrait.overrideSprite = GameData.instance.backMonSprites[PokemonData.MonToID(playermon.name) - 1];
 }
Esempio n. 18
0
 public EggDataExportModel(PokemonData pokemon)
 {
     TargetDistance = pokemon.EggKmWalkedTarget;
     Id             = pokemon.Id;
 }
Esempio n. 19
0
 public static double GetLevel(PokemonData poke)
 {
     switch ((int) ((poke.CpMultiplier + poke.AdditionalCpMultiplier)*1000.0))
     {
         case 93: // 0.094 * 1000 = 93.99999678134
         case 94:
             return 1;
         case 135:
             return 1.5;
         case 166:
             return 2;
         case 192:
             return 2.5;
         case 215:
             return 3;
         case 236:
             return 3.5;
         case 255:
             return 4;
         case 273:
             return 4.5;
         case 290:
             return 5;
         case 306:
             return 5.5;
         case 321:
             return 6;
         case 335:
             return 6.5;
         case 349:
             return 7;
         case 362:
             return 7.5;
         case 375:
             return 8;
         case 387:
             return 8.5;
         case 399:
             return 9;
         case 411:
             return 9.5;
         case 422:
             return 10;
         case 432:
             return 10.5;
         case 443:
             return 11;
         case 453:
             return 11.5;
         case 462:
             return 12;
         case 472:
             return 12.5;
         case 481:
             return 13;
         case 490:
             return 13.5;
         case 499:
             return 14;
         case 508:
             return 14.5;
         case 517:
             return 15;
         case 525:
             return 15.5;
         case 534:
             return 16;
         case 542:
             return 16.5;
         case 550:
             return 17;
         case 558:
             return 17.5;
         case 566:
             return 18;
         case 574:
             return 18.5;
         case 582:
             return 19;
         case 589:
             return 19.5;
         case 597:
             return 20;
         case 604:
             return 20.5;
         case 612:
             return 21;
         case 619:
             return 21.5;
         case 626:
             return 22;
         case 633:
             return 22.5;
         case 640:
             return 23;
         case 647:
             return 23.5;
         case 654:
             return 24;
         case 661:
             return 24.5;
         case 667:
             return 25;
         case 674:
             return 25.5;
         case 681:
             return 26;
         case 687:
             return 26.5;
         case 694:
             return 27;
         case 700:
             return 27.5;
         case 706:
             return 28;
         case 713:
             return 28.5;
         case 719:
             return 29;
         case 725:
             return 29.5;
         case 731:
             return 30;
         case 734:
             return 30.5;
         case 737:
             return 31;
         case 740:
             return 31.5;
         case 743:
             return 32;
         case 746:
             return 32.5;
         case 749:
             return 33;
         case 752:
             return 33.5;
         case 755:
             return 34;
         case 758:
             return 34.5;
         case 761:
             return 35;
         case 764:
             return 35.5;
         case 767:
             return 36;
         case 770:
             return 36.5;
         case 773:
             return 37;
         case 776:
             return 37.5;
         case 778:
             return 38;
         case 781:
             return 38.5;
         case 784:
             return 39;
         case 787:
             return 39.5;
         case 790:
             return 40;
         default:
             return 0;
     }
 }
Esempio n. 20
0
        private double CalculateMinCpMultiplier(PokemonData poke)
        {
            PokemonSettings pokemonSettings = GetPokemonSetting(poke.PokemonId).Data;

            return(pokemonSettings.Stats.BaseAttack * Math.Sqrt(pokemonSettings.Stats.BaseDefense) * Math.Sqrt(pokemonSettings.Stats.BaseStamina));
        }
Esempio n. 21
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                AnimationFrame     = 0;
                BattleMode.moveEnd = false;
                return(false);
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
        private void PopulateComboBoxes()
        {
            bool oldLoaded = loaded;

            loaded = false;

            AddComparisonComboBoxItems(comboBoxHatchCounterComparison);
            AddComparisonComboBoxItems(comboBoxStatComparison);
            AddComparisonComboBoxItems(comboBoxConditionComparison);
            AddComparisonComboBoxItems(comboBoxIVComparison);
            AddComparisonComboBoxItems(comboBoxEVComparison);
            AddComparisonComboBoxItems(comboBoxLevelComparison);
            AddComparisonComboBoxItems(comboBoxFriendshipComparison);
            AddComparisonComboBoxItems(comboBoxHiddenPowerDamageComparison);

            comboBoxSpecies.Items.Clear();
            for (ushort i = 1; i <= 386; i++)
            {
                AddComboBoxItem(comboBoxSpecies, PokemonDatabase.GetPokemonFromDexID(i).Name, (int)i);
            }

            comboBoxType.Items.Clear();
            for (PokemonTypes i = PokemonTypes.Normal; i <= PokemonTypes.Dark; i++)
            {
                AddComboBoxItem(comboBoxType, i.ToString(), (int)i);
            }

            comboBoxNature.Items.Clear();
            for (byte i = 0; i <= 24; i++)
            {
                AddComboBoxItem(comboBoxNature, PokemonDatabase.GetNatureFromID(i).Name, (int)i);
            }

            comboBoxAbility.Items.Clear();
            for (byte i = 1; i <= 76; i++)
            {
                AddComboBoxItem(comboBoxAbility, PokemonDatabase.GetAbilityFromID(i).Name, (int)i);
            }

            comboBoxHeldItem.Items.Clear();
            AddComboBoxItem(comboBoxHeldItem, "Any", 0);
            for (int i = 1; ItemDatabase.GetItemAt(i) != null; i++)
            {
                ItemData item = ItemDatabase.GetItemAt(i);
                if (!item.IsImportant && item.ID < 500)
                {
                    AddComboBoxItem(comboBoxHeldItem, item.Name, (int)item.ID);
                }
            }

            comboBoxPokeBall.Items.Clear();
            AddComboBoxItem(comboBoxPokeBall, "Poké Ball", 4);
            AddComboBoxItem(comboBoxPokeBall, "Great Ball", 3);
            AddComboBoxItem(comboBoxPokeBall, "Ultra Ball", 2);
            AddComboBoxItem(comboBoxPokeBall, "Master Ball", 1);
            AddComboBoxItem(comboBoxPokeBall, "Safari Ball", 5);
            AddComboBoxItem(comboBoxPokeBall, "Timer Ball", 10);
            AddComboBoxItem(comboBoxPokeBall, "Repeat Ball", 9);
            AddComboBoxItem(comboBoxPokeBall, "Net Ball", 6);
            AddComboBoxItem(comboBoxPokeBall, "Dive Ball", 7);
            AddComboBoxItem(comboBoxPokeBall, "Nest Ball", 8);
            AddComboBoxItem(comboBoxPokeBall, "Premier Ball", 12);
            AddComboBoxItem(comboBoxPokeBall, "Luxury Ball", 11);


            comboBoxRibbon.Items.Clear();
            for (PokemonRibbons i = PokemonRibbons.Any; i <= PokemonRibbons.World; i++)
            {
                // Add spaces to the names
                string        name    = i.ToString();
                StringBuilder newName = new StringBuilder();
                foreach (char c in name)
                {
                    if (char.IsUpper(c) && newName.Length > 0)
                    {
                        newName.Append(' ');
                    }
                    newName.Append(c);
                }
                AddComboBoxItem(comboBoxRibbon, newName.ToString(), (int)i);
            }


            comboBoxPokerus.Items.Clear();
            AddComboBoxItem(comboBoxPokerus, "None", (int)PokerusStatuses.None);
            AddComboBoxItem(comboBoxPokerus, "Infected", (int)PokerusStatuses.Infected);
            AddComboBoxItem(comboBoxPokerus, "Cured", (int)PokerusStatuses.Cured);

            ComboBox[] statComboBoxes = new ComboBox[] { comboBoxStatType, comboBoxIVType, comboBoxEVType };
            for (int i = 0; i < 3; i++)
            {
                statComboBoxes[i].Items.Clear();
                AddComboBoxItem(statComboBoxes[i], "HP", (int)StatTypes.HP);
                AddComboBoxItem(statComboBoxes[i], "Attack", (int)StatTypes.Attack);
                AddComboBoxItem(statComboBoxes[i], "Defense", (int)StatTypes.Defense);
                AddComboBoxItem(statComboBoxes[i], "Sp Attack", (int)StatTypes.SpAttack);
                AddComboBoxItem(statComboBoxes[i], "Sp Defense", (int)StatTypes.SpDefense);
                AddComboBoxItem(statComboBoxes[i], "Speed", (int)StatTypes.Speed);
                AddComboBoxItem(statComboBoxes[i], "Any", (int)StatTypes.Any);
                AddComboBoxItem(statComboBoxes[i], "All", (int)StatTypes.All);
                AddComboBoxItem(statComboBoxes[i], "Total", (int)StatTypes.Total);
            }

            comboBoxConditionType.Items.Clear();
            AddComboBoxItem(comboBoxConditionType, "Cool", (int)ConditionTypes.Cool);
            AddComboBoxItem(comboBoxConditionType, "Beauty", (int)ConditionTypes.Beauty);
            AddComboBoxItem(comboBoxConditionType, "Cute", (int)ConditionTypes.Cute);
            AddComboBoxItem(comboBoxConditionType, "Smart", (int)ConditionTypes.Smart);
            AddComboBoxItem(comboBoxConditionType, "Tough", (int)ConditionTypes.Tough);
            AddComboBoxItem(comboBoxConditionType, "Feel", (int)ConditionTypes.Feel);
            AddComboBoxItem(comboBoxConditionType, "Any", (int)ConditionTypes.Any);
            AddComboBoxItem(comboBoxConditionType, "All", (int)ConditionTypes.All);
            AddComboBoxItem(comboBoxConditionType, "Total", (int)ConditionTypes.Total);

            comboBoxGender.Items.Clear();
            AddComboBoxItem(comboBoxGender, "Male", (int)Genders.Male);
            AddComboBoxItem(comboBoxGender, "Female", (int)Genders.Female);
            AddComboBoxItem(comboBoxGender, "Genderless", (int)Genders.Genderless);

            comboBoxFamily.Items.Clear();
            for (ushort i = 1; i <= 386; i++)
            {
                PokemonData pokemonData = PokemonDatabase.GetPokemonFromDexID(i);
                if (pokemonData.FamilyDexID == i)
                {
                    AddComboBoxItem(comboBoxFamily, pokemonData.Name, (int)i);
                }
            }


            ComboBox[] moveComboBoxes = new ComboBox[] { comboBoxMove1, comboBoxMove2, comboBoxMove3, comboBoxMove4 };
            for (int i = 0; i < 4; i++)
            {
                moveComboBoxes[i].Items.Clear();
                AddComboBoxItem(moveComboBoxes[i], "None", 0);
                for (ushort j = 1; j <= 354; j++)
                {
                    AddComboBoxItem(moveComboBoxes[i], PokemonDatabase.GetMoveFromID(j).Name, (int)j);
                }
            }

            comboBoxHiddenPowerType.Items.Clear();
            for (PokemonTypes i = PokemonTypes.Fighting; i <= PokemonTypes.Dark; i++)
            {
                AddComboBoxItem(comboBoxHiddenPowerType, i.ToString(), (int)i);
            }


            comboBoxEggGroup.Items.Clear();
            for (EggGroups i = EggGroups.Field; i <= EggGroups.Ditto; i++)
            {
                AddComboBoxItem(comboBoxEggGroup, PokemonDatabase.GetEggGroupName(i), (int)i);
            }

            comboBoxEggMode.Items.Clear();
            AddComboBoxItem(comboBoxEggMode, "Include Eggs", (int)EggModes.IncludeEggs);
            AddComboBoxItem(comboBoxEggMode, "Exclude Eggs", (int)EggModes.ExcludeEggs);
            AddComboBoxItem(comboBoxEggMode, "Only Eggs", (int)EggModes.OnlyEggs);

            comboBoxShinyMode.Items.Clear();
            AddComboBoxItem(comboBoxShinyMode, "Include Shinies", (int)ShinyModes.IncludeShinies);
            AddComboBoxItem(comboBoxShinyMode, "Exclude Shinies", (int)ShinyModes.ExcludeShinies);
            AddComboBoxItem(comboBoxShinyMode, "Only Shinies", (int)ShinyModes.OnlyShinies);

            comboBoxShadowMode.Items.Clear();
            AddComboBoxItem(comboBoxShadowMode, "Include Shadow", (int)ShadowModes.IncludeShadow);
            AddComboBoxItem(comboBoxShadowMode, "Exclude Shadow", (int)ShadowModes.ExcludeShadow);
            AddComboBoxItem(comboBoxShadowMode, "Only Shadow", (int)ShadowModes.OnlyShadow);

            comboBoxSortMethod.Items.Clear();
            AddComboBoxItem(comboBoxSortMethod, "None", (int)SortMethods.None);
            AddComboBoxItem(comboBoxSortMethod, "Dex Number", (int)SortMethods.DexNumber);
            AddComboBoxItem(comboBoxSortMethod, "Alphabetical", (int)SortMethods.Alphabetical);
            AddComboBoxItem(comboBoxSortMethod, "Level", (int)SortMethods.Level);
            AddComboBoxItem(comboBoxSortMethod, "Friendship", (int)SortMethods.Friendship);
            AddComboBoxItem(comboBoxSortMethod, "Hatch Counter", (int)SortMethods.HatchCounter);
            AddComboBoxItem(comboBoxSortMethod, "Type", (int)SortMethods.Type);
            AddComboBoxItem(comboBoxSortMethod, "Hidden Power Type", (int)SortMethods.HiddenPowerType);
            AddComboBoxItem(comboBoxSortMethod, "Hidden Power Damage", (int)SortMethods.HiddenPowerDamage);
            AddComboBoxItem(comboBoxSortMethod, "Total Stats", (int)SortMethods.TotalStats);
            AddComboBoxItem(comboBoxSortMethod, "Total IVs", (int)SortMethods.TotalIVs);
            AddComboBoxItem(comboBoxSortMethod, "Total EVs", (int)SortMethods.TotalEVs);
            AddComboBoxItem(comboBoxSortMethod, "Total Conditions", (int)SortMethods.TotalCondition);
            AddComboBoxItem(comboBoxSortMethod, "Ribbon Count", (int)SortMethods.RibbonCount);
            AddComboBoxItem(comboBoxSortMethod, "HP", (int)SortMethods.HP);
            AddComboBoxItem(comboBoxSortMethod, "Attack", (int)SortMethods.Attack);
            AddComboBoxItem(comboBoxSortMethod, "Defense", (int)SortMethods.Defense);
            AddComboBoxItem(comboBoxSortMethod, "Sp Attack", (int)SortMethods.SpAttack);
            AddComboBoxItem(comboBoxSortMethod, "Sp Defense", (int)SortMethods.SpDefense);
            AddComboBoxItem(comboBoxSortMethod, "Speed", (int)SortMethods.Speed);
            AddComboBoxItem(comboBoxSortMethod, "HP IV", (int)SortMethods.HPIV);
            AddComboBoxItem(comboBoxSortMethod, "Attack IV", (int)SortMethods.AttackIV);
            AddComboBoxItem(comboBoxSortMethod, "Defense IV", (int)SortMethods.DefenseIV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Attack IV", (int)SortMethods.SpAttackIV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Defense IV", (int)SortMethods.SpDefenseIV);
            AddComboBoxItem(comboBoxSortMethod, "Speed IV", (int)SortMethods.SpeedIV);
            AddComboBoxItem(comboBoxSortMethod, "HP EV", (int)SortMethods.HPEV);
            AddComboBoxItem(comboBoxSortMethod, "Attack EV", (int)SortMethods.AttackEV);
            AddComboBoxItem(comboBoxSortMethod, "Defense EV", (int)SortMethods.DefenseEV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Attack EV", (int)SortMethods.SpAttackEV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Defense EV", (int)SortMethods.SpDefenseEV);
            AddComboBoxItem(comboBoxSortMethod, "Speed EV", (int)SortMethods.SpeedEV);
            AddComboBoxItem(comboBoxSortMethod, "Coolness", (int)SortMethods.Coolness);
            AddComboBoxItem(comboBoxSortMethod, "Beauty", (int)SortMethods.Beauty);
            AddComboBoxItem(comboBoxSortMethod, "Cuteness", (int)SortMethods.Cuteness);
            AddComboBoxItem(comboBoxSortMethod, "Smartness", (int)SortMethods.Smartness);
            AddComboBoxItem(comboBoxSortMethod, "Toughness", (int)SortMethods.Toughness);
            AddComboBoxItem(comboBoxSortMethod, "Feel", (int)SortMethods.Feel);

            comboBoxSortOrder.Items.Clear();
            AddComboBoxItem(comboBoxSortOrder, "Highest to Lowest", (int)SortOrders.HighestToLowest);
            AddComboBoxItem(comboBoxSortOrder, "Lowest to Highest", (int)SortOrders.LowestToHighest);

            comboBoxSearchMode.Items.Clear();
            AddComboBoxItem(comboBoxSearchMode, "New Search", (int)SearchModes.NewSearch);
            AddComboBoxItem(comboBoxSearchMode, "Add Results", (int)SearchModes.AddResults);
            AddComboBoxItem(comboBoxSearchMode, "Refine Results", (int)SearchModes.RefineResults);

            loaded = oldLoaded;
        }
Esempio n. 23
0
 // NOTE: this is the real IV Percent, using only Individual values.
 public static double CalculateIVPerfection(PokemonData pokemon)
 {
     // NOTE: 45 points = 15 at points + 15 def points + 15 sta points
     //  100/45 simplifying is 20/9
     return(((double)pokemon.IndividualAttack + pokemon.IndividualDefense + pokemon.IndividualStamina) * 20 / 9);
 }
Esempio n. 24
0
 public static int GetPowerUpLevel(PokemonData poke)
 {
     return((int)(GetLevel(poke) * 2.0));
 }
Esempio n. 25
0
        public static PokemonMove GetPokemonMove2(PokemonData poke)
        {
            var move2 = poke.Move2;

            return(move2);
        }
Esempio n. 26
0
        public static PokemonMove GetPokemonMove1(PokemonData poke)
        {
            var move1 = poke.Move1;

            return(move1);
        }
Esempio n. 27
0
 public async Task<PokemonData> GetHighestPokemonOfTypeByCp(PokemonData pokemon)
 {
     var myPokemon = await GetPokemons();
     var pokemons = myPokemon.ToList();
     return pokemons.Where(x => x.PokemonId == pokemon.PokemonId)
         .OrderByDescending(x => x.Cp)
         .FirstOrDefault();
 }
Esempio n. 28
0
 public PokemonListWeb(PokemonData data)
 {
     Base = data;
 }
Esempio n. 29
0
 public double GetPerfect(PokemonData poke)
 {
     var result = PokemonInfo.CalculatePokemonPerfection(poke);
     return result;
 }
Esempio n. 30
0
        public static async Task Execute(ISession session, CancellationToken cancellationToken, ulong pokemonId = 0)
        {
            PokemonData newBuddy = null;

            if (pokemonId == 0)
            {
                if (string.IsNullOrEmpty(session.LogicSettings.DefaultBuddyPokemon))
                {
                    return;
                }

                PokemonId buddyPokemonId;
                bool      success = Enum.TryParse(session.LogicSettings.DefaultBuddyPokemon, out buddyPokemonId);
                if (!success)
                {
                    // Invalid buddy pokemon type
                    Logger.Write($"The DefaultBuddyPokemon ({session.LogicSettings.DefaultBuddyPokemon}) is not a valid pokemon.", LogLevel.Error);
                    return;
                }

                if (session.Profile.PlayerData.BuddyPokemon?.Id > 0)
                {
                    var currentBuddy = (await session.Inventory.GetPokemons().ConfigureAwait(false)).FirstOrDefault(x => x.Id == session.Profile.PlayerData.BuddyPokemon.Id);
                    if (currentBuddy.PokemonId == buddyPokemonId)
                    {
                        //dont change same buddy
                        return;
                    }
                }

                var buddy = (await session.Inventory.GetPokemons().ConfigureAwait(false)).Where(x => x.PokemonId == buddyPokemonId)
                            .OrderByDescending(x => PokemonInfo.CalculateCp(x));

                if (session.LogicSettings.PrioritizeIvOverCp)
                {
                    buddy = buddy.OrderByDescending(x => PokemonInfo.CalculatePokemonPerfection(x));
                }
                newBuddy = buddy.FirstOrDefault();

                if (newBuddy == null)
                {
                    Logger.Write($"You don't have the pokemon {session.LogicSettings.DefaultBuddyPokemon} to set as your buddy");
                    return;
                }
            }
            if (newBuddy == null)
            {
                newBuddy = (await session.Inventory.GetPokemons().ConfigureAwait(false)).FirstOrDefault(x => x.Id == pokemonId);
            }
            if (newBuddy == null)
            {
                return;
            }

            var response = await session.Client.Player.SelectBuddy(newBuddy.Id).ConfigureAwait(false);

            if (response.Result == SetBuddyPokemonResponse.Types.Result.Success)
            {
                session.EventDispatcher.Send(new BuddyUpdateEvent(response.UpdatedBuddy, newBuddy));
            }
        }
Esempio n. 31
0
        private static async Task transferPokemon(PokemonData pokemon)
        {
            try
            {
                var transferPokemonResponse = await client.TransferPokemon(pokemon.Id);
                string message = "";
                string caption = "";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult result;

                if (transferPokemonResponse.Status == 1)
                {
                    message = $"{pokemon.PokemonId} was transferred\n{transferPokemonResponse.CandyAwarded} candy awarded";
                    caption = $"{pokemon.PokemonId} transferred";
                }
                else
                {
                    message = $"{pokemon.PokemonId} could not be transferred";
                    caption = $"Transfer {pokemon.PokemonId} failed";
                }

                result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Information);
            }
            catch (TaskCanceledException) { await transferPokemon(pokemon); }
            catch (UriFormatException) { await transferPokemon(pokemon); }
            catch (ArgumentOutOfRangeException) { await transferPokemon(pokemon); }
            catch (ArgumentNullException) { await transferPokemon(pokemon); }
            catch (NullReferenceException) { await transferPokemon(pokemon); }
            catch (Exception ex) { await transferPokemon(pokemon); }
        }
Esempio n. 32
0
        public async Task ProcessPvPSubscription(PokemonData pkmn)
        {
            if (!MasterFile.Instance.Pokedex.ContainsKey(pkmn.Id))
            {
                return;
            }

            var loc = _whm.GetGeofence(pkmn.Latitude, pkmn.Longitude);

            if (loc == null)
            {
                //_logger.Warn($"Failed to lookup city from coordinates {pkmn.Latitude},{pkmn.Longitude} {db.Pokemon[pkmn.Id].Name} {pkmn.IV}, skipping...");
                return;
            }

            var subscriptions = Manager.GetUserSubscriptionsByPvPPokemonId(pkmn.Id);

            if (subscriptions == null)
            {
                _logger.Warn($"Failed to get subscriptions from database table.");
                return;
            }

            SubscriptionObject user;
            PvPSubscription    subscribedPokemon;
            DiscordMember      member = null;
            var pokemon      = MasterFile.GetPokemon(pkmn.Id, pkmn.FormId);
            var matchesGreat = false;
            var matchesUltra = false;

            for (var i = 0; i < subscriptions.Count; i++)
            {
                try
                {
                    user = subscriptions[i];
                    if (user == null)
                    {
                        continue;
                    }

                    if (!user.Enabled)
                    {
                        continue;
                    }

                    if (!_whConfig.Servers.ContainsKey(user.GuildId))
                    {
                        continue;
                    }

                    if (!_whConfig.Servers[user.GuildId].Subscriptions.Enabled)
                    {
                        continue;
                    }

                    if (!_servers.ContainsKey(user.GuildId))
                    {
                        continue;
                    }

                    var client = _servers[user.GuildId];

                    try
                    {
                        member = await client.GetMemberById(user.GuildId, user.UserId);
                    }
                    catch (Exception ex)
                    {
                        _logger.Debug($"FAILED TO GET MEMBER BY ID {user.UserId}");
                        _logger.Error(ex);
                        continue;
                    }

                    if (member?.Roles == null || loc == null)
                    {
                        continue;
                    }

                    if (!member.HasSupporterRole(_whConfig.Servers[user.GuildId].DonorRoleIds))
                    {
                        _logger.Debug($"User {member?.Username} ({user.UserId}) is not a supporter, skipping pvp pokemon {pokemon.Name}...");
                        // Automatically disable users subscriptions if not supporter to prevent issues
                        user.Enabled = false;
                        user.Save(false);
                        continue;
                    }

                    var form = Translator.Instance.GetFormName(pkmn.FormId);
                    subscribedPokemon = user.PvP.FirstOrDefault(x =>
                                                                x.PokemonId == pkmn.Id &&
                                                                (string.IsNullOrEmpty(x.Form) || (!string.IsNullOrEmpty(x.Form) && string.Compare(x.Form, form, true) == 0))
                                                                );
                    // Not subscribed to Pokemon
                    if (subscribedPokemon == null)
                    {
                        //_logger.Info($"User {member.Username} not subscribed to PvP Pokemon {pokemon.Name} (Form: {form}).");
                        continue;
                    }

                    matchesGreat = pkmn.GreatLeague != null && (pkmn.GreatLeague?.Exists(x => subscribedPokemon.League == PvPLeague.Great &&
                                                                                         (x.CP ?? 0) >= Strings.MinimumGreatLeagueCP && (x.CP ?? 0) <= Strings.MaximumGreatLeagueCP &&
                                                                                         (x.Rank ?? 4096) <= subscribedPokemon.MinimumRank &&
                                                                                         (x.Percentage ?? 0) * 100 >= subscribedPokemon.MinimumPercent) ?? false);
                    matchesUltra = pkmn.UltraLeague != null && (pkmn.GreatLeague?.Exists(x => subscribedPokemon.League == PvPLeague.Ultra &&
                                                                                         (x.CP ?? 0) >= Strings.MinimumUltraLeagueCP && (x.CP ?? 0) <= Strings.MaximumUltraLeagueCP &&
                                                                                         (x.Rank ?? 4096) <= subscribedPokemon.MinimumRank &&
                                                                                         (x.Percentage ?? 0) * 100 >= subscribedPokemon.MinimumPercent) ?? false);

                    // Check if Pokemon IV stats match any relevant great or ultra league ranks, if not skip.
                    if (!matchesGreat && !matchesUltra)
                    {
                        continue;
                    }

                    var distanceMatches = user.DistanceM > 0 && user.DistanceM > new Coordinates(user.Latitude, user.Longitude).DistanceTo(new Coordinates(pkmn.Latitude, pkmn.Longitude));
                    var geofenceMatches = subscribedPokemon.Areas.Select(x => x.ToLower()).Contains(loc.Name.ToLower());

                    // If set distance does not match and no geofences match, then skip Pokemon...
                    if (!distanceMatches && !geofenceMatches)
                    {
                        continue;
                    }

                    var embed = await pkmn.GeneratePokemonMessage(user.GuildId, client, _whConfig, null, loc.Name);

                    foreach (var emb in embed.Embeds)
                    {
                        _queue.Enqueue(new NotificationItem(user, member, emb, pokemon.Name, loc.Name));
                    }

                    Statistics.Instance.SubscriptionPokemonSent++;
                    Thread.Sleep(5);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex);
                }
            }

            subscriptions.Clear();
            subscriptions = null;
            member        = null;
            user          = null;
            loc           = null;
            pokemon       = null;

            await Task.CompletedTask;
        }
Esempio n. 33
0
 public static PokemonMove GetPokemonMove1(PokemonData poke)
 {
     var move1 = poke.Move1;
     return move1;
 }
Esempio n. 34
0
        public async Task ProcessPokemonSubscription(PokemonData pkmn)
        {
            if (!MasterFile.Instance.Pokedex.ContainsKey(pkmn.Id))
            {
                return;
            }

            var loc = _whm.GetGeofence(pkmn.Latitude, pkmn.Longitude);

            if (loc == null)
            {
                //_logger.Warn($"Failed to lookup city from coordinates {pkmn.Latitude},{pkmn.Longitude} {db.Pokemon[pkmn.Id].Name} {pkmn.IV}, skipping...");
                return;
            }

            var subscriptions = Manager.GetUserSubscriptionsByPokemonId(pkmn.Id);

            if (subscriptions == null)
            {
                _logger.Warn($"Failed to get subscriptions from database table.");
                return;
            }

            SubscriptionObject  user;
            PokemonSubscription subscribedPokemon;
            DiscordMember       member = null;
            var pokemon       = MasterFile.GetPokemon(pkmn.Id, pkmn.FormId);
            var matchesIV     = false;
            var matchesLvl    = false;
            var matchesGender = false;
            var matchesIVList = false;

            for (var i = 0; i < subscriptions.Count; i++)
            {
                try
                {
                    user = subscriptions[i];
                    if (user == null)
                    {
                        continue;
                    }

                    if (!user.Enabled)
                    {
                        continue;
                    }

                    if (!_whConfig.Servers.ContainsKey(user.GuildId))
                    {
                        continue;
                    }

                    if (!_whConfig.Servers[user.GuildId].Subscriptions.Enabled)
                    {
                        continue;
                    }

                    if (!_servers.ContainsKey(user.GuildId))
                    {
                        continue;
                    }

                    var client = _servers[user.GuildId];

                    try
                    {
                        member = await client.GetMemberById(user.GuildId, user.UserId);
                    }
                    catch (Exception ex)
                    {
                        _logger.Debug($"FAILED TO GET MEMBER BY ID {user.UserId}");
                        _logger.Error(ex);
                        continue;
                    }

                    if (member?.Roles == null || loc == null)
                    {
                        continue;
                    }

                    if (!member.HasSupporterRole(_whConfig.Servers[user.GuildId].DonorRoleIds))
                    {
                        _logger.Debug($"User {member?.Username} ({user.UserId}) is not a supporter, skipping pokemon {pokemon.Name}...");
                        // Automatically disable users subscriptions if not supporter to prevent issues
                        user.Enabled = false;
                        user.Save(false);
                        continue;
                    }

                    var form = Translator.Instance.GetFormName(pkmn.FormId);
                    subscribedPokemon = user.Pokemon.FirstOrDefault(x =>
                                                                    x.PokemonId == pkmn.Id &&
                                                                    (string.IsNullOrEmpty(x.Form) || (!string.IsNullOrEmpty(x.Form) && string.Compare(x.Form, form, true) == 0))
                                                                    );
                    // Not subscribed to Pokemon
                    if (subscribedPokemon == null)
                    {
                        _logger.Info($"User {member.Username} not subscribed to Pokemon {pokemon.Name} (Form: {form}).");
                        continue;
                    }

                    matchesIV = Filters.MatchesIV(pkmn.IV, subscribedPokemon.MinimumIV);
                    //var matchesCP = _whm.Filters.MatchesCpFilter(pkmn.CP, subscribedPokemon.MinimumCP);
                    matchesLvl    = Filters.MatchesLvl(pkmn.Level, (uint)subscribedPokemon.MinimumLevel, (uint)subscribedPokemon.MaximumLevel);
                    matchesGender = Filters.MatchesGender(pkmn.Gender, subscribedPokemon.Gender);
                    matchesIVList = subscribedPokemon.IVList?.Contains($"{pkmn.Attack}/{pkmn.Defense}/{pkmn.Stamina}") ?? false;

                    if (!(
                            (/*!subscribedPokemon.HasStats && */ matchesIV && matchesLvl && matchesGender) ||
                            (subscribedPokemon.HasStats && matchesIVList)
                            ))
                    {
                        continue;
                    }

                    var distanceMatches = user.DistanceM > 0 && user.DistanceM > new Coordinates(user.Latitude, user.Longitude).DistanceTo(new Coordinates(pkmn.Latitude, pkmn.Longitude));
                    var geofenceMatches = subscribedPokemon.Areas.Select(x => x.ToLower()).Contains(loc.Name.ToLower());

                    // If set distance does not match and no geofences match, then skip Pokemon...
                    if (!distanceMatches && !geofenceMatches)
                    {
                        continue;
                    }

                    var embed = await pkmn.GeneratePokemonMessage(user.GuildId, client, _whConfig, null, loc.Name);

                    foreach (var emb in embed.Embeds)
                    {
                        _queue.Enqueue(new NotificationItem(user, member, emb, pokemon.Name, loc.Name, pkmn));
                    }

                    Statistics.Instance.SubscriptionPokemonSent++;
                    Thread.Sleep(5);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex);
                }
            }

            subscriptions.Clear();
            subscriptions = null;
            member        = null;
            user          = null;
            loc           = null;
            pokemon       = null;

            await Task.CompletedTask;
        }
Esempio n. 35
0
        public static double CalculateMinCpMultiplier(PokemonData poke)
        {
            var baseStats = GetBaseStats(poke.PokemonId);

            return(baseStats.BaseAttack * Math.Sqrt(baseStats.BaseDefense) * Math.Sqrt(baseStats.BaseStamina));
        }
Esempio n. 36
0
 public virtual bool IsMatch(PokemonData data)
 {         //Utility.IsMatch() checks for evolution situations such as Eevee -> Umbreon and Acquisition Level + 1.
     return(data.HomeTown == m_HomeTown && Utility.IsMatch(data.NatID, m_NatID, data.m_MinLevel, m_MinLevel));
 }
Esempio n. 37
0
 public void DetermineFrontSprite()
 {
     frontportrait.overrideSprite = GameData.instance.frontMonSprites[PokemonData.MonToID(enemymon.name) - 1];
 }
Esempio n. 38
0
 public virtual bool IsValidGender(PokemonData data)
 {
     return(true);
 }
        private async void PowerUpPokemon(PokemonData pokemon)
        {
            var evolvePokemonResponse = await client2.PowerUp(pokemon.Id);

            if (evolvePokemonResponse.Result == 1)
            {
                ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} successfully upgraded.");
                ReloadPokemonList();
            }
            else
            {
                ColoredConsoleWrite(Color.Magenta, $"{pokemon.PokemonId} could not be upgraded");
            }
        }
Esempio n. 40
0
 public virtual bool IsValidPokeBall(PokemonData data)
 {
     return(true);
 }
Esempio n. 41
0
        private static void LoadPokemon(SQLiteConnection connection)
        {
            SQLiteCommand command;
            SQLiteDataReader reader;
            DataTable table;

            // Load Gen3 Pokemon Data
            command = new SQLiteCommand("SELECT * FROM Pokemon", connection);
            reader = command.ExecuteReader();
            table = new DataTable("Pokemon");
            table.Load(reader);
            foreach (DataRow row in table.Rows) {
                if ((int)(long)row["ID"] != 412) {
                    PokemonData pokemon = new PokemonData(row);
                    gen3PokemonMap.Add(pokemon.ID, pokemon);
                    gen3PokemonDexMap.Add(pokemon.DexID, pokemon);
                    gen3PokemonDexList.Add(pokemon);
                }
            }
            // Sort the Dex ID list
            gen3PokemonDexList = gen3PokemonDexList.OrderBy(o => o.DexID).ToList();
        }
Esempio n. 42
0
 public virtual bool IsValidAlgorithm(PokemonData data)
 {
     return(true);
 }
Esempio n. 43
0
        private static async Task PowerUp(PokemonData pokemon)
        {
            try
            {
                var evolvePokemonResponse = await client.PowerUp(pokemon.Id);
                string message = "";
                string caption = "";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult result;

                if (evolvePokemonResponse.Result == 1)
                {
                    message = $"{pokemon.PokemonId} successfully upgraded.";
                    caption = $"{pokemon.PokemonId} upgraded";
                }
                else
                {
                    message = $"{pokemon.PokemonId} could not be upgraded";
                    caption = $"Upgrade {pokemon.PokemonId} failed";
                }

                result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Information);
            }
            catch (TaskCanceledException) { await PowerUp(pokemon); }
            catch (UriFormatException) { await PowerUp(pokemon); }
            catch (ArgumentOutOfRangeException) { await PowerUp(pokemon); }
            catch (ArgumentNullException) { await PowerUp(pokemon); }
            catch (NullReferenceException) { await PowerUp(pokemon); }
            catch (Exception ex) { await PowerUp(pokemon); }
        }
Esempio n. 44
0
 public static double CalculateMinCpMultiplier(PokemonData poke)
 {
     var baseStats = GetBaseStats(poke.PokemonId);
     return baseStats.BaseAttack*Math.Sqrt(baseStats.BaseDefense)*Math.Sqrt(baseStats.BaseStamina);
 }
Esempio n. 45
0
 public async Task<PokemonData> GetHighestPokemonOfTypeByIv(PokemonData pokemon)
 {
     var myPokemon = await GetPokemons();
     var pokemons = myPokemon.ToList();
     return pokemons.Where(x => x.PokemonId == pokemon.PokemonId)
         .OrderByDescending(PokemonInfo.CalculatePokemonPerfection)
         .FirstOrDefault();
 }
Esempio n. 46
0
 public static int CalculateMaxCP(PokemonData poke)
 {
     return(Math.Max((int)Math.Floor(0.1 * CalculateMaxCPMultiplier(poke) * Math.Pow(poke.CpMultiplier + poke.AdditionalCpMultiplier, 2)), 10));
 }
Esempio n. 47
0
 public static double CalculateMaxCPMultiplier(PokemonData poke)
 {
     BaseStats baseStats = GetBaseStats(poke.PokemonId);
     return (baseStats.BaseAttack + 15) * Math.Sqrt(baseStats.BaseDefense + 15) * Math.Sqrt(baseStats.BaseStamina + 15);
 }
Esempio n. 48
0
 public static float Perfect(PokemonData poke)
 {
     return(((float)(poke.IndividualAttack + poke.IndividualDefense + poke.IndividualStamina) / (3.0f * 15.0f)) * 100.0f);
 }
Esempio n. 49
0
        private static async Task evolvePokemon(PokemonData pokemon)
        {
            try
            {
                var evolvePokemonResponse = await client.EvolvePokemon(pokemon.Id);
                string message = "";
                string caption = "";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult result;

                if (evolvePokemonResponse.Result == 1)
                {
                    message = $"{pokemon.PokemonId} successfully evolved into {evolvePokemonResponse.EvolvedPokemon.PokemonType}\n{evolvePokemonResponse.ExpAwarded} experience awarded\n{evolvePokemonResponse.CandyAwarded} candy awarded";
                    caption = $"{pokemon.PokemonId} evolved into {evolvePokemonResponse.EvolvedPokemon.PokemonType}";
                }
                else
                {
                    message = $"{pokemon.PokemonId} could not be evolved";
                    caption = $"Evolve {pokemon.PokemonId} failed";
                }

                result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Information);
            }
            catch (TaskCanceledException) { await evolvePokemon(pokemon); }
            catch (UriFormatException) { await evolvePokemon(pokemon); }
            catch (ArgumentOutOfRangeException) { await evolvePokemon(pokemon); }
            catch (ArgumentNullException) { await evolvePokemon(pokemon); }
            catch (NullReferenceException) { await evolvePokemon(pokemon); }
            catch (Exception ex) { await evolvePokemon(pokemon); }
        }
Esempio n. 50
0
    private IEnumerator runEvent(CustomEventTree[] treesArray, int index)
    {
        CustomEventDetails currentEvent = treesArray[eventTreeIndex].events[index];
        CustomEventDetails nextEvent    = null;

        if (index + 1 < treesArray[eventTreeIndex].events.Length)       //if not the last event
        {
            nextEvent = treesArray[eventTreeIndex].events[index + 1];
        }

        NPCHandler targetNPC = null;

        CustomEventDetails.CustomEventType ty = currentEvent.eventType;

        Debug.Log("Run event. Type: " + ty.ToString());

        switch (ty)
        {
        case (CustomEventDetails.CustomEventType.Wait):
            yield return(new WaitForSeconds(currentEvent.float0));

            break;

        case (CustomEventDetails.CustomEventType.Walk):
            if (currentEvent.object0.GetComponent <NPCHandler>() != null)
            {
                targetNPC = currentEvent.object0.GetComponent <NPCHandler>();

                int initialDirection = targetNPC.direction;
                targetNPC.direction = (int)currentEvent.dir;
                for (int i = 0; i < currentEvent.int0; i++)
                {
                    targetNPC.direction = (int)currentEvent.dir;
                    Vector3 forwardsVector = targetNPC.getForwardsVector(true);
                    if (currentEvent.bool0)                     //if direction locked in
                    {
                        targetNPC.direction = initialDirection;
                    }
                    while (forwardsVector == new Vector3(0, 0, 0))
                    {
                        targetNPC.direction = (int)currentEvent.dir;
                        forwardsVector      = targetNPC.getForwardsVector(true);
                        if (currentEvent.bool0)                         //if direction locked in
                        {
                            targetNPC.direction = initialDirection;
                        }
                        yield return(new WaitForSeconds(0.1f));
                    }

                    targetNPC.setOverrideBusy(true);
                    yield return(StartCoroutine(targetNPC.move(forwardsVector, currentEvent.float0)));

                    targetNPC.setOverrideBusy(false);
                }
                targetNPC.setFrameStill();
            }                           //Move the player if set to player
            if (currentEvent.object0 == PlayerMovement.player.gameObject)
            {
                int initialDirection = PlayerMovement.player.direction;

                PlayerMovement.player.speed = (currentEvent.float0 > 0)? PlayerMovement.player.walkSpeed / currentEvent.float0 : PlayerMovement.player.walkSpeed;
                for (int i = 0; i < currentEvent.int0; i++)
                {
                    PlayerMovement.player.updateDirection((int)currentEvent.dir);
                    Vector3 forwardsVector = PlayerMovement.player.getForwardVector();
                    if (currentEvent.bool0)                     //if direction locked in
                    {
                        PlayerMovement.player.updateDirection(initialDirection);
                    }

                    PlayerMovement.player.setOverrideAnimPause(true);
                    yield return(StartCoroutine(PlayerMovement.player.move(forwardsVector, false, currentEvent.bool0)));

                    PlayerMovement.player.setOverrideAnimPause(false);
                }
                PlayerMovement.player.speed = PlayerMovement.player.walkSpeed;
            }
            break;

        case (CustomEventDetails.CustomEventType.TurnTo):
            int   direction;
            float xDistance;
            float zDistance;
            if (currentEvent.object0.GetComponent <NPCHandler>() != null)
            {
                targetNPC = currentEvent.object0.GetComponent <NPCHandler>();
            }
            if (targetNPC != null)
            {
                if (currentEvent.object1 != null)
                {
                    //calculate target objects's position relative to this objects's and set direction accordingly.
                    xDistance = targetNPC.hitBox.position.x - currentEvent.object1.transform.position.x;
                    zDistance = targetNPC.hitBox.position.z - currentEvent.object1.transform.position.z;
                    if (xDistance >= Mathf.Abs(zDistance))                      //Mathf.Abs() converts zDistance to a positive always.
                    {
                        direction = 3;
                    }                                                           //this allows for better accuracy when checking orientation.
                    else if (xDistance <= Mathf.Abs(zDistance) * -1)
                    {
                        direction = 1;
                    }
                    else if (zDistance >= Mathf.Abs(xDistance))
                    {
                        direction = 2;
                    }
                    else
                    {
                        direction = 0;
                    }
                    targetNPC.setDirection(direction);
                }
                if (currentEvent.int0 != 0)
                {
                    direction = targetNPC.direction + currentEvent.int0;
                    while (direction > 3)
                    {
                        direction -= 4;
                    }
                    while (direction < 0)
                    {
                        direction += 4;
                    }
                    targetNPC.setDirection(direction);
                }
            }
            break;

        case (CustomEventDetails.CustomEventType.Dialog):
            for (int i = 0; i < currentEvent.strings.Length; i++)
            {
                Dialog.drawDialogBox();
                yield return(StartCoroutine(Dialog.drawText(currentEvent.strings[i])));

                if (i < currentEvent.strings.Length - 1)
                {
                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                }
            }
            if (nextEvent != null)
            {
                if (nextEvent.eventType != CustomEventDetails.CustomEventType.Choice)
                {
                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    if (!EventRequiresDialogBox(nextEvent.eventType))
                    {
                        Dialog.undrawDialogBox();
                    }                                                      // do not undraw the box if the next event needs it
                }
            }
            else
            {
                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
                Dialog.undrawDialogBox();
            }
            break;

        case (CustomEventDetails.CustomEventType.Choice):
            if (currentEvent.strings.Length > 1)
            {
                Dialog.drawChoiceBox(currentEvent.strings);
                yield return(StartCoroutine(Dialog.choiceNavigate(currentEvent.strings)));
            }
            else
            {
                Dialog.drawChoiceBox();
                yield return(StartCoroutine(Dialog.choiceNavigate()));
            }
            int chosenIndex = Dialog.chosenIndex;
            chosenIndex = currentEvent.ints.Length - 1 - chosenIndex;         //flip it to reflect the original input
            Dialog.undrawChoiceBox();
            Dialog.undrawDialogBox();
            if (chosenIndex < currentEvent.ints.Length)             //only change tree if index is valid
            {
                if (currentEvent.ints[chosenIndex] != eventTreeIndex &&
                    currentEvent.ints[chosenIndex] < treesArray.Length)
                {
                    JumpToTree(currentEvent.ints[chosenIndex]);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.Sound:
            SfxHandler.Play(currentEvent.sound);
            break;

        case CustomEventDetails.CustomEventType.ReceiveItem:
            //Play Good for TM, Average for Item
            AudioClip itemGetMFX = (currentEvent.bool0)? Resources.Load <AudioClip>("Audio/mfx/GetGood") : Resources.Load <AudioClip>("Audio/mfx/GetDecent");
            BgmHandler.main.PlayMFX(itemGetMFX);

            string firstLetter = currentEvent.string0.Substring(0, 1).ToLowerInvariant();
            Dialog.drawDialogBox();
            if (currentEvent.bool0)
            {
                Dialog.StartCoroutine("drawText", SaveData.currentSave.playerName + " received TM" + ItemDatabase.getItem(currentEvent.string0).getTMNo() + ": " + currentEvent.string0 + "!");
            }
            else
            {
                if (currentEvent.int0 > 1)
                {
                    Dialog.StartCoroutine("drawText", SaveData.currentSave.playerName + " received " + currentEvent.string0 + "s!");
                }
                else if (firstLetter == "a" || firstLetter == "e" || firstLetter == "i" || firstLetter == "o" || firstLetter == "u")
                {
                    Dialog.StartCoroutine("drawText", SaveData.currentSave.playerName + " received an " + currentEvent.string0 + "!");
                }
                else
                {
                    Dialog.StartCoroutine("drawText", SaveData.currentSave.playerName + " received a " + currentEvent.string0 + "!");
                }
            }
            yield return(new WaitForSeconds(itemGetMFX.length));

            bool itemAdd = SaveData.currentSave.Bag.addItem(currentEvent.string0, currentEvent.int0);

            Dialog.drawDialogBox();
            if (itemAdd)
            {
                if (currentEvent.bool0)
                {
                    yield return(Dialog.StartCoroutine("drawTextSilent", SaveData.currentSave.playerName + " put the TM" + ItemDatabase.getItem(currentEvent.string0).getTMNo() + " \\away into the bag."));
                }
                else
                {
                    if (currentEvent.int0 > 1)
                    {
                        yield return(Dialog.StartCoroutine("drawTextSilent", SaveData.currentSave.playerName + " put the " + currentEvent.string0 + "s \\away into the bag."));
                    }
                    else
                    {
                        yield return(Dialog.StartCoroutine("drawTextSilent", SaveData.currentSave.playerName + " put the " + currentEvent.string0 + " \\away into the bag."));
                    }
                }
                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
            }
            else
            {
                yield return(Dialog.StartCoroutine("drawTextSilent", "But there was no room..."));

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

        case CustomEventDetails.CustomEventType.ReceivePokemon:
            if (SaveData.currentSave.PC.hasSpace(0))
            {
                //Play Great for Pokemon
                AudioClip pokeGetMFX = Resources.Load <AudioClip>("Audio/mfx/GetGreat");

                PokemonData pkd = PokemonDatabase.getPokemon(currentEvent.ints[0]);

                string         pkName   = pkd.getName();
                Pokemon.Gender pkGender = Pokemon.Gender.CALCULATE;

                if (pkd.getMaleRatio() == -1)
                {
                    pkGender = Pokemon.Gender.NONE;
                }
                else if (pkd.getMaleRatio() == 0)
                {
                    pkGender = Pokemon.Gender.FEMALE;
                }
                else if (pkd.getMaleRatio() == 100)
                {
                    pkGender = Pokemon.Gender.MALE;
                }
                else                 //if not a set gender
                {
                    if (currentEvent.ints[2] == 0)
                    {
                        pkGender = Pokemon.Gender.MALE;
                    }
                    else if (currentEvent.ints[2] == 1)
                    {
                        pkGender = Pokemon.Gender.FEMALE;
                    }
                }

                Dialog.drawDialogBox();
                yield return(Dialog.StartCoroutine("drawText", SaveData.currentSave.playerName + " received the " + pkName + "!"));

                BgmHandler.main.PlayMFX(pokeGetMFX);
                yield return(new WaitForSeconds(pokeGetMFX.length));

                string nickname = currentEvent.strings[0];
                if (currentEvent.strings[1].Length == 0)                 //If no OT set, allow nicknaming of Pokemon

                {
                    Dialog.drawDialogBox();
                    yield return(StartCoroutine(Dialog.drawTextSilent("Would you like to give a nickname to \nthe " + pkName + " you received?")));

                    Dialog.drawChoiceBox();
                    yield return(StartCoroutine(Dialog.choiceNavigate()));

                    int nicknameCI = Dialog.chosenIndex;
                    Dialog.undrawDialogBox();
                    Dialog.undrawChoiceBox();

                    if (nicknameCI == 1)                     //give nickname
                    //SfxHandler.Play(selectClip);
                    {
                        yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                        Scene.main.Typing.gameObject.SetActive(true);
                        StartCoroutine(Scene.main.Typing.control(10, "", pkGender, Pokemon.GetIconsFromID_(currentEvent.ints[0], currentEvent.bool0)));
                        while (Scene.main.Typing.gameObject.activeSelf)
                        {
                            yield return(null);
                        }
                        if (Scene.main.Typing.typedString.Length > 0)
                        {
                            nickname = Scene.main.Typing.typedString;
                        }

                        yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                    }
                }
                if (!EventRequiresDialogBox(nextEvent.eventType))
                {
                    Dialog.undrawDialogBox();
                }

                int[] IVs = new int[] {
                    Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32),
                    Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32)
                };
                if (currentEvent.bool1)                 //if using Custom IVs
                {
                    IVs[0] = currentEvent.ints[5];
                    IVs[1] = currentEvent.ints[6];
                    IVs[2] = currentEvent.ints[7];
                    IVs[3] = currentEvent.ints[8];
                    IVs[4] = currentEvent.ints[9];
                    IVs[5] = currentEvent.ints[10];
                }

                string pkNature = (currentEvent.ints[3] == 0)? NatureDatabase.getRandomNature().getName() : NatureDatabase.getNature(currentEvent.ints[3] - 1).getName();

                string[] pkMoveset = pkd.GenerateMoveset(currentEvent.ints[1]);
                for (int i = 0; i < 4; i++)
                {
                    if (currentEvent.strings[4 + i].Length > 0)
                    {
                        pkMoveset[i] = currentEvent.strings[4 + i];
                    }
                }

                Debug.Log(pkMoveset[0] + ", " + pkMoveset[1] + ", " + pkMoveset[2] + ", " + pkMoveset[3]);


                Pokemon pk = new Pokemon(currentEvent.ints[0], nickname, pkGender, currentEvent.ints[1], currentEvent.bool0, currentEvent.strings[2], currentEvent.strings[3],
                                         currentEvent.strings[1], IVs[0], IVs[1], IVs[2], IVs[3], IVs[4], IVs[5], 0, 0, 0, 0, 0, 0, pkNature, currentEvent.ints[4],
                                         pkMoveset, new int[4]);

                SaveData.currentSave.PC.addPokemon(pk);
            }
            else
            {
                //jump to new tree
                JumpToTree(currentEvent.int0);
            }
            break;

        case (CustomEventDetails.CustomEventType.SetActive):
            if (currentEvent.bool0)
            {
                currentEvent.object0.SetActive(true);
            }
            else
            {
                if (currentEvent.object0 == this.gameObject)
                {
                    deactivateOnFinish = true;
                }
                else if (currentEvent.object0 != PlayerMovement.player.gameObject)                 //important to never deactivate the player
                {
                    currentEvent.object0.SetActive(false);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.SetCVariable:
            SaveData.currentSave.setCVariable(currentEvent.string0, currentEvent.float0);
            break;

        case (CustomEventDetails.CustomEventType.LogicCheck):
            bool passedCheck = false;

            CustomEventDetails.Logic lo = currentEvent.logic;

            switch (lo)
            {
            case CustomEventDetails.Logic.CVariableEquals:
                if (currentEvent.float0 == SaveData.currentSave.getCVariable(currentEvent.string0))
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.CVariableGreaterThan:
                if (SaveData.currentSave.getCVariable(currentEvent.string0) > currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.CVariableLessThan:
                if (SaveData.currentSave.getCVariable(currentEvent.string0) < currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.GymBadgeNoOwned:
                if (Mathf.FloorToInt(currentEvent.float0) < SaveData.currentSave.gymsBeaten.Length &&
                    Mathf.FloorToInt(currentEvent.float0) >= 0)                 //ensure input number is valid
                {
                    if (SaveData.currentSave.gymsBeaten[Mathf.FloorToInt(currentEvent.float0)])
                    {
                        passedCheck = true;
                    }
                }
                break;

            case CustomEventDetails.Logic.GymBadgesEarned:
                int badgeCount = 0;
                for (int bi = 0; bi < SaveData.currentSave.gymsBeaten.Length; bi++)
                {
                    if (SaveData.currentSave.gymsBeaten[bi])
                    {
                        badgeCount += 1;
                    }
                }
                if (badgeCount >= currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.PokemonIDIsInParty:
                for (int pi = 0; pi < 6; pi++)
                {
                    if (SaveData.currentSave.PC.boxes[0][pi] != null)
                    {
                        if (SaveData.currentSave.PC.boxes[0][pi].getID() == Mathf.FloorToInt(currentEvent.float0))
                        {
                            passedCheck = true;
                            pi          = 6;
                        }
                    }
                }
                break;

            case CustomEventDetails.Logic.SpaceInParty:
                if (currentEvent.bool0)
                {
                    if (!SaveData.currentSave.PC.hasSpace(0))
                    {
                        passedCheck = true;
                    }
                }
                else
                {
                    if (SaveData.currentSave.PC.hasSpace(0))
                    {
                        passedCheck = true;
                    }
                }
                break;
            }

            if (passedCheck)
            {
                int newTreeIndex = currentEvent.int0;
                if (newTreeIndex != eventTreeIndex &&                   //only change tree if index is valid
                    newTreeIndex < treesArray.Length)
                {
                    JumpToTree(newTreeIndex);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.TrainerBattle:

            //custom cutouts not yet implemented
            StartCoroutine(ScreenFade.main.FadeCutout(false, ScreenFade.slowedSpeed, null));

            //Automatic LoopStart usage not yet implemented
            Scene.main.Battle.gameObject.SetActive(true);

            Trainer trainer = currentEvent.object0.GetComponent <Trainer>();

            if (trainer.battleBGM != null)
            {
                Debug.Log(trainer.battleBGM.name);
                BgmHandler.main.PlayOverlay(trainer.battleBGM, trainer.samplesLoopStart);
            }
            else
            {
                BgmHandler.main.PlayOverlay(Scene.main.Battle.defaultTrainerBGM, Scene.main.Battle.defaultTrainerBGMLoopStart);
            }
            Scene.main.Battle.gameObject.SetActive(false);
            yield return(new WaitForSeconds(1.6f));

            Scene.main.Battle.gameObject.SetActive(true);
            StartCoroutine(Scene.main.Battle.control(true, trainer, currentEvent.bool0));

            while (Scene.main.Battle.gameObject.activeSelf)
            {
                yield return(null);
            }

            //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
            yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));

            if (currentEvent.bool0)
            {
                if (Scene.main.Battle.victor == 1)
                {
                    int newTreeIndex = currentEvent.int0;
                    if (newTreeIndex != eventTreeIndex &&                       //only change tree if index is valid
                        newTreeIndex < treesArray.Length)
                    {
                        JumpToTree(newTreeIndex);
                    }
                }
            }

            break;
        }
    }
Esempio n. 51
0
        public static int GetCandy(PokemonData pokemon, List<Candy> PokemonFamilies, IEnumerable<PokemonSettings> PokemonSettings)
        {
            var setting = PokemonSettings.FirstOrDefault(q => pokemon != null && q.PokemonId.Equals(pokemon.PokemonId));
            var family = PokemonFamilies.FirstOrDefault(q => setting != null && q.FamilyId.Equals(setting.FamilyId));

            return family.Candy_;
        }
Esempio n. 52
0
        private async Task <MethodResult> IncubateEggs()
        {
            if (!UserSettings.IncubateEggs)
            {
                LogCaller(new LoggerEventArgs("Incubating disabled", LoggerTypes.Info));

                return(new MethodResult
                {
                    Message = "Incubate eggs disabled",
                    Success = true
                });
            }

            MethodResult <EggIncubator> incubatorResponse = GetIncubator();

            if (!incubatorResponse.Success)
            {
                return(new MethodResult
                {
                    Message = incubatorResponse.Message,
                    Success = true
                });
            }

            PokemonData egg = Eggs.FirstOrDefault(x => String.IsNullOrEmpty(x.EggIncubatorId));

            if (egg == null)
            {
                return(new MethodResult
                {
                    Message = "No egg to incubate",
                    Success = true
                });
            }

            var response = await _client.ClientSession.RpcClient.SendRemoteProcedureCallAsync(new Request
            {
                RequestType    = RequestType.UseItemEggIncubator,
                RequestMessage = new UseItemEggIncubatorMessage
                {
                    ItemId    = incubatorResponse.Data.Id,
                    PokemonId = egg.Id
                }.ToByteString()
            });

            if (response == null)
            {
                return(new MethodResult());
            }

            var useItemEggIncubatorResponse = UseItemEggIncubatorResponse.Parser.ParseFrom(response);

            var incitem = incubatorResponse.Data.Id;
            var _egg    = egg.PokemonId;

            LogCaller(new LoggerEventArgs(String.Format("Incubating egg in {0}. Pokemon Id: {1}", incitem, _egg), LoggerTypes.Incubate));

            //TODO: Need tests
            UpdateInventory(InventoryRefresh.Eggs);
            UpdateInventory(InventoryRefresh.Incubators);

            return(new MethodResult
            {
                Message = "Success",
                Success = true
            });
        }
Esempio n. 53
0
 void UpdateScreen()
 {
     for (int i = 0; i < 7; i++)
     {
         int slotNo = topSlotIndex + i;
         entries[i].transform.GetChild(0).GetComponent <CustomText>().text = slotNo.ZeroFormat("00x") + "\n" + (!GameData.instance.pokedexlist[slotNo - 1].seen ? "   ----------" : "   " + PokemonData.IndexToMonUpper(slotNo));
         entries[i].transform.GetChild(1).gameObject.SetActive(GameData.instance.pokedexlist[slotNo - 1].caught);
     }
 }
Esempio n. 54
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            if (AnimationFrame == 1) //At initial frame we pan camera to attacker
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 140) //Move animation begin after 140 frames
            {
                BattleMode.UI.splashText.SetText("");

                MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));

                TerramonMod.ZoomAnimator.ScreenPosX(target.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(target.projectile.position.Y, 500, Easing.OutExpo);

                a      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore1 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + a, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore1].maxPenetrate = 99;
                Main.projectile[spore1].penetrate    = 99;
            }
            else if (AnimationFrame == 155)
            {
                b      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore2 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + b, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore2].maxPenetrate = 99;
                Main.projectile[spore2].penetrate    = 99;
            }
            else if (AnimationFrame == 170)
            {
                c      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore3 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + c, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore3].maxPenetrate = 99;
                Main.projectile[spore3].penetrate    = 99;
            }
            else if (AnimationFrame == 185)
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
                d      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore4 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + d, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore4].maxPenetrate = 99;
                Main.projectile[spore4].penetrate    = 99;
            }
            else if (AnimationFrame == 200)
            {
                e      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore5 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + e, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore5].maxPenetrate = 99;
                Main.projectile[spore5].penetrate    = 99;
            }
            else if (AnimationFrame == 215)
            {
                f      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore6 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + f, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore6].maxPenetrate = 99;
                Main.projectile[spore6].penetrate    = 99;
            }
            else if (AnimationFrame == 265)//At Last frame we destroy new proj
            {
                TerramonMod.ZoomAnimator.ScreenPosX(target.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(target.projectile.position.Y, 500, Easing.OutExpo);
                damageDealt = InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                {
                    CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                }
                Main.projectile[spore1].timeLeft = 0;
                Main.projectile[spore1].active   = false;
                Main.projectile[spore2].timeLeft = 0;
                Main.projectile[spore2].active   = false;
                Main.projectile[spore3].timeLeft = 0;
                Main.projectile[spore3].active   = false;
                Main.projectile[spore4].timeLeft = 0;
                Main.projectile[spore4].active   = false;
                Main.projectile[spore5].timeLeft = 0;
                Main.projectile[spore5].active   = false;
                Main.projectile[spore6].timeLeft = 0;
                Main.projectile[spore6].active   = false;
                BattleMode.queueEndMove          = true;
            }

            else if (AnimationFrame > 140 && AnimationFrame < 265)
            {
                //Vector2 vel = (target.projectile.position + (target.projectile.Size / 2)) - (mon.projectile.position + (mon.projectile.Size / 2));
                //var l = vel.Length();
                //vel.Normalize();
                //Main.projectile[id].position = mon.projectile.position + (vel * (l * (AnimationFrame / 120)));
                if (AnimationFrame < 190)
                {
                    var pos = Main.projectile[spore1].position;
                    Main.projectile[spore1].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + a, mon.projectile.Hitbox.Center(), 140, 190,
                                                                             Easing.Out);
                    AbsorbSpore ai = (AbsorbSpore)Main.projectile[spore1].modProjectile;
                    ai.vel = Main.projectile[spore1].position - pos;
                }
                if (AnimationFrame > 155 && AnimationFrame < 205)
                {
                    var pos = Main.projectile[spore2].position;
                    Main.projectile[spore2].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + b, mon.projectile.Hitbox.Center(), 155, 205,
                                                                             Easing.Out);
                    AbsorbSpore bi = (AbsorbSpore)Main.projectile[spore2].modProjectile;
                    bi.vel = Main.projectile[spore2].position - pos;
                }
                if (AnimationFrame > 170 && AnimationFrame < 220)
                {
                    var pos = Main.projectile[spore3].position;
                    Main.projectile[spore3].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + c, mon.projectile.Hitbox.Center(), 170, 220,
                                                                             Easing.Out);
                    AbsorbSpore ci = (AbsorbSpore)Main.projectile[spore3].modProjectile;
                    ci.vel = Main.projectile[spore3].position - pos;
                }
                if (AnimationFrame > 185 && AnimationFrame < 235)
                {
                    var pos = Main.projectile[spore4].position;
                    Main.projectile[spore4].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + d, mon.projectile.Hitbox.Center(), 185, 235,
                                                                             Easing.Out);
                    AbsorbSpore di = (AbsorbSpore)Main.projectile[spore4].modProjectile;
                    di.vel = Main.projectile[spore4].position - pos;
                }
                if (AnimationFrame > 200 && AnimationFrame < 250)
                {
                    var pos = Main.projectile[spore5].position;
                    Main.projectile[spore5].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + e, mon.projectile.Hitbox.Center(), 200, 250,
                                                                             Easing.Out);
                    AbsorbSpore ei = (AbsorbSpore)Main.projectile[spore5].modProjectile;
                    ei.vel = Main.projectile[spore5].position - pos;
                }
                if (AnimationFrame > 215 && AnimationFrame < 265)
                {
                    var pos = Main.projectile[spore6].position;
                    Main.projectile[spore6].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + f, mon.projectile.Hitbox.Center(), 215, 265,
                                                                             Easing.Out);
                    AbsorbSpore fi = (AbsorbSpore)Main.projectile[spore6].modProjectile;
                    fi.vel = Main.projectile[spore6].position - pos;
                }
            }

            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                endMoveTimer++;
                if (endMoveTimer >= 50 && endMoveTimer < 190)
                {
                    if (opponent)
                    {
                        BattleMode.UI.splashText.SetText($"{deffender.PokemonName} had its energy drained!");
                    }
                    else
                    {
                        if (state == BattleState.BattleWithWild)
                        {
                            BattleMode.UI.splashText.SetText($"The wild {deffender.PokemonName} had its energy drained!");
                        }
                        else
                        if (state == BattleState.BattleWithTrainer)
                        {
                            BattleMode.UI.splashText.SetText($"The foe's {deffender.PokemonName} had its energy drained!");
                        }
                    }
                    //TerramonMod.ZoomAnimator.ScreenPos(mon.projectile.position + new Vector2(12, 0), 500, Easing.OutExpo);
                    TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                    TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
                    //BattleMode.animWindow = 0;
                }
                if (endMoveTimer == 190)
                {
                    BattleMode.UI.splashText.SetText("");
                    // If this attack deals 1 HP of damage, 1 HP will be restored to the user.
                    if ((int)damageDealt == 1)
                    {
                        CombatText.NewText(mon.projectile.Hitbox, CombatText.HealLife, SelfHeal(attacker, mon, 1));
                    }
                    else
                    {
                        CombatText.NewText(mon.projectile.Hitbox, CombatText.HealLife, SelfHeal(attacker, mon, (int)damageDealt / 2));
                    }
                }
                if (endMoveTimer >= 330)
                {
                    endMoveTimer       = 0;
                    AnimationFrame     = 0;
                    BattleMode.moveEnd = false;
                    return(false);
                }
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 55
0
 public static PokemonMove GetPokemonMove2(PokemonData poke)
 {
     var move2 = poke.Move2;
     return move2;
 }
Esempio n. 56
0
    void UseMove(string moveName)
    {
        MoveData moveData = PokemonData.GetMove(moveName);

        switch (moveData.effect)
        {
        case "noEffect": break;

        case "twoFiveEffect": break;

        case "payDayEffect": break;

        case "burnSideEffect1": break;

        case "freezeSideEffect": break;

        case "paralyzeSideEffect1": break;

        case "ohkoEffect": break;

        case "chargeEffect": break;

        case "attackUp2Effect": break;

        case "switchTeleportEffect": break;

        case "flyEffect": break;

        case "trappingEffect": break;

        case "flinchSideEffect2": break;

        case "doubleAttackEffect": break;

        case "jumpKickEffect": break;

        case "accuracyDown1Effect": break;

        case "paralyzeSideEffect2": break;

        case "recoilEffect": break;

        case "thrashEffect": break;

        case "defenseDown1Effect": break;

        case "poisonSideEffect1": break;

        case "twinNeedleEffect": break;

        case "flinchSideEffect1": break;

        case "attackDown1Effect": break;

        case "sleepEffect": break;

        case "confusionEffect": break;

        case "specialDamageEffect": break;

        case "disableEffect": break;

        case "defenseDownSideEffect": break;

        case "mistEffect": break;

        case "confusionSideEffect": break;

        case "speedDownSideEffect": break;

        case "attackDownSideEffect": break;

        case "hyperBeamEffect": break;

        case "drainHpEffect": break;

        case "leechSeedEffect": break;

        case "specialUp1Effect": break;

        case "poisonEffect": break;

        case "paralyzeEffect": break;

        case "speedDown1Effect": break;

        case "specialDownSideEffect": break;

        case "attackUp1Effect": break;

        case "speedUp2Effect": break;

        case "rageEffect": break;

        case "mimicEffect": break;

        case "defenseDown2Effect": break;

        case "evasionUp1Effect": break;

        case "healEffect": break;

        case "defenseUp1Effect": break;

        case "defenseUp2Effect": break;

        case "lightScreenEffect": break;

        case "hazeEffect": break;

        case "reflectEffect": break;

        case "focusEffect": break;

        case "bideEffect": break;

        case "metronomeEffect": break;

        case "mirrorMoveEffect": break;

        case "explodeEffect": break;

        case "poisonSideEffect2": break;

        case "burnSideEffect2": break;

        case "swiftEffect": break;

        case "specialUp2Effect": break;

        case "dreamEaterEffect": break;

        case "transformEffect": break;

        case "splashEffect": break;

        case "conversionEffect": break;

        case "superFangEffect": break;

        case "substituteEffect": break;
        }
    }
Esempio n. 57
0
 public virtual bool IsValidRibbons(PokemonData data)
 {
     return(true);            //Some ribbons are REQUIRED
 }
Esempio n. 58
0
        public static double GetLevel(PokemonData poke)
        {
            switch ((int)((poke.CpMultiplier + poke.AdditionalCpMultiplier) * 1000.0))
            {
            case 93:     // 0.094 * 1000 = 93.99999678134
            case 94:
                return(1);

            case 135:
                return(1.5);

            case 166:
                return(2);

            case 192:
                return(2.5);

            case 215:
                return(3);

            case 236:
                return(3.5);

            case 255:
                return(4);

            case 273:
                return(4.5);

            case 290:
                return(5);

            case 306:
                return(5.5);

            case 321:
                return(6);

            case 335:
                return(6.5);

            case 349:
                return(7);

            case 362:
                return(7.5);

            case 375:
                return(8);

            case 387:
                return(8.5);

            case 399:
                return(9);

            case 411:
                return(9.5);

            case 422:
                return(10);

            case 432:
                return(15);

            case 443:
                return(11);

            case 453:
                return(11.5);

            case 462:
                return(12);

            case 472:
                return(12.5);

            case 481:
                return(13);

            case 490:
                return(13.5);

            case 499:
                return(14);

            case 508:
                return(14.5);

            case 517:
                return(15);

            case 525:
                return(15.5);

            case 534:
                return(16);

            case 542:
                return(16.5);

            case 550:
                return(17);

            case 558:
                return(17.5);

            case 566:
                return(18);

            case 574:
                return(18.5);

            case 582:
                return(19);

            case 589:
                return(19.5);

            case 597:
                return(20);

            case 604:
                return(25);

            case 612:
                return(21);

            case 619:
                return(21.5);

            case 626:
                return(22);

            case 633:
                return(22.5);

            case 640:
                return(23);

            case 647:
                return(23.5);

            case 654:
                return(24);

            case 661:
                return(24.5);

            case 667:
                return(25);

            case 674:
                return(25.5);

            case 681:
                return(26);

            case 687:
                return(26.5);

            case 694:
                return(27);

            case 700:
                return(27.5);

            case 706:
                return(28);

            case 713:
                return(28.5);

            case 719:
                return(29);

            case 725:
                return(29.5);

            case 731:
                return(30);

            case 734:
                return(35);

            case 737:
                return(31);

            case 740:
                return(31.5);

            case 743:
                return(32);

            case 746:
                return(32.5);

            case 749:
                return(33);

            case 752:
                return(33.5);

            case 755:
                return(34);

            case 758:
                return(34.5);

            case 761:
                return(35);

            case 764:
                return(35.5);

            case 767:
                return(36);

            case 770:
                return(36.5);

            case 773:
                return(37);

            case 776:
                return(37.5);

            case 778:
                return(38);

            case 781:
                return(38.5);

            case 784:
                return(39);

            case 787:
                return(39.5);

            case 790:
                return(40);

            default:
                return(0);
            }
        }
Esempio n. 59
0
 public static float Perfect(PokemonData poke)
 {
     return ((float)(poke.IndividualAttack + poke.IndividualDefense + poke.IndividualStamina) / (3.0f * 15.0f)) * 100.0f;
 }
Esempio n. 60
0
        public static double CalculateCPMultiplier(PokemonData poke)
        {
            BaseStats baseStats = GetBaseStats(poke.PokemonId);

            return((baseStats.BaseAttack + poke.IndividualAttack) * Math.Sqrt(baseStats.BaseDefense + poke.IndividualDefense) * Math.Sqrt(baseStats.BaseStamina + poke.IndividualStamina));
        }