mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-25 08:10:48 -05:00
Add $rand0/$rand3 batch cmd for dudu/maus rare
.EncryptionConstant=$rand0 .EncryptionConstant=$rand3 ^ both will randomize so EC%100 = 0 Additionally, added $rand0/$randB/$randS for Wurmple/Beautifly/Silcoon to force EC%10 [0,4], otherwise EC%10 will be [5,9] for the Cascoon/Dustox evolution. For neither of the two above cases, can do EC%6=last char if someone cares about the EC tiebreaker for characteristic determination. No, I don't want to consider how allow the above cases to do that too :) -- just write your own syntax via a plugin and add your ComplexSet to the list!
This commit is contained in:
parent
76ec39b75f
commit
731a3fdc3b
|
|
@ -79,8 +79,35 @@ public static class BatchMods
|
|||
|
||||
new ComplexSet(nameof(PKM.Species), value => value == "0", (pk, _) => Array.Clear(pk.Data, 0, pk.Data.Length)),
|
||||
new ComplexSet(nameof(PKM.IsNicknamed), value => string.Equals(value, "false", StringComparison.OrdinalIgnoreCase), (pk, _) => pk.SetDefaultNickname()),
|
||||
|
||||
// Complicated
|
||||
new ComplexSet(nameof(PKM.EncryptionConstant), value => value.StartsWith(CONST_RAND), (pk, cmd) => SetComplicatedEC(pk, cmd.PropertyValue[^1])),
|
||||
};
|
||||
|
||||
private static void SetComplicatedEC(PKM pk, char option)
|
||||
{
|
||||
var rng = Util.Rand;
|
||||
uint rand = rng.Rand32();
|
||||
uint mod = 1, noise = 0;
|
||||
if (pk.Species is >= (int)Species.Wurmple and <= (int)Species.Dustox)
|
||||
{
|
||||
mod = 10;
|
||||
bool lower = option is '0' or 'B' or 'S' || WurmpleUtil.GetWurmpleEvoGroup(pk.Species) == 0;
|
||||
noise = (lower ? 0u : 5u) + (uint)rng.Next(0, 5);
|
||||
}
|
||||
else if (pk.Species is (int)Species.Dunsparce or (int)Species.Dudunsparce or (int)Species.Tandemaus or (int)Species.Maushold)
|
||||
{
|
||||
mod = 100;
|
||||
noise = option is '0' or '3' ? 0u : (uint)rng.Next(1, 100);
|
||||
}
|
||||
else if (option is >= '0' and <= '5')
|
||||
{
|
||||
mod = 6;
|
||||
noise = (uint)(option - '0');
|
||||
}
|
||||
pk.EncryptionConstant = unchecked(rand - (rand % mod) + noise);
|
||||
}
|
||||
|
||||
private static void SetRandomEVs(PKM pk)
|
||||
{
|
||||
Span<int> evs = stackalloc int[6];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user