Skip to content

Commit e8658a6

Browse files
Additional extensions
1 parent ab56657 commit e8658a6

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

InscryptionAPI/Helpers/Extensions/BoardManagerExtensions.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ public static List<PlayableCard> GetCards(
3939
Predicate<PlayableCard> filterOnPredicate = null
4040
) => manager.GetSlotsCopy(getPlayerCards).SelectCards(filterOnPredicate).ToList();
4141

42+
/// <summary>
43+
/// Retrieve all cards on the board that match the predicate, if given.
44+
/// </summary>
45+
/// <param name="manager">Manager instance to access.</param>
46+
/// <param name="filterOnPredicate">The predicate to filter on each card.</param>
47+
/// <returns>The list of relevant cards on the board.</returns>
48+
public static List<PlayableCard> GetCards(this BoardManager manager, Predicate<PlayableCard> filterOnPredicate = null)
49+
=> manager.AllSlotsCopy.SelectCards(filterOnPredicate).ToList();
50+
51+
4252
/// <summary>
4353
/// Retrieve all player slots that are not occupied by a card.
4454
/// </summary>
@@ -74,6 +84,17 @@ public static List<CardSlot> GetOpenSlots(
7484
Predicate<CardSlot> filterOnPredicate = null
7585
) => manager.GetSlotsCopy(getPlayerSlots).SelectOpenSlots(filterOnPredicate).ToList();
7686

87+
/// <summary>
88+
/// Retrieve all slots on the board that are not occupied by a card.
89+
/// </summary>
90+
/// <param name="manager">Manager instance to access.</param>
91+
/// <param name="filterOnPredicate">The predicate to filter on each slot.</param>
92+
/// <returns>The list of relevant card slots with no cards.</returns>
93+
public static List<CardSlot> GetOpenSlots(
94+
this BoardManager manager,
95+
Predicate<CardSlot> filterOnPredicate = null
96+
) => manager.AllSlotsCopy.SelectOpenSlots(filterOnPredicate).ToList();
97+
7798
/// <summary>
7899
/// Retrieve a copy of the board slots for the player or opponent's side of the board.
79100
/// </summary>
@@ -84,7 +105,6 @@ public static List<CardSlot> GetOpenSlots(
84105
public static List<CardSlot> GetSlotsCopy(this BoardManager manager, bool getPlayerSlotsCopy)
85106
=> getPlayerSlotsCopy ? manager.PlayerSlotsCopy : manager.OpponentSlotsCopy;
86107

87-
88108
/// <summary>
89109
/// Retrieve all player or opponent card slots on the board.
90110
/// </summary>

0 commit comments

Comments
 (0)