Add fullness legality check

Closes #2836

Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
This commit is contained in:
Kurt
2020-05-24 20:00:32 -07:00
parent 9619306a8f
commit 7c6ea78c63
10 changed files with 70 additions and 6 deletions

View File

@@ -309,6 +309,9 @@ public static class LegalityCheckStrings
public static string LMemoryStatFriendshipHT0 { get; set; } = "Untraded: Handling Trainer Friendship should be 0.";
public static string LMemoryStatFriendshipOTBaseEvent { get; set; } = "Event OT Friendship does not match base friendship.";
public static string LMemoryStatFullness { get; set; } = "Fullness should be {0}.";
public static string LMemoryStatEnjoyment { get; set; } = "Enjoyment should be {0}.";
public static string LMoveEggFIncompatible0_1 { get; set; } = "{0} Inherited Move. Incompatible with {1} inherited moves.";
public static string LMoveEggIncompatible { get; set; } = "Egg Move. Incompatible with event Egg moves.";
public static string LMoveEggIncompatibleEvent { get; set; } = "Event Egg Move. Incompatible with normal Egg moves.";

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using static PKHeX.Core.LegalityCheckStrings;
using static PKHeX.Core.CheckIdentifier;
@@ -43,12 +44,21 @@ public override void Verify(LegalityAnalysis data)
VerifyMiscMovePP(data);
}
if (pkm is PK7 pk7 && pk7.ResortEventStatus >= 20)
data.AddLine(GetInvalid(LTransferBad));
if (pkm is PB7 pb7)
VerifyBelugaStats(data, pb7);
if (pkm is PK8 pk8)
VerifySWSHStats(data, pk8);
switch (pkm)
{
case PK7 pk7 when pk7.ResortEventStatus >= 20:
data.AddLine(GetInvalid(LTransferBad));
break;
case PB7 pb7:
VerifyBelugaStats(data, pb7);
break;
case PK8 pk8:
VerifySWSHStats(data, pk8);
break;
}
if (pkm.Format >= 6)
VerifyFullness(data, pkm);
VerifyMiscFatefulEncounter(data);
}
@@ -299,6 +309,41 @@ public void VerifyVersionEvolution(LegalityAnalysis data)
}
}
private static void VerifyFullness(LegalityAnalysis data, PKM pkm)
{
if (pkm.Format >= 8 || pkm.IsEgg)
{
if (pkm.Fullness != 0)
data.AddLine(GetInvalid(string.Format(LMemoryStatFullness, 0), Encounter));
if (pkm.Enjoyment != 0)
data.AddLine(GetInvalid(string.Format(LMemoryStatEnjoyment, 0), Encounter));
return;
}
if (pkm.Format != 6 || !pkm.IsUntraded || pkm.XY)
return;
// OR/AS PK6
if (pkm.Fullness == 0)
return;
if (pkm.Species != data.EncounterMatch.Species)
return; // evolved
if (Unfeedable.Contains(pkm.Species))
data.AddLine(GetInvalid(string.Format(LMemoryStatFullness, 0), Encounter));
}
private static readonly HashSet<int> Unfeedable = new HashSet<int>
{
(int)Species.Metapod,
(int)Species.Kakuna,
(int)Species.Pineco,
(int)Species.Silcoon,
(int)Species.Cascoon,
(int)Species.Shedinja,
(int)Species.Spewpa,
};
private static void VerifyBelugaStats(LegalityAnalysis data, PB7 pb7)
{
// ReSharper disable once CompareOfFloatsByEqualityOperator -- THESE MUST MATCH EXACTLY

View File

@@ -237,8 +237,10 @@ LMemoryMissingHT = Memory: Handling Trainer Memory missing.
LMemoryMissingOT = Memory: Original Trainer Memory missing.
LMemoryStatAffectionHT0 = Untraded: Handling Trainer Affection should be 0.
LMemoryStatAffectionOT0 = OT Affection should be 0.
LMemoryStatEnjoyment = Enjoyment should be {0}.
LMemoryStatFriendshipHT0 = Untraded: Handling Trainer Friendship should be 0.
LMemoryStatFriendshipOTBaseEvent = Event OT Friendship does not match base friendship.
LMemoryStatFullness = Fullness should be {0}.
LMoveEggFIncompatible0_1 = {0} Inherited Move. Incompatible with {1} inherited moves.
LMoveEggIncompatible = Egg Move. Incompatible with event Egg moves.
LMoveEggIncompatibleEvent = Event Egg Move. Incompatible with normal Egg moves.

View File

@@ -237,8 +237,10 @@ LMemoryMissingHT = Memory: Handling Trainer Memory missing.
LMemoryMissingOT = Memory: Original Trainer Memory missing.
LMemoryStatAffectionHT0 = Untraded: Handling Trainer Affection should be 0.
LMemoryStatAffectionOT0 = OT Affection should be 0.
LMemoryStatEnjoyment = Enjoyment should be {0}.
LMemoryStatFriendshipHT0 = Untraded: Handling Trainer Friendship should be 0.
LMemoryStatFriendshipOTBaseEvent = Event OT Friendship does not match base friendship.
LMemoryStatFullness = Fullness should be {0}.
LMoveEggFIncompatible0_1 = {0} Inherited Move. Incompatible with {1} inherited moves.
LMoveEggIncompatible = Egg Move. Incompatible with event Egg moves.
LMoveEggIncompatibleEvent = Event Egg Move. Incompatible with normal Egg moves.

View File

@@ -237,8 +237,10 @@ LMemoryMissingHT = Recuerdo: Falta el recuerdo del entrenador anterior.
LMemoryMissingOT = Recuerdo: Falta el recuerdo del entrenador original.
LMemoryStatAffectionHT0 = No intercambiado: El Afecto con el entrenador anterior debería ser cero.
LMemoryStatAffectionOT0 = El afecto del EO debería de ser cero.
LMemoryStatEnjoyment = Enjoyment should be {0}.
LMemoryStatFriendshipHT0 = No intercambiado: La Amistad con el entrenador anterior debería ser cero.
LMemoryStatFriendshipOTBaseEvent = La Amistad con el EO de Evento no coincide con el valor de base.
LMemoryStatFullness = Fullness should be {0}.
LMoveEggFIncompatible0_1 = {0} Movimiento Heredado. Incompatible con {1} Movimientos heredados.
LMoveEggIncompatible = Movimiento Huevo. Incompatible con Movimientos Huevo de Evento.
LMoveEggIncompatibleEvent = Movimiento Huevo de Evento. Incompatible con Movimiento Huevo normal.

View File

@@ -237,8 +237,10 @@ LMemoryMissingHT = Mémoire : Mémoire avec Dresseur actuel manquante.
LMemoryMissingOT = Mémoire : Mémoire avec DO manquante.
LMemoryStatAffectionHT0 = Non-échangés : L'affection avec le Dresseur Actuel doit être nulle.
LMemoryStatAffectionOT0 = L'Affection pour le DO doit être nulle.
LMemoryStatEnjoyment = Enjoyment should be {0}.
LMemoryStatFriendshipHT0 = Non-échangés : L'amitié avec le Dresseur Actuel doit être nulle .
LMemoryStatFriendshipOTBaseEvent = Event OT Friendship does not match base friendship.
LMemoryStatFullness = Fullness should be {0}.
LMoveEggFIncompatible0_1 = {0} Inherited Move. Incompatible with {1} inherited moves.
LMoveEggIncompatible = Egg Move. Incompatible with event Egg moves.
LMoveEggIncompatibleEvent = Event Egg Move. Incompatible with normal Egg moves.

View File

@@ -237,8 +237,10 @@ LMemoryMissingHT = Memory: Handling Trainer Memory missing.
LMemoryMissingOT = Memory: Original Trainer Memory missing.
LMemoryStatAffectionHT0 = Untraded: Handling Trainer Affection should be 0.
LMemoryStatAffectionOT0 = OT Affection should be 0.
LMemoryStatEnjoyment = Enjoyment should be {0}.
LMemoryStatFriendshipHT0 = Untraded: Handling Trainer Friendship should be 0.
LMemoryStatFriendshipOTBaseEvent = Event OT Friendship does not match base friendship.
LMemoryStatFullness = Fullness should be {0}.
LMoveEggFIncompatible0_1 = {0} Inherited Move. Incompatible with {1} inherited moves.
LMoveEggIncompatible = Egg Move. Incompatible with event Egg moves.
LMoveEggIncompatibleEvent = Event Egg Move. Incompatible with normal Egg moves.

View File

@@ -237,8 +237,10 @@ LMemoryMissingHT = Memory: Handling Trainer Memory missing.
LMemoryMissingOT = Memory: Original Trainer Memory missing.
LMemoryStatAffectionHT0 = Untraded: Handling Trainer Affection should be 0.
LMemoryStatAffectionOT0 = OT Affection should be 0.
LMemoryStatEnjoyment = Enjoyment should be {0}.
LMemoryStatFriendshipHT0 = Untraded: Handling Trainer Friendship should be 0.
LMemoryStatFriendshipOTBaseEvent = Event OT Friendship does not match base friendship.
LMemoryStatFullness = Fullness should be {0}.
LMoveEggFIncompatible0_1 = {0} Inherited Move. Incompatible with {1} inherited moves.
LMoveEggIncompatible = Egg Move. Incompatible with event Egg moves.
LMoveEggIncompatibleEvent = Event Egg Move. Incompatible with normal Egg moves.

View File

@@ -237,8 +237,10 @@ LMemoryMissingHT = 추억: 소유했던 트레이너와의 추억이 없습니
LMemoryMissingOT = 추억: 어버이와의 추억이 없습니다.
LMemoryStatAffectionHT0 = 교환 경험 없음: 소유했던 트레이너와의 절친도는 0이어야 합니다.
LMemoryStatAffectionOT0 = 어버이와의 절친도는 0이어야 합니다.
LMemoryStatEnjoyment = Enjoyment should be {0}.
LMemoryStatFriendshipHT0 = 교환 경험 없음: 소유했던 트레이너와의 친밀도는 0이어야 합니다.
LMemoryStatFriendshipOTBaseEvent = 이벤트 어버이와의 친밀도가 기본 친밀도와 일치하지 않습니다.
LMemoryStatFullness = Fullness should be {0}.
LMoveEggFIncompatible0_1 = 유전받은 {0} 기술입니다. 유전받은 {1} 기술과 함께 존재할 수 없습니다.
LMoveEggIncompatible = 교배기입니다. 이벤트 교배기와 함께 존재할 수 없습니다.
LMoveEggIncompatibleEvent = 이벤트 교배기입니다. 일반 교배기와 함께 존재할 수 없습니다.

View File

@@ -237,8 +237,10 @@ LMemoryMissingHT = 回忆: 缺失持有人回忆。
LMemoryMissingOT = 回忆: 缺失初训家回忆。
LMemoryStatAffectionHT0 = 未交换: 持有人的友好度应为0。
LMemoryStatAffectionOT0 = 初训家友好度应为0。
LMemoryStatEnjoyment = Enjoyment should be {0}.
LMemoryStatFriendshipHT0 = 未交换: 持有人的亲密度应为0。
LMemoryStatFriendshipOTBaseEvent = 配信的初训家亲密度与初始亲密度不一致。
LMemoryStatFullness = Fullness should be {0}.
LMoveEggFIncompatible0_1 = {0}的遗传招式。与遗传的招式{1}不共存。
LMoveEggIncompatible = 遗传招式。与配信蛋招式冲突。
LMoveEggIncompatibleEvent = 配信蛋招式。与遗传招式冲突。