Getting started with implementing an explicit AI, based on the Essentials one.
All checks were successful
Build / Build (push) Successful in 1m2s
All checks were successful
Build / Build (push) Successful in 1m2s
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "leech_seed")]
|
||||
public class LeechSeedEffect : Script, IScriptOnEndTurn
|
||||
public class LeechSeedEffect : Script, IScriptOnEndTurn, IAIInfoScriptExpectedEndOfTurnDamage
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
private readonly IPokemon _placer;
|
||||
@@ -15,7 +15,7 @@ public class LeechSeedEffect : Script, IScriptOnEndTurn
|
||||
/// <inheritdoc />
|
||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
var damage = _owner.BoostedStats.Hp / 8;
|
||||
var damage = _owner.MaxHealth / 8;
|
||||
if (_owner.CurrentHealth <= damage)
|
||||
damage = _owner.CurrentHealth;
|
||||
|
||||
@@ -25,4 +25,10 @@ public class LeechSeedEffect : Script, IScriptOnEndTurn
|
||||
else
|
||||
_placer.Heal(damage);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ExpectedEndOfTurnDamage(IPokemon pokemon, ref int damage)
|
||||
{
|
||||
damage += (int)(_owner.MaxHealth / 8f);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user