This commit is contained in:
49
Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/FlowerVeilEffect.cs
Normal file
49
Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/FlowerVeilEffect.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "flower_veil")]
|
||||
public class FlowerVeilEffect : 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 PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
ref bool prevent)
|
||||
{
|
||||
if (selfInflicted)
|
||||
return;
|
||||
|
||||
if (amount > 0)
|
||||
return;
|
||||
|
||||
if (target.Types.All(x => x.Name != "grass"))
|
||||
return;
|
||||
|
||||
prevent = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||
ref bool preventStatus)
|
||||
{
|
||||
if (selfInflicted)
|
||||
return;
|
||||
if (pokemon.Types.All(x => x.Name != "grass"))
|
||||
return;
|
||||
|
||||
preventStatus = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user