mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-02 04:29:05 -05:00
Add date restrictions for WC9, pika diff
This commit is contained in:
@@ -28,14 +28,16 @@ private static bool IsValidDate(DateOnly obtained, (DateOnly Start, DateOnly? En
|
||||
WC8 wc8 => Result(IsValidDateWC8(wc8.CardID, obtained)),
|
||||
WA8 wa8 => Result(IsValidDateWA8(wa8.CardID, obtained)),
|
||||
WB8 wb8 => Result(IsValidDateWB8(wb8.CardID, obtained)),
|
||||
//WC9 wc9 => Result(IsValidDateWC9(wc9.CardID, obtained)),
|
||||
WC9 wc9 => Result(IsValidDateWC9(wc9, obtained)),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(enc)),
|
||||
};
|
||||
|
||||
public static bool IsValidDateWC8(int cardID, DateOnly obtained) => WC8Gifts.TryGetValue(cardID, out var time) && IsValidDate(obtained, time);
|
||||
public static bool IsValidDateWA8(int cardID, DateOnly obtained) => WA8Gifts.TryGetValue(cardID, out var time) && IsValidDate(obtained, time);
|
||||
public static bool IsValidDateWB8(int cardID, DateOnly obtained) => WB8Gifts.TryGetValue(cardID, out var time) && IsValidDate(obtained, time);
|
||||
public static bool IsValidDateWC9(int cardID, DateOnly obtained) => WC9Gifts.TryGetValue(cardID, out var time) && IsValidDate(obtained, time);
|
||||
|
||||
public static bool IsValidDateWC9(WC9 card , DateOnly obtained) => (WC9Gifts.TryGetValue(card.CardID, out var time)
|
||||
|| WC9GiftsChk.TryGetValue(card.Checksum, out time)) && IsValidDate(obtained, time);
|
||||
|
||||
/// <summary>
|
||||
/// Minimum date the gift can be received.
|
||||
@@ -89,9 +91,20 @@ private static bool IsValidDate(DateOnly obtained, (DateOnly Start, DateOnly? En
|
||||
{9017, (new(2022, 05, 18), Never)}, // Hidden Ability Piplup
|
||||
};
|
||||
|
||||
// ReSharper disable once CollectionNeverUpdated.Global
|
||||
/// <summary>
|
||||
/// Minimum date the gift can be received.
|
||||
/// </summary>
|
||||
public static readonly Dictionary<int, (DateOnly Start, DateOnly? End)> WC9Gifts = new(0);
|
||||
public static readonly Dictionary<int, (DateOnly Start, DateOnly? End)> WC9GiftsChk = new()
|
||||
{
|
||||
{0xE5EB, (new(2022, 11, 17), new(2023, 02, 03))}, // Fly Pikachu - rev 1 (male 128)
|
||||
{0x908B, (new(2023, 02, 02), Never)}, // Fly Pikachu - rev 2 (both 0)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Minimum date the gift can be received.
|
||||
/// </summary>
|
||||
public static readonly Dictionary<int, (DateOnly Start, DateOnly? End)> WC9Gifts = new()
|
||||
{
|
||||
{1501, (new(2022, 11, 17), Never)}, // Flabébé Pokécenter
|
||||
};
|
||||
}
|
||||
|
||||
@@ -268,6 +268,8 @@ public void SetRibbonAtIndex(int byteIndex, byte ribbonIndex)
|
||||
public byte OT_Feeling { get => Data[CardStart + 0x277]; set => Data[CardStart + 0x277] = value; }
|
||||
public ushort OT_TextVar { get => ReadUInt16LittleEndian(Data.AsSpan(CardStart + 0x278)); set => WriteUInt16LittleEndian(Data.AsSpan(CardStart + 0x278), value); }
|
||||
|
||||
public ushort Checksum => ReadUInt16LittleEndian(Data.AsSpan(0x2C4));
|
||||
|
||||
// Meta Accessible Properties
|
||||
public override int[] IVs
|
||||
{
|
||||
@@ -505,7 +507,7 @@ public override PK9 ConvertToPKM(ITrainerInfo tr, EncounterCriteria criteria)
|
||||
}
|
||||
}
|
||||
|
||||
pk.MetDate = IsDateRestricted && EncounterServerDate.WC9Gifts.TryGetValue(CardID, out var dt) ? dt.Start : DateOnly.FromDateTime(DateTime.Now);
|
||||
pk.MetDate = IsDateRestricted && EncounterServerDate.WC9GiftsChk.TryGetValue(CardID, out var dt) ? dt.Start : DateOnly.FromDateTime(DateTime.Now);
|
||||
|
||||
var nickname_language = GetLanguage(language);
|
||||
pk.Language = nickname_language != 0 ? nickname_language : tr.Language;
|
||||
@@ -525,12 +527,10 @@ public override PK9 ConvertToPKM(ITrainerInfo tr, EncounterCriteria criteria)
|
||||
SetEggMetData(pk);
|
||||
pk.CurrentFriendship = pk.IsEgg ? pi.HatchCycles : pi.BaseFriendship;
|
||||
|
||||
pk.HeightScalar = (byte)HeightValue;
|
||||
pk.WeightScalar = (byte)WeightValue;
|
||||
if (!IsHOMEGift)
|
||||
{
|
||||
pk.HeightScalar = PokeSizeUtil.GetRandomScalar();
|
||||
pk.WeightScalar = PokeSizeUtil.GetRandomScalar();
|
||||
pk.Scale = PokeSizeUtil.GetRandomScalar();
|
||||
}
|
||||
|
||||
pk.Obedience_Level = Level;
|
||||
pk.ResetPartyStats();
|
||||
@@ -723,12 +723,13 @@ public override bool IsMatchExact(PKM pk, EvoCriteria evo)
|
||||
if (Nature != -1 && pk.Nature != Nature) return false;
|
||||
if (Gender != 3 && Gender != pk.Gender) return false;
|
||||
|
||||
if (IsHOMEGift && pk is IScaledSize s)
|
||||
if (pk is IScaledSize s)
|
||||
{
|
||||
if (s.HeightScalar != 0)
|
||||
if (s.HeightScalar != HeightValue)
|
||||
return false;
|
||||
if (s.WeightScalar != 0)
|
||||
if (s.WeightScalar != WeightValue)
|
||||
return false;
|
||||
// Random scalar
|
||||
}
|
||||
|
||||
// PID Types 0 and 1 do not use the fixed PID value.
|
||||
@@ -740,7 +741,7 @@ public override bool IsMatchExact(PKM pk, EvoCriteria evo)
|
||||
return pk.PID == GetPID(pk, type);
|
||||
}
|
||||
|
||||
public bool IsDateRestricted => IsHOMEGift;
|
||||
public bool IsDateRestricted => true;
|
||||
|
||||
protected override bool IsMatchDeferred(PKM pk) => Species != pk.Species;
|
||||
protected override bool IsMatchPartial(PKM pk)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user