forked from External/mage
GUI: added restriction card icon to permanent (contains all applied restrictions and requirements, #7471)
This commit is contained in:
parent
ebaa92c537
commit
eaa510b265
7 changed files with 87 additions and 14 deletions
|
|
@ -16,8 +16,8 @@ public class HintUtils {
|
|||
// icons changes to real files on client side (see mana icons replacement)
|
||||
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_ICON_RESTRICT = "ICON_RESTRICT"; // used for restrict card icon too
|
||||
public static final String HINT_ICON_REQUIRE = "ICON_REQUIRE"; // used for restrict card icon too
|
||||
public static final String HINT_ICON_DUNGEON_ROOM_CURRENT = "ICON_DUNGEON_ROOM_CURRENT";
|
||||
public static final String HINT_ICON_DUNGEON_ROOM_NEXT = "ICON_DUNGEON_ROOM_NEXT";
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import java.io.Serializable;
|
|||
*/
|
||||
public class CardIconImpl implements CardIcon, Serializable {
|
||||
|
||||
private final CardIconType cardIconType;
|
||||
private final String text;
|
||||
private final String hint;
|
||||
private final CardIconType cardIconType; // icon image
|
||||
private final String text; // drawing text instead over icon (example: x value or level)
|
||||
private final String hint; // popup text hint on mouse move over icon
|
||||
|
||||
// Utility Icons
|
||||
public static final CardIconImpl FACE_DOWN = new CardIconImpl(CardIconType.OTHER_FACEDOWN, "Card is face down");
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public enum CardIconType {
|
|||
//
|
||||
OTHER_FACEDOWN("prepared/reply-fill.svg", CardIconCategory.ABILITY, 100),
|
||||
OTHER_COST_X("prepared/square-fill.svg", CardIconCategory.ABILITY, 100),
|
||||
OTHER_HAS_RESTRICTIONS("prepared/exclamation-triangle-fill.svg", CardIconCategory.ABILITY, 100),
|
||||
//
|
||||
RINGBEARER("prepared/ring.svg", CardIconCategory.COMMANDER, 100),
|
||||
COMMANDER("prepared/crown.svg", CardIconCategory.COMMANDER, 100), // TODO: fix big size, see CardIconsPanel
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<String> getRules(Game game) {
|
||||
final public List<String> getRules(Game game) {
|
||||
try {
|
||||
List<String> rules = super.getRules(game);
|
||||
|
||||
|
|
@ -277,6 +277,9 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
|
||||
// ability hints already collected in super call
|
||||
|
||||
// warning, if you add new icon type for restriction or requirement then don't forget
|
||||
// to add it for card icon too (search CardIconType.OTHER_HAS_RESTRICTIONS)
|
||||
|
||||
// restrict hints
|
||||
List<String> restrictHints = new ArrayList<>();
|
||||
if (HintUtils.RESTRICT_HINTS_ENABLE) {
|
||||
|
|
@ -301,7 +304,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
}
|
||||
}
|
||||
|
||||
// requirement
|
||||
// requirement hints
|
||||
for (Map.Entry<RequirementEffect, Set<Ability>> entry : game.getContinuousEffects().getApplicableRequirementEffects(this, false, game).entrySet()) {
|
||||
for (Ability ability : entry.getValue()) {
|
||||
if (entry.getKey().mustAttack(game)) {
|
||||
|
|
@ -338,11 +341,11 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
}
|
||||
}
|
||||
|
||||
// Goaded hints.
|
||||
// goaded hints
|
||||
for (UUID playerId : getGoadingPlayers()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
restrictHints.add(HintUtils.prepareText("Goaded by " + player.getLogName(), null, HintUtils.HINT_ICON_REQUIRE));
|
||||
restrictHints.add(HintUtils.prepareText("Goaded by " + player.getLogName() + " (must attack)", null, HintUtils.HINT_ICON_REQUIRE));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue