GUI: added restriction card icon to permanent (contains all applied restrictions and requirements, #7471)

This commit is contained in:
Oleg Agafonov 2023-12-03 00:01:47 +04:00
parent ebaa92c537
commit eaa510b265
7 changed files with 87 additions and 14 deletions

View file

@ -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));
}
}