java.lang.Object
net.demilich.metastone.game.spells.desc.valueprovider.ValueProvider
All Implemented Interfaces:
java.io.Serializable, HasDesc<ValueProviderDesc>
Direct Known Subclasses:
AftermathsCountValueProvider, AlgebraicValueProvider, AttributeCounter, AttributeValueProvider, CardsPlayedValueProvider, ConditionalValueProvider, CurrentTurnValueProvider, DestroyedThisSequenceValueProvider, DiedThisTurnValueProvider, DistinctTribesValueProvider, EntityCountValueProvider, EventValueProvider, ExcessHealingThisTurnValueProvider, FiresLeftValueProvider, GameValueProvider, GatekeeperShaValueProvider, HeroPowerDamageValueProvider, IndexInSourceValueProvider, LastTurnValueProvider, ManaCostModifierValueProvider, ManaCostProvider, MaxBoardSizeValueProvider, MinionSummonValueProvider, OriginalValueProvider, PlayedLastTurnValueProvider, PlayedThisTurnValueProvider, PlayerAttributeValueProvider, RandomValueProvider, ReduceValueProvider, SpellDamageValueProvider, SpellstoneValueProvider, TurnsNoCardPlayedValueProvider

public abstract class ValueProvider
extends java.lang.Object
implements java.io.Serializable, HasDesc<ValueProviderDesc>
Value providers compute an integer value given ValueProviderArg, an underlying implementation, and the player, host and target from whose point of view the value should be calculated.

Value providers are typically executed by Desc.getValue(Enum, GameContext, Player, Entity, Entity, int).

All value providers support the following features:

  • ValueProviderArg.OFFSET: Specifies an amount to always add (possibly negative) to the calculated value. Defaults to 0.
  • ValueProviderArg.MULTIPLIER: Specifies an amount to always multiply (possible negative) to the calculate value. Defaults to 1. This is applied before the offset.
  • ValueProviderArg.TARGET_PLAYER: Specifies a change to whose point of view the value provider should be computed. For example, if the player is casting a spell that calculates something from the TargetPlayer.BOTH point of view, the result of this value provider for both player's points of view are added together.

Observe that ValueProviderArg.TARGET is not available to all value providers. The target that the value provider is evaluated against depends on the context and the ValueProviderArg.TARGET is ignored unless the underlying class (like e.g. AttributeValueProvider) specifically handles the ValueProviderArg.TARGET argument. It is almost always the SpellArg.TARGET.

The target is interpreted as:

Refer to the class hierarchy of this class for all the possible value providers.

See Also:
Serialized Form