using System;
namespace PKHeX.Core;
///
/// Settings for exporting a battle template.
///
public readonly ref struct BattleTemplateExportSettings
{
///
/// Order of the tokens in the export.
///
public ReadOnlySpan Order { get; init; }
///
/// Localization for the battle template.
///
public BattleTemplateLocalization Localization { get; }
///
/// Display style for the EVs.
///
public StatDisplayStyle StatsEVs { get; init; }
///
/// Display style for the IVs.
///
public StatDisplayStyle StatsIVs { get; init; }
public StatDisplayStyle StatsOther { get; init; }
///
/// Display style for the moves.
///
public MoveDisplayStyle Moves { get; init; }
public static BattleTemplateExportSettings Showdown => new(BattleTemplateConfig.Showdown);
public static BattleTemplateExportSettings CommunityStandard => new(BattleTemplateConfig.CommunityStandard);
public BattleTemplateExportSettings(string language) : this(BattleTemplateConfig.Showdown, language) { }
public BattleTemplateExportSettings(LanguageID language) : this(BattleTemplateConfig.Showdown, language) { }
public BattleTemplateExportSettings(ReadOnlySpan order, string language = BattleTemplateLocalization.DefaultLanguage)
{
Localization = BattleTemplateLocalization.GetLocalization(language);
Order = order;
}
public BattleTemplateExportSettings(ReadOnlySpan order, LanguageID language)
{
Localization = BattleTemplateLocalization.GetLocalization(language);
Order = order;
}
///
/// Checks if the token is in the export.
///
public bool IsTokenInExport(BattleTemplateToken token)
{
foreach (var t in Order)
{
if (t == token)
return true;
}
return false;
}
///
/// Gets the index of the token in the export.
///
public int GetTokenIndex(BattleTemplateToken token)
{
for (int i = 0; i < Order.Length; i++)
{
if (Order[i] == token)
return i;
}
return -1;
}
///
/// Checks if the token is in the export.
///
/// Should be a static method, but is not because it feels better this way.
/// Token to check
/// Tokens to check against
public bool IsTokenInExport(BattleTemplateToken token, ReadOnlySpan tokens)
{
foreach (var t in tokens)
{
if (t == token)
return true;
}
return false;
}
}