/// <summary> /// Toggles the Hyper Training flag for a given stat. /// </summary> /// <param name="t">Hyper Trainable object</param> /// <param name="index">Battle Stat (H/A/B/S/C/D)</param> /// <returns>Final Hyper Training Flag value</returns> public static bool HyperTrainInvert(this IHyperTrain t, int index) { return(index switch { 0 => (t.HT_HP ^= true), 1 => (t.HT_ATK ^= true), 2 => (t.HT_DEF ^= true), 3 => (t.HT_SPE ^= true), 4 => (t.HT_SPA ^= true), 5 => (t.HT_SPD ^= true), _ => false });
/// <summary> /// Gets one of the <see cref="IHyperTrain"/> values based on its index within the array. /// </summary> /// <param name="pk">Pokémon to check.</param> /// <param name="index">Index to get</param> public static bool GetHT(this IHyperTrain pk, int index) { return index switch { 0 => pk.HT_HP, 1 => pk.HT_ATK, 2 => pk.HT_DEF, 3 => pk.HT_SPE, 4 => pk.HT_SPA, 5 => pk.HT_SPD, _ => throw new ArgumentOutOfRangeException(nameof(index)) }; }
/// <summary> /// Toggles the Hyper Training flag for a given stat. /// </summary> /// <param name="t">Hyper Trainable object</param> /// <param name="index">Battle Stat (H/A/B/S/C/D)</param> /// <returns>Final Hyper Training Flag value</returns> public static bool HyperTrainInvert(this IHyperTrain t, int index) { switch (index) { case 0: return t.HT_HP ^= true; case 1: return t.HT_ATK ^= true; case 2: return t.HT_DEF ^= true; case 3: return t.HT_SPE ^= true; case 4: return t.HT_SPA ^= true; case 5: return t.HT_SPD ^= true; } return false; }
/// <summary> /// Gets one of the <see cref="IHyperTrain"/> values based on its index within the array. /// </summary> /// <param name="pk">Pokémon to check.</param> /// <param name="index">Index to get</param> public static bool GetHT(this IHyperTrain pk, int index) { switch (index) { case 0: return pk.HT_HP; case 1: return pk.HT_ATK; case 2: return pk.HT_DEF; case 3: return pk.HT_SPE; case 4: return pk.HT_SPA; case 5: return pk.HT_SPD; default: throw new ArgumentOutOfRangeException(nameof(index)); } }
public static bool IsHyperTrained(this IHyperTrain t, int index) { switch (index) { case 0: return(t.HT_HP); case 1: return(t.HT_ATK); case 2: return(t.HT_DEF); case 3: return(t.HT_SPE); case 4: return(t.HT_SPA); case 5: return(t.HT_SPD); default: throw new ArgumentOutOfRangeException(nameof(index)); } }
/// <summary> /// Toggles the Hyper Training flag for a given stat. /// </summary> /// <param name="t">Hyper Trainable object</param> /// <param name="index">Battle Stat (H/A/B/S/C/D)</param> /// <returns>Final Hyper Training Flag value</returns> public static bool HyperTrainInvert(this IHyperTrain t, int index) => index switch { 0 => t.HT_HP ^= true,
public static bool IsHyperTrained(this IHyperTrain t) => t.HyperTrainFlags != 0;
public static void HyperTrainClear(this IHyperTrain t) => t.HyperTrainFlags = 0;
public static bool IsHyperTrainedAll(this IHyperTrain t) => t.HyperTrainFlags == 0x3F;