mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
* UI: added card hints about active requirement effects (permanent must attack or must block);
This commit is contained in:
parent
537906004f
commit
68326c8554
4 changed files with 26 additions and 4 deletions
|
@ -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
|
||||
|
|
BIN
Mage.Client/src/main/resources/hint/require.png
Normal file
BIN
Mage.Client/src/main/resources/hint/require.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
|
@ -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 = "<br/><hintstart/>"; // workaround to find hint text in rules list and shows it in html
|
||||
|
|
|
@ -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<String> restrictHints = new ArrayList<>();
|
||||
if (game != null && HintUtils.RESTRICT_HINTS_ENABLE) {
|
||||
// restrict
|
||||
for (Map.Entry<RestrictionEffect, Set<Ability>> 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<RequirementEffect, Set<Ability>> 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue