This commit is contained in:
@@ -252,7 +252,7 @@ public class BattleImpl : ScriptSource, IBattle
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool CanSlotBeFilled(byte side, byte position) => Parties.Any(x =>
|
||||
x.IsResponsibleForIndex(new ResponsibleIndex(side, position)) && x.HasPokemonNotInField());
|
||||
x.IsResponsibleForIndex(new ResponsibleIndex(side, position)) && x.HasUsablePokemonNotInField());
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ValidateBattleState()
|
||||
|
||||
@@ -21,7 +21,12 @@ public interface IBattleParty : IDeepCloneable
|
||||
/// <summary>
|
||||
/// Whether the party has a living Pokemon left that is not in the field.
|
||||
/// </summary>
|
||||
bool HasPokemonNotInField();
|
||||
bool HasUsablePokemonNotInField();
|
||||
|
||||
/// <summary>
|
||||
/// Gets all usable Pokemon that are not currently in the field.
|
||||
/// </summary>
|
||||
IEnumerable<IPokemon> GetUsablePokemonNotInField();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -49,6 +54,10 @@ public class BattlePartyImpl : IBattleParty
|
||||
public bool IsResponsibleForIndex(ResponsibleIndex index) => _responsibleIndices.Contains(index);
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasPokemonNotInField() =>
|
||||
public bool HasUsablePokemonNotInField() =>
|
||||
Party.WhereNotNull().Any(x => x.IsUsable && x.BattleData?.IsOnBattlefield != true);
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IPokemon> GetUsablePokemonNotInField() =>
|
||||
Party.WhereNotNull().Where(x => x.IsUsable && x.BattleData?.IsOnBattlefield != true);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using PkmnLib.Dynamic.Events;
|
||||
using PkmnLib.Dynamic.Libraries;
|
||||
using PkmnLib.Dynamic.Models.Choices;
|
||||
using PkmnLib.Dynamic.Models.Serialized;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Static;
|
||||
@@ -489,6 +490,8 @@ public interface IPokemonBattleData : IDeepCloneable
|
||||
/// </summary>
|
||||
uint SwitchInTurn { get; internal set; }
|
||||
|
||||
uint TurnsOnField { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The side the Pokémon is on.
|
||||
/// </summary>
|
||||
@@ -503,6 +506,11 @@ public interface IPokemonBattleData : IDeepCloneable
|
||||
/// The form of the Pokémon at the time it was sent out.
|
||||
/// </summary>
|
||||
IForm OriginalForm { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The last move choice executed by the Pokémon.
|
||||
/// </summary>
|
||||
IMoveChoice? LastMoveChoice { get; internal set; }
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IPokemon"/>
|
||||
@@ -1490,6 +1498,9 @@ public class PokemonBattleDataImpl : IPokemonBattleData
|
||||
/// <inheritdoc />
|
||||
public uint SwitchInTurn { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public uint TurnsOnField => Battle.CurrentTurnNumber - SwitchInTurn;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IBattleSide BattleSide => Battle.Sides[SideIndex];
|
||||
|
||||
@@ -1498,4 +1509,7 @@ public class PokemonBattleDataImpl : IPokemonBattleData
|
||||
|
||||
/// <inheritdoc />
|
||||
public IForm OriginalForm { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IMoveChoice? LastMoveChoice { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user