OK here are the changes I made and an explanation of what is going on. (I
don't know how to make the diffs look nice.)
I changed the string for wrapped abilities (triggers and maybe other stuff).
This makes different abilities look different when considering whether to
ask the user to order simultaneous abilities. This also gives the human
player the information needed to see what an ability actually is doing when
ordering simultaneous abilities.
First, in WrappedAbility.java use the stack description as that now has the
important triggering information at the end. This works for the untap
ability of
Amulet of Vigor and most other abilities.
Second, in WrappedAbility.java add in the host card string representation if
that isn't already in the string and the string has " this " in it.
This is for abliities like Evolve that don't have CARDNAME in them but that
affect the host card. (A better solution would be to actually change the
wording for Evolve and all other such triggers to use CARDNAME.)
Third, in Trigger.java add a new variant of toString() for triggers that can
switch between using card names and card toString() and, in
WrappedAbility.java, use it for wrapped abilities. This is to distinguish
between cards with the same name when determining whether two wrapped
abilities are equivalent.
The interesting aspect of this change is that it if there are two different
Amulet of Vigor in play and one permanent comes into play tapped the two
effects will have the same string representation as there is no reason to
add the identifier of the
Amulet of Vigor to the string representation.
There are still cases where the string representations are different but the
effects will be the same, such as two creatures coming into play
simultaneously and both triggering Evolve on the same creature.
This is done in a bit sneaky way beacuse toString() is final in a parent
and can't be changed here. It might be better to make toString() not final
in the parent and override it directly in WrappedAbility.
Index: forge-game/src/main/java/forge/game/trigger/WrappedAbility.java
===================================================================
--- forge-game/src/main/java/forge/game/trigger/WrappedAbility.java (revision 32943)
+++ forge-game/src/main/java/forge/game/trigger/WrappedAbility.java (working copy)
@@ -191,12 +191,17 @@
@
Override public String toUnsuppressedString() {
- return regtrig.toString();
+ String strg = this.getStackDescription(); /* use augmented stack description as string for wrapped things */
+ String card = regtrig.getHostCard().toString();
+ if ( !strg.contains(card) && strg.contains(" this ")) { /* a hack for Evolve and similar that don't have CARDNAME */
+ return card + ": " + strg;
+ } else return strg;
+ /* return regtrig.toString(); */
}
@
Override public String getStackDescription() {
- final StringBuilder sb = new StringBuilder(regtrig.replaceAbilityText(toUnsuppressedString(), this));
+ final StringBuilder sb = new StringBuilder(regtrig.replaceAbilityText(regtrig.toString(true), this));
if (usesTargeting()) {
sb.append(" (Targeting ");
for (final GameObject o : this.getTargets().getTargets()) {
Index: forge-game/src/main/java/forge/game/trigger/Trigger.java
==================================================================
--- forge-game/src/main/java/forge/game/trigger/Trigger.java (revision 32943)
+++ forge-game/src/main/java/forge/game/trigger/Trigger.java (working copy)
@@ -146,13 +146,17 @@
*/
@
Override public final String toString() {
+ return toString(false);
+ }
+
+ public String toString(boolean active) {
if (this.mapParams.containsKey("TriggerDescription") && !this.isSuppressed()) {
StringBuilder sb = new StringBuilder();
String desc = this.mapParams.get("TriggerDescription");
- desc = desc.replace("CARDNAME", getHostCard().getName());
+ desc = desc.replace("CARDNAME", active ? getHostCard().toString() : getHostCard().getName());
if (getHostCard().getEffectSource() != null) {
- desc = desc.replace("EFFECTSOURCE", getHostCard().getEffectSource().getName());
+ desc = desc.replace("EFFECTSOURCE", active ? getHostCard().getEffectSource().toString() : getHostCard().getEffectSource().getName());
}
sb.append(desc);
if (!this.triggerRemembered.isEmpty()) {