package mage.abilities; import mage.MageIdentifier; import mage.MageObject; import mage.abilities.costs.Cost; import mage.abilities.costs.CostAdjuster; import mage.abilities.costs.Costs; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCosts; import mage.abilities.effects.Effect; import mage.abilities.effects.Effects; import mage.abilities.hint.Hint; import mage.abilities.icon.CardIcon; import mage.constants.*; import mage.game.Controllable; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; import mage.target.Targets; import mage.target.targetadjustment.TargetAdjuster; import mage.watchers.Watcher; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.UUID; /** * Practically everything in the game is started from an Ability. This interface * describes what an Ability is composed of at the highest level. */ public interface Ability extends Controllable, Serializable { /** * Gets the globally unique id of the ability contained within the game. * * @return A {@link java.util.UUID} which the game will use to store and * retrieve the exact instance of this ability. */ @Override UUID getId(); /** * Assigns a new {@link java.util.UUID} * * @see mage.players.PlayerImpl#playAbility(mage.abilities.ActivatedAbility, * mage.game.Game) * @see Game#addTriggeredAbility(TriggeredAbility, GameEvent) * @see mage.game.GameImpl#addDelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) */ void newId(); /** * Assigns a new {@link java.util.UUID} * * @see mage.players.PlayerImpl#playAbility(mage.abilities.ActivatedAbility, * mage.game.Game) * @see Game#addTriggeredAbility(TriggeredAbility, GameEvent) * @see mage.game.GameImpl#addDelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) */ void newOriginalId(); // TODO: delete newOriginalId??? /** * Gets the {@link AbilityType} of this ability. * * @return The {@link AbilityType type} of this ability. */ AbilityType getAbilityType(); /** * Gets the id of the player in control of this ability. * * @return The {@link java.util.UUID} of the controlling player. */ @Override UUID getControllerId(); /** * Sets the id of the controller of this ability. * * @param controllerId The {@link java.util.UUID} of the controller. */ void setControllerId(UUID controllerId); /** * Gets the id of the object which put this ability in motion. *
* WARNING, MageSingleton abilities contains dirty data here, so you can't use sourceId with it
*
* @return The {@link java.util.UUID} of the object this ability is
* associated with.
*/
UUID getSourceId();
/**
* Sets the id of the object which this ability orignates from.
*
* @param sourceID {@link java.util.UUID} the source id to set.
*/
void setSourceId(UUID sourceID);
/**
* Gets all {@link Costs} associated with this ability.
*
* @return All {@link Costs} associated with this ability.
*/
Costs
* true = show the rule at the top position of the rules
*
* @param ruleAtTheTop
* @return
*/
Ability setRuleAtTheTop(boolean ruleAtTheTop);
/**
* Returns true if this ability has to work also with face down object (set
* to not visible normally).
*
* @return
*/
boolean getWorksFaceDown();
/**
* Sets the value for the worksFaceDown flag
*
* true = the ability works also if the object is face down
*
* @param worksFaceDown
*/
void setWorksFaceDown(boolean worksFaceDown);
/**
* Returns true if this ability's rule is visible on the card tooltip
*
* @return
*/
boolean getRuleVisible();
/**
* Sets the value for the ruleVisible attribute
*
* true = rule will be shown for the card / permanent false = rule won't be
* shown
*
* @param ruleVisible
*/
void setRuleVisible(boolean ruleVisible);
/**
* Returns true if the additional costs of the abilitiy should be visible on
* the tooltip text
*
* @return
*/
boolean getAdditionalCostsRuleVisible();
/**
* Sets the value for the additional costs rule attribute
*
* true = rule will be shown for the card / permanent false = rule won't be
* shown
*
* @param ruleAdditionalCostsVisible
*/
void setAdditionalCostsRuleVisible(boolean ruleAdditionalCostsVisible);
/**
* Get the originalId of the ability
*
* @return originalId
*/
UUID getOriginalId();
/**
* Sets the ability word for the given ability. An ability word is a word
* that, in essence, groups, and reminds players of, cards that have a
* common functionality and does not imply any particular rules.
*
* --- Not usable yet for rule text generation of triggered abilities ---
*
* @param abilityWord
*/
Ability setAbilityWord(AbilityWord abilityWord);
/**
* Sets flavor word for whole ability
*
* @param flavorWord
* @return
*/
Ability withFlavorWord(String flavorWord);
/**
* Sets flavor word for first mode
*
* @param flavorWord
* @return
*/
Ability withFirstModeFlavorWord(String flavorWord);
/**
* Creates the message about the ability casting/triggering/activating to
* post in the game log before the ability resolves.
*
* @param game
* @return
*/
String getGameLogMessage(Game game);
boolean activateAlternateOrAdditionalCosts(MageObject sourceObject, boolean noMana, Player controller, Game game);
/**
* Return source object or LKI from battlefield
*
* @param game
* @return
*/
MageObject getSourceObject(Game game);
void setSourceObjectZoneChangeCounter(int zoneChangeCounter);
int getSourceObjectZoneChangeCounter();
/**
* Returns exists source object:
* - for not activated ability - returns exists object
* - for activated ability - returns exists object or LKI (if it triggers from non battlefield, e.g. sacrifice cost);
*
* @param game
* @return
*/
MageObject getSourceObjectIfItStillExists(Game game);
/**
* See getSourceObjectIfItStillExists for details. Works with Permanent only.
*
* @param game
* @return
*/
Permanent getSourcePermanentIfItStillExists(Game game);
/**
* Returns source permanent info (actual or from LKI)
*
* @param game
* @return
*/
Permanent getSourcePermanentOrLKI(Game game);
void setSourcePermanentTransformCount(Game game);
boolean checkTransformCount(Permanent permanent, Game game);
String getTargetDescription(Targets targets, Game game);
void setCanFizzle(boolean canFizzle);
boolean canFizzle();
Ability setTargetAdjuster(TargetAdjuster targetAdjuster);
TargetAdjuster getTargetAdjuster();
void adjustTargets(Game game);
Ability setCostAdjuster(CostAdjuster costAdjuster);
CostAdjuster getCostAdjuster();
void adjustCosts(Game game);
List