Implements a bunch more moves
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-05-17 17:44:15 +02:00
parent ecabe2fd10
commit a17cb92c5a
62 changed files with 1180 additions and 81 deletions

View File

@@ -3,14 +3,45 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "stockpile_effect")]
public class StockpileEffect : Script
{
private IPokemon? _pokemon;
public int StockpileCount { get; set; } = 1;
/// <inheritdoc />
public override void OnAddedToParent(IScriptSource source)
{
if (source is not IPokemon pokemon)
{
throw new InvalidOperationException("StockpileEffect can only be added to a Pokemon.");
}
_pokemon = pokemon;
EventBatchId batchId = new();
pokemon.ChangeStatBoost(Statistic.Defense, 1, true, batchId);
pokemon.ChangeStatBoost(Statistic.SpecialDefense, 1, true, batchId);
StockpileCount = 1;
}
/// <inheritdoc />
public override void Stack()
{
if (StockpileCount < 3)
{
EventBatchId batchId = new();
_pokemon?.ChangeStatBoost(Statistic.Defense, 1, true, batchId);
_pokemon?.ChangeStatBoost(Statistic.SpecialDefense, 1, true, batchId);
StockpileCount++;
}
}
/// <inheritdoc />
public override void OnRemove()
{
if (_pokemon == null)
{
return;
}
EventBatchId batchId = new();
_pokemon.ChangeStatBoost(Statistic.Defense, (sbyte)-StockpileCount, true, batchId);
_pokemon.ChangeStatBoost(Statistic.SpecialDefense, (sbyte)-StockpileCount, true, batchId);
StockpileCount = 0;
}
}