Style cleanup

This commit is contained in:
2025-03-02 17:19:57 +01:00
parent c0bc905c46
commit 284ab3079c
175 changed files with 588 additions and 650 deletions

View File

@@ -50,7 +50,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// The amount of experience of the Pokemon.
/// </summary>
uint Experience { get; }
/// <summary>
/// Increases the experience of the Pokemon. Returns whether any experience was gained.
/// </summary>
@@ -71,7 +71,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// currently not used, and can be used for other implementations.
/// </summary>
byte Coloring { get; }
/// <summary>
/// Whether the Pokemon is shiny.
/// </summary>
@@ -98,7 +98,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// <param name="weightInKg">The new weight in kilograms</param>
/// <returns></returns>
public bool ChangeWeightInKgBy(float weightInKg);
/// <summary>
/// The height of the Pokémon in meters.
/// </summary>
@@ -124,7 +124,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// The stats of the Pokemon including the stat boosts
/// </summary>
StatisticSet<uint> BoostedStats { get; }
/// <summary>
/// The maximum health of the Pokemon.
/// </summary>
@@ -171,12 +171,12 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// are null.
/// </summary>
IReadOnlyList<ILearnedMove?> Moves { get; }
/// <summary>
/// Checks whether the Pokemon has a specific move in its current moveset.
/// </summary>
bool HasMove(StringKey moveName);
/// <summary>
/// Swaps two moves of the Pokemon.
/// </summary>
@@ -201,7 +201,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// Whether or not this Pokemon was caught this battle.
/// </summary>
bool IsCaught { get; }
public void MarkAsCaught();
/// <summary>
@@ -240,7 +240,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// </summary>
[MustUseReturnValue]
IItem? RemoveHeldItem();
/// <summary>
/// Removes the held item from the Pokemon for the duration of the battle. Returns the previously held item.
/// </summary>
@@ -249,7 +249,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// restored after the battle.
/// </remarks>
IItem? RemoveHeldItemForBattle();
/// <summary>
/// Restores the held item of a Pokémon if it was temporarily removed.
/// </summary>
@@ -273,7 +273,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// Suppresses the ability of the Pokémon.
/// </summary>
public void SuppressAbility();
/// <summary>
/// Returns the currently active ability.
/// </summary>
@@ -322,7 +322,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// heal if the Pokemon has 0 health. If the amount healed is 0, this will return false.
/// </summary>
bool Heal(uint heal, bool allowRevive = false);
/// <summary>
/// Restores all PP of the Pokemon.
/// </summary>
@@ -337,10 +337,12 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// Checks whether the Pokémon has a specific non-volatile status.
/// </summary>
bool HasStatus(StringKey status);
/// <summary>
/// Adds a non-volatile status to the Pokemon.
/// </summary>
void SetStatus(StringKey status);
/// <summary>
/// Removes the current non-volatile status from the Pokemon.
/// </summary>
@@ -371,23 +373,23 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// Marks a Pokemon as seen in the battle.
/// </summary>
void MarkOpponentAsSeen(IPokemon pokemon);
/// <summary>
/// Removes a type from the Pokémon. Returns whether the type was removed.
/// </summary>
bool RemoveType(TypeIdentifier type);
/// <summary>
/// Adds a type to the Pokémon. Returns whether the type was added. It will not add the type if
/// the Pokémon already has it.
/// </summary>
bool AddType(TypeIdentifier type);
/// <summary>
/// Replace the types of the Pokémon with the provided types.
/// </summary>
void SetTypes(IReadOnlyList<TypeIdentifier> types);
void ChangeAbility(IAbility ability);
/// <summary>
@@ -431,17 +433,17 @@ public interface IPokemonBattleData : IDeepCloneable
/// Adds an opponent to the list of seen opponents.
/// </summary>
void MarkOpponentAsSeen(IPokemon opponent);
/// <summary>
/// A list of items the Pokémon has consumed this battle.
/// </summary>
IReadOnlyList<IItem> ConsumedItems { get; }
/// <summary>
/// Marks an item as consumed.
/// </summary>
void MarkItemAsConsumed(IItem itemName);
uint SwitchInTurn { get; internal set; }
}
@@ -569,7 +571,7 @@ public class PokemonImpl : ScriptSource, IPokemon
{
BatchId = batchId,
});
var newLevel = Library.StaticLibrary.GrowthRates.CalculateLevel(Species.GrowthRate, Experience);
if (newLevel > Level)
{
@@ -579,7 +581,7 @@ public class PokemonImpl : ScriptSource, IPokemon
{
BatchId = batchId,
});
if (newLevel >= maxLevel)
{
Experience = Library.StaticLibrary.GrowthRates.CalculateExperience(Species.GrowthRate, maxLevel);
@@ -597,7 +599,7 @@ public class PokemonImpl : ScriptSource, IPokemon
/// <inheritdoc />
public byte Coloring { get; }
/// <inheritdoc />
public bool IsShiny => Coloring == 1;
@@ -686,7 +688,11 @@ public class PokemonImpl : ScriptSource, IPokemon
private List<TypeIdentifier> _types = new();
/// <inheritdoc />
public IReadOnlyList<TypeIdentifier> Types { get => _types; private set => _types = value.ToList(); }
public IReadOnlyList<TypeIdentifier> Types
{
get => _types;
private set => _types = value.ToList();
}
/// <inheritdoc />
public bool IsEgg { get; private set; }
@@ -730,7 +736,7 @@ public class PokemonImpl : ScriptSource, IPokemon
HeldItem = null;
return previous;
}
private IItem? _stolenHeldItem;
/// <inheritdoc />
@@ -753,7 +759,7 @@ public class PokemonImpl : ScriptSource, IPokemon
return false;
if (!Library.ScriptResolver.TryResolveBattleItemScript(HeldItem, out _))
return false;
if (BattleData != null)
{
var prevented = false;
@@ -761,7 +767,7 @@ public class PokemonImpl : ScriptSource, IPokemon
if (prevented)
return false;
}
// TODO: actually consume the item
throw new NotImplementedException();
}
@@ -798,12 +804,12 @@ public class PokemonImpl : ScriptSource, IPokemon
RecalculateBoostedStats();
return true;
}
/// <summary>
/// Whether the ability of the Pokémon is suppressed.
/// </summary>
public bool AbilitySuppressed { get; private set; }
/// <inheritdoc />
public void SuppressAbility()
{
@@ -933,7 +939,7 @@ public class PokemonImpl : ScriptSource, IPokemon
this.RunScriptHook(script => script.ChangeIncomingDamage(this, source, ref dmg));
damage = dmg;
}
// If the damage is more than the current health, we cap it at the current health, to prevent
// underflow.
if (damage >= CurrentHealth)
@@ -989,7 +995,7 @@ public class PokemonImpl : ScriptSource, IPokemon
{
if (IsFainted && !allowRevive)
return false;
var maxAmount = this.BoostedStats.Hp - CurrentHealth;
var maxAmount = BoostedStats.Hp - CurrentHealth;
if (heal > maxAmount)
heal = maxAmount;
if (heal == 0)
@@ -1019,7 +1025,8 @@ public class PokemonImpl : ScriptSource, IPokemon
{
for (byte i = 0; i < Moves.Count; i++)
{
if (Moves[i] is not null) continue;
if (Moves[i] is not null)
continue;
index = i;
break;
}