mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-26 11:05:13 -05:00
Force shiny state of raids
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
This commit is contained in:
@@ -110,6 +110,9 @@ protected sealed override void SetPINGA(PKM pk, EncounterCriteria criteria)
|
||||
if (pk.Nature != pk.StatNature && ((Nature)pk.StatNature).IsNeutral())
|
||||
pk.StatNature = (int)Nature.Serious;
|
||||
}
|
||||
var pid = pk.PID;
|
||||
RaidRNG.ForceShinyState(pk, Shiny == Shiny.Always, ref pid);
|
||||
pk.PID = pid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
@@ -59,16 +60,7 @@ private static bool Verify(PKM pk, ulong seed, int[] ivs, int iv_count, int abil
|
||||
isShiny = shiny == Shiny.Always;
|
||||
}
|
||||
|
||||
if (isShiny)
|
||||
{
|
||||
if (!GetIsShiny(pk.TID, pk.SID, pid))
|
||||
pid = GetShinyPID(pk.TID, pk.SID, pid, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetIsShiny(pk.TID, pk.SID, pid))
|
||||
pid ^= 0x1000_0000;
|
||||
}
|
||||
ForceShinyState(pk, isShiny, ref pid);
|
||||
|
||||
if (pk.PID != pid)
|
||||
return false;
|
||||
@@ -181,6 +173,21 @@ private static bool Verify(PKM pk, ulong seed, int[] ivs, int iv_count, int abil
|
||||
return true;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void ForceShinyState(PKM pk, bool isShiny, ref uint pid)
|
||||
{
|
||||
if (isShiny)
|
||||
{
|
||||
if (!GetIsShiny(pk.TID, pk.SID, pid))
|
||||
pid = GetShinyPID(pk.TID, pk.SID, pid, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetIsShiny(pk.TID, pk.SID, pid))
|
||||
pid ^= 0x1000_0000;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ApplyDetailsTo(PKM pk, ulong seed, int[] ivs, int iv_count, int ability_param, int gender_ratio, sbyte nature_param = -1, Shiny shiny = Shiny.Random)
|
||||
{
|
||||
var rng = new Xoroshiro128Plus(seed);
|
||||
|
||||
Reference in New Issue
Block a user