Skip to content

Commit 6783971

Browse files
CardInfo.GetAbilityStacks
1 parent 064cace commit 6783971

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

InscryptionAPI/Card/CardExtensionsHelpers.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,22 @@ public static int GetAbilityStacks(this PlayableCard card, Ability ability)
304304
return AbilitiesUtil.GetInfo(ability).canStack ? count : 1;
305305
}
306306

307+
/// <summary>
308+
/// Gets the number of Ability stacks a card has.
309+
/// </summary>
310+
/// <param name="card">The PlayableCard to access.</param>
311+
/// <param name="ability">The Ability to check for.</param>
312+
/// <returns>The number of Ability stacks the card has.</returns>
313+
public static int GetAbilityStacks(this CardInfo info, Ability ability)
314+
{
315+
int count = info.Abilities.Count(a => a == ability);
316+
if (count == 0)
317+
return 0;
318+
319+
// If it's not stackable, you get at most one
320+
return AbilitiesUtil.GetInfo(ability).canStack ? count : 1;
321+
}
322+
307323
/// <summary>
308324
/// Check if the other PlayableCard is on the same side of the board as this PlayableCard.
309325
/// </summary>

0 commit comments

Comments
 (0)