mirror of
https://github.com/kwsch/pkNX.git
synced 2026-10-02 14:16:55 -05:00
Add AllowRandomFusions to Trainer Randomizer Settings
Move BattleExclusiveForms outside of Tables7 since it'll be used for every Generation, and update it with Gen 8 species. Also fix FormRandomizer allowing Zen/Galarian Zen Darmanitan.
This commit is contained in:
@@ -47,7 +47,7 @@ private void Randomize(EvolutionSet evos, int species)
|
||||
if (evo.Method != 0)
|
||||
{
|
||||
evo.Species = RandSpec.GetRandomSpecies(evo.Species, species);
|
||||
evo.Form = RandForm.GetRandomForme(evo.Species, false, true, Game.SWSH, Personal.Table);
|
||||
evo.Form = RandForm.GetRandomForme(evo.Species, false, false, true, Game.SWSH, Personal.Table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public FormRandomizer(PersonalTable t)
|
||||
Personal = t;
|
||||
}
|
||||
|
||||
public int GetRandomForme(int species, bool mega, bool alola, bool galar, PersonalInfo[] stats = null)
|
||||
public int GetRandomForme(int species, bool mega, bool fused, bool alola, bool galar, PersonalInfo[] stats = null)
|
||||
{
|
||||
if (stats == null)
|
||||
stats = Personal.Table;
|
||||
@@ -28,7 +28,6 @@ public int GetRandomForme(int species, bool mega, bool alola, bool galar, Person
|
||||
case Sawsbuck:
|
||||
return 31; // Random
|
||||
case Greninja when !mega:
|
||||
case Eternatus:
|
||||
return 0;
|
||||
case Scatterbug:
|
||||
case Spewpa:
|
||||
@@ -37,15 +36,13 @@ public int GetRandomForme(int species, bool mega, bool alola, bool galar, Person
|
||||
case Minior:
|
||||
return Util.Random.Next(7); // keep the core color a surprise
|
||||
|
||||
// Galarian Forms
|
||||
case Meowth when galar: // Kanto, Alola, Galar
|
||||
return Util.Random.Next(3);
|
||||
case Darmanitan when galar: // Standard, Zen, Galar Standard, Galar Zen
|
||||
return Util.Random.Next(4);
|
||||
case Meowth when galar:
|
||||
return Util.Random.Next(3); // Kanto, Alola, Galar
|
||||
|
||||
// some species have 1 invalid form among several other valid forms, handle them here
|
||||
case Pikachu when Personal.TableLength == 1181:
|
||||
case Slowbro when galar:
|
||||
case Darmanitan:
|
||||
{
|
||||
int form = Util.Random.Next(stats[species].FormeCount - 1);
|
||||
int banned = GetInvalidForm(species, galar, Personal);
|
||||
@@ -61,7 +58,7 @@ public int GetRandomForme(int species, bool mega, bool alola, bool galar, Person
|
||||
return Util.Random.Next(2);
|
||||
if (galar && Legal.EvolveToGalarForms.Contains(species))
|
||||
return Util.Random.Next(2);
|
||||
if (!Legal.BattleExclusiveForms.Contains(species) || mega)
|
||||
if (!Legal.BattleExclusiveForms.Contains(species) || mega || fused && Legal.BattleFusions.Contains(species))
|
||||
return Util.Random.Next(stats[species].FormeCount); // Slot-Random
|
||||
return 0;
|
||||
}
|
||||
@@ -72,6 +69,7 @@ public int GetInvalidForm(int species, bool galar, PersonalTable stats)
|
||||
{
|
||||
(int)Pikachu when stats.TableLength == 1181 => 8, // LGPE Partner Pikachu
|
||||
(int)Slowbro when galar => 1, // Mega Slowbro
|
||||
(int)Darmanitan => 1, // Zen Mode
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(species))
|
||||
};
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@ public class TrainerRandSettings
|
||||
[Category(PKM), Description("Allows random Mega Forms when randomizing species.")]
|
||||
public bool AllowRandomMegaForms { get; set; } = false;
|
||||
|
||||
[Category(PKM), Description("Allows random Fused PKM when randomizing species.")]
|
||||
public bool AllowRandomFusions { get; set; } = false;
|
||||
|
||||
[Category(PKM), Description("Allows random Held Items when randomizing species.")]
|
||||
public bool AllowRandomHeldItems { get; set; } = false;
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ private void RandomizeSpecFormItem(IPokeData pk, int Type)
|
||||
else // every other pkm
|
||||
{
|
||||
pk.Species = RandSpec.GetRandomSpeciesType(pk.Species, Type);
|
||||
pk.Form = RandForm.GetRandomForme(pk.Species, Settings.AllowRandomMegaForms, true, true, Personal.Table);
|
||||
pk.Form = RandForm.GetRandomForme(pk.Species, Settings.AllowRandomMegaForms, Settings.AllowRandomFusions, true, true, Personal.Table);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ private void RandomizeSpecForm(TrainerPoke7b pk, int type)
|
||||
else
|
||||
{
|
||||
pk.Species = RandSpec.GetRandomSpeciesType(pk.Species, type);
|
||||
pk.Form = RandForm.GetRandomForme(pk.Species, Settings.AllowRandomMegaForms, true, false, Personal.Table);
|
||||
pk.Form = RandForm.GetRandomForme(pk.Species, Settings.AllowRandomMegaForms, Settings.AllowRandomFusions, true, false, Personal.Table);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ private void UpdatePKMFromSettings(TrainerPoke pk)
|
||||
return;
|
||||
|
||||
c.Species = AllowedGigantamaxes[Util.Random.Next(AllowedGigantamaxes.Length)];
|
||||
c.Form = c.Species == (int)Species.Pikachu || c.Species == (int)Species.Meowth ? 0 : RandForm.GetRandomForme(c.Species, false, false, false, Personal.Table); // Pikachu & Meowth altforms can't gmax
|
||||
c.Form = c.Species == (int)Species.Pikachu || c.Species == (int)Species.Meowth ? 0 : RandForm.GetRandomForme(c.Species, false, false, false, false, Personal.Table); // Pikachu & Meowth altforms can't gmax
|
||||
}
|
||||
if (Settings.MaxDynamaxLevel && c.CanDynamax)
|
||||
c.DynamaxLevel = 10;
|
||||
|
||||
Reference in New Issue
Block a user