using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
///
/// Teravolt is an ability that allows moves to ignore the target's abilities if they could hinder or prevent the move.
///
/// Bulbapedia - Teravolt
///
[Script(ScriptCategory.Ability, "teravolt")]
public class Teravolt : Script, IScriptOnBeforeMoveChoice, IScriptOnAfterMoveChoice
{
///
public 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());
}
}
///
public 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();
}
}
}