Imlements baneful bunker, data fixes

This commit is contained in:
2025-01-10 12:55:25 +01:00
parent 6434f9925c
commit 92ab67ddf8
12 changed files with 209 additions and 17 deletions

View File

@@ -1,3 +1,4 @@
using PkmnLib.Dynamic.Models.Choices;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Static;
using PkmnLib.Static.Moves;
@@ -133,6 +134,11 @@ public interface IExecutingMove : IScriptSource
/// Gets the targets of this move.
/// </summary>
IReadOnlyList<IPokemon?> Targets { get; }
/// <summary>
/// The underlying move choice.
/// </summary>
IMoveChoice MoveChoice { get; }
}
/// <inheritdoc cref="IExecutingMove"/>
@@ -142,15 +148,14 @@ public class ExecutingMoveImpl : ScriptSource, IExecutingMove
private readonly IHitData[] _hits;
/// <inheritdoc cref="ExecutingMoveImpl"/>
public ExecutingMoveImpl(IReadOnlyList<IPokemon?> targets, byte numberOfHits, IPokemon user, ILearnedMove chosenMove,
IMoveData useMove, ScriptContainer script)
public ExecutingMoveImpl(IReadOnlyList<IPokemon?> targets, byte numberOfHits, ILearnedMove chosenMove,
IMoveData useMove, IMoveChoice moveChoice)
{
_targets = targets;
NumberOfHits = numberOfHits;
User = user;
ChosenMove = chosenMove;
UseMove = useMove;
Script = script;
MoveChoice = moveChoice;
var totalHits = targets.Count * numberOfHits;
_hits = new IHitData[totalHits];
@@ -167,7 +172,7 @@ public class ExecutingMoveImpl : ScriptSource, IExecutingMove
public byte NumberOfHits { get; }
/// <inheritdoc />
public IPokemon User { get; }
public IPokemon User => MoveChoice.User;
/// <inheritdoc />
public ILearnedMove ChosenMove { get; }
@@ -176,7 +181,7 @@ public class ExecutingMoveImpl : ScriptSource, IExecutingMove
public IMoveData UseMove { get; }
/// <inheritdoc />
public ScriptContainer Script { get; }
public ScriptContainer Script => MoveChoice.Script;
/// <inheritdoc />
public IHitData GetHitData(IPokemon target, byte hit)
@@ -215,6 +220,9 @@ public class ExecutingMoveImpl : ScriptSource, IExecutingMove
/// <inheritdoc />
public IReadOnlyList<IPokemon?> Targets => _targets.ToList();
/// <inheritdoc />
public IMoveChoice MoveChoice { get; }
/// <inheritdoc />
public override int ScriptCount => 1 + User.ScriptCount;