More abilities
This commit is contained in:
41
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Teravolt.cs
Normal file
41
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Teravolt.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user