forked from External/mage
[TDM] Implement Perennation
This commit is contained in:
parent
cf970ec019
commit
9285b7e78a
6 changed files with 67 additions and 22 deletions
|
|
@ -7,6 +7,8 @@ import mage.counters.Counters;
|
|||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
|
@ -17,15 +19,17 @@ public class ReturnFromGraveyardToBattlefieldWithCounterTargetEffect extends Ret
|
|||
private final Counters counters;
|
||||
private final String counterText;
|
||||
|
||||
public ReturnFromGraveyardToBattlefieldWithCounterTargetEffect(Counter counter) {
|
||||
this(counter, false);
|
||||
public ReturnFromGraveyardToBattlefieldWithCounterTargetEffect(Counter... counters) {
|
||||
this(false, counters);
|
||||
}
|
||||
|
||||
public ReturnFromGraveyardToBattlefieldWithCounterTargetEffect(Counter counter, boolean additional) {
|
||||
public ReturnFromGraveyardToBattlefieldWithCounterTargetEffect(boolean additional, Counter... counters) {
|
||||
super(false);
|
||||
this.counters = new Counters();
|
||||
this.counters.addCounter(counter);
|
||||
this.counterText = makeText(counter, additional);
|
||||
for (Counter counter : counters) {
|
||||
this.counters.addCounter(counter);
|
||||
}
|
||||
this.counterText = makeText(additional, counters);
|
||||
}
|
||||
|
||||
protected ReturnFromGraveyardToBattlefieldWithCounterTargetEffect(final ReturnFromGraveyardToBattlefieldWithCounterTargetEffect effect) {
|
||||
|
|
@ -47,22 +51,26 @@ public class ReturnFromGraveyardToBattlefieldWithCounterTargetEffect extends Ret
|
|||
return super.apply(game, source);
|
||||
}
|
||||
|
||||
private String makeText(Counter counter, boolean additional) {
|
||||
StringBuilder sb = new StringBuilder(" with ");
|
||||
if (counter.getCount() == 1) {
|
||||
if (additional) {
|
||||
sb.append("an additional ").append(counter.getName());
|
||||
private static String makeText(boolean additional, Counter... counters) {
|
||||
List<String> strings = new ArrayList<>();
|
||||
for (Counter counter : counters) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (counter.getCount() == 1) {
|
||||
if (additional) {
|
||||
sb.append("an additional ").append(counter.getName());
|
||||
} else {
|
||||
sb.append(CardUtil.addArticle(counter.getName()));
|
||||
}
|
||||
sb.append(" counter");
|
||||
} else {
|
||||
sb.append(CardUtil.addArticle(counter.getName()));
|
||||
sb.append(CardUtil.numberToText(counter.getCount()));
|
||||
sb.append(additional ? " additional " : " ");
|
||||
sb.append(counter.getName());
|
||||
sb.append(" counters");
|
||||
}
|
||||
sb.append(" counter");
|
||||
} else {
|
||||
sb.append(CardUtil.numberToText(counter.getCount()));
|
||||
sb.append(additional ? " additional " : " ");
|
||||
sb.append(counter.getName());
|
||||
sb.append(" counters");
|
||||
strings.add(sb.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
return " with " + CardUtil.concatWithAnd(strings);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue