public async Task RewriteCodeBin() { await this.TestCodeBinStructure(async codeBin => { TmsHms tmsHms = await ORASConfig.GameConfig.GetTmsHms(); ORASConfig.GameConfig.SaveTmsHms(tmsHms, codeBin); }); }
public async Task SaveTmsHms(TmsHms tmsHms) { var codeBin = await this.GetCodeBin(); this.SaveTmsHms(tmsHms, codeBin); await this.SaveFile(codeBin); }
public async Task Bulbasaur() { PokemonInfoTable pokeInfo = await ORASConfig.GameConfig.GetPokemonInfo(); TmsHms tmsHms = await ORASConfig.GameConfig.GetTmsHms(); PokemonInfo nullInfo = pokeInfo[0]; PokemonInfo bulbasaurInfo = pokeInfo[Species.Bulbasaur]; Assert.AreNotEqual(nullInfo, bulbasaurInfo, "Species info for Bulbasaur is the same as Null/Egg"); Assert.AreEqual(6.9, bulbasaurInfo.WeightKg, "Species weight for Bulbasaur doesn't match the Pokedex!"); Assert.AreEqual(0.7, bulbasaurInfo.HeightM, "Species height for Bulbasaur doesn't match the Pokedex!"); Assert.AreEqual(PokemonTypes.Grass, PokemonTypes.GetValueFrom(bulbasaurInfo.Types[0]), "Bulbasaur's primary type should be Grass!"); Assert.AreEqual(PokemonTypes.Poison, PokemonTypes.GetValueFrom(bulbasaurInfo.Types[1]), "Bulbasaur's secondary type should be Poison!"); TestContext.Out.WriteLine("Bulbasaur can learn the following TMs:"); foreach (var(_, tm) in bulbasaurInfo.TmHm .Select((b, i) => (b, i)) .Where(t => t.Item1)) { string type = tm >= tmsHms.TmIds.Length ? "HM" : "TM"; int num = (type == "HM") ? (tm - 100 + 1) : (tm + 1); TestContext.Out.WriteLine($"\t{type} {num}: {tmsHms.GetMove( tm ).Name}"); } }
public async Task Hm01Cut() { TmsHms tmsHms = await ORASConfig.GameConfig.GetTmsHms(); ushort cutId = tmsHms.HmIds[0]; // TM02 - Dragon Claw (array is 0-indexed) Assert.AreEqual(Moves.Cut, (Move)cutId, $"HM01 should be Cut but it is {( (Move) cutId ).Name}"); }
public async Task Tm02DragonClaw() { TmsHms tmsHms = await ORASConfig.GameConfig.GetTmsHms(); ushort dragonClawId = tmsHms.TmIds[1]; // TM02 - Dragon Claw (array is 0-indexed) Assert.AreEqual(Moves.DragonClaw, (Move)dragonClawId, $"TM02 should be Dragon Claw but it is {( (Move) dragonClawId ).Name}"); }
public async Task <TmsHms> GetTmsHms(bool edited = false) { var codeBin = await this.GetCodeBin(edited); var tmsHms = new TmsHms(this.Version); tmsHms.ReadFromCodeBin(codeBin); return(tmsHms); }
public static Move GetMove(this TmsHms tmsHms, int tmHm) => tmHm >= tmsHms.TmIds.Length ? (Move)tmsHms.HmIds[tmHm - tmsHms.TmIds.Length] : (Move)tmsHms.TmIds[tmHm];
internal void SaveTmsHms(TmsHms tmsHms, CodeBin codeBin) { Assertions.AssertVersion(this.Version, tmsHms.GameVersion); codeBin.WriteStructure(tmsHms); }