namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
///
/// Storm Drain is an ability that draws in all Water-type moves to up its Special Attack.
///
/// Bulbapedia - Storm Drain
///
[Script(ScriptCategory.Ability, "storm_drain")]
public class StormDrain : Script, IScriptChangeIncomingTargets, IScriptChangeEffectiveness
{
///
public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList targets)
{
if (moveChoice.ChosenMove.MoveData.MoveType.Name == "water" && targets.Count == 1)
{
targets = [moveChoice.User];
}
}
///
public 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);
}
}