package mage.target; import mage.abilities.Ability; import mage.cards.Cards; import mage.constants.Outcome; import mage.constants.Zone; import mage.filter.Filter; import mage.game.Game; import mage.players.Player; import java.io.Serializable; import java.util.Collection; import java.util.List; import java.util.Set; import java.util.UUID; /** * @author BetaSteward_at_googlemail.com */ public interface Target extends Serializable { boolean isChosen(); boolean doneChoosing(); void clearChosen(); boolean isNotTarget(); /** * Mark it as non target (e.g. card's rules do not contain a "target" word) *
* Non targeted abilities are unaffected by protection/hexproof and other target related effects
* Non targeted spells can't be fizzled on resolve with invalid targets
* Non targeted spells chooses targets on resolve, targeted spells chooses targets on activate
* All costs must be non targeted
*
* @param notTarget
* @return
*/
Target withNotTarget(boolean notTarget);
// methods for targets
boolean canChoose(UUID sourceControllerId, Ability source, Game game);
/**
* Returns a set of all possible targets that match the criteria of the implemented Target class.
*
* @param sourceControllerId UUID of the ability's controller
* @param source Ability which requires the targets
* @param game Current game
* @return Set of the UUIDs of possible targets
*/
Set
* It will NOT add it to the list of targets, it will ony choose the next target
*
* Use this version when the targets is selected from targets.getTargets.
*
* It will auto-choosen if all of the following criteria are met:
* - The minimum and maximum number of targets is the same (i.e. effect does not have "up to" in its name)
* - The number of valid targets is equal to the number of targets still left to be specified
*
* @param abilityControllerId
* @param source
* @param game
* @return The UUID of the chosen option, or null if one could not be chosen
*/
UUID tryToAutoChoose(UUID abilityControllerId, Ability source, Game game);
/**
* Use this version when the target is chosen from a specified collection.
* E.g. {@link Player#chooseTarget(Outcome outcome, Cards cards, TargetCard target, Ability source, Game game)}
*
* @param abilityControllerId
* @param source
* @param game
* @param possibleTargets
* @return
*/
UUID tryToAutoChoose(UUID abilityControllerId, Ability source, Game game, Collection