Class CardSource
java.lang.Object
net.demilich.metastone.game.spells.desc.source.CardSource
- All Implemented Interfaces:
Serializable,HasDesc<CardSourceDesc>
- Direct Known Subclasses:
AftermathsCardSource,CatalogueSource,CombinedSource,DeckCollectionSource,DeckSource,FormatCatalogueSource,GraveyardActorsSource,GraveyardCardAndActorSourceCardSource,GraveyardCardsSource,GraveyardDiedMinionsSource,HandSource,MinionsSource,SecretSource,ShuffledCardsSource,StoredEntitiesSource,SummonWithoutReplacementCardSource,UncollectibleCatalogueSource,UnweightedCatalogueSource
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetArg(CardSourceArg arg) getCards(GameContext context, Entity source, Player player) getDesc()booleanhasArg(CardSourceArg arg) protected abstract CardListmatch(GameContext context, Entity source, Player player) Overridden by card source implementations to return a list of cards that usually get filtered in anEntityFilter.match(GameContext context, Entity source, Player player, Predicate<Card> filter, int limit, boolean shuffled) Provides cards performantly, on demand, without having to iterate through the entire card catalogue for many kinds of sources.void
-
Constructor Details
-
CardSource
-
-
Method Details
-
getArg
-
hasArg
-
getCards
-
match
Overridden by card source implementations to return a list of cards that usually get filtered in anEntityFilter.See the implementations for examples of how, e.g. the graveyard is turned into a
CardListinstance by iterating through all the actors in the graveyard and retrieving theirEntity.getSourceCard().- Parameters:
context- The game contextsource- The entity that is the origin of this matching operationplayer- The casting player- Returns:
- A list of cards pre-filter.
-
match
protected Stream<Card> match(GameContext context, Entity source, Player player, Predicate<Card> filter, int limit, boolean shuffled) Provides cards performantly, on demand, without having to iterate through the entire card catalogue for many kinds of sources.The implementations are responsible for providing an efficient answer.
- Parameters:
context-source-player-limit-shuffled-- Returns:
-
getTargetPlayer
-
getDesc
- Specified by:
getDescin interfaceHasDesc<CardSourceDesc>
-
setDesc
- Specified by:
setDescin interfaceHasDesc<CardSourceDesc>
-