More abilities, refactor stealing held items
All checks were successful
Build / Build (push) Successful in 50s

This commit is contained in:
2025-06-15 11:49:15 +02:00
parent 1b9d137bb0
commit f5d18d7186
22 changed files with 326 additions and 21 deletions

View File

@@ -0,0 +1,34 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Storm Drain is an ability that draws in all Water-type moves to up its Special Attack.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Storm_Drain_(Ability)">Bulbapedia - Storm Drain</see>
/// </summary>
[Script(ScriptCategory.Ability, "storm_drain")]
public class StormDrain : Script
{
/// <inheritdoc />
public override void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
{
if (moveChoice.ChosenMove.MoveData.MoveType.Name == "water" && targets.Count == 1)
{
targets = [moveChoice.User];
}
}
/// <inheritdoc />
public override void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness)
{
if (move.GetHitData(target, hit).Type?.Name != "water")
return;
effectiveness = 0f;
EventBatchId batchId = new();
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(move.User)
{
BatchId = batchId,
});
move.User.ChangeStatBoost(Statistic.SpecialAttack, 1, true, true, batchId);
}
}