namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; [Script(ScriptCategory.Pokemon, "infestation")] public class InfestationEffect : Script, IScriptOnEndTurn, IScriptPreventSelfSwitch, IScriptPreventSelfRunAway, IAIInfoScriptExpectedEndOfTurnDamage { private readonly IBattlePokemon _owner; private int _turns; private readonly float _bindDamage; public InfestationEffect(IBattlePokemon owner, int turns, float bindDamage) { _owner = owner; _turns = turns; _bindDamage = bindDamage; } /// public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true; /// public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true; /// public void OnEndTurn(IScriptSource owner, IBattle battle) { var damage = _owner.BoostedStats.Hp * _bindDamage; _owner.Damage((uint)damage, DamageSource.Misc); _turns--; if (_turns <= 0) { RemoveSelf(); } } /// public void ExpectedEndOfTurnDamage(IBattlePokemon pokemon, ref int damage) { damage += (int)(_owner.MaxHealth * _bindDamage); } }