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 TypeMethodDescriptionboolean
getDesc()
int
hashCode()
final boolean
isFulfilled
(GameContext context, Player player, Entity source, Entity target) Is the condition fulfilled given the specifiedsource
andtarget
?protected abstract boolean
isFulfilled
(GameContext context, Player player, ConditionDesc desc, Entity source, Entity target) protected boolean
isFulfilledForTarget
(GameContext context, Player player, Entity source, Entity target, TargetPlayer targetPlayer) protected boolean
WhentargetConditionArgOverridesSuppliedTarget()
istrue
, the result of the condition on each of the resolved targets isand
-ed if this istrue
.protected boolean
WhentargetConditionArgOverridesSuppliedTarget()
istrue
, the result of the condition on each of the resolved targets isor
-ed if this istrue
.protected boolean
Whentrue
andmultipleTargetsEvaluatedAsAnd()
, there must be at least one target in the resolved targets.void
protected boolean
Expects a single target only.protected boolean
Whentrue
,ConditionArg.TARGET
is evaluated instead of being interpreted by the subclass, replacingtarget
if 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 specifiedsource
andtarget
?Uses the
getDesc()
desc
this was constructed with for many parameters.target
is context-sensitive. When used inEventTriggerArg.QUEUE_CONDITION
orEventTriggerArg.FIRE_CONDITION
,source
is theGameEvent.getSource()
andtarget
is 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:
setDesc
in interfaceHasDesc<ConditionDesc>
-
getDesc
- Specified by:
getDesc
in interfaceHasDesc<ConditionDesc>
-
targetConditionArgOverridesSuppliedTarget
protected boolean targetConditionArgOverridesSuppliedTarget()Whentrue
,ConditionArg.TARGET
is evaluated instead of being interpreted by the subclass, replacingtarget
if it is specified.When
false
, onlytarget
is 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
true
whenmultipleTargetsEvaluatedAsOr()
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
true
whenmultipleTargetsEvaluatedAsAnd()
is alsotrue
.- Returns:
-
singleTargetOnly
protected boolean singleTargetOnly()Expects a single target only. Used in conjunction withtargetConditionArgOverridesSuppliedTarget()
.- Returns:
-
requiresAtLeastOneTarget
protected boolean requiresAtLeastOneTarget()Whentrue
andmultipleTargetsEvaluatedAsAnd()
, there must be at least one target in the resolved targets.- Returns:
-
usesFilter
protected boolean usesFilter()- Returns:
-
equals
-
hashCode
public int hashCode()
-