mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Add contest stat batch modification
This commit is contained in:
parent
1e0ac7fb26
commit
39f8e9173e
3 changed files with 17 additions and 1 deletions
|
@ -63,7 +63,7 @@ namespace PKHeX.Core
|
|||
|
||||
internal const string CONST_RAND = "$rand";
|
||||
internal const string CONST_SHINY = "$shiny";
|
||||
private const string CONST_SUGGEST = "$suggest";
|
||||
internal const string CONST_SUGGEST = "$suggest";
|
||||
private const string CONST_BYTES = "$[]";
|
||||
|
||||
internal const string PROP_LEGAL = "Legal";
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace PKHeX.Core
|
|||
new ComplexSuggestion(nameof(PKM.RelearnMoves), (_, value, info) => BatchModifications.SetSuggestedRelearnData(info, value)),
|
||||
new ComplexSuggestion(PROP_RIBBONS, (_, value, info) => BatchModifications.SetSuggestedRibbons(info, value)),
|
||||
new ComplexSuggestion(nameof(PKM.Met_Location), (_, _, info) => BatchModifications.SetSuggestedMetData(info)),
|
||||
new ComplexSuggestion("ContestStats", p => p is IContestStatsMutable, (_, value, info) => BatchModifications.SetContestStats(info.Entity, info.Legality.EncounterMatch, value)),
|
||||
};
|
||||
|
||||
private static DateTime ParseDate(string val) => DateTime.ParseExact(val, "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None);
|
||||
|
|
|
@ -66,5 +66,20 @@ namespace PKHeX.Core
|
|||
pk.HealPP();
|
||||
return ModifyResult.Modified;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the contests stats as requested.
|
||||
/// </summary>
|
||||
/// <param name="pk">Pokémon to modify.</param>
|
||||
/// <param name="enc">Encounter matched to.</param>
|
||||
/// <param name="option">Option to apply with</param>
|
||||
public static ModifyResult SetContestStats(PKM pk, IEncounterTemplate enc, string option)
|
||||
{
|
||||
if (option.Length != 0 && option[BatchEditing.CONST_SUGGEST.Length..] is not "0")
|
||||
pk.SetMaxContestStats(enc);
|
||||
else
|
||||
pk.SetSuggestedContestStats(enc);
|
||||
return ModifyResult.Modified;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue