23 lines
850 B
C#
23 lines
850 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|
|
|
[Script(ScriptCategory.Move, "magnetic_flux")]
|
|
public class MagneticFlux : Script, IScriptOnSecondaryEffect
|
|
{
|
|
/// <inheritdoc />
|
|
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
|
{
|
|
var battleData = move.User;
|
|
if (battleData is null)
|
|
return;
|
|
|
|
foreach (var pokemon in battleData.BattleSide.Pokemon.WhereNotNull())
|
|
{
|
|
if (pokemon.ActiveAbility?.Name != AbilityNames.Plus && pokemon.ActiveAbility?.Name != AbilityNames.Minus)
|
|
continue;
|
|
|
|
EventBatchId batch = new();
|
|
pokemon.ChangeStatBoost(Statistic.Defense, 1, pokemon == move.User, false, batch);
|
|
pokemon.ChangeStatBoost(Statistic.SpecialDefense, 1, pokemon == move.User, false, batch);
|
|
}
|
|
}
|
|
} |