Supply the context
UDeckToolkitRules::CheckAddCard is a pure validation utility. It never queries an inventory singleton or player progression service. Fill FDTDeckAddContext with the current deck size/capacity, copies already present/copy limit, owned copies, player/required levels and whether class policy permits this card.
FDTDeckAddContext Context;
Context.DeckSize = 12;
Context.Capacity = 20;
Context.CopiesInDeck = 1;
Context.CopyLimit = 3;
Context.OwnedCopies = 2;
Context.PlayerLevel = 5;
Context.RequiredLevel = 3;
Context.bClassAllowed = true;
const FDTDeckRuleResult Result = UDeckToolkitRules::CheckAddCard(Context);
// C++: Result.IsAllowed(). Blueprint: compare Failure with None.
// Use Result.Reason or map Failure to your own localized message.Rejection precedence
| Order / failure | Condition |
|---|---|
| 1 / InvalidInput | Negative scalar input or CopiesInDeck greater than DeckSize. |
| 2 / Capacity | DeckSize is already at Capacity. |
| 3 / CopyLimit | CopiesInDeck has reached CopyLimit. |
| 4 / Ownership | No additional owned copy is available. |
| 5 / Level | PlayerLevel is below RequiredLevel. |
| 6 / ClassRestriction | bClassAllowed is false. |
| None | The add is allowed by these supplied constraints. |
A successful add check is not a complete deck legality check. Validate any minimum size, required card mix, faction rules or game-specific restrictions before equipping or starting combat.
Workshop policies
The default workshop maps deck size, copy, ownership and level values into this context. Its Family filter is a browsing filter; it does not enforce a deck class restriction. Add your own class policy in the host adapter's Add implementation, using CheckAddCard with bClassAllowed set explicitly. CanAdd on the base model is not virtual; customize the UI preflight too if you need to display that additional restriction before activation.
Opening-hand probability
OpeningHandProbability(N, K, DrawCount) gives the probability of at least one matching card in a draw without replacement: 1 - C(N-K, DrawCount) / C(N, DrawCount), with impossible-miss cases handled directly. For 20 cards, 3 matches and 5 draws, the chance is approximately 60.09%.
Valid inputs require 0 ≤ K ≤ N ≤ 1,000,000 and 0 ≤ DrawCount ≤ N. Invalid inputs return -1. No matching cards or no draws returns 0. Drawing more than the number of non-matches returns 1.