diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java index 306f098a87..1c60131a56 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java @@ -791,6 +791,9 @@ public final class ManaSymbols { if (replaced.contains(HintUtils.HINT_ICON_RESTRICT)) { replaced = replaced.replace(HintUtils.HINT_ICON_RESTRICT, GuiDisplayUtil.getHintIconHtml("restrict", symbolSize) + " "); } + if (replaced.contains(HintUtils.HINT_ICON_REQUIRE)) { + replaced = replaced.replace(HintUtils.HINT_ICON_REQUIRE, GuiDisplayUtil.getHintIconHtml("require", symbolSize) + " "); + } // ignored data restore replaced = replaced diff --git a/Mage.Client/src/main/resources/hint/require.png b/Mage.Client/src/main/resources/hint/require.png new file mode 100644 index 0000000000..f2064a8f8b Binary files /dev/null and b/Mage.Client/src/main/resources/hint/require.png differ diff --git a/Mage/src/main/java/mage/abilities/hint/HintUtils.java b/Mage/src/main/java/mage/abilities/hint/HintUtils.java index 4fc94befaf..cd36e35cfa 100644 --- a/Mage/src/main/java/mage/abilities/hint/HintUtils.java +++ b/Mage/src/main/java/mage/abilities/hint/HintUtils.java @@ -16,6 +16,7 @@ public class HintUtils { public static final String HINT_ICON_GOOD = "ICON_GOOD"; public static final String HINT_ICON_BAD = "ICON_BAD"; public static final String HINT_ICON_RESTRICT = "ICON_RESTRICT"; + public static final String HINT_ICON_REQUIRE = "ICON_REQUIRE"; // public static final String HINT_START_MARK = "
"; // workaround to find hint text in rules list and shows it in html diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index 8dc2c1f7e2..4626c753bd 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -8,6 +8,7 @@ import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.Effect; +import mage.abilities.effects.RequirementEffect; import mage.abilities.effects.RestrictionEffect; import mage.abilities.hint.Hint; import mage.abilities.hint.HintUtils; @@ -28,6 +29,7 @@ import mage.game.command.CommandObject; import mage.game.events.*; import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.SquirrelToken; +import mage.game.permanent.token.Token; import mage.game.stack.Spell; import mage.game.stack.StackObject; import mage.players.Player; @@ -268,29 +270,45 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { // restrict hints List restrictHints = new ArrayList<>(); if (game != null && HintUtils.RESTRICT_HINTS_ENABLE) { + // restrict for (Map.Entry> entry : game.getContinuousEffects().getApplicableRestrictionEffects(this, game).entrySet()) { for (Ability ability : entry.getValue()) { if (!entry.getKey().canAttack(game, false) || !entry.getKey().canAttack(this, null, ability, game, false)) { restrictHints.add(HintUtils.prepareText("Can't attack" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_RESTRICT)); } - if (!entry.getKey().canBlock(null, this, ability, game, false)) { restrictHints.add(HintUtils.prepareText("Can't block" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_RESTRICT)); } - if (!entry.getKey().canBeUntapped(this, ability, game, false)) { restrictHints.add(HintUtils.prepareText("Can't untapped" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_RESTRICT)); } - if (!entry.getKey().canUseActivatedAbilities(this, ability, game, false)) { restrictHints.add(HintUtils.prepareText("Can't use activated abilities" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_RESTRICT)); } - if (!entry.getKey().canTransform(this, ability, game, false)) { restrictHints.add(HintUtils.prepareText("Can't transform" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_RESTRICT)); } } } + + // requirement + for (Map.Entry> entry : game.getContinuousEffects().getApplicableRequirementEffects(this, false, game).entrySet()) { + for (Ability ability : entry.getValue()) { + if (entry.getKey().mustAttack(game)) { + restrictHints.add(HintUtils.prepareText("Must attack" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_REQUIRE)); + } + if (entry.getKey().mustBlock(game)) { + restrictHints.add(HintUtils.prepareText("Must block" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_REQUIRE)); + } + if (entry.getKey().mustBlockAny(game)) { + restrictHints.add(HintUtils.prepareText("Must block any" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_REQUIRE)); + } + if (entry.getKey().mustBlockAllAttackers(game)) { + restrictHints.add(HintUtils.prepareText("Must block all attackers" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_REQUIRE)); + } + } + } + restrictHints.sort(String::compareTo); }