Deukhoofd 2533512eda
All checks were successful
Build / Build (push) Successful in 51s
Slight cleanup, do some TODOs
2025-06-22 10:42:25 +02:00

40 lines
1.2 KiB
C#

using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Teravolt is an ability that allows moves to ignore the target's abilities if they could hinder or prevent the move.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Teravolt_(Ability)">Bulbapedia - Teravolt</see>
/// </summary>
[Script(ScriptCategory.Ability, "teravolt")]
public class Teravolt : Script
{
/// <inheritdoc />
public override void OnBeforeMoveChoice(IMoveChoice moveChoice)
{
var battleData = moveChoice.User.BattleData;
if (battleData is null)
return;
var sides = battleData.Battle.Sides.Where(x => x != battleData.BattleSide);
foreach (var side in sides)
{
side.VolatileScripts.Add(new TeravoltEffect());
}
}
/// <inheritdoc />
public override void OnAfterMoveChoice(IMoveChoice move)
{
var battleData = move.User.BattleData;
if (battleData is null)
return;
var sides = battleData.Battle.Sides.Where(x => x != battleData.BattleSide);
foreach (var side in sides)
{
side.VolatileScripts.Remove<TeravoltEffect>();
}
}
}