Further tweaks

Handle terminated strings better for 1->7
Indicate RBY encounter origins when transferred to 7+.
Remove check duplication
This commit is contained in:
Kurt 2017-02-14 22:06:15 -08:00
parent dcb30e61a8
commit 679efcd741
6 changed files with 64 additions and 39 deletions

View File

@ -155,8 +155,6 @@ private void updateEncounterInfo()
private void updateChecks()
{
History = verifyHistory();
AddLine(Encounter);
AddLine(History);
verifyECPID();

View File

@ -51,7 +51,7 @@ public class CheckResult
public bool Flag;
private readonly CheckIdentifier Identifier;
internal CheckResult(CheckIdentifier i) { }
internal CheckResult(CheckIdentifier i) { Identifier = i; }
internal CheckResult(Severity s, string c, CheckIdentifier i)
{
Judgement = s;
@ -622,11 +622,19 @@ private CheckResult verifyVCEncounter(int baseSpecies)
species = baseSpecies;
// Check existing EncounterMatch
if (EncounterMatch == null)
AddLine(new CheckResult(Severity.Invalid, "Unable to match an encounter from origin game.", CheckIdentifier.Encounter));
string oldEncounter = (EncounterMatch as IEncounterable)?.Name;
AddLine(oldEncounter != null
? new CheckResult(Severity.Valid, "Origin game encounter: " + oldEncounter, CheckIdentifier.Encounter)
: new CheckResult(Severity.Invalid, "Unable to match an encounter from origin game.", CheckIdentifier.Encounter));
var s = EncounterMatch as EncounterStatic;
if (s != null && s.Version == GameVersion.SPECIAL)
AddLine(new CheckResult(Severity.Invalid, "Special encounter is not available to Virtual Console games.", CheckIdentifier.Encounter));
{
bool exceptions = false;
exceptions |= baseSpecies == 151 && pkm.TID == 22796;
if (!exceptions)
AddLine(new CheckResult(Severity.Invalid, "Special encounter is not available to Virtual Console games.", CheckIdentifier.Encounter));
}
EncounterMatch = new EncounterStatic
{
@ -637,6 +645,7 @@ private CheckResult verifyVCEncounter(int baseSpecies)
Fateful = species == 151,
Location = 30013,
EggLocation = 0,
Version = GameVersion.RBY
};
var ematch = (EncounterStatic) EncounterMatch;

View File

@ -25,7 +25,16 @@ public EncounterSlot(EncounterSlot template)
Pressure = template.Pressure;
}
public string Name => "Wild Encounter";
public string Name
{
get
{
const string wild = "Wild Encounter";
if (Type == SlotType.Any)
return wild;
return wild + " " + $"{Type.ToString().Replace("_", " ")}";
}
}
}
public class EncounterSlot1 : EncounterSlot
{

View File

@ -26,6 +26,15 @@ public class EncounterStatic : IEncounterable
public bool RibbonWishing = false;
public bool SkipFormCheck = false;
public string Name => "Static Encounter";
public string Name
{
get
{
const string game = "Static Encounter";
if (Version == GameVersion.Any)
return game;
return game + " " + $"({Version})";
}
}
}
}

View File

@ -45,25 +45,25 @@ public static partial class Legal
internal static readonly EncounterStatic[] Encounter_RBY =
{
new EncounterStatic { Species = 001, Level = 05 }, // Bulbasaur
new EncounterStatic { Species = 004, Level = 05 }, // Charmander
new EncounterStatic { Species = 007, Level = 05 }, // Squirtle
new EncounterStatic { Species = 001, Level = 05, Version = GameVersion.RBY }, // Bulbasaur
new EncounterStatic { Species = 004, Level = 05, Version = GameVersion.RBY }, // Charmander
new EncounterStatic { Species = 007, Level = 05, Version = GameVersion.RBY }, // Squirtle
new EncounterStatic { Species = 025, Level = 05, Version = GameVersion.YW }, // Pikachu
// Game Corner
new EncounterStatic { Species = 030, Level = 17 }, // Nidorina (Red Game Corner)
new EncounterStatic { Species = 033, Level = 17 }, // Nidorino (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 035, Level = 08 }, // Clefairy (Red Game Corner)
new EncounterStatic { Species = 036, Level = 24 }, // Clefable (Blue[JP] Game Corner)
new EncounterStatic { Species = 037, Level = 18 }, // Vulpix (Yellow Game Corner)
new EncounterStatic { Species = 040, Level = 22 }, // Wigglytuff (Yellow Game Corner)
new EncounterStatic { Species = 063, Level = 06 }, // Abra (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 116, Level = 18 }, // Horsea (Blue[JP] Game Corner)
new EncounterStatic { Species = 123, Level = 25 }, // Scyther (Red Game Corner)
new EncounterStatic { Species = 127, Level = 20 }, // Pinsir (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 137, Level = 18 }, // Porygon (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 147, Level = 18 }, // Dratini (Red Game Corner)
new EncounterStatic { Species = 148, Level = 30 }, // Dragonair (Blue[JP] Game Corner)
new EncounterStatic { Species = 030, Level = 17, Version = GameVersion.RBY }, // Nidorina (Red Game Corner)
new EncounterStatic { Species = 033, Level = 17, Version = GameVersion.RBY }, // Nidorino (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 035, Level = 08, Version = GameVersion.RBY }, // Clefairy (Red Game Corner)
new EncounterStatic { Species = 036, Level = 24, Version = GameVersion.RBY }, // Clefable (Blue[JP] Game Corner)
new EncounterStatic { Species = 037, Level = 18, Version = GameVersion.RBY }, // Vulpix (Yellow Game Corner)
new EncounterStatic { Species = 040, Level = 22, Version = GameVersion.RBY }, // Wigglytuff (Yellow Game Corner)
new EncounterStatic { Species = 063, Level = 06, Version = GameVersion.RBY }, // Abra (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 116, Level = 18, Version = GameVersion.RBY }, // Horsea (Blue[JP] Game Corner)
new EncounterStatic { Species = 123, Level = 25, Version = GameVersion.RBY }, // Scyther (Red Game Corner)
new EncounterStatic { Species = 127, Level = 20, Version = GameVersion.RBY }, // Pinsir (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 137, Level = 18, Version = GameVersion.RBY }, // Porygon (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 147, Level = 18, Version = GameVersion.RBY }, // Dratini (Red Game Corner)
new EncounterStatic { Species = 148, Level = 30, Version = GameVersion.RBY }, // Dragonair (Blue[JP] Game Corner)
// Lower level less ideal matches; best match is from above.
// new EncounterStatic { Species = 025, Level = 12 }, // Pikachu (Blue[JP] Game Corner)
@ -78,24 +78,23 @@ public static partial class Legal
// new EncounterStatic { Species = 137, Level = 26 }, // Porygon (Yellow Game Corner)
// new EncounterStatic { Species = 147, Level = 24 }, // Dratini (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 129, Level = 05 }, // Magikarp
new EncounterStatic { Species = 143, Level = 30 }, // Snorlax
new EncounterStatic { Species = 106, Level = 30 }, // Hitmonlee
new EncounterStatic { Species = 107, Level = 30 }, // Hitmonchan
new EncounterStatic { Species = 131, Level = 15 }, // Lapras
new EncounterStatic { Species = 138, Level = 30 }, // Omanyte
new EncounterStatic { Species = 140, Level = 30 }, // Kabuto
new EncounterStatic { Species = 142, Level = 30 }, // Aerodactyl
new EncounterStatic { Species = 129, Level = 05, Version = GameVersion.RBY }, // Magikarp
new EncounterStatic { Species = 143, Level = 30, Version = GameVersion.RBY }, // Snorlax
new EncounterStatic { Species = 106, Level = 30, Version = GameVersion.RBY }, // Hitmonlee
new EncounterStatic { Species = 107, Level = 30, Version = GameVersion.RBY }, // Hitmonchan
new EncounterStatic { Species = 131, Level = 15, Version = GameVersion.RBY }, // Lapras
new EncounterStatic { Species = 138, Level = 30, Version = GameVersion.RBY }, // Omanyte
new EncounterStatic { Species = 140, Level = 30, Version = GameVersion.RBY }, // Kabuto
new EncounterStatic { Species = 142, Level = 30, Version = GameVersion.RBY }, // Aerodactyl
new EncounterStatic { Species = 144, Level = 50 }, // Articuno
new EncounterStatic { Species = 145, Level = 50 }, // Zapdos
new EncounterStatic { Species = 146, Level = 50 }, // Moltres
new EncounterStatic { Species = 144, Level = 50, Version = GameVersion.RBY }, // Articuno
new EncounterStatic { Species = 145, Level = 50, Version = GameVersion.RBY }, // Zapdos
new EncounterStatic { Species = 146, Level = 50, Version = GameVersion.RBY }, // Moltres
new EncounterStatic { Species = 150, Level = 70 }, // Mewtwo
new EncounterStatic { Species = 150, Level = 70, Version = GameVersion.RBY }, // Mewtwo
new EncounterStatic { Species = 133, Level = 25 }, // Eevee
new EncounterStatic { Species = 133, Level = 25, Version = GameVersion.RBY }, // Eevee
// Yellow Only -- duplicate encounters with a higher level
// new EncounterStatic { Species = 133, Level = 25, Version = GameVersion.YW }, // Eevee (Celadon City)
@ -104,6 +103,7 @@ public static partial class Legal
// new EncounterStatic { Species = 007, Level = 10, Version = GameVersion.YW }, // Squirtle (Vermillion City)
new EncounterStatic { Species = 054, Level = 15, Moves = new [] { 133, 10 }, Version = GameVersion.SPECIAL }, // Stadium Psyduck (Amnesia)
new EncounterStatic { Species = 151, Level = 5, IVs = new [] {15,15,15,15,15,15}, Version = GameVersion.SPECIAL }, // Event Mew
};
internal static readonly EncounterTrade[] TradeGift_RBY =
{

View File

@ -2585,7 +2585,7 @@ public static string getG1ConvertedString(byte[] strdata, bool jp)
var us_table = new ushort[] { 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0000, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x0028, 0x0029, 0x003A, 0x003B, 0x0028, 0x0029, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x00C4, 0x00D6, 0x00DC, 0x00E4, 0x00F6, 0x00FC, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0050, 0x004D, 0x002D, 0x0020, 0x0020, 0x003F, 0x0021, 0x002D, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0xE08E, 0x0020, 0x0078, 0x002E, 0x002F, 0x002C, 0xE08F, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020 };
var jp_table = new ushort[] { 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x30AC, 0x30AE, 0x30B0, 0x30B2, 0x30B4, 0x30B6, 0x30B8, 0x30BA, 0x30BC, 0x30BE, 0x30C0, 0x30C2, 0x30C5, 0x30C7, 0x30C9, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x30D0, 0x30D3, 0x30D6, 0x30DC, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x304C, 0x304E, 0x3050, 0x3052, 0x3054, 0x3056, 0x3058, 0x305A, 0x305C, 0x305E, 0x3060, 0x3062, 0x3065, 0x3067, 0x3069, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3070, 0x3073, 0x3076, 0x30D9, 0x307C, 0x3000, 0x30D1, 0x30D4, 0x30D7, 0x30DD, 0x3071, 0x3074, 0x3077, 0x30DA, 0x307D, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x0000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30DB, 0x30DE, 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F2, 0x30F3, 0x30C3, 0x30E3, 0x30E5, 0x30E7, 0x30A3, 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x304B, 0x304D, 0x304F, 0x3051, 0x3053, 0x3055, 0x3057, 0x3059, 0x305B, 0x305D, 0x305F, 0x3061, 0x3064, 0x3066, 0x3068, 0x306A, 0x306B, 0x306C, 0x306D, 0x306E, 0x306F, 0x3072, 0x3075, 0x30D8, 0x307B, 0x307E, 0x307F, 0x3080, 0x3081, 0x3082, 0x3084, 0x3086, 0x3088, 0x3089, 0x30EA, 0x308B, 0x308C, 0x308D, 0x308F, 0x3092, 0x3093, 0x3063, 0x3083, 0x3085, 0x3087, 0x30FC, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x30A1, 0x30A5, 0x30A7, 0x3000, 0x3000, 0x3000, 0x2642, 0x3000, 0x3000, 0x3000, 0x3000, 0x30A9, 0x2640, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000 };
var table = jp ? jp_table : us_table;
return Util.TrimFromZero(new string(strdata.Select(b => (char)table[b]).ToArray()));
return Util.TrimFromZero(new string(strdata.TakeWhile(b => b != 0).Select(b => (char)table[b]).ToArray()));
}
/// <summary>