/// <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)); }
/// <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); }
/// <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)); }