Deukhoofd 97868ab4c6
All checks were successful
Build / Build (push) Successful in 48s
More abilities
2025-06-09 13:44:26 +02:00

28 lines
721 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Side;
[Script(ScriptCategory.Side, "friend_guard")]
public class FriendGuardEffect : Script
{
private readonly HashSet<IPokemon> _placerPokemon = [];
public void OnAdded(IPokemon placer)
{
_placerPokemon.Add(placer);
}
public void OnRemoved(IPokemon placer)
{
_placerPokemon.Remove(placer);
if (_placerPokemon.Count == 0)
{
RemoveSelf();
}
}
/// <inheritdoc />
public override void ChangeIncomingMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
var modifier = Math.Pow(0.75f, _placerPokemon.Count);
damage = (uint)(damage * modifier);
}
}