mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[DSC] Implement Experimental Lab // Staff Room
This commit is contained in:
parent
98f7613d20
commit
bee3614f65
3 changed files with 107 additions and 12 deletions
|
|
@ -14,29 +14,32 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class ManifestDreadEffect extends OneShotEffect {
|
||||
|
||||
private final Counter counter;
|
||||
private final List<Counter> counters = new ArrayList<>();
|
||||
|
||||
public ManifestDreadEffect() {
|
||||
this((Counter) null);
|
||||
}
|
||||
|
||||
public ManifestDreadEffect(Counter counter) {
|
||||
public ManifestDreadEffect(Counter... counters) {
|
||||
super(Outcome.Benefit);
|
||||
this.counter = counter;
|
||||
staticText = "manifest dread" + (counter != null ? ", then put " + counter.getDescription() + " on that creature" : "");
|
||||
for (Counter counter : counters) {
|
||||
this.counters.add(counter);
|
||||
}
|
||||
staticText = this.makeText();
|
||||
}
|
||||
|
||||
private ManifestDreadEffect(final ManifestDreadEffect effect) {
|
||||
super(effect);
|
||||
this.counter = Optional.ofNullable(effect.counter).map(Counter::copy).orElse(null);
|
||||
for (Counter counter : effect.counters) {
|
||||
this.counters.add(counter.copy());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -52,9 +55,9 @@ public class ManifestDreadEffect extends OneShotEffect {
|
|||
}
|
||||
Permanent permanent = doManifestDread(player, source, game);
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if (counter != null) {
|
||||
for (Counter counter : counters) {
|
||||
permanent.addCounters(counter, source, game);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -91,4 +94,15 @@ public class ManifestDreadEffect extends OneShotEffect {
|
|||
game.fireEvent(new ManifestedDreadEvent(permanent, source, player.getId(), cards, game));
|
||||
return permanent;
|
||||
}
|
||||
|
||||
private String makeText() {
|
||||
StringBuilder sb = new StringBuilder("manifest dread");
|
||||
if (this.counters.isEmpty()) {
|
||||
return sb.toString();
|
||||
}
|
||||
sb.append(", then put ");
|
||||
sb.append(CardUtil.concatWithAnd(counters.stream().map(Counter::getDescription).collect(Collectors.toList())));
|
||||
sb.append(" on that creature");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue