More abilities
All checks were successful
Build / Build (push) Successful in 49s

This commit is contained in:
2025-06-09 18:16:29 +02:00
parent e68491e72a
commit 4326794611
26 changed files with 297 additions and 26 deletions

View File

@@ -0,0 +1,34 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Lightning Rod is an ability that draws all Electric-type moves to the Pokémon, raising its Special Attack.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Lightning_Rod_(Ability)">Bulbapedia - Lightning Rod</see>
/// </summary>
[Script(ScriptCategory.Ability, "lightning_rod")]
public class LightningRod : Script
{
/// <inheritdoc />
public override void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
{
if (moveChoice.ChosenMove.MoveData.MoveType.Name == "electric" && targets.Count == 1)
{
targets = [moveChoice.User];
}
}
/// <inheritdoc />
public override void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness)
{
if (move.GetHitData(target, hit).Type?.Name != "electric")
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);
}
}