28 lines
721 B
C#
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);
|
|
}
|
|
} |