Many more tests and fixes
All checks were successful
Build / Build (push) Successful in 3m12s

This commit is contained in:
2026-08-27 17:11:12 +02:00
parent 32b3ef9c4a
commit d2a82b5fe3
204 changed files with 20255 additions and 242 deletions

View File

@@ -3,7 +3,7 @@ using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "mirror_coat")]
public class MirrorCoat : Script, IScriptOnBeforeTurnStart, IScriptChangeMoveDamage
public class MirrorCoat : Script, IScriptOnBeforeTurnStart, IScriptChangeTargets, IScriptChangeMoveDamage
{
/// <inheritdoc />
public void OnBeforeTurnStart(ITurnChoice choice)
@@ -11,19 +11,31 @@ public class MirrorCoat : Script, IScriptOnBeforeTurnStart, IScriptChangeMoveDam
choice.User.Volatile.Add(new MirrorCoatHelper());
}
/// <inheritdoc />
public void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
{
var helper = moveChoice.User.Volatile.Get<MirrorCoatHelper>();
var lastAttacker = helper?.LastAttacker;
if (lastAttacker == null)
{
moveChoice.Fail();
return;
}
targets = [lastAttacker];
}
/// <inheritdoc />
public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
{
var helper = target.Volatile.Get<MirrorCoatHelper>();
var helper = move.User.Volatile.Get<MirrorCoatHelper>();
if (helper?.LastAttacker == null || helper.LastAttacker != move.User)
if (helper?.LastAttacker == null || helper.LastAttacker != target)
{
move.GetHitData(target, hit).Fail();
return;
}
damage = helper.LastDamage.MultiplyOrMax(2f);
target.Volatile.Remove<MirrorCoatHelper>();
damage = Math.Max(helper.LastDamage.MultiplyOrMax(2f), 1);
}
[Script(ScriptCategory.Pokemon, "mirror_coat_helper")]