Fix pk4->pk5 HM transferral

Was deleting the PK4 move, not the PK5 move, thus not actually sanitizing the moves.
Do same logic for PK3->PK4 (saves an array allocation)
This commit is contained in:
Kurt 2022-06-19 13:46:04 -07:00
parent aac498a31d
commit 5c4c866482
2 changed files with 9 additions and 13 deletions

View file

@ -323,15 +323,11 @@ public sealed class PK3 : G3PKM, ISanityChecksum
}
// Remove HM moves
int[] newMoves = pk4.Moves;
for (int i = 0; i < 4; i++)
{
var move = newMoves[i];
if (Array.IndexOf(Legal.HM_3, move) != -1)
newMoves[i] = 0;
}
pk4.Moves = newMoves;
var banned = Legal.HM_3;
if (Array.IndexOf(banned, Move1) != -1) pk4.Move1 = 0;
if (Array.IndexOf(banned, Move2) != -1) pk4.Move2 = 0;
if (Array.IndexOf(banned, Move3) != -1) pk4.Move3 = 0;
if (Array.IndexOf(banned, Move4) != -1) pk4.Move4 = 0;
pk4.FixMoves();
pk4.HealPP();

View file

@ -355,10 +355,10 @@ public sealed class PK4 : G4PKM
// if has defog, remove whirlpool.
bool hasDefog = HasMove((int) Move.Defog);
var banned = hasDefog ? Legal.HM_HGSS : Legal.HM_DPPt;
if (Array.IndexOf(banned, Move1) != -1) Move1 = 0;
if (Array.IndexOf(banned, Move2) != -1) Move2 = 0;
if (Array.IndexOf(banned, Move3) != -1) Move3 = 0;
if (Array.IndexOf(banned, Move4) != -1) Move4 = 0;
if (Array.IndexOf(banned, Move1) != -1) pk5.Move1 = 0;
if (Array.IndexOf(banned, Move2) != -1) pk5.Move2 = 0;
if (Array.IndexOf(banned, Move3) != -1) pk5.Move3 = 0;
if (Array.IndexOf(banned, Move4) != -1) pk5.Move4 = 0;
pk5.FixMoves();
// D/P(not Pt)/HG/SS created Shedinja forget to set Gender to Genderless.