From 68326c85544c5f4ce09204afe5aaf782ac555ae5 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Wed, 29 Jan 2020 06:51:12 +0400 Subject: [PATCH] * UI: added card hints about active requirement effects (permanent must attack or must block); --- .../org/mage/card/arcane/ManaSymbols.java | 3 ++ .../src/main/resources/hint/require.png | Bin 0 -> 7888 bytes .../java/mage/abilities/hint/HintUtils.java | 1 + .../mage/game/permanent/PermanentImpl.java | 26 +++++++++++++++--- 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 Mage.Client/src/main/resources/hint/require.png 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 0000000000000000000000000000000000000000..f2064a8f8b4d9667f13c5b953afc1ababbf09612 GIT binary patch literal 7888 zcmbVx2UJttx@{n!^df>ZrT3Nu2)#E^dKaW7p#~C4Ab=E+B3-37DT*LS6DfiS0)j}B zrXV$RLkS89QeXVrIQNco?z``0jGevqT62A6&ToBVWGCLlNRO6^oeBT|(CS~;HY466 ze_s?Ah~HhR&iw!YiJXU)mWc)&<$~Zg)6?V@1}iAYivR$^4>MBRZ*-Ylj%(-8d0%Wr zvABR1GBrU?yi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D7;#pRQrtcAyH6OrGNPnyJD~YJ<;Ywyz-1zs+qC@a_~TOKCB-A|hBa zl)putNVbmgbW!gCJjHNx=M(gPPL~1SuF4deqv+z4cwclum%+kN`F31426qu#&bK_^ z?8>l6OOJ0-ezrlY13dmTFaBM1y2;;PIF+?o?2aFLT9W;)F@4_mSi(2|o_vu5DlH1X zu=(vd)#eWRBubvHtP|VBsvqWU-dqoIyO5gg$t+5rRlDl*6TqK?yF^dk4VXgX*fdsW z@lVWWdYJa+-vy7|9N~0jSi=?e9(8Hwo{2#S7VCNb2iwsU54*M?gih<8P$a~hK=;~w zuQ~Kad|ubyliskFH-b>({d?>|iSb&RyDHJzgV E4-{NN 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); }