PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Struggle.cs

31 lines
898 B
C#
Raw Normal View History

2024-11-02 11:59:55 +00:00
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "struggle")]
public class Struggle : Script
{
/// <inheritdoc />
public override void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
{
numberOfHits = 1;
}
/// <inheritdoc />
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
{
invulnerable = false;
}
/// <inheritdoc />
public override void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness)
{
effectiveness = 1;
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var damage = move.User.MaxHealth / 4;
if (damage == 0) damage = 1;
move.User.Damage(damage, DamageSource.Struggle, new());
}
}