* Fixed a problem with triggered mana abilities. Fixed a problem that AI did not always select the needed mana color. Fixed a problem with Reflecting Pool not taking triggered mana abilities into account.

This commit is contained in:
LevelX2 2016-11-03 22:37:54 +01:00
parent f07408f995
commit d2561c1752
74 changed files with 744 additions and 436 deletions

View file

@ -24,24 +24,23 @@
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
*/
package mage.abilities;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
import mage.constants.Zone;
import mage.abilities.keyword.ProtectionAbility;
import mage.abilities.mana.ManaAbility;
import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.constants.Zone;
import mage.game.Game;
/**
* Represents a collection of {@link Ability Abilities}. This is the top most
* Represents a collection of {@link Ability Abilities}. This is the top most
* interface for this.
*
*
* @param <T> The ability type this collection will hold.
*
*
* @see mage.abilities.AbilitiesImpl
* @see mage.abilities.DelayedTriggeredAbilities
* @see mage.abilities.SpecialActions
@ -52,10 +51,10 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
/**
* Retrieves a {@link List}&lt;{@link String}&gt; of ability texts for the
* given source.
*
*
* @param source The source to retrieve ability texts.
* @return the {@link List}&lt;{@link String}&gt; of ability texts.
*
*
* @see mage.cards.CardImpl#getRules()
* @see mage.abilities.keyword.LevelAbility#getRule()
*/
@ -63,10 +62,10 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
/**
* Retrieves all activated abilities for the given {@link Zone}.
*
*
* @param zone The {@link Zone} for which abilities should be retrieved.
* @return All abilities for the given {@link Zone}
*
*
* @see mage.cards.CardImpl#getSpellAbility()
*/
Abilities<ActivatedAbility> getActivatedAbilities(Zone zone);
@ -82,47 +81,74 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
Abilities<ActivatedAbility> getPlayableAbilities(Zone zone);
/**
* Retrieves all {@link ManaAbility mana abilities} in the given {@link Zone}.
*
* @param zone The {@link Zone} to search for {@link ManaAbility mana abilities}.
* @return All {@link ManaAbility mana abilities} for the given {@link Zone}.
*
* Retrieves all {@link ActivatedManaAbilityImpl mana abilities} in the
* given {@link Zone}.
*
* @param zone The {@link Zone} to search for
* {@link ActivatedManaAbilityImpl mana abilities}.
* @return All {@link ActivatedManaAbilityImpl mana abilities} for the given
* {@link Zone}.
*
* @see mage.cards.CardImpl#getMana()
* @see mage.players.PlayerImpl#getManaAvailable(mage.game.Game)
* @see mage.players.PlayerImpl#getAvailableManaProducers(mage.game.Game)
*/
Abilities<ManaAbility> getManaAbilities(Zone zone);
Abilities<ActivatedManaAbilityImpl> getActivatedManaAbilities(Zone zone);
/**
* Retrieves all {@link ManaAbility mana abilities} in the given {@link Zone} that can be used.
*
* @param zone The {@link Zone} to search for {@link ManaAbility mana abilities}.
* @return All {@link ManaAbility mana abilities} for the given {@link Zone} that can be used.
*
* Retrieves a list of all mana abilities (activated and triggered
* abilities)
*
* @param zone
* @return
*/
Abilities<Ability> getManaAbilities(Zone zone);
/**
* Retrieves all {@link ActivatedManaAbilityImpl mana abilities} in the
* given {@link Zone} that can be used.
*
* @param zone The {@link Zone} to search for
* {@link ActivatedManaAbilityImpl mana abilities}.
* @return All {@link ActivatedManaAbilityImpl mana abilities} for the given
* {@link Zone} that can be used.
*
* @see mage.cards.CardImpl#getMana()
* @see mage.players.PlayerImpl#getManaAvailable(mage.game.Game)
* @see mage.players.PlayerImpl#getAvailableManaProducers(mage.game.Game)
*/
Abilities<ManaAbility> getAvailableManaAbilities(Zone zone, Game game);
Abilities<ActivatedManaAbilityImpl> getAvailableActivatedManaAbilities(Zone zone, Game game);
/**
* Retrieves all {@link StaticAbility static abilities} in the given {@link Zone}.
*
* Retrieves all {@link StaticAbility static abilities} in the given
* {@link Zone}.
*
* @param zone The {@link Zone} to search for {@link StaticAbility}
* @return All {@link StaticAbility static abilities} in the given {@link Zone}
*
* @see mage.abilities.effects.ContinuousEffects#getLayeredEffects(mage.game.Game)
* @see mage.abilities.effects.ContinuousEffects#getApplicableRequirementEffects(mage.game.permanent.Permanent, mage.game.Game)
* @see mage.abilities.effects.ContinuousEffects#getApplicableRestrictionEffects(mage.game.permanent.Permanent, mage.game.Game)
* @see mage.abilities.effects.ContinuousEffects#getApplicableReplacementEffects(mage.game.events.GameEvent, mage.game.Game)
* @see mage.abilities.effects.ContinuousEffects#asThough(java.util.UUID, mage.constants.AsThoughEffectType, mage.game.Game)
* @see mage.abilities.effects.ContinuousEffects#costModification(mage.abilities.Ability, mage.game.Game)
* @return All {@link StaticAbility static abilities} in the given
* {@link Zone}
*
* @see
* mage.abilities.effects.ContinuousEffects#getLayeredEffects(mage.game.Game)
* @see
* mage.abilities.effects.ContinuousEffects#getApplicableRequirementEffects(mage.game.permanent.Permanent,
* mage.game.Game)
* @see
* mage.abilities.effects.ContinuousEffects#getApplicableRestrictionEffects(mage.game.permanent.Permanent,
* mage.game.Game)
* @see
* mage.abilities.effects.ContinuousEffects#getApplicableReplacementEffects(mage.game.events.GameEvent,
* mage.game.Game)
* @see mage.abilities.effects.ContinuousEffects#asThough(java.util.UUID,
* mage.constants.AsThoughEffectType, mage.game.Game)
* @see
* mage.abilities.effects.ContinuousEffects#costModification(mage.abilities.Ability,
* mage.game.Game)
*/
Abilities<StaticAbility> getStaticAbilities(Zone zone);
/**
* Retrieves all {@link EvasionAbility evasion abilities}.
*
*
* @return The {@link EvasionAbility evasion abilities}.
*/
Abilities<EvasionAbility> getEvasionAbilities();
@ -130,21 +156,27 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
/**
* Retrieves all {@link TriggeredAbility triggered abilities} for the given
* {@link Zone}.
*
* @param zone The {@link Zone} to search for {@link TriggeredAbility triggered abilities}
*
* @param zone The {@link Zone} to search for
* {@link TriggeredAbility triggered abilities}
* @return All found {@link TriggeredAbility triggered abilities}.
*
* @see mage.cards.CardImpl#checkTriggers(mage.constants.Zone, mage.game.events.GameEvent, mage.game.Game)
* @see mage.game.permanent.PermanentImpl#checkTriggers(mage.game.events.GameEvent, mage.game.Game)
* @see mage.game.permanent.PermanentCard#checkPermanentOnlyTriggers(mage.game.events.ZoneChangeEvent, mage.game.Game)
*
* @see mage.cards.CardImpl#checkTriggers(mage.constants.Zone,
* mage.game.events.GameEvent, mage.game.Game)
* @see
* mage.game.permanent.PermanentImpl#checkTriggers(mage.game.events.GameEvent,
* mage.game.Game)
* @see
* mage.game.permanent.PermanentCard#checkPermanentOnlyTriggers(mage.game.events.ZoneChangeEvent,
* mage.game.Game)
*/
Abilities<TriggeredAbility> getTriggeredAbilities(Zone zone);
/**
* Retrieves all {@link ProtectionAbility protection abilities}.
*
*
* @return All found {@link ProtectionAbility protection abilities}.
*
*
* @see mage.game.permanent.PermanentImpl#hasProtectionFrom(mage.MageObject)
* @see mage.players.PlayerImpl#hasProtectionFrom(mage.MageObject)
* @see mage.players.PlayerImpl#canDamage(mage.MageObject)
@ -153,32 +185,34 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
/**
* TODO Method is unused, keep it around?
*
*
* The only implementation seems to want to use this for totally a set of
* abilities by some arbitrary numeral value. Possibly a good method to be
* abilities by some arbitrary numeral value. Possibly a good method to be
* used by the AI's?
*
* @return A numeral value representing the 'strength' or effectiveness of the abilities?
*
* @return A numeral value representing the 'strength' or effectiveness of
* the abilities?
*/
int getOutcomeTotal();
/**
* Sets the controller of this set of abilities.
*
*
* @param controllerId
*
*
* @see mage.cards.CardImpl#setControllerId(java.util.UUID)
* @see mage.cards.CardImpl#setOwnerId(java.util.UUID)
* @see mage.game.permanent.PermanentImpl#changeControllerId(java.util.UUID, mage.game.Game)
* @see mage.game.permanent.PermanentImpl#changeControllerId(java.util.UUID,
* mage.game.Game)
* @see mage.game.permanent.PermanentCard#copyFromCard(mage.cards.Card)
*/
void setControllerId(UUID controllerId);
/**
* Sets the source of this set of abilities.
*
*
* @param sourceId
*
*
* @see mage.cards.CardImpl#assignNewId()
*/
void setSourceId(UUID sourceId);
@ -194,39 +228,40 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
void newOriginalId();
/**
* Searches this set of abilities to see if the ability represented by the abilityId
* is contained within. Can be used to find usages of singleton abilities.
*
* Searches this set of abilities to see if the ability represented by the
* abilityId is contained within. Can be used to find usages of singleton
* abilities.
*
* @param abilityId
* @return
* @return
*/
boolean containsKey(UUID abilityId);
/**
* TODO Method is unused, keep it around?
*
*
* Gets the ability represented by the given abilityId.
*
*
* @param abilityId
* @return
* @return
*/
T get(UUID abilityId);
/**
* TODO The usage of this method seems redundant to that of {@link #containsKey(java.util.UUID)}
* minus the fact that it searches for exact instances instead of id's of
* singleton Abilities.
*
* TODO The usage of this method seems redundant to that of
* {@link #containsKey(java.util.UUID)} minus the fact that it searches for
* exact instances instead of id's of singleton Abilities.
*
* Searches for the exact instance of the passed in ability.
*
*
* @param ability
* @return
* @return
*/
boolean contains(T ability);
/**
* Searches an ability with the same rule text as the passed in ability.
*
*
* @param ability
* @return
*/
@ -235,9 +270,10 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
/**
* Searches this set of abilities for the existence of each of the passed in
* set of abilities.
*
*
* @param abilities
* @return True if the passed in set of abilities is also in this set of abilities.
* @return True if the passed in set of abilities is also in this set of
* abilities.
*/
boolean containsAll(Abilities<T> abilities);
@ -250,10 +286,10 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
boolean containsClass(Class classObject);
/**
* Copies this set of abilities. This copy should be new instances of all
* Copies this set of abilities. This copy should be new instances of all
* the contained abilities.
*
* @return
*
* @return
*/
Abilities<T> copy();