Deukhoofd 1feb27e826
All checks were successful
Build / Build (push) Successful in 50s
More work on refactor to interfaces
2025-06-29 12:03:51 +02:00

30 lines
878 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "charge_effect")]
public class ChargeEffect : Script, IScriptChangeDamageModifier, IScriptOnEndTurn
{
private bool _turnOfUse = true;
/// <inheritdoc />
public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
{
var library = target.BattleData?.Battle.Library;
if (library == null)
return;
if (!library.StaticLibrary.Types.TryGetTypeIdentifier("electric", out var electricType))
return;
if (move.UseMove.MoveType == electricType)
modifier *= 2;
}
/// <inheritdoc />
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (_turnOfUse)
{
_turnOfUse = false;
return;
}
RemoveSelf();
}
}