* Dust to Dust - Fixed tooltip text.

This commit is contained in:
LevelX2 2016-02-08 16:15:46 +01:00
parent c7c6c1fa4b
commit 6b20f7733a
3 changed files with 24 additions and 5 deletions

View file

@ -32,6 +32,7 @@ import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterArtifactPermanent;
import mage.target.common.TargetArtifactPermanent;
/**
@ -44,10 +45,9 @@ public class DustToDust extends CardImpl {
super(ownerId, 78, "Dust to Dust", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{W}{W}");
this.expansionSetCode = "DRK";
// Exile two target artifacts.
this.getSpellAbility().addEffect(new ExileTargetEffect());
this.getSpellAbility().addTarget(new TargetArtifactPermanent(2));
this.getSpellAbility().addTarget(new TargetArtifactPermanent(2, 2, new FilterArtifactPermanent("artifacts"), false));
}
public DustToDust(final DustToDust card) {

View file

@ -109,7 +109,7 @@ public class DestroyTargetEffect extends OneShotEffect {
return staticText;
}
StringBuilder sb = new StringBuilder();
if (mode.getTargets().size() == 0) {
if (mode.getTargets().isEmpty()) {
sb.append("destroy that creature"); //TODO add possibility to specify text with targetPointer usage
} else {
Target target;

View file

@ -41,6 +41,8 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.targetpointer.FirstTargetPointer;
import mage.target.targetpointer.SecondTargetPointer;
import mage.util.CardUtil;
/**
*
@ -146,10 +148,27 @@ public class ExileTargetEffect extends OneShotEffect {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
if (mode.getTargets().isEmpty()) {
return "exile it";
sb.append("exile that permanent"); // this will be used if the target is set by target pointer and staticText not set.
} else {
return "exile target " + mode.getTargets().get(0).getTargetName();
Target target;
if (targetPointer instanceof SecondTargetPointer && mode.getTargets().size() > 1) {
target = mode.getTargets().get(1);
} else {
target = mode.getTargets().get(0);
}
if (target.getNumberOfTargets() == 1) {
String targetName = target.getTargetName();
sb.append("exile ");
if (!targetName.startsWith("another")) {
sb.append("target ");
}
sb.append(targetName);
} else {
sb.append("exile ").append(CardUtil.numberToText(target.getNumberOfTargets())).append(" target ").append(target.getTargetName());
}
}
return sb.toString();
}
}