This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user