diff --git a/PKHeX.Core/Editing/Applicators/GenderApplicator.cs b/PKHeX.Core/Editing/Applicators/GenderApplicator.cs
index 143e10178..fb4bb2e72 100644
--- a/PKHeX.Core/Editing/Applicators/GenderApplicator.cs
+++ b/PKHeX.Core/Editing/Applicators/GenderApplicator.cs
@@ -24,6 +24,9 @@ public static void SetSaneGender(this PKM pk, int gender)
public static void SetGender(this PKM pk, int gender)
{
gender = Math.Min(2, Math.Max(0, gender));
+ if (pk.Gender == gender)
+ return;
+
if (pk.Format <= 2)
{
pk.SetAttackIVFromGender(gender);
diff --git a/PKHeX.Core/Editing/CommonEdits.cs b/PKHeX.Core/Editing/CommonEdits.cs
index 31bde0989..569eba6d7 100644
--- a/PKHeX.Core/Editing/CommonEdits.cs
+++ b/PKHeX.Core/Editing/CommonEdits.cs
@@ -48,28 +48,6 @@ public static string ClearNickname(this PKM pk)
return nick;
}
- ///
- /// Sets the value, with special consideration for values which derive the value.
- ///
- /// Pokémon to modify.
- /// Desired value to set.
- public static void SetForm(this PKM pk, int form)
- {
- switch (pk.Format)
- {
- case 2:
- while (pk.Form != form)
- pk.SetRandomIVs();
- break;
- case 3:
- pk.SetPIDUnown3(form);
- break;
- default:
- pk.Form = form;
- break;
- }
- }
-
///
/// Sets the value by sanity checking the provided against the possible pool of abilities.
///
@@ -191,6 +169,7 @@ public static void SetNature(this PKM pk, int nature)
public static void ApplySetDetails(this PKM pk, IBattleTemplate Set)
{
pk.Species = Math.Min(pk.MaxSpeciesID, Set.Species);
+ pk.Form = Set.Form;
pk.SetMoves(Set.Moves, true);
pk.ApplyHeldItem(Set.HeldItem, Set.Format);
pk.CurrentLevel = Set.Level;
@@ -225,7 +204,6 @@ public static void ApplySetDetails(this PKM pk, IBattleTemplate Set)
pk.SetMarkings();
pk.SetNickname(Set.Nickname);
- pk.SetForm(Set.Form);
pk.SetSaneGender(Set.Gender);
if (Legal.IsPPUpAvailable(pk))
diff --git a/PKHeX.Core/PKM/Shared/G3PKM.cs b/PKHeX.Core/PKM/Shared/G3PKM.cs
index a0f508a6f..b91028294 100644
--- a/PKHeX.Core/PKM/Shared/G3PKM.cs
+++ b/PKHeX.Core/PKM/Shared/G3PKM.cs
@@ -28,7 +28,6 @@ public abstract class G3PKM : PKM, IRibbonSetEvent3, IRibbonSetCommon3, IRibbonS
public sealed override int Ability { get => ((PersonalInfoG3)PersonalInfo).GetAbility(AbilityBit); set { } }
public sealed override uint EncryptionConstant { get => PID; set { } }
public sealed override int Nature { get => (int)(PID % 25); set { } }
- public sealed override int Form { get => Species == (int)Core.Species.Unown ? PKX.GetUnownForm(PID) : 0; set { } }
public sealed override bool IsNicknamed { get => SpeciesName.IsNicknamed(Species, Nickname, Language, 3); set { } }
public sealed override int Gender { get => PKX.GetGenderFromPID(Species, PID); set { } }
public sealed override int Characteristic => -1;
@@ -36,6 +35,19 @@ public abstract class G3PKM : PKM, IRibbonSetEvent3, IRibbonSetCommon3, IRibbonS
public sealed override int CurrentHandler { get => 0; set { } }
public sealed override int Egg_Location { get => 0; set { } }
+ public sealed override int Form
+ {
+ get => Species == (int)Core.Species.Unown ? PKX.GetUnownForm(PID) : 0;
+ set
+ {
+ if (Species != (int)Core.Species.Unown)
+ return;
+ var rnd = Util.Rand;
+ while (PKX.GetUnownForm(PID) != value)
+ PID = Util.Rand32(rnd);
+ }
+ }
+
public sealed override int AbilityNumber { get => 1 << (AbilityBit ? 1 : 0); set => AbilityBit = value > 1; } // [0,1]->[1,2] ; [1,x]->[0,1]
public abstract bool AbilityBit { get; set; }
diff --git a/PKHeX.Core/PKM/Shared/GBPKM.cs b/PKHeX.Core/PKM/Shared/GBPKM.cs
index 6eb55aedd..ded1c36ed 100644
--- a/PKHeX.Core/PKM/Shared/GBPKM.cs
+++ b/PKHeX.Core/PKM/Shared/GBPKM.cs
@@ -145,7 +145,13 @@ public sealed override int Form
formeVal |= (uint)((IV_SPC & 0x6) >> 1);
return (int)(formeVal / 10);
}
- set { }
+ set
+ {
+ if (Species != 201) // Unown
+ return;
+ while (Form != value)
+ SetRandomIVs(0);
+ }
}
public abstract int EV_SPC { get; set; }