using System.Linq; using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Static; namespace PkmnLib.Plugin.Gen7.Scripts.Moves; [Script(ScriptCategory.Move, "curse")] public class Curse : Script { /// public override 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.CurrentHealth / 2, DamageSource.Misc); if (move.User.CurrentHealth == 0) return; target.Volatile.Add(new GhostCurseEffect(target)); } else { EventBatchId batchId = new(); move.User.ChangeStatBoost(Statistic.Speed, -1, true, batchId); move.User.ChangeStatBoost(Statistic.Defense, 1, true, batchId); move.User.ChangeStatBoost(Statistic.Attack, 1, true, batchId); } } }