Class AllModuloValueEqualsZeroCondition
java.lang.Object
net.demilich.metastone.game.spells.desc.condition.Condition
net.demilich.metastone.game.spells.desc.condition.AllModuloValueEqualsZeroCondition
- All Implemented Interfaces:
Serializable,HasDesc<ConditionDesc>
A condition that is fulfilled if all the entities in
ConditionArg.TARGET, when evaluated as the
target to ConditionArg.VALUE1 modulo ConditionArg.VALUE2 equals zero.
To test if all the cards in the hand and deck are odd, use this example:
"condition": {
"class": "AndCondition",
"conditions": [
{
"class": "AllModuloValueEqualsZeroCondition",
"target": "FRIENDLY_HAND",
"value1": {
"class": "AttributeValueProvider",
"attribute": "BASE_MANA_COST",
"offset": 1
},
"value2": 2
},
{
"class": "AllModuloValueEqualsZeroCondition",
"target": "FRIENDLY_DECK",
"value1": {
"class": "AttributeValueProvider",
"attribute": "BASE_MANA_COST",
"offset": 1
},
"value2": 2
}
]
}
For even, remove the offset:
"condition": {
"class": "AndCondition",
"conditions": [
{
"class": "AllModuloValueEqualsZeroCondition",
"target": "FRIENDLY_HAND",
"value1": {
"class": "AttributeValueProvider",
"attribute": "BASE_MANA_COST"
},
"value2": 2
},
{
"class": "AllModuloValueEqualsZeroCondition",
"target": "FRIENDLY_DECK",
"value1": {
"class": "AttributeValueProvider",
"attribute": "BASE_MANA_COST"
},
"value2": 2
}
]
}
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanisFulfilled(GameContext context, Player player, ConditionDesc desc, Entity source, Entity target) protected booleanWhenCondition.targetConditionArgOverridesSuppliedTarget()istrue, the result of the condition on each of the resolved targets isand-ed if this istrue.protected booleanWhenCondition.targetConditionArgOverridesSuppliedTarget()istrue, the result of the condition on each of the resolved targets isor-ed if this istrue.protected booleanExpects a single target only.protected booleanMethods inherited from class net.demilich.metastone.game.spells.desc.condition.Condition
equals, getDesc, hashCode, isFulfilled, isFulfilledForTarget, requiresAtLeastOneTarget, setDesc, targetConditionArgOverridesSuppliedTarget
-
Constructor Details
-
AllModuloValueEqualsZeroCondition
-
-
Method Details
-
isFulfilled
protected boolean isFulfilled(GameContext context, Player player, ConditionDesc desc, Entity source, Entity target) - Specified by:
isFulfilledin classCondition
-
singleTargetOnly
protected boolean singleTargetOnly()Description copied from class:ConditionExpects a single target only. Used in conjunction withCondition.targetConditionArgOverridesSuppliedTarget().- Overrides:
singleTargetOnlyin classCondition- Returns:
-
multipleTargetsEvaluatedAsOr
protected boolean multipleTargetsEvaluatedAsOr()Description copied from class:ConditionWhenCondition.targetConditionArgOverridesSuppliedTarget()istrue, the result of the condition on each of the resolved targets isor-ed if this istrue.Should not be
truewhenCondition.multipleTargetsEvaluatedAsAnd()is alsotrue.- Overrides:
multipleTargetsEvaluatedAsOrin classCondition- Returns:
-
multipleTargetsEvaluatedAsAnd
protected boolean multipleTargetsEvaluatedAsAnd()Description copied from class:ConditionWhenCondition.targetConditionArgOverridesSuppliedTarget()istrue, the result of the condition on each of the resolved targets isand-ed if this istrue.Should not be
truewhenCondition.multipleTargetsEvaluatedAsOr()is alsotrue.- Overrides:
multipleTargetsEvaluatedAsAndin classCondition- Returns:
-
usesFilter
protected boolean usesFilter()Description copied from class:Condition- Overrides:
usesFilterin classCondition- Returns:
-