Update memory fix&checks

Closes #746
Memories are not wiped, but Geo_Region/Geo_Country is.
This commit is contained in:
Kurt
2017-01-25 18:51:15 -08:00
parent 45367cdce7
commit 0bddd2f072
2 changed files with 10 additions and 58 deletions

View File

@@ -1301,7 +1301,7 @@ private void verifyOTMemory()
AddLine(Severity.Valid, "OT Memory (Ingame Trade) is valid.", CheckIdentifier.Memory);
return;
}
if (EncounterType == typeof(WC6) && pkm.Format == 6)
if (EncounterType == typeof(WC6))
{
WC6 MatchedWC6 = EncounterMatch as WC6;
if (pkm.OT_Memory != MatchedWC6.OT_Memory)
@@ -1325,7 +1325,7 @@ private void verifyOTMemory()
if (pkm.OT_Feeling != MatchedWC7.OT_Feeling)
AddLine(Severity.Invalid, "Event " + (MatchedWC7.OT_Feeling == 0 ? "should not have an OT Memory Feeling value" : "OT Memory Feeling should be index " + MatchedWC7.OT_Feeling) + ".", CheckIdentifier.Memory);
}
else if (pkm.Format == 7)
else if (pkm.GenNumber == 7)
{
if (pkm.OT_Memory != 0)
AddLine(Severity.Invalid, "Should not have an OT Memory.", CheckIdentifier.Memory);
@@ -1382,7 +1382,7 @@ private void verifyHTMemory()
if (!History.Valid)
return;
if (pkm.Format == 7)
if (pkm.GenNumber == 7)
{
if (pkm.HT_Memory != 0)
AddLine(Severity.Invalid, "Should not have a HT Memory.", CheckIdentifier.Memory);

View File

@@ -485,10 +485,15 @@ public void FixRelearn()
}
public void FixMemories()
{
Enjoyment = Fullness = 0;
Geo1_Region = Geo1_Country =
Geo2_Region = Geo2_Country =
Geo3_Region = Geo3_Country =
Geo4_Region = Geo4_Country =
Geo5_Region = Geo5_Country = 0;
if (IsEgg) // No memories if is egg.
{
Geo1_Country = Geo2_Country = Geo3_Country = Geo4_Country = Geo5_Country =
Geo1_Region = Geo2_Region = Geo3_Region = Geo4_Region = Geo5_Region =
HT_Friendship = HT_Affection = HT_TextVar = HT_Memory = HT_Intensity = HT_Feeling =
/* OT_Friendship */ OT_Affection = OT_TextVar = OT_Memory = OT_Intensity = OT_Feeling = 0;
@@ -505,59 +510,6 @@ public void FixMemories()
{
HT_TextVar = HT_Memory = HT_Intensity = HT_Feeling =
OT_TextVar = OT_Memory = OT_Intensity = OT_Feeling = 0;
Geo1_Region = Geo1_Country =
Geo2_Region = Geo2_Country =
Geo3_Region = Geo3_Country =
Geo4_Region = Geo4_Country =
Geo5_Region = Geo5_Country = 0;
return;
}
Geo1_Region = Geo1_Country > 0 ? Geo1_Region : 0;
Geo2_Region = Geo2_Country > 0 ? Geo2_Region : 0;
Geo3_Region = Geo3_Country > 0 ? Geo3_Region : 0;
Geo4_Region = Geo4_Country > 0 ? Geo4_Region : 0;
Geo5_Region = Geo5_Country > 0 ? Geo5_Region : 0;
while (true)
{
if (Geo5_Country != 0 && Geo4_Country == 0)
{
Geo4_Country = Geo5_Country;
Geo4_Region = Geo5_Region;
Geo5_Country = Geo5_Region = 0;
}
if (Geo4_Country != 0 && Geo3_Country == 0)
{
Geo3_Country = Geo4_Country;
Geo3_Region = Geo4_Region;
Geo4_Country = Geo4_Region = 0;
continue;
}
if (Geo3_Country != 0 && Geo2_Country == 0)
{
Geo2_Country = Geo3_Country;
Geo2_Region = Geo3_Region;
Geo3_Country = Geo3_Region = 0;
continue;
}
if (Geo2_Country != 0 && Geo1_Country == 0)
{
Geo1_Country = Geo2_Country;
Geo1_Region = Geo2_Region;
Geo2_Country = Geo2_Region = 0;
continue;
}
if (Geo1_Country == 0 && !IsUntraded && !IsUntradedEvent6)
{
if ((Country | Region) == 0)
break;
// Traded Non-Eggs/Events need to have a current location.
Geo1_Country = Country;
Geo1_Region = Region;
continue;
}
break;
}
}