示例#1
0
        /// <summary>
        /// Testing battle engine
        /// </summary>
        private void startBattle()
        {
            Trainer trainer = new Trainer();

            //BaseStatsList.initialize();


            BaseMove tackle = new BaseMove("Tackle", "hits the opponent hard", 50, 100, "Normal", "Physical", 35);

            tackle.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove scratch = new BaseMove("Scratch", "hits the opponent hard", 10, 100, "Normal", "Physical", 35);

            scratch.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove bubble = new BaseMove("Bubble", "waters the opponent", 20, 100, "Water", "Special", 30);

            bubble.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove ember = new BaseMove("Ember", "fires the opponent", 40, 100, "Fire", "Special", 25);

            ember.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";



            ActivePokemon charmander = new ActivePokemon(BaseStatsList.basestats);
            ActivePokemon squirtle   = new ActivePokemon(BaseStatsList.basestats);

            charmander.baseStat  = BaseStatsList.GetBaseStats("Charmander");
            charmander.level     = 20;
            charmander.currentHP = charmander.HP;
            charmander.setNickname("Charmander");
            charmander.addExp(charmander.expAtLevel(charmander.level) - 1);
            squirtle.baseStat  = BaseStatsList.GetBaseStats("Squirtle");
            squirtle.level     = 20;
            squirtle.currentHP = squirtle.HP;
            squirtle.setNickname("Squirtle");
            squirtle.addExp(squirtle.expAtLevel(squirtle.level) - 1);


            charmander.move[0] = new ActiveMove(scratch);
            charmander.move[1] = new ActiveMove(ember);
            squirtle.move[0]   = new ActiveMove(bubble);
            squirtle.move[1]   = new ActiveMove(tackle);

            player.addPokemon(squirtle);
            trainer.addPokemon(charmander);

            ScreenHandler.TopScreen.IsVisible = false;
            ScreenHandler.PushScreen(new BattleScreen(graphics, content, font, player, trainer));
        }
示例#2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch  = new SpriteBatch(GraphicsDevice);
            font         = Content.Load <SpriteFont>("font");
            simpleEffect = Content.Load <Effect>("simpleEffect");

            // initialize the screenhandler. need to do it here for the font.
            // ScreenHandler.Initialize(graphics, Content, font);

            if (!Directory.Exists(Application.StartupPath + "\\TileSets"))
            {
                downloadTileSets();
            }

            ScreenHandler.Initialize(graphics, Content, font);
            ScreenHandler.SwitchScreen(new GameScreen(graphics, Content, font));

            world = new World();
            Zone zone = new Zone(2, 2);

            world.addZone(zone);
            world.changeZone(zone);


            GameDraw.Initialize(graphics, Content, font);
            GameDraw.drawAdjObjects = true;
            GameDraw.MakeAdjBuffers(world);

            BaseStatsList.initialize(); //  We need this so we can edit trainer pokemon in the map maker

            // TODO: use this.Content to load your game content here
        }
示例#3
0
        /// <summary>
        /// Must have Pokemon List loaded in memory before calling this function
        /// </summary>
        /// <param name="reader"></param>
        /// <returns>Active Pokemon</returns>
        public static ActivePokemon LoadActivePokemon(BinaryReader reader)
        {
            int           ID      = reader.ReadInt32();
            byte          form    = reader.ReadByte();
            ActivePokemon pokemon = new ActivePokemon(BaseStatsList.basestats);

            pokemon.baseStat  = BaseStatsList.GetBaseStats(ID, form);
            pokemon.IVHP      = reader.ReadInt32();
            pokemon.IVAttack  = reader.ReadInt32();
            pokemon.IVDefense = reader.ReadInt32();
            pokemon.IVSPAtk   = reader.ReadInt32();
            pokemon.IVSPDef   = reader.ReadInt32();
            pokemon.IVSpeed   = reader.ReadInt32();
            pokemon.EVHP      = reader.ReadInt32();
            pokemon.EVAttack  = reader.ReadInt32();
            pokemon.EVDefense = reader.ReadInt32();
            pokemon.EVSPAtk   = reader.ReadInt32();
            pokemon.EVSPDef   = reader.ReadInt32();
            pokemon.EVSpeed   = reader.ReadInt32();
            pokemon.currentHP = reader.ReadInt32();
            pokemon.status    = (MajorStatus)reader.ReadInt16();
            pokemon.ability   = reader.ReadString();
            pokemon.happiness = reader.ReadInt32();
            pokemon.isNamed   = reader.ReadBoolean();
            pokemon.setNickname(reader.ReadString());
            pokemon.level      = reader.ReadInt32();
            pokemon.currentExp = reader.ReadInt32();
            pokemon.isShiny    = reader.ReadBoolean();
            pokemon.nature     = (NatureType)reader.ReadInt16();

            int moves = reader.ReadInt32();

            for (int i = 0; i < moves; i++)
            {
                pokemon.move[i] = LoadActiveMove(reader);
            }

            return(pokemon);
        }
示例#4
0
        /// <summary>
        /// Testing battle engine
        /// </summary>
        private void startBattle()
        {
            Trainer trainer = new Trainer();

            //BaseStatsList.initialize();


            BaseMove tackle = new BaseMove("Tackle", "hits the opponent hard", 50, 100, "Normal", "Physical", 35);

            tackle.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove party = new BaseMove("Party", "hits the opponent hard", 10, 100, "Normal", "Physical", 35);

            party.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                        ShowMessage(target.pokemon.Nickname..'\'s attack decreased!')
                                    end
                                ";
            BaseMove bubble = new BaseMove("Bubble", "waters the opponent", 20, 100, "Water", "Special", 30);

            bubble.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove smile = new BaseMove("Smile", "waters the opponent", 100, 100, "Water", "Special", 30);

            smile.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                        ShowMessage(target.pokemon.Nickname..' died of cuteness!')
                                    end
                                ";
            BaseMove ember = new BaseMove("Ember", "fires the opponent", 40, 100, "Fire", "Special", 25);

            ember.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";

            BaseMove pinkiesense = new BaseMove("Pinkie Sense", "Confuses the opponent", 40, 100, "Fire", "Special", 25);

            pinkiesense.moveScript = @"  if user:hits(move, target) then
                                        s = target.pokemon.Nickname..' is confused!'
                                        ShowMessage(s)
                                    end
                                ";


            ActivePokemon charmander = new ActivePokemon(BaseStatsList.basestats);
            ActivePokemon squirtle   = new ActivePokemon(BaseStatsList.basestats);

            charmander.baseStat  = BaseStatsList.GetBaseStats("Charmander");
            charmander.level     = 20;
            charmander.currentHP = charmander.HP;
            charmander.setNickname("Charmander");
            charmander.addExp(charmander.expAtLevel(charmander.level) - 1);
            squirtle.baseStat  = BaseStatsList.GetBaseStats("Squirtle");
            squirtle.level     = 20;
            squirtle.currentHP = squirtle.HP;
            squirtle.setNickname("Pinkie Pie");
            squirtle.addExp(squirtle.expAtLevel(squirtle.level) - 1);


            charmander.move[0] = new ActiveMove(tackle);
            charmander.move[1] = new ActiveMove(ember);
            squirtle.move[0]   = new ActiveMove(party);
            squirtle.move[1]   = new ActiveMove(smile);
            squirtle.move[2]   = new ActiveMove(pinkiesense);

            player.addPokemon(squirtle);
            trainer.addPokemon(charmander);

            ScreenHandler.PushScreen(new BattleScreen(graphics, content, font, player, trainer));
        }
示例#5
0
 public static void LoadBaseStatsList(BinaryReader reader)
 {
     BaseStatsList.LoadBaseStatsList(reader);
 }
示例#6
0
        //This region is for saving and loading the static Base Stats List
        #region BaseStatsList

        public static void SaveBaseStatsList(BinaryWriter writer)
        {
            BaseStatsList.SaveBaseStatsList(writer);
        }
示例#7
0
        public static void StartRandomEncounter(Player player)
        {
            //This is only a test implementation for now
            //Starts random battle with Starly, Rattata, or HootHoot
            Trainer trainer = new Trainer();


            BaseMove tackle = new BaseMove("Tackle", "hits the opponent hard", 50, 100, "Normal", "Physical", 35);

            tackle.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove scratch = new BaseMove("Scratch", "hits the opponent hard", 40, 100, "Normal", "Physical", 35);

            scratch.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove growl = new BaseMove("Growl", "Lowers target's attack", 0, 100, "Normal", "Special", 40);

            growl.moveScript = @" if user:hits(move, target) then
                                    target:changeStat('Attack', -1)
                                    ShowMessage(target.pokemon.Nickname .. 'has had their attack lowered')
                                    end
                                ";
            BaseMove foresight = new BaseMove("Foresight", "Negates accuracy reduction moves", 0, "Normal", "Status", 40);

            foresight.moveScript = @"target:changeStat('Accuracy', 12)
                                    target:changeStat('Accuracy', -6)
                                    ShowMessage(target.pokemon.Nickname .. 'has had their accuracy reset')
                                ";
            BaseMove quickattack = new BaseMove("Quick Attack", "Always strikes first", 40, 100, "Normal", "Physical", 30);

            quickattack.basePriority = 1;
            quickattack.moveScript   = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove tailwhip = new BaseMove("Tail Whip", "Lowers target's defense", 0, 100, "Normal", "Special", 40);

            tailwhip.moveScript = @" if user:hits(move, target) then
                                    target:changeStat('Defense', -1)
                                    ShowMessage(target.pokemon.Nickname .. 'has had their defense lowered')
                                    end
                                ";


            ActivePokemon enemy  = new ActivePokemon(BaseStatsList.basestats);
            Random        random = new Random();
            int           r      = random.Next(3);

            switch (r)
            {
            case 0:
                enemy.baseStat = BaseStatsList.GetBaseStats("Starly");
                enemy.move[0]  = new ActiveMove(tackle);
                enemy.move[1]  = new ActiveMove(growl);
                enemy.move[2]  = new ActiveMove(quickattack);
                break;

            case 1:
                enemy.baseStat = BaseStatsList.GetBaseStats("Hoothoot");
                enemy.move[0]  = new ActiveMove(tackle);
                enemy.move[1]  = new ActiveMove(growl);
                enemy.move[2]  = new ActiveMove(foresight);
                break;

            case 2:
                enemy.baseStat = BaseStatsList.GetBaseStats("Rattata");
                enemy.move[0]  = new ActiveMove(tackle);
                enemy.move[1]  = new ActiveMove(tailwhip);
                enemy.move[2]  = new ActiveMove(quickattack);
                break;

            default: return;
            }

            enemy.level     = 5;
            enemy.currentHP = enemy.HP;
            enemy.addExp(enemy.expAtLevel(enemy.level) - 1);

            trainer.addPokemon(enemy);

            ScreenHandler.TopScreen.IsVisible = false;
            ScreenHandler.PushScreen(new BattleScreen(graphics, content, font, player, trainer));
        }
示例#8
0
        public static void AddNewPokemon(Player player, string pokemonname, int level)
        {
            BaseMove tackle = new BaseMove("Tackle", "hits the opponent hard", 50, 100, "Normal", "Physical", 35);

            tackle.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove scratch = new BaseMove("Scratch", "hits the opponent hard", 40, 100, "Normal", "Physical", 35);

            scratch.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove pound = new BaseMove("Pound", "hits the opponent hard", 40, 100, "Normal", "Physical", 35);

            pound.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove growl = new BaseMove("Growl", "Lowers target's attack", 0, 100, "Normal", "Special", 40);

            growl.moveScript = @" if user:hits(move, target) then
                                    target:changeStat('Attack', -1)
                                    ShowMessage(target.pokemon.Nickname .. 'has had their attack lowered')
                                    end
                                ";
            BaseMove foresight = new BaseMove("Foresight", "Negates accuracy reduction moves", 0, "Normal", "Status", 40);

            foresight.moveScript = @"target:changeStat('Accuracy', 12)
                                    target:changeStat('Accuracy', -6)
                                    ShowMessage(target.pokemon.Nickname .. 'has had their accuracy reset')
                                ";
            BaseMove quickattack = new BaseMove("Quick Attack", "Always strikes first", 40, 100, "Normal", "Physical", 30);

            quickattack.basePriority = 1;
            quickattack.moveScript   = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove tailwhip = new BaseMove("Tail Whip", "Lowers target's defense", 0, 100, "Normal", "Special", 40);

            tailwhip.moveScript = @" if user:hits(move, target) then
                                    target:changeStat('Defense', -1)
                                    ShowMessage(target.pokemon.Nickname .. 'has had their defense lowered')
                                    end
                                ";
            BaseMove ember = new BaseMove("Ember", "fires the opponent", 40, 100, "Fire", "Special", 25);

            ember.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove bubble = new BaseMove("Bubble", "waters the opponent", 20, 100, "Water", "Special", 30);

            bubble.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";
            BaseMove razorleaf = new BaseMove("Razor Leaf", "Sends razor sharp leaves at the target", 55, 95, "Grass", "Special", 25);

            razorleaf.moveScript = @"  if user:hits(move, target) then
                                        user:doDamageTo(move, target)
                                    end
                                ";


            ActivePokemon newPokemon = new ActivePokemon(BaseStatsList.basestats);

            switch (pokemonname)
            {
            case "Charmander":
                newPokemon.baseStat = BaseStatsList.GetBaseStats("Charmander");
                newPokemon.move[0]  = new ActiveMove(scratch);
                newPokemon.move[1]  = new ActiveMove(growl);
                newPokemon.move[2]  = new ActiveMove(ember);
                break;

            case "Mudkip":
                newPokemon.baseStat = BaseStatsList.GetBaseStats("Piplup");
                newPokemon.move[0]  = new ActiveMove(pound);
                newPokemon.move[1]  = new ActiveMove(growl);
                newPokemon.move[2]  = new ActiveMove(bubble);
                break;

            case "Chikorita":
                newPokemon.baseStat = BaseStatsList.GetBaseStats("Chikorita");
                newPokemon.move[0]  = new ActiveMove(tackle);
                newPokemon.move[1]  = new ActiveMove(growl);
                newPokemon.move[2]  = new ActiveMove(razorleaf);
                break;

            default:
                newPokemon.baseStat = BaseStatsList.GetBaseStats("Piplup");
                newPokemon.move[0]  = new ActiveMove(pound);
                newPokemon.move[1]  = new ActiveMove(growl);
                newPokemon.move[2]  = new ActiveMove(bubble);
                break;
            }

            newPokemon.level     = 7;
            newPokemon.currentHP = newPokemon.HP;
            newPokemon.addExp(newPokemon.expAtLevel(newPokemon.level) - 1);
            player.currentPokemon[0] = newPokemon;
        }