Unreal ToolsDeck Toolkit / DocsAll tools ↗
DECK TOOLKIT / DOCUMENTATION

Validate a composition.

Apply game-supplied deck constraints and measure opening-hand consistency.

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.

cpp
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 / failureCondition
1 / InvalidInputNegative scalar input or CopiesInDeck greater than DeckSize.
2 / CapacityDeckSize is already at Capacity.
3 / CopyLimitCopiesInDeck has reached CopyLimit.
4 / OwnershipNo additional owned copy is available.
5 / LevelPlayerLevel is below RequiredLevel.
6 / ClassRestrictionbClassAllowed is false.
NoneThe 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.

© 2026 Hungry Ghost / Unreal Tools.
Independent tools for Unreal Engine. Not affiliated with or endorsed by Epic Games.
Documentation for version 0.3.0 · Updated September 10, 2026