mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Hints: removed duplicated hints from popup;
This commit is contained in:
parent
f341d35ece
commit
7e4767fd30
3 changed files with 18 additions and 3 deletions
|
|
@ -1,6 +1,10 @@
|
|||
package mage.abilities.hint;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
|
|
@ -40,4 +44,15 @@ public class HintUtils {
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void appendHints(@NotNull List<String> destList, @NotNull List<String> newHints) {
|
||||
// append only unique hints
|
||||
HashSet<String> used = new HashSet<>();
|
||||
for (String s : newHints) {
|
||||
if (!used.contains(s)) {
|
||||
destList.add(s);
|
||||
used.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
// total hints
|
||||
if (!abilityHints.isEmpty()) {
|
||||
rules.add(HintUtils.HINT_START_MARK);
|
||||
rules.addAll(abilityHints);
|
||||
HintUtils.appendHints(rules, abilityHints);
|
||||
}
|
||||
}
|
||||
return rules;
|
||||
|
|
|
|||
|
|
@ -295,8 +295,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
// total hints
|
||||
if (!abilityHints.isEmpty() || !restrictHints.isEmpty()) {
|
||||
rules.add(HintUtils.HINT_START_MARK);
|
||||
rules.addAll(abilityHints);
|
||||
rules.addAll(restrictHints);
|
||||
HintUtils.appendHints(rules, abilityHints);
|
||||
HintUtils.appendHints(rules, restrictHints);
|
||||
}
|
||||
|
||||
return rules;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue