Implements several more moves
This commit is contained in:
@@ -252,12 +252,18 @@ public interface IPokemon : IScriptSource, IDeepCloneable
|
||||
/// <param name="stat">The stat to be changed</param>
|
||||
/// <param name="change">The amount to change the stat by</param>
|
||||
/// <param name="selfInflicted">Whether the change was self-inflicted. This can be relevant in scripts.</param>
|
||||
bool ChangeStatBoost(Statistic stat, sbyte change, bool selfInflicted);
|
||||
/// <param name="batchId">The event batch ID this change is a part of. This is relevant for visual handling</param>
|
||||
bool ChangeStatBoost(Statistic stat, sbyte change, bool selfInflicted, EventBatchId batchId = default);
|
||||
|
||||
/// <summary>
|
||||
/// Suppresses the ability of the Pokémon.
|
||||
/// </summary>
|
||||
public void SuppressAbility();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the currently active ability.
|
||||
/// </summary>
|
||||
IAbility ActiveAbility { get; }
|
||||
IAbility? ActiveAbility { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the flat stats on the Pokemon. This should be called when for example the base
|
||||
@@ -362,6 +368,11 @@ public interface IPokemon : IScriptSource, IDeepCloneable
|
||||
/// 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);
|
||||
|
||||
/// <summary>
|
||||
/// Converts the data structure to a serializable format.
|
||||
@@ -714,7 +725,7 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool ChangeStatBoost(Statistic stat, sbyte change, bool selfInflicted)
|
||||
public bool ChangeStatBoost(Statistic stat, sbyte change, bool selfInflicted, EventBatchId batchId = default)
|
||||
{
|
||||
var prevented = false;
|
||||
this.RunScriptHook(script => script.PreventStatBoostChange(this, stat, change, selfInflicted, ref prevented));
|
||||
@@ -736,18 +747,34 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
if (BattleData != null)
|
||||
{
|
||||
var newBoost = StatBoost.GetStatistic(stat);
|
||||
BattleData.Battle.EventHook.Invoke(new StatBoostEvent(this, stat, oldBoost, newBoost));
|
||||
BattleData.Battle.EventHook.Invoke(new StatBoostEvent(this, stat, oldBoost, newBoost)
|
||||
{
|
||||
BatchId = batchId,
|
||||
});
|
||||
}
|
||||
|
||||
RecalculateBoostedStats();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the ability of the Pokémon is suppressed.
|
||||
/// </summary>
|
||||
public bool AbilitySuppressed { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SuppressAbility()
|
||||
{
|
||||
OverrideAbility = null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IAbility ActiveAbility
|
||||
public IAbility? ActiveAbility
|
||||
{
|
||||
get
|
||||
{
|
||||
if (AbilitySuppressed)
|
||||
return null;
|
||||
if (OverrideAbility != null)
|
||||
return OverrideAbility;
|
||||
var ability = Form.GetAbility(AbilityIndex);
|
||||
@@ -1004,6 +1031,9 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
Volatile.Clear();
|
||||
WeightInKg = Form.Weight;
|
||||
HeightInMeters = Form.Height;
|
||||
Types = Form.Types;
|
||||
OverrideAbility = null;
|
||||
AbilitySuppressed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1032,6 +1062,12 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetTypes(IReadOnlyList<TypeIdentifier> types)
|
||||
{
|
||||
_types = types.ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public SerializedPokemon Serialize() => new(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user