namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "magnet_rise")]
public class MagnetRiseEffect : Script, IScriptChangeEffectiveness, IScriptOnEndTurn
{
private int _turnsRemaining = 4;
///
public void ChangeEffectiveness(IExecutingMove move, IBattlePokemon target, byte hit, ref float effectiveness)
{
if (move.User.HasHeldItem(ItemNames.IronBall))
return;
if (move.UseMove.MoveType.Name == TypeNames.Ground)
{
effectiveness = 0.0f;
}
}
///
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_turnsRemaining > 0)
_turnsRemaining--;
else
RemoveSelf();
}
}