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

@@ -1,4 +1,5 @@
using PkmnLib.Plugin.Gen7.Scripts.Battle;
using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
@@ -11,8 +12,28 @@ public class FutureSight : Script, IScriptStopBeforeMove
var battleData = move.User.BattleData;
if (battleData == null)
return;
battleData.Battle.Volatile.Add(new FutureSightEffect(move.MoveChoice));
var battle = battleData.Battle;
var moveChoice = move.MoveChoice;
prevent = true;
if (IsTargetAlreadySetToBeHit(battle, moveChoice.TargetSide, moveChoice.TargetPosition))
{
moveChoice.Fail();
return;
}
if (battle.Volatile.TryGet<FutureSightEffect>(out var effect))
effect.AddStrike(moveChoice);
else
battle.Volatile.Add(new FutureSightEffect(moveChoice));
}
private static bool IsTargetAlreadySetToBeHit(IBattle battle, byte side, byte position)
{
if (battle.Volatile.TryGet<FutureSightEffect>(out var futureSight) && futureSight.HasStrikeAt(side, position))
return true;
var doomDesire = battle.Sides[side].VolatileScripts.Get<DoomDesireEffect>();
return doomDesire != null && doomDesire.HasTarget(position);
}
}