Style cleanup
This commit is contained in:
@@ -18,7 +18,7 @@ public interface IAbility : INamedValue
|
||||
/// The parameters for the script effect of the ability.
|
||||
/// </summary>
|
||||
IReadOnlyDictionary<StringKey, object?> Parameters { get; }
|
||||
|
||||
|
||||
bool HasFlag(StringKey key);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ public interface IAbility : INamedValue
|
||||
public class AbilityImpl : IAbility
|
||||
{
|
||||
/// <inheritdoc cref="AbilityImpl" />
|
||||
public AbilityImpl(StringKey name, StringKey? effect, IReadOnlyDictionary<StringKey, object?> parameters, ImmutableHashSet<StringKey> flags)
|
||||
public AbilityImpl(StringKey name, StringKey? effect, IReadOnlyDictionary<StringKey, object?> parameters,
|
||||
ImmutableHashSet<StringKey> flags)
|
||||
{
|
||||
Name = name;
|
||||
Effect = effect;
|
||||
@@ -46,10 +47,7 @@ public class AbilityImpl : IAbility
|
||||
public ImmutableHashSet<StringKey> Flags;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasFlag(StringKey key)
|
||||
{
|
||||
return Flags.Contains(key);
|
||||
}
|
||||
public bool HasFlag(StringKey key) => Flags.Contains(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -95,8 +95,8 @@ public interface IForm : INamedValue
|
||||
public class FormImpl : IForm
|
||||
{
|
||||
/// <inheritdoc cref="FormImpl" />
|
||||
public FormImpl(StringKey name, float height, float weight, uint baseExperience,
|
||||
IEnumerable<TypeIdentifier> types, ImmutableStatisticSet<ushort> baseStats, IEnumerable<StringKey> abilities,
|
||||
public FormImpl(StringKey name, float height, float weight, uint baseExperience, IEnumerable<TypeIdentifier> types,
|
||||
ImmutableStatisticSet<ushort> baseStats, IEnumerable<StringKey> abilities,
|
||||
IEnumerable<StringKey> hiddenAbilities, ILearnableMoves moves, ImmutableHashSet<StringKey> flags)
|
||||
{
|
||||
Name = name;
|
||||
@@ -109,7 +109,7 @@ public class FormImpl : IForm
|
||||
HiddenAbilities = [..hiddenAbilities];
|
||||
Moves = moves;
|
||||
Flags = flags;
|
||||
|
||||
|
||||
if (Types.Count == 0)
|
||||
throw new ArgumentException("A form must have at least one type.");
|
||||
if (Abilities.Count == 0)
|
||||
@@ -163,20 +163,24 @@ public class FormImpl : IForm
|
||||
for (var i = 0; i < Abilities.Count && i < 255; i++)
|
||||
{
|
||||
if (Abilities[i] == ability.Name)
|
||||
{
|
||||
return new AbilityIndex
|
||||
{
|
||||
IsHidden = false,
|
||||
Index = (byte)i,
|
||||
};
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < HiddenAbilities.Count && i < 255; i++)
|
||||
{
|
||||
if (HiddenAbilities[i] == ability.Name)
|
||||
{
|
||||
return new AbilityIndex
|
||||
{
|
||||
IsHidden = true,
|
||||
Index = (byte)i,
|
||||
};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -191,20 +195,11 @@ public class FormImpl : IForm
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public StringKey GetRandomAbility(IRandom rand)
|
||||
{
|
||||
return Abilities[rand.GetInt(Abilities.Count)];
|
||||
}
|
||||
public StringKey GetRandomAbility(IRandom rand) => Abilities[rand.GetInt(Abilities.Count)];
|
||||
|
||||
/// <inheritdoc />
|
||||
public StringKey GetRandomHiddenAbility(IRandom rand)
|
||||
{
|
||||
return HiddenAbilities[rand.GetInt(HiddenAbilities.Count)];
|
||||
}
|
||||
public StringKey GetRandomHiddenAbility(IRandom rand) => HiddenAbilities[rand.GetInt(HiddenAbilities.Count)];
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasFlag(string key)
|
||||
{
|
||||
return Flags.Contains(key);
|
||||
}
|
||||
public bool HasFlag(string key) => Flags.Contains(key);
|
||||
}
|
||||
@@ -10,10 +10,12 @@ public enum Gender : byte
|
||||
{
|
||||
/// The Pokémon has no gender.
|
||||
Genderless,
|
||||
|
||||
/// <summary>
|
||||
/// The Pokémon is male.
|
||||
/// </summary>
|
||||
Male,
|
||||
|
||||
/// <summary>
|
||||
/// The Pokémon is female.
|
||||
/// </summary>
|
||||
|
||||
@@ -14,7 +14,7 @@ public interface ILearnableMoves
|
||||
/// <param name="move">The move the Pokémon learns.</param>
|
||||
/// <returns>Whether the move was added successfully.</returns>
|
||||
void AddLevelMove(LevelInt level, StringKey move);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new egg move the Pokémon can learn.
|
||||
/// </summary>
|
||||
@@ -38,7 +38,7 @@ public interface ILearnableMoves
|
||||
/// Gets a list of all moves a Pokémon can learn up to a specific level.
|
||||
/// </summary>
|
||||
IReadOnlyList<StringKey> GetLearnableMovesUpToLevel(LevelInt level);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets all moves a Pokémon can learn by breeding.
|
||||
/// </summary>
|
||||
@@ -50,9 +50,8 @@ public class LearnableMovesImpl : ILearnableMoves
|
||||
{
|
||||
private readonly Dictionary<LevelInt, List<StringKey>> _learnedByLevel = new();
|
||||
private readonly HashSet<StringKey> _distinctLevelMoves = new();
|
||||
|
||||
private readonly List<StringKey> _eggMoves = new();
|
||||
|
||||
private readonly List<StringKey> _eggMoves = new();
|
||||
|
||||
/// <inheritdoc />
|
||||
public void AddLevelMove(LevelInt level, StringKey move)
|
||||
@@ -81,10 +80,7 @@ public class LearnableMovesImpl : ILearnableMoves
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<StringKey> GetDistinctLevelMoves()
|
||||
{
|
||||
return _distinctLevelMoves.ToList();
|
||||
}
|
||||
public IReadOnlyList<StringKey> GetDistinctLevelMoves() => _distinctLevelMoves.ToList();
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<StringKey> GetLearnableMovesUpToLevel(LevelInt level)
|
||||
|
||||
@@ -50,7 +50,7 @@ public interface ISpecies : INamedValue
|
||||
/// Gets a form by name.
|
||||
/// </summary>
|
||||
bool TryGetForm(StringKey id, [MaybeNullWhen(false)] out IForm form);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the form the Pokémon will have by default, if no other form is specified.
|
||||
/// </summary>
|
||||
@@ -70,7 +70,7 @@ public interface ISpecies : INamedValue
|
||||
/// The data regarding into which Pokémon this species can evolve, and how.
|
||||
/// </summary>
|
||||
IReadOnlyList<IEvolution> EvolutionData { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The egg groups the Pokémon belongs to.
|
||||
/// </summary>
|
||||
@@ -124,14 +124,13 @@ public class SpeciesImpl : ISpecies
|
||||
|
||||
/// <inheritdoc />
|
||||
public ImmutableHashSet<StringKey> Flags { get; }
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<IEvolution> EvolutionData { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public ICollection<StringKey> EggGroups { get; }
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool TryGetForm(StringKey id, [MaybeNullWhen(false)] out IForm form) => Forms.TryGetValue(id, out form);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user