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:
@@ -3,7 +3,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
[Script(ScriptCategory.Pokemon, "substitute")]
|
||||
public class SubstituteEffect(uint health) : Script, IScriptBlockIncomingHit
|
||||
{
|
||||
private uint _health = health;
|
||||
public uint Health { get; private set; } = health;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||
@@ -19,12 +19,12 @@ public class SubstituteEffect(uint health) : Script, IScriptBlockIncomingHit
|
||||
|
||||
block = true;
|
||||
var damage = executingMove.GetHitData(target, hitIndex).Damage;
|
||||
if (damage >= _health)
|
||||
if (damage >= Health)
|
||||
{
|
||||
executingMove.Battle.EventHook.Invoke(new DialogEvent("substitute_broken"));
|
||||
RemoveSelf();
|
||||
return;
|
||||
}
|
||||
_health -= damage;
|
||||
Health -= damage;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user