GUI: introduced default card hints:

* refactor: added helper emblems instead rad counter's inherent emblems (use initGameDefaultHelperEmblems to define new card hints or other fake objects);
* refactor: added card hints support for emblems, planes and other command objects;
* GUI: added storm counter as default card hint (use hints tool to see it, closes #12360);
This commit is contained in:
Oleg Agafonov 2024-07-27 09:40:41 +04:00
parent 83823acec7
commit 521a0f6e32
36 changed files with 234 additions and 144 deletions

View file

@ -1,6 +1,7 @@
package mage.abilities;
import mage.MageObject;
import mage.abilities.keyword.ProtectionAbility;
import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.constants.Zone;
@ -18,7 +19,6 @@ import java.util.function.Predicate;
* interface for this.
*
* @param <T> The ability type this collection will hold.
*
* @see mage.abilities.AbilitiesImpl
* @see mage.abilities.DelayedTriggeredAbilities
* @see mage.abilities.SpecialActions
@ -27,25 +27,27 @@ import java.util.function.Predicate;
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()
* Return rules as part of another rules. Use it for text generation.
*/
List<String> getRules(String source);
List<String> getRules();
List<String> getRules(String source, boolean capitalize);
/**
* Return rules as part of another rules. Use it for text generation.
*/
List<String> getRules(boolean capitalize);
/**
* Return full rules with card hints. Use it for user's data like GameView
*
* @param game on null will ignore card hints
*/
List<String> getRules(Game game, MageObject object);
/**
* 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);
@ -55,7 +57,6 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
*
* @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> getPlayableAbilities(Zone zone);
@ -65,10 +66,9 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
* given {@link Zone}.
*
* @param zone The {@link Zone} to search for
* {@link ActivatedManaAbilityImpl mana abilities}.
* {@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)
@ -80,12 +80,11 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
* 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}.
* @param zone The {@link Zone} to search for
* {@link ActivatedManaAbilityImpl mana abilities}.
* @param playerId The id of the player to check availability for
* @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)
@ -99,22 +98,16 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
* @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,
* @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,
* @see mage.abilities.effects.ContinuousEffects#getApplicableRestrictionEffects(mage.game.permanent.Permanent,
* mage.game.Game)
* @see
* mage.abilities.effects.ContinuousEffects#getApplicableReplacementEffects(mage.game.events.GameEvent,
* @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,
* @see mage.abilities.effects.ContinuousEffects#costModification(mage.abilities.Ability,
* mage.game.Game)
*/
Abilities<StaticAbility> getStaticAbilities(Zone zone);
@ -131,16 +124,13 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
* {@link Zone}.
*
* @param zone The {@link Zone} to search for
* {@link TriggeredAbility triggered abilities}
* {@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,
* @see mage.game.permanent.PermanentImpl#checkTriggers(mage.game.events.GameEvent,
* mage.game.Game)
* @see
* mage.game.permanent.PermanentCard#checkPermanentOnlyTriggers(mage.game.events.ZoneChangeEvent,
* @see mage.game.permanent.PermanentCard#checkPermanentOnlyTriggers(mage.game.events.ZoneChangeEvent,
* mage.game.Game)
*/
Abilities<TriggeredAbility> getTriggeredAbilities(Zone zone);
@ -149,16 +139,17 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
* 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)
*/
Abilities<ProtectionAbility> getProtectionAbilities();
Abilities<Ability> getAllAbilities();
/**
* TODO Method is unused, keep it around?
*
* <p>
* 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
* used by the AI's?
@ -172,7 +163,6 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
* 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,
@ -185,7 +175,6 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
* Sets the source of this set of abilities.
*
* @param sourceId
*
* @see mage.cards.CardImpl#assignNewId()
*/
void setSourceId(UUID sourceId);
@ -212,7 +201,7 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
/**
* TODO Method is unused, keep it around?
*
* <p>
* Gets the ability represented by the given abilityId.
*
* @param abilityId
@ -224,7 +213,7 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
* 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.
*
* <p>
* Searches for the exact instance of the passed in ability.
*
* @param ability
@ -261,10 +250,11 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
/**
* Returns true if one or more of the abilities are activated mana abilities with the pollDependant flag set to true.
* @return
*
* @return
*/
boolean hasPoolDependantAbilities();
/**
* Copies this set of abilities. This copy should be new instances of all
* the contained abilities.
@ -275,12 +265,15 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
String getValue();
@Deprecated // use permanent.removeAbility instead
@Deprecated
// use permanent.removeAbility instead
boolean remove(Object o);
@Deprecated // use permanent.removeAbility instead
@Deprecated
// use permanent.removeAbility instead
boolean removeAll(Collection<?> c);
@Deprecated // use permanent.removeAbility instead
@Deprecated
// use permanent.removeAbility instead
boolean removeIf(Predicate<? super T> filter);
}