Class Condition
java.lang.Object
net.demilich.metastone.game.spells.desc.condition.Condition
- All Implemented Interfaces:
Serializable,HasDesc<ConditionDesc>
- Direct Known Subclasses:
AdjacentToPermanentCondition,AllMatchFilterCondition,AllModuloValueEqualsZeroCondition,AmalgamRaceCondition,AndCondition,AnyMatchFilterCondition,AttributeCondition,AttributeExistsCondition,CanPlayPactCondition,CanSummonCondition,CardPropertyCondition,ComboCondition,ComparisonCondition,ControlsSecretCondition,CountCondition,DeckContainsCondition,EntityEqualityCondition,GraveyardContainsCondition,HasAttackedCondition,HasEntitiesOnBoardCondition,HasHeroPowerCondition,HasWeaponCondition,HeroClassCondition,HighlanderHandCondition,HoldsCardCondition,InvokeCondition,IsAdjacentCondition,IsDamagedCondition,IsDeadCondition,ManaCostCondition,ManaMaxedCondition,MinionOnBoardCondition,NumberOfCopiesCondition,OrCondition,OverloadedCondition,OverloadedManaCrystalsCondition,OwnedByPlayerCondition,PlayedLastTurnCondition,RaceCondition,RandomCondition,ReservoirCondition,StorageContainsCondition,SurgeCondition
A condition is used for true or false comparisons in the
CardDesc card
JSON.
The core function is isFulfilled(GameContext, Player, Entity, Entity).
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetDesc()inthashCode()final booleanisFulfilled(GameContext context, Player player, Entity source, Entity target) Is the condition fulfilled given the specifiedsourceandtarget?protected abstract booleanisFulfilled(GameContext context, Player player, ConditionDesc desc, Entity source, Entity target) protected booleanisFulfilledForTarget(GameContext context, Player player, Entity source, Entity target, TargetPlayer targetPlayer) protected booleanWhentargetConditionArgOverridesSuppliedTarget()istrue, the result of the condition on each of the resolved targets isand-ed if this istrue.protected booleanWhentargetConditionArgOverridesSuppliedTarget()istrue, the result of the condition on each of the resolved targets isor-ed if this istrue.protected booleanWhentrueandmultipleTargetsEvaluatedAsAnd(), there must be at least one target in the resolved targets.voidprotected booleanExpects a single target only.protected booleanWhentrue,ConditionArg.TARGETis evaluated instead of being interpreted by the subclass, replacingtargetif it is specified.protected boolean
-
Constructor Details
-
Condition
-
-
Method Details
-
isFulfilled
protected abstract boolean isFulfilled(GameContext context, Player player, ConditionDesc desc, Entity source, Entity target) -
isFulfilled
Is the condition fulfilled given the specifiedsourceandtarget?Uses the
getDesc()descthis was constructed with for many parameters.targetis context-sensitive. When used inEventTriggerArg.QUEUE_CONDITIONorEventTriggerArg.FIRE_CONDITION,sourceis theGameEvent.getSource()andtargetis theGameEvent.getTarget(). The trigger's host is typically accessed usingEntityReference.TRIGGER_HOST.- Parameters:
context-player-source-target-- Returns:
-
isFulfilledForTarget
protected boolean isFulfilledForTarget(GameContext context, Player player, Entity source, Entity target, TargetPlayer targetPlayer) -
setDesc
- Specified by:
setDescin interfaceHasDesc<ConditionDesc>
-
getDesc
- Specified by:
getDescin interfaceHasDesc<ConditionDesc>
-
targetConditionArgOverridesSuppliedTarget
protected boolean targetConditionArgOverridesSuppliedTarget()Whentrue,ConditionArg.TARGETis evaluated instead of being interpreted by the subclass, replacingtargetif it is specified.When
false, onlytargetis passed.- Returns:
-
multipleTargetsEvaluatedAsAnd
protected boolean multipleTargetsEvaluatedAsAnd()WhentargetConditionArgOverridesSuppliedTarget()istrue, the result of the condition on each of the resolved targets isand-ed if this istrue.Should not be
truewhenmultipleTargetsEvaluatedAsOr()is alsotrue.- Returns:
-
multipleTargetsEvaluatedAsOr
protected boolean multipleTargetsEvaluatedAsOr()WhentargetConditionArgOverridesSuppliedTarget()istrue, the result of the condition on each of the resolved targets isor-ed if this istrue.Should not be
truewhenmultipleTargetsEvaluatedAsAnd()is alsotrue.- Returns:
-
singleTargetOnly
protected boolean singleTargetOnly()Expects a single target only. Used in conjunction withtargetConditionArgOverridesSuppliedTarget().- Returns:
-
requiresAtLeastOneTarget
protected boolean requiresAtLeastOneTarget()WhentrueandmultipleTargetsEvaluatedAsAnd(), there must be at least one target in the resolved targets.- Returns:
-
usesFilter
protected boolean usesFilter()- Returns:
-
equals
-
hashCode
public int hashCode()
-