Add vc transfer nature checks

Closes #2279 thanks @SadisticMystic !
This commit is contained in:
Kurt 2019-04-03 20:13:30 -07:00
parent 21e7d82468
commit 054d498619
13 changed files with 57 additions and 2 deletions

View file

@ -251,6 +251,8 @@ namespace PKHeX.Core
foreach (var z in Transfer.VerifyVCEncounter(pkm, EncounterOriginalGB, s, Info.Moves))
AddLine(z);
Transfer.VerifyTransferLegalityG12(this);
}
private void UpdateInfo()

View file

@ -432,6 +432,7 @@ namespace PKHeX.Core
public static string LTransferMove { get; set; } = "Incompatible transfer move.";
public static string LTransferMoveG4HM { get; set; } = "Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5.";
public static string LTransferMoveHM { get; set; } = "Generation {0} HM. Should have been removed before transfered to Generation {1}.";
public static string LTransferNature { get; set; } = "Invalid Nature for transfer Experience.";
public static string LTransferOriginFInvalid0_1 { get; set; } = "{0} origin cannot exist in the currently loaded ({1}) savegame.";
public static string LTransferPIDECBitFlip { get; set; } = "PID should be equal to EC [with top bit flipped]!";
public static string LTransferPIDECEquals { get; set; } = "PID should be equal to EC!";

View file

@ -16,6 +16,50 @@ namespace PKHeX.Core
throw new NotImplementedException();
}
public void VerifyTransferLegalityG12(LegalityAnalysis data)
{
VerifyTransferVCNatureEXP(data);
}
private void VerifyTransferVCNatureEXP(LegalityAnalysis data)
{
var pkm = data.pkm;
var met = pkm.Met_Level;
if (met == 100) // check for precise match, can't receive EXP after transfer.
{
var nature = Experience.GetNatureVC(pkm.EXP);
if (nature != pkm.Nature)
data.AddLine(GetInvalid(LTransferNature));
return;
}
if (met <= 2) // Not enough EXP to have every nature -- check for exclusions!
{
var pi = pkm.PersonalInfo;
var growth = pi.EXPGrowth;
var nature = pkm.Nature;
bool valid = VerifyVCNature(growth, nature);
if (!valid)
data.AddLine(GetInvalid(LTransferNature));
}
}
private static bool VerifyVCNature(int growth, int nature)
{
// exp % 25 with a limited amount of EXP does not allow for every nature
switch (growth)
{
case 0: // MediumFast -- Can't be Brave, Adamant, Naughty, Bold, Docile, or Relaxed
return nature < (int)Nature.Brave || nature > (int)Nature.Relaxed;
case 4: // Fast -- Can't be Gentle, Sassy, Careful, Quirky, Hardy, Lonely, Brave, Adamant, Naughty, or Bold
return nature < (int)Nature.Gentle && nature > (int)Nature.Bold;
case 5: // Slow -- Can't be Impish or Lax
return nature != (int)Nature.Impish && nature != (int)Nature.Lax;
default:
return true;
}
}
public void VerifyTransferLegalityG3(LegalityAnalysis data)
{
var pkm = data.pkm;

View file

@ -350,6 +350,7 @@ LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move.
LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5.
LTransferMoveHM = Generation {0} HM. Should have been removed before transfered to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!
LTransferPIDECEquals = PID should be equal to EC!

View file

@ -350,6 +350,7 @@ LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move.
LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5.
LTransferMoveHM = Generation {0} HM. Should have been removed before transfered to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!
LTransferPIDECEquals = PID should be equal to EC!

View file

@ -350,6 +350,7 @@ LTransferMetLocation = Lugar de Encuentro mediante transferencia inválido.
LTransferMove = Movimiento de transferencia incompatible.
LTransferMoveG4HM = Despejar y Torbellino. Uno de estos movimientos debe de ser eliminado antes de ser transferido a la Generación 5.
LTransferMoveHM = MO de la {0} generación. Debería de haber sido eliminado antes de ser transferido a la Generación {1}.
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origen no puede existir en la partida cargada ({1}) actualmente.
LTransferPIDECBitFlip = ¡El PID debería de ser igual al EC [Con el primer dígito invertido]!
LTransferPIDECEquals = ¡El PID debería de ser igual al EC!

View file

@ -350,6 +350,7 @@ LTransferMetLocation = Pokémon transféré, endroit de rencontre invalide.
LTransferMove = Attaque de transfert incompatible.
LTransferMoveG4HM = Anti-Brume ou Siphon doivent être oubliées avant tout transfert vers la Génération 5.
LTransferMoveHM = CS de Génération {0}. Elle doit être oubliée avant de transférer le Pokémon vers la génération {1}.
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = L'origine de {0} ne peut pas exister dans cette sauvegarde ({1}).
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!
LTransferPIDECEquals = PID should be equal to EC!

View file

@ -350,6 +350,7 @@ LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move.
LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5.
LTransferMoveHM = Generation {0} HM. Should have been removed before transfered to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!
LTransferPIDECEquals = PID should be equal to EC!

View file

@ -350,6 +350,7 @@ LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move.
LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5.
LTransferMoveHM = Generation {0} HM. Should have been removed before transfered to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!
LTransferPIDECEquals = PID should be equal to EC!

View file

@ -350,6 +350,7 @@ LTransferMetLocation = 옮겨진 만난 장소가 잘못되었습니다.
LTransferMove = 호환되지 않는 전송 공격.
LTransferMoveG4HM = 안개제거와 바다회오리가 함께 존재합니다. 둘 중 하나는 5세대로 옮기기 전에 제거해야 합니다.
LTransferMoveHM = {0}세대 비전머신입니다. {1}세대로 옮기기 전에 제거해야 합니다.
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = 현재 로드한 세이브파일 ({1}) 에서는 {0} 버전에서 만난 포켓몬이 존재할 수 없습니다.
LTransferPIDECBitFlip = PID는 Top bit가 뒤집힌 암호화 상수와 동일해야 합니다!
LTransferPIDECEquals = PID는 암호화 상수와 동일해야 합니다!

View file

@ -1,4 +1,4 @@
MsgProgramRestart = Please restart the program.
MsgProgramRestart = Please restart the program.
MsgProgramIllegalModeBehave = Please behave.
MsgProgramIllegalModeActive = Illegal mode activated.
MsgProgramUpdateAvailable = New Update Available!

View file

@ -350,6 +350,7 @@ LTransferMetLocation = 传送相遇地点不合法。
LTransferMove = 不兼容的虚拟传送招式。
LTransferMoveG4HM = 清除浓雾与潮旋。两者在传到5代以前必须被移除。
LTransferMoveHM = 第{0}世代秘传学习器HM招式。应在传至第{1}世代前被移除。
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0}来源的宝可梦不能存在于({1})的游戏记录。
LTransferPIDECBitFlip = PID应与加密常数相等[第一位反转]!
LTransferPIDECEquals = PID应与加密常数相等!

View file

@ -1,4 +1,4 @@
MsgProgramRestart = 请重启程序。
MsgProgramRestart = 请重启程序。
MsgProgramIllegalModeBehave = 请自重。
MsgProgramIllegalModeActive = 不合法模式启动。
MsgProgramUpdateAvailable = 有新版本!