Beispiel #1
0
 public Trainer(string name, TrainerTypes trainertype)
 {
     this.name        = name;
     @language        = Game.pbGetLanguage();
     this.trainertype = trainertype;
     @id       = Core.Rand.Next(256);
     @id      |= Core.Rand.Next(256) << 8;
     @id      |= Core.Rand.Next(256) << 16;
     @id      |= Core.Rand.Next(256) << 24;
     @metaID   = 0;
     @outfit   = 0;
     @pokegear = false;
     @pokedex  = false;
     clearPokedex();
     //@shadowcaught=new bool[0];
     //for (int i = 1; i < Game.PokemonData.Count; i++) {
     //  @shadowcaught[i]=false;
     //}
     @shadowcaught = new List <Pokemons>();
     @badges       = new bool[0];
     for (int i = 0; i < 8; i++)
     {
         @badges[i] = false;
     }
     @money = Core.INITIALMONEY;
     @party = new Monster.Pokemon[Core.MAXPARTYSIZE];
 }
Beispiel #2
0
 public static int?getFormOnEnteringBattle(Monster.Pokemon pokemon)
 {
     if (pokemon.Species == Pokemons.BURMY)
     {
         ////Environment env=Environment.None;
         //Environments env=Game.pbGetEnvironment();
         //if (!Game.pbGetMetadata(Game.GameData.GameMap.map_id,MetadataOutdoor)) {
         ////if (Game.TileData[Game.GameData.Player.Area] == Indoor) {
         //  return 2; // Trash Cloak
         //} else if (env==Environments.Sand ||
         //      env==Environments.Rock ||
         //      env==Environments.Cave) {
         //  return 1; // Sandy Cloak
         //}
         //else {
         //  return 0; // Plant Cloak
         //}
         // }
         // else if (pokemon.Species == Pokemons.XERNEAS)
         // {
         return(1);
     }
     else
     {
         return(null); //pokemon.pokemon.FormId;
     }
 }
Beispiel #3
0
 public int pbStorePokemon(Combat.Trainer player, Monster.Pokemon pokemon)
 {
     if (player.party.GetCount() < 6)
     {
         player.party[player.party.GetCount()] = pokemon;
         return(-1);
     }
     else
     {
         pokemon.Heal();
         //int oldcurbox=Game.GameData.PokemonStorage.currentBox;
         //int storedbox=Game.GameData.PokemonStorage.pbStoreCaught(pokemon);
         int oldcurbox = Game.GameData.Player.PC.ActiveBox;
         int?storedbox = Game.GameData.Player.PC.getIndexOfFirstEmpty();
         //if (storedbox<0) {
         if (!storedbox.HasValue)
         {
             //Game.UI.pbDisplayPaused(Game._INTL("Can't catch any more..."));
             return(oldcurbox);
         }
         else
         {
             return(storedbox.Value);
         }
     }
 }
Beispiel #4
0
 public void InitPokemon(Monster.Pokemon pkmn, sbyte pkmnIndex) //, params object[] placeholder
 {
     if (pokemonIndex > 0 && inHyperMode() && !isFainted())
     {
         // Called out of hypermode
         pkmn.hypermode = false;
         //pkmn.isHyperMode=false;
         //pkmn.adjustHeart(-50);
         pkmn.decreaseShadowLevel(Monster.Pokemon.PokemonActions.CallTo);
     }
     this._InitPokemon(pkmn, pkmnIndex);
     // Called into battle
     if (isShadow())
     {
         //if (hasConst(Types.SHADOW))
         Type1 = Types.SHADOW;
         Type2 = Types.SHADOW;
         //}
         //if (@battle.pbOwnedByPlayer(@Index)) this.pokemon.adjustHeart(-30);
         if (@battle.pbOwnedByPlayer(@Index))
         {
             this.pokemon.decreaseShadowLevel(Monster.Pokemon.PokemonActions.Battle);
         }
     }
 }
Beispiel #5
0
 public int pbStorePokemon(Combat.Trainer player, Monster.Pokemon pokemon)
 {
     if (player.party.GetCount() < 6)
     {
         player.party[player.party.GetCount()] = pokemon;
     }
     return(-1);
 }
Beispiel #6
0
 public bool isShadow()
 {
     Monster.Pokemon p = this.pokemon;
     if (p.IsNotNullOrNone() && p is Monster.IShadowPokemon && ((Monster.IShadowPokemon)p).heartgauge > 0) //p.ShadowLevel.HasValue && p.ShadowLevel.Value>0)
     {
         return(p.isShadow);
     }
     return(false);
 }
Beispiel #7
0
        public void pbOnEnteringBattle(Combat.Battle battle, Monster.Pokemon pokemon)
        {
            //int? f=MultipleForms.call("getFormOnEnteringBattle",pokemon);
            int?f = MultipleForms.getFormOnEnteringBattle(pokemon);

            if (f.HasValue)
            {
                //pokemon.form=f.Value;
                pokemon.SetForm(f.Value);
            }
            //pokemon.SetForm(f);
        }
Beispiel #8
0
 public void pbHyperMode()
 {
     Monster.Pokemon p = this.pokemon;
     if (isShadow() && !IsHyperMode)
     {
         if (@battle.pbRandom(p.ShadowLevel.Value) <= Monster.Pokemon.HEARTGAUGESIZE / 4) //p.HeartGuageSize
         {
             isHyperMode = true;
             @battle.pbDisplay(Game._INTL("{1}'s emotions rose to a fever pitch!\nIt entered Hyper Mode!", this.ToString()));
         }
     }
 }
Beispiel #9
0
 public bool inHyperMode()
 {
     if (isFainted())
     {
         return(false);
     }
     Monster.Pokemon p = this.pokemon;
     if (p.IsNotNullOrNone() && p is Monster.IShadowPokemon && ((Monster.IShadowPokemon)p).hypermode) //&& IsHyperMode)
     {
         return(true);
     }
     return(false);
 }
Beispiel #10
0
 public static void OnCatch(Items ball, Battle battle, Monster.Pokemon pokemon)
 {
     //if (!OnCatch[ball]) return;
     //OnCatch.trigger(ball,battle,pokemon);
     if (ball == Items.HEAL_BALL)
     {
         pokemon.Heal();
     }
     else if (ball == Items.FRIEND_BALL)
     {
         //e.pokemon.Happiness=200;
         //e.pokemon.ChangeHappiness(HappinessMethods.FRIENDBALL);
     }
     else
     {
         return;
     }
 }
Beispiel #11
0
 public Monster.Pokemon[,] GetPokemonsFromSeri()
 {
     //Monster.Pokemon[,] pkmn = new Monster.Pokemon[Pokemons.Length, Pokemons.GetLength(1)];
     Monster.Pokemon[,] pkmn = new Monster.Pokemon[Pokemons.Length, Pokemons[0].Length];
     for (int i = 0; i < Pokemons.Length; i++)
     {
         for (int j = 0; j < Pokemons[i].Length; j++)
         {
             //Easier if it only grabs actual pokemons (with values), than trying to copy everything...
             if ((PokemonUnity.Pokemons)Pokemons[i][j].Species != PokemonUnity.Pokemons.NONE) //|| Pokemons[i][j] == null
             {
                 pkmn[i, j] = (Monster.Pokemon)Pokemons[i][j];
             }
             else
             {
                 pkmn[i, j] = new Monster.Pokemon(PokemonUnity.Pokemons.NONE);
             }
         }
     }
     return(pkmn);
 }
Beispiel #12
0
 public void pbOnEnteringBattle(Combat.Battle battle, Monster.Pokemon pokemon)
 {
 }
Beispiel #13
0
 public static void onSetForm(Monster.Pokemon pokemon, int form)
 {
     if (pokemon.Species == Pokemons.ROTOM)
     {
         Moves[] moves = new Moves[] {
             Moves.OVERHEAT,   // Heat, Microwave
             Moves.HYDRO_PUMP, // Wash, Washing Machine
             Moves.BLIZZARD,   // Frost, Refrigerator
             Moves.AIR_SLASH,  // Fan
             Moves.LEAF_STORM  // Mow, Lawnmower
         };
         int hasoldmove = -1;
         for (int i = 0; i < 4; i++)
         {
             for (int j = 0; j < moves.Length; j++)
             {
                 if (pokemon.moves[i].MoveId == moves[j])
                 {
                     hasoldmove = i; break;
                 }
             }
             if (hasoldmove >= 0)
             {
                 break;
             }
         }
         if (form > 0)
         {
             Moves newmove = moves[form - 1];
             if (newmove != Moves.NONE) //&& hasConst(PBMoves,newmove)
             {
                 if (hasoldmove >= 0)
                 {
                     // Automatically replace the old form's special move with the new one's
                     string oldmovename = pokemon.moves[hasoldmove].MoveId.ToString(TextScripts.Name);
                     string newmovename = newmove.ToString(TextScripts.Name);
                     pokemon.moves[hasoldmove] = new Attack.Move(newmove);
                     Game.pbMessage(Game._INTL("\\se[]1,\\wt[4] 2,\\wt[4] and...\\wt[8] ...\\wt[8] ...\\wt[8] Poof!\\se[balldrop]\\1"));
                     Game.pbMessage(Game._INTL("{1} forgot how to\r\nuse {2}.\\1", pokemon.Name, oldmovename));
                     Game.pbMessage(Game._INTL("And...\\1"));
                     Game.pbMessage(Game._INTL("\\se[]{1} learned {2}!\\se[MoveLearnt]", pokemon.Name, newmovename));
                 }
                 else
                 {
                     // Try to learn the new form's special move
                     //pbLearnMove(pokemon,newmove,true);
                     pokemon.LearnMove(newmove, out bool s);
                 }
             }
         }
         else
         {
             if (hasoldmove >= 0)
             {
                 // Forget the old form's special move
                 string oldmovename = pokemon.moves[hasoldmove].MoveId.ToString(TextScripts.Name);
                 pokemon.DeleteMoveAtIndex(hasoldmove);
                 Game.pbMessage(Game._INTL("{1} forgot {2}...", pokemon.Name, oldmovename));
                 if (pokemon.moves.Count(i => i.MoveId != 0) == 0)
                 {
                     //pbLearnMove(pokemon,Moves.THUNDER_SHOCK);
                     pokemon.LearnMove(Moves.THUNDER_SHOCK, out bool s);
                 }
             }
         }
     }
     else if (pokemon.Species == Pokemons.FURFROU || pokemon.Species == Pokemons.HOOPA)
     {
         pokemon.formTime = (form > 0) ? Game.GetTimeNow : (DateTime?)null;
     }
 }
Beispiel #14
0
 public static int getForm(Monster.Pokemon pokemon)
 {
     if (pokemon.Species == Pokemons.GIRATINA)
     {
         int[] maps = new int[] { 49, 50, 51, 72, 73 }; // Map IDs for Origin Forme
         if (pokemon.Item == Items.GRISEOUS_ORB ||
             //(Game.GameData.GameMap != null && maps.Contains(Game.GameData.GameMap.map_id))) {
             Game.GameData != null && maps.Contains(Game.GameData.Player.Area))
         {
             return(1);
         }
         return(0);
     }
     else if (pokemon.Species == Pokemons.SHAYMIN)
     {
         if (pokemon.HP <= 0 || pokemon.Status == Status.FROZEN || Game.IsNight)
         {
             return(0);                                                   //null;
         }
     }
     else if (pokemon.Species == Pokemons.ARCEUS)
     {
         if (pokemon.Item == Items.FIST_PLATE)
         {
             return(1);
         }
         if (pokemon.Item == Items.SKY_PLATE)
         {
             return(2);
         }
         if (pokemon.Item == Items.TOXIC_PLATE)
         {
             return(3);
         }
         if (pokemon.Item == Items.EARTH_PLATE)
         {
             return(4);
         }
         if (pokemon.Item == Items.STONE_PLATE)
         {
             return(5);
         }
         if (pokemon.Item == Items.INSECT_PLATE)
         {
             return(6);
         }
         if (pokemon.Item == Items.SPOOKY_PLATE)
         {
             return(7);
         }
         if (pokemon.Item == Items.IRON_PLATE)
         {
             return(8);
         }
         if (pokemon.Item == Items.FLAME_PLATE)
         {
             return(10);
         }
         if (pokemon.Item == Items.SPLASH_PLATE)
         {
             return(11);
         }
         if (pokemon.Item == Items.MEADOW_PLATE)
         {
             return(12);
         }
         if (pokemon.Item == Items.ZAP_PLATE)
         {
             return(13);
         }
         if (pokemon.Item == Items.MIND_PLATE)
         {
             return(14);
         }
         if (pokemon.Item == Items.ICICLE_PLATE)
         {
             return(15);
         }
         if (pokemon.Item == Items.DRACO_PLATE)
         {
             return(16);
         }
         if (pokemon.Item == Items.DREAD_PLATE)
         {
             return(17);
         }
         if (pokemon.Item == Items.PIXIE_PLATE)
         {
             return(18);
         }
         return(0);
     }
     else if (pokemon.Species == Pokemons.DEERLING || pokemon.Species == Pokemons.SAWSBUCK)
     {
         return((int)Game.Season);//pbGetSeason();
     }
     else if (pokemon.Species == Pokemons.KELDEO)
     {
         if (pokemon.hasMove(Moves.SECRET_SWORD))
         {
             return(1);                 // Resolute Form
         }
         return(0);                     // Ordinary Form
     }
     else if (pokemon.Species == Pokemons.GENESECT)
     {
         if (pokemon.Item == Items.SHOCK_DRIVE)
         {
             return(1);
         }
         if (pokemon.Item == Items.BURN_DRIVE)
         {
             return(2);
         }
         if (pokemon.Item == Items.CHILL_DRIVE)
         {
             return(3);
         }
         if (pokemon.Item == Items.DOUSE_DRIVE)
         {
             return(4);
         }
         return(0);
     }
     else if (pokemon.Species == Pokemons.FURFROU)
     {
         if (!pokemon.formTime.HasValue || Game.GetTimeNow > pokemon.formTime.Value.AddDays(5))  // 5 days => +60*60*24*5
         {
             return(0);
         }
         //continue;
     }
     else if (pokemon.Species == Pokemons.HOOPA)
     {
         if (!pokemon.formTime.HasValue || Game.GetTimeNow > pokemon.formTime.Value.AddDays(3))  // 3 days => +60*60*24*3
         {
             return(0);
         }
         //continue;
     }
     //else
     return(pokemon.FormId); //0;
 }
Beispiel #15
0
        public BattleResults pbStartBattle()
        {
            try { //begin
                Monster.Pokemon wildpoke = @party2[0];
                //this.pbPlayer.seen[wildpoke.Species]=true;
                Game.GameData.Player.Pokedex[(int)wildpoke.Species, 0] = (byte)1;
                //Game.pbSeenForm(wildpoke);
                base.pbSetSeen(wildpoke);
                @scene.pbStartBattle(this);
                pbDisplayPaused(Game._INTL("Wild {1} appeared!", wildpoke.Name));
                @scene.pbSafariStart();
                //dexdata=pbOpenDexData;
                //pbDexDataOffset(dexdata,wildpoke.Species,16);
                //rareness=dexdata.fgetb; // Get rareness from dexdata file
                //dexdata.close;
                int rareness = (int)Game.PokemonData[wildpoke.Species].Rarity;
                int g        = (rareness * 100) / 1275;
                int e        = (pbEscapeRate(rareness) * 100) / 1275;
                g = (int)Math.Min((int)Math.Max(g, 3), 20);
                e = (int)Math.Min((int)Math.Max(e, 3), 20);
                int lastCommand = 0;
                do //begin;
                {
                    int cmd = @scene.pbSafariCommandMenu(0);
                    switch (cmd)
                    {
                    case 0: // Ball
                        //if (Game.GameData.Player.PC.pbBoxesFull()) {
                        if (Game.GameData.Player.PC.hasSpace())
                        {
                            pbDisplay(Game._INTL("The boxes are full! You can't catch any more Pokémon!"));
                            continue;
                        }
                        @ballCount -= 1;
                        int   rare       = (g * 1275) / 100;
                        Items safariBall = Items.SAFARI_BALL;
                        if (safariBall != Items.NONE)
                        {
                            base.pbThrowPokeball(1, safariBall, rare, true);
                        }
                        break;

                    case 1: // Bait
                        pbDisplayBrief(Game._INTL("{1} threw some bait at the {2}!", this.pbPlayer().name, wildpoke.Name));
                        @scene.pbThrowBait();
                        g          /= 2; // Harder to catch
                        e          /= 2; // Less likely to escape
                        g           = (int)Math.Min((int)Math.Max(g, 3), 20);
                        e           = (int)Math.Min((int)Math.Max(e, 3), 20);
                        lastCommand = 1;
                        break;

                    case 2: // Rock
                        pbDisplayBrief(Game._INTL("{1} threw a rock at the {2}!", this.pbPlayer().name, wildpoke.Name));
                        @scene.pbThrowRock();
                        g          *= 2; // Easier to catch
                        e          *= 2; // More likely to escape
                        g           = (int)Math.Min((int)Math.Max(g, 3), 20);
                        e           = (int)Math.Min((int)Math.Max(e, 3), 20);
                        lastCommand = 2;
                        break;

                    case 3: // Run
                        pbDisplayPaused(Game._INTL("Got away safely!"));
                        @decision = BattleResults.FORFEIT;
                        break;
                    }
                    if (@decision == 0)
                    {
                        if (@ballCount <= 0)
                        {
                            pbDisplay(Game._INTL("PA:  You have no Safari Balls left! Game over!"));
                            @decision = BattleResults.LOST;
                        }
                        else if (pbRandom(100) < 5 * e)
                        {
                            pbDisplay(Game._INTL("{1} fled!", wildpoke.Name));
                            @decision = BattleResults.FORFEIT;
                        }
                        else if (lastCommand == 1)
                        {
                            pbDisplay(Game._INTL("{1} is eating!", wildpoke.Name));
                        }
                        else if (lastCommand == 2)
                        {
                            pbDisplay(Game._INTL("{1} is angry!", wildpoke.Name));
                        }
                        else
                        {
                            pbDisplay(Game._INTL("{1} is watching carefully!", wildpoke.Name));
                        }
                    }
                } while (@decision == 0);
                @scene.pbEndBattle(@decision);
            } catch { //rescue BattleAbortedException;
                @decision = 0;
                @scene.pbEndBattle(@decision);
            }
            return(@decision);
        }
Beispiel #16
0
        /// <summary>
        /// Returns if a Pokémon likes this berry based on its flavour.
        /// </summary>
        /// <param name="p">The Pokémon to test this berry for.</param>
        public bool PokemonLikes(Monster.Pokemon p)
        {
            switch (p.Nature)
            {
            case Monster.Natures.LONELY:
            {
                if (Flavour == Flavours.Spicy)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Sour)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.ADAMANT:
            {
                if (Flavour == Flavours.Spicy)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Dry)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.NAUGHTY:
            {
                if (Flavour == Flavours.Spicy)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Bitter)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.BRAVE:
            {
                if (Flavour == Flavours.Spicy)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Sweet)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.BOLD:
            {
                if (Flavour == Flavours.Sour)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Spicy)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.IMPISH:
            {
                if (Flavour == Flavours.Sour)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Dry)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.LAX:
            {
                if (Flavour == Flavours.Sour)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Bitter)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.RELAXED:
            {
                if (Flavour == Flavours.Sour)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Sweet)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.MODEST:
            {
                if (Flavour == Flavours.Dry)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Spicy)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.MILD:
            {
                if (Flavour == Flavours.Dry)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Sour)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.RASH:
            {
                if (Flavour == Flavours.Dry)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Bitter)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.QUIET:
            {
                if (Flavour == Flavours.Dry)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Sweet)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.CALM:
            {
                if (Flavour == Flavours.Bitter)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Spicy)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.GENTLE:
            {
                if (Flavour == Flavours.Bitter)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Sour)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.CAREFUL:
            {
                if (Flavour == Flavours.Bitter)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Dry)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.SASSY:
            {
                if (Flavour == Flavours.Bitter)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Sweet)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.TIMID:
            {
                if (Flavour == Flavours.Sweet)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Spicy)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.HASTY:
            {
                if (Flavour == Flavours.Sweet)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Sour)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.JOLLY:
            {
                if (Flavour == Flavours.Sweet)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Dry)
                {
                    return(false);
                }
                break;
            }

            case Monster.Natures.NAIVE:
            {
                if (Flavour == Flavours.Sweet)
                {
                    return(true);
                }
                else if (Flavour == Flavours.Bitter)
                {
                    return(false);
                }
                break;
            }

            default:
            {
                return(true);
            }
            }
            return(true);
        }
Beispiel #17
0
 public string pbNameEntry(string helptext, Monster.Pokemon pokemon)
 {
     throw new NotImplementedException();
 }