More moves, allow for typeless moves

This commit is contained in:
2025-05-02 15:46:37 +02:00
parent 807acf1947
commit 068ff8d5b7
33 changed files with 525 additions and 56 deletions

View File

@@ -33,9 +33,9 @@ public interface IHitData
uint Damage { get; }
/// <summary>
/// The type of the hit.
/// The type of the hit. Null if the move is typeless.
/// </summary>
TypeIdentifier Type { get; }
TypeIdentifier? Type { get; }
/// <summary>
/// Whether the hit has failed.
@@ -64,7 +64,7 @@ public record HitData : IHitData
public uint Damage { get; internal set; }
/// <inheritdoc />
public TypeIdentifier Type { get; internal set; }
public TypeIdentifier? Type { get; internal set; }
/// <inheritdoc />
public bool HasFailed { get; private set; }
@@ -141,6 +141,8 @@ public interface IExecutingMove : IScriptSource
IMoveChoice MoveChoice { get; }
IReadOnlyList<IHitData> Hits { get; }
IBattle Battle { get; }
}
/// <inheritdoc cref="IExecutingMove"/>
@@ -148,16 +150,18 @@ public class ExecutingMoveImpl : ScriptSource, IExecutingMove
{
private readonly IReadOnlyList<IPokemon?> _targets;
private readonly IHitData[] _hits;
private readonly IBattle _battle;
/// <inheritdoc cref="ExecutingMoveImpl"/>
public ExecutingMoveImpl(IReadOnlyList<IPokemon?> targets, byte numberOfHits, ILearnedMove chosenMove,
IMoveData useMove, IMoveChoice moveChoice)
IMoveData useMove, IMoveChoice moveChoice, IBattle battle)
{
_targets = targets;
NumberOfHits = numberOfHits;
ChosenMove = chosenMove;
UseMove = useMove;
MoveChoice = moveChoice;
_battle = battle;
var totalHits = targets.Count * numberOfHits;
_hits = new IHitData[totalHits];
@@ -230,6 +234,9 @@ public class ExecutingMoveImpl : ScriptSource, IExecutingMove
/// <inheritdoc />
public IReadOnlyList<IHitData> Hits => _hits;
/// <inheritdoc />
public IBattle Battle => _battle;
/// <inheritdoc />
public override int ScriptCount => 2 + User.ScriptCount;