WrappedAbility: fixed StackDescription

This commit is contained in:
Hans Mackowiak
2021-02-25 10:17:20 +01:00
parent b99de32027
commit e428e66623
2 changed files with 11 additions and 16 deletions

View File

@@ -1648,13 +1648,13 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
final List<TargetChoices> res = Lists.newArrayList();
SpellAbility sa = getRootAbility();
if (sa.getTargetRestrictions() != null) {
if (sa.usesTargeting()) {
res.add(sa.getTargets());
}
while (sa.getSubAbility() != null) {
sa = sa.getSubAbility();
if (sa.getTargetRestrictions() != null) {
if (sa.usesTargeting()) {
res.add(sa.getTargets());
}
}

View File

@@ -2,7 +2,6 @@ package forge.game.trigger;
import forge.card.mana.ManaCost;
import forge.game.Game;
import forge.game.GameObject;
import forge.game.ability.AbilityKey;
import forge.game.ability.ApiType;
import forge.game.card.Card;
@@ -231,23 +230,19 @@ public class WrappedAbility extends Ability {
public String getStackDescription() {
final Trigger regtrig = getTrigger();
final StringBuilder sb = new StringBuilder(regtrig.replaceAbilityText(regtrig.toString(true), this));
if (usesTargeting()) {
List<TargetChoices> allTargets = sa.getAllTargetChoices();
if (!allTargets.isEmpty()) {
sb.append(" (Targeting ");
for (final GameObject o : this.getTargets()) {
sb.append(o.toString());
sb.append(", ");
}
if (sb.toString().endsWith(", ")) {
sb.setLength(sb.length() - 2);
} else {
sb.append("ERROR");
}
sb.append(allTargets);
sb.append(")");
}
String important = regtrig.getImportantStackObjects(this);
if (!important.isEmpty()) {
sb.append(" [");
sb.append(regtrig.getImportantStackObjects(this));
sb.append(important);
sb.append("]");
}
return sb.toString();
}