Rename SetTradeMemoryHT, add SetTradeMemoryHT8

Gen6 behaves differently from Gen8.
Fix broken test case [Arrived via link trade, it had fun! (2) -> (3)]
This commit is contained in:
Kurt 2021-08-29 13:15:45 -07:00
parent 2f3e496e6f
commit 92d15bdd03
9 changed files with 24 additions and 21 deletions

View file

@ -48,7 +48,11 @@ namespace PKHeX.Core
{
pk6.Geo1_Country = o.Country;
pk6.Geo1_Region = o.Region;
pk6.SetTradeMemoryHT(true);
pk6.SetTradeMemoryHT6(true);
}
else if (pk is PK8 pk8)
{
pk8.SetTradeMemoryHT8();
}
}

View file

@ -217,7 +217,7 @@ namespace PKHeX.Core
pk7.Nickname = StringConverter12Transporter.GetString(RawNickname, Japanese);
}
pk7.SetTradeMemoryHT(bank:true); // oh no, memories on gen7 pkm
pk7.SetTradeMemoryHT6(bank:true); // oh no, memories on gen7 pkm
pk7.RefreshChecksum();
return pk7;

View file

@ -207,7 +207,7 @@ namespace PKHeX.Core
pk7.OT_Gender = OT_Gender; // Crystal
pk7.OT_Friendship = pk7.HT_Friendship = PersonalTable.SM[Species].BaseFriendship;
pk7.SetTradeMemoryHT(bank: true); // oh no, memories on gen7 pkm
pk7.SetTradeMemoryHT6(bank: true); // oh no, memories on gen7 pkm
// Dizzy Punch cannot be transferred
{

View file

@ -443,7 +443,7 @@ namespace PKHeX.Core
// Make a memory if no memory already exists. Pretty terrible way of doing this but I'd rather not overwrite existing memories.
if (HT_Memory == 0)
this.SetTradeMemory(false);
this.SetTradeMemoryHT6(false);
}
// Maximums
@ -475,7 +475,7 @@ namespace PKHeX.Core
break;
}
pk7.SetTradeMemory(bank: true); // oh no, memories on gen7 pkm
pk7.SetTradeMemoryHT6(true); // oh no, memories on gen7 pkm
PKMConverter.SetFirstCountryRegion(pk7);
// Bank-accurate data zeroing

View file

@ -462,7 +462,7 @@ namespace PKHeX.Core
if (Generation < 7) // must be transferred via bank, and must have memories
{
this.SetTradeMemory(true);
this.SetTradeMemoryHT6(true); // oh no, memories on gen7 pkm
// georegions cleared on 6->7, no need to set
}
}

View file

@ -550,7 +550,7 @@ namespace PKHeX.Core
if (gen < 6)
OT_TextVar = OT_Memory = OT_Intensity = OT_Feeling = 0;
if (gen != 8) // must be transferred via HOME, and must have memories
TradeMemory();
this.SetTradeMemoryHT8(); // not faking HOME tracker.
}
private bool TradeOT(ITrainerInfo tr)
@ -573,11 +573,7 @@ namespace PKHeX.Core
CurrentHandler = 1;
HT_Gender = tr.Gender;
HT_Language = tr.Language;
}
// Misc Updates
public static void TradeMemory()
{
this.SetTradeMemoryHT8();
}
// Maximums

View file

@ -16,7 +16,7 @@
/// <summary>
/// Sets a Link Trade memory to the <see cref="ht"/>.
/// </summary>
public static void SetTradeMemoryHT(this IMemoryHT ht, bool bank)
public static void SetTradeMemoryHT6(this IMemoryHT ht, bool bank)
{
ht.HT_Memory = 4; // Link trade to [VAR: General Location]
ht.HT_TextVar = bank ? 0 : 9; // Somewhere (Bank) : Pokécenter (Trade)
@ -24,6 +24,17 @@
ht.HT_Feeling = MemoryContext6.GetRandomFeeling6(4, bank ? 10 : 20); // 0-9 Bank, 0-19 Trade
}
/// <summary>
/// Sets a Link Trade memory to the <see cref="ht"/>.
/// </summary>
public static void SetTradeMemoryHT8(this IMemoryHT ht)
{
ht.HT_Memory = 4; // Link trade to [VAR: General Location]
ht.HT_TextVar = 9; // Pokécenter (Trade)
ht.HT_Intensity = 1;
ht.HT_Feeling = MemoryContext8.GetRandomFeeling8(4, 20); // 0-19 Trade
}
/// <summary>
/// Sets all values to zero.
/// </summary>

View file

@ -3,12 +3,4 @@
public interface ITrainerMemories : IMemoryOT, IMemoryHT
{
}
public static partial class Extensions
{
public static void SetTradeMemory(this ITrainerMemories m, bool bank)
{
m.SetTradeMemoryHT(bank);
}
}
}