28 lines
790 B
C#
28 lines
790 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
|
|
|
[Script(ScriptCategory.Pokemon, "leech_seed")]
|
|
public class LeechSeedEffect : Script
|
|
{
|
|
private readonly IPokemon _owner;
|
|
private readonly IPokemon _placer;
|
|
|
|
public LeechSeedEffect(IPokemon owner, IPokemon placer)
|
|
{
|
|
_owner = owner;
|
|
_placer = placer;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
|
{
|
|
var damage = _owner.BoostedStats.Hp / 8;
|
|
if (_owner.CurrentHealth <= damage)
|
|
damage = _owner.CurrentHealth;
|
|
|
|
_owner.Damage(damage, DamageSource.Misc);
|
|
if (_owner.ActiveAbility?.Name == "liquid_ooze")
|
|
_placer.Damage(damage, DamageSource.Misc);
|
|
else
|
|
_placer.Heal(damage);
|
|
}
|
|
} |