AbilityVerifier: gen5 ability patch for genies

and giratina
extract to a single location
abilityverifier is still needing a rewrite to clean up all the branched logic, but it's still "functional"
This commit is contained in:
Kurt 2025-03-24 10:29:22 -05:00
parent ca03311d21
commit b303ea90ef
2 changed files with 18 additions and 20 deletions

View File

@ -185,18 +185,22 @@ public static bool IsAbilityPatchRevertPossible(EvolutionHistory evosAll, int ab
}
// Some species have a distinct hidden ability only on another form, and can change between that form and its current form.
var first = evos[0];
return first.Form != 0 && first.Species switch
{
(int)Species.Giratina => true, // Form-0 is a/a/h
(int)Species.Tornadus => true, // Form-0 is a/a/h
(int)Species.Thundurus => true, // Form-0 is a/a/h
(int)Species.Landorus => true, // Form-0 is a/a/h
(int)Species.Enamorus => true, // Form-0 is a/a/h
_ => false,
};
return IsFormChangeDifferentHidden(evos[0]);
}
public static bool IsFormChangeDifferentHidden<TEvo>(TEvo first) where TEvo : ISpeciesForm =>
first.Form != 0 && IsFormChangeDifferentHidden(first.Species);
public static bool IsFormChangeDifferentHidden(ushort species) => species switch
{
(int)Species.Giratina => true, // Form-0 is a/a/h
(int)Species.Tornadus => true, // Form-0 is a/a/h
(int)Species.Thundurus=> true, // Form-0 is a/a/h
(int)Species.Landorus => true, // Form-0 is a/a/h
(int)Species.Enamorus => true, // Form-0 is a/a/h
_ => false,
};
private static bool IsRevertPossible<TTable, TInfo, TDex>(ReadOnlySpan<TDex> evos, TTable table, int abilityIndex)
where TTable : IPersonalTable<TInfo>
where TInfo : class, IPersonalInfo, IPersonalAbility12H
@ -215,6 +219,8 @@ public static bool IsAbilityPatchRevertPossible(EvolutionHistory evosAll, int ab
return true;
revert = true;
}
return false;
// Some species have a distinct hidden ability only on another form, and can change between that form and its current form.
return abilityIndex == 1 && IsFormChangeDifferentHidden(evos[0]); // can't change to second index
}
}

View File

@ -455,14 +455,6 @@ public static bool CanAbilityPatch(byte format, IPersonalAbility12H abilities, u
return true;
// Some species have a distinct hidden ability only on another form, and can change between that form and its current form.
return species switch
{
(int)Species.Giratina => true, // Form-0 is a/a/h
(int)Species.Tornadus => true, // Form-0 is a/a/h
(int)Species.Thundurus => true, // Form-0 is a/a/h
(int)Species.Landorus => true, // Form-0 is a/a/h
(int)Species.Enamorus => true, // Form-0 is a/a/h
_ => false,
};
return AbilityChangeRules.IsFormChangeDifferentHidden(species);
}
}