mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Description for wrapped abilities includes stack information; Fixes problem with autoordering
This commit is contained in:
@@ -146,13 +146,17 @@ public abstract class Trigger extends TriggerReplacementBase {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final String toString() {
|
public final String toString() {
|
||||||
|
return toString(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(boolean active) {
|
||||||
if (this.mapParams.containsKey("TriggerDescription") && !this.isSuppressed()) {
|
if (this.mapParams.containsKey("TriggerDescription") && !this.isSuppressed()) {
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
String desc = this.mapParams.get("TriggerDescription");
|
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) {
|
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);
|
sb.append(desc);
|
||||||
if (!this.triggerRemembered.isEmpty()) {
|
if (!this.triggerRemembered.isEmpty()) {
|
||||||
|
|||||||
@@ -199,14 +199,21 @@ public class WrappedAbility extends Ability {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// include triggering information so that different effects look different
|
||||||
|
// this information is in the stack description so just use that
|
||||||
|
// a real solution would include only the triggering information that actually is used, but that's a major change
|
||||||
@Override
|
@Override
|
||||||
public String toUnsuppressedString() {
|
public String toUnsuppressedString() {
|
||||||
return regtrig.toString();
|
String desc = this.getStackDescription(); /* use augmented stack description as string for wrapped things */
|
||||||
|
String card = getTrigger().getHostCard().toString();
|
||||||
|
if ( !desc.contains(card) && desc.contains(" this ")) { /* a hack for Evolve and similar that don't have CARDNAME */
|
||||||
|
return card + ": " + desc;
|
||||||
|
} else return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStackDescription() {
|
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()) {
|
if (usesTargeting()) {
|
||||||
sb.append(" (Targeting ");
|
sb.append(" (Targeting ");
|
||||||
for (final GameObject o : this.getTargets().getTargets()) {
|
for (final GameObject o : this.getTargets().getTargets()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user