Class EntityFilter
java.lang.Object
net.demilich.metastone.game.spells.desc.filter.EntityFilter
- All Implemented Interfaces:
Serializable
,HasDesc<EntityFilterDesc>
- Direct Known Subclasses:
AmalgamRaceFilter
,AndFilter
,AttributeFilter
,CardFilter
,CollectibleFilter
,CopiesHaveBeenPlayedFilter
,DamagedFilter
,EntityEqualsFilter
,EntityTypeFilter
,HasAttackedFilter
,HasEffectsFilter
,HasEnchantmentFilter
,HasTextFilter
,HasTurnEffectsFilter
,HealedFilter
,HighestAttributeFilter
,IsDestroyedFilter
,ManaCostFilter
,NullFilter
,OrFilter
,OwnedByPlayerFilter
,RaceEqualsFilter
,RaceFilter
,SameHeroClassFilter
,SpecificCardFilter
,SpellFilter
,StorageContainsFilter
,SummonedByPlayerFilter
,TargetSelectionFilter
,ZoneContainsFilter
public abstract class EntityFilter
extends Object
implements Serializable, HasDesc<EntityFilterDesc>
Filters
Entity
objects using its test(GameContext, Player, Entity, Entity)
implementation.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
getArg
(EntityFilterArg arg) getDesc()
getTargetedEntities
(GameContext context, Player player, Entity host) boolean
hasArg
(EntityFilterArg arg) matcher
(GameContext context, Player player, Entity host) boolean
matches
(GameContext context, Player player, Entity entity, Entity host) A method that calls the subclass'stest(GameContext, Player, Entity, Entity)
implementation that determines whether or not a givenentity
matches the filter.void
protected abstract boolean
test
(GameContext context, Player player, Entity entity, Entity host) The subclasses of this class implement this method to actually perform the logic of the filtering.
-
Constructor Details
-
EntityFilter
-
-
Method Details
-
getDesc
- Specified by:
getDesc
in interfaceHasDesc<EntityFilterDesc>
-
getArg
-
hasArg
-
matcher
-
matches
A method that calls the subclass'stest(GameContext, Player, Entity, Entity)
implementation that determines whether or not a givenentity
matches the filter.EntityFilterArg.TARGET_PLAYER
is interpreted as the point of view from which thetest(GameContext, Player, Entity, Entity)
call is evaluated.If an
EntityFilterArg.AND_CONDITION
is specified, the filter's test and the condition must pass. Works The condition uses theplayer
passed into this function, not theEntityFilterArg.TARGET_PLAYER
that is potentially specified on this filter. for any filter. The condition uses theplayer
passed into this function, not theEntityFilterArg.TARGET_PLAYER
that is potentially specified on this filter.- Parameters:
context
-player
-entity
-host
-- Returns:
true
if theentity
passes the filter, otherwisefalse
.
-
test
The subclasses of this class implement this method to actually perform the logic of the filtering. Observe that results from filtering other entities are not available here; this function is stateless in the sense that an earlier acceptance or rejection of an entity cannot influence the acceptance or rejection of a current entity.- Parameters:
context
-player
-entity
-host
-- Returns:
-
equals
-
getTargetedEntities
-
setDesc
- Specified by:
setDesc
in interfaceHasDesc<EntityFilterDesc>
-