diff --git a/Mage/src/main/java/mage/abilities/hint/ConditionHint.java b/Mage/src/main/java/mage/abilities/hint/ConditionHint.java
new file mode 100644
index 0000000000..4df8b1cf59
--- /dev/null
+++ b/Mage/src/main/java/mage/abilities/hint/ConditionHint.java
@@ -0,0 +1,59 @@
+package mage.abilities.hint;
+
+import mage.abilities.Ability;
+import mage.abilities.condition.Condition;
+import mage.game.Game;
+
+import java.awt.*;
+
+/**
+ * @author JayDi85
+ */
+public class ConditionHint implements Hint {
+
+ private Condition condition;
+ private String trueText;
+ private Color trueColor;
+ private String falseText;
+ private Color falseColor;
+ private Boolean useIcons;
+
+ public ConditionHint(Condition condition, String textWithIcons) {
+ this(condition, textWithIcons, null, textWithIcons, null, true);
+ }
+
+ public ConditionHint(Condition condition, String trueText, Color trueColor, String falseText, Color falseColor, Boolean useIcons) {
+ this.condition = condition;
+ this.trueText = trueText;
+ this.trueColor = trueColor;
+ this.falseText = falseText;
+ this.falseColor = falseColor;
+ this.useIcons = useIcons;
+ }
+
+ private ConditionHint(final ConditionHint hint) {
+ this.condition = hint.condition;
+ this.trueText = hint.trueText;
+ this.trueColor = hint.trueColor;
+ this.falseText = hint.falseText;
+ this.falseColor = hint.falseColor;
+ this.useIcons = hint.useIcons;
+ }
+
+ @Override
+ public String getText(Game game, Ability ability) {
+ String icon;
+ if (condition.apply(game, ability)) {
+ icon = this.useIcons ? HintUtils.HINT_ICON_GOOD : null;
+ return HintUtils.prepareText(this.trueText, this.trueColor, icon);
+ } else {
+ icon = this.useIcons ? HintUtils.HINT_ICON_BAD : null;
+ return HintUtils.prepareText(this.falseText, this.falseColor, icon);
+ }
+ }
+
+ @Override
+ public Hint copy() {
+ return new ConditionHint(this);
+ }
+}
diff --git a/Mage/src/main/java/mage/abilities/hint/Hint.java b/Mage/src/main/java/mage/abilities/hint/Hint.java
index 9d5963c144..71a0ef8cbc 100644
--- a/Mage/src/main/java/mage/abilities/hint/Hint.java
+++ b/Mage/src/main/java/mage/abilities/hint/Hint.java
@@ -1,16 +1,16 @@
package mage.abilities.hint;
+import mage.abilities.Ability;
import mage.game.Game;
import java.io.Serializable;
-import java.util.UUID;
/**
* @author JayDi85
*/
public interface Hint extends Serializable {
- String getText(Game game, UUID sourceId);
+ String getText(Game game, Ability ability);
Hint copy();
}
\ No newline at end of file
diff --git a/Mage/src/main/java/mage/abilities/hint/HintUtils.java b/Mage/src/main/java/mage/abilities/hint/HintUtils.java
new file mode 100644
index 0000000000..7351bf1a86
--- /dev/null
+++ b/Mage/src/main/java/mage/abilities/hint/HintUtils.java
@@ -0,0 +1,35 @@
+package mage.abilities.hint;
+
+import java.awt.*;
+
+/**
+ * @author JayDi85
+ */
+public class HintUtils {
+
+ public static final String HINT_ICON_GOOD = " GOOD_ICON "; // TODO: icon
+ public static final String HINT_ICON_BAD = " BAD_ICON "; // TODO: icon
+
+ public static String prepareText(String text, Color color) {
+ return prepareText(text, color, null);
+ }
+
+ public static String prepareText(String text, Color color, String icon) {
+ String res;
+
+ // text
+ if (text != null && color != null) {
+ String hex = String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getGreen());
+ res = String.format("%s", hex, text);
+ } else {
+ res = text;
+ }
+
+ // icon
+ if (res != null && icon != null) {
+ res = icon + res;
+ }
+
+ return res;
+ }
+}
diff --git a/Mage/src/main/java/mage/abilities/hint/StaticHint.java b/Mage/src/main/java/mage/abilities/hint/StaticHint.java
index e5e16d0a1a..848b09ac56 100644
--- a/Mage/src/main/java/mage/abilities/hint/StaticHint.java
+++ b/Mage/src/main/java/mage/abilities/hint/StaticHint.java
@@ -1,9 +1,9 @@
package mage.abilities.hint;
+import mage.abilities.Ability;
import mage.game.Game;
import java.awt.*;
-import java.util.UUID;
/**
* @author JayDi85
@@ -17,22 +17,18 @@ public class StaticHint implements Hint {
}
public StaticHint(String text, Color color) {
- if (color != null) {
- String hex = String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getGreen());
- this.text = String.format("%s", hex, text);
- } else {
- this.text = text;
- }
- }
-
- public String getText(Game game, UUID sourceId) {
- return text;
+ this.text = HintUtils.prepareText(text, color);
}
private StaticHint(final StaticHint hint) {
this.text = hint.text;
}
+ @Override
+ public String getText(Game game, Ability ability) {
+ return text;
+ }
+
@Override
public Hint copy() {
return new StaticHint(this);
diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java
index 94076fff79..db47e6de17 100644
--- a/Mage/src/main/java/mage/cards/CardImpl.java
+++ b/Mage/src/main/java/mage/cards/CardImpl.java
@@ -257,7 +257,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
// extra hints
for (Ability ability : abilities) {
for (Hint hint : ability.getHints()) {
- String s = hint.getText(game, objectId);
+ String s = hint.getText(game, ability);
if (s != null && !s.isEmpty()) {
rules.add(s);
}
diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java
index 19d5a624d0..c36a2f7f18 100644
--- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java
+++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java
@@ -248,7 +248,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
// extra hints
for (Ability ability : abilities) {
for (Hint hint : ability.getHints()) {
- String s = hint.getText(game, objectId);
+ String s = hint.getText(game, ability);
if (s != null && !s.isEmpty()) {
rules.add(s);
}