Files
PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Curse.cs
Deukhoofd 6a82c20cf2
All checks were successful
Build / Build (push) Successful in 1m57s
More tests, more fixes
2026-07-05 18:26:55 +02:00

30 lines
1.1 KiB
C#

using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "curse")]
public class Curse : Script, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battleData = move.User.BattleData;
if (battleData == null)
return;
var typeLibrary = battleData.Battle.Library.StaticLibrary.Types;
if (!typeLibrary.TryGetTypeIdentifier("ghost", out var ghostType))
return;
if (move.User.Types.Contains(ghostType))
{
move.User.Damage(move.User.MaxHealth / 2, DamageSource.Misc, forceDamage: true);
target.Volatile.Add(new GhostCurseEffect(target));
}
else
{
EventBatchId batchId = new();
move.User.ChangeStatBoost(Statistic.Speed, -1, true, false, batchId);
move.User.ChangeStatBoost(Statistic.Defense, 1, true, false, batchId);
move.User.ChangeStatBoost(Statistic.Attack, 1, true, false, batchId);
}
}
}