Getting started with implementing an explicit AI, based on the Essentials one.
All checks were successful
Build / Build (push) Successful in 1m2s

This commit is contained in:
2025-07-11 17:03:08 +02:00
parent 084ae84130
commit a3a4993407
56 changed files with 2687 additions and 1274 deletions

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "badly_poisoned")]
public class BadlyPoisoned : Poisoned, IScriptOnEndTurn
public class BadlyPoisoned : Poisoned
{
private int _turns = 1;

View File

@@ -3,7 +3,7 @@ using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "burned")]
public class Burned : Script, IScriptChangeMoveDamage, IScriptOnEndTurn
public class Burned : Script, IScriptChangeMoveDamage, IScriptOnEndTurn, IAIInfoScriptExpectedEndOfTurnDamage
{
private IPokemon? _target;
@@ -41,4 +41,11 @@ public class Burned : Script, IScriptChangeMoveDamage, IScriptOnEndTurn
});
_target.Damage(damage, DamageSource.Status, eventBatch);
}
/// <inheritdoc />
public void ExpectedEndOfTurnDamage(IPokemon pokemon, ref int damage)
{
if (_target != null)
damage += (int)(_target.MaxHealth / 16f);
}
}

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "poisoned")]
public class Poisoned : Script, IScriptOnEndTurn
public class Poisoned : Script, IScriptOnEndTurn, IAIInfoScriptExpectedEndOfTurnDamage
{
private IPokemon? _pokemon;
@@ -46,4 +46,11 @@ public class Poisoned : Script, IScriptOnEndTurn
else
_pokemon.Damage(damage, DamageSource.Status, eventBatchId);
}
/// <inheritdoc />
public virtual void ExpectedEndOfTurnDamage(IPokemon pokemon, ref int damage)
{
if (_pokemon != null)
damage += (int)(_pokemon.MaxHealth * GetPoisonMultiplier());
}
}

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "sleep")]
public class Sleep : Script, IScriptPreventMove
public class Sleep : Script, IScriptPreventMove, IAIInfoScriptNumberTurnsLeft
{
private IPokemon? _pokemon;
public int Turns { get; set; }
@@ -54,4 +54,7 @@ public class Sleep : Script, IScriptPreventMove
{ "pokemon", _pokemon },
}));
}
/// <inheritdoc />
public int TurnsLeft() => Turns;
}