mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[SPM] Implement Miles Morales / Ultimate Spider-Man
This commit is contained in:
parent
49a3b1176e
commit
2db69b4ba5
3 changed files with 131 additions and 3 deletions
|
|
@ -4,12 +4,14 @@ package mage.abilities.effects.common.counter;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
|
|
@ -23,7 +25,9 @@ public class DoubleCounterOnEachPermanentEffect extends OneShotEffect {
|
|||
super(Outcome.BoostCreature);
|
||||
this.counterType = counterType;
|
||||
this.filter = filter.copy();
|
||||
this.staticText = "double the number of " + counterType.getName() + " counters on each " + filter.getMessage();
|
||||
this.staticText = "double the number of " +
|
||||
(counterType != null ? (counterType.getName() + " counters") : "each kind of counter") +
|
||||
" on each " + filter.getMessage();
|
||||
}
|
||||
|
||||
private DoubleCounterOnEachPermanentEffect(final DoubleCounterOnEachPermanentEffect effect) {
|
||||
|
|
@ -39,8 +43,19 @@ public class DoubleCounterOnEachPermanentEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game);
|
||||
for (Permanent permanent : permanents) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
if (counterType == null) {
|
||||
List<Counter> counters = permanent
|
||||
.getCounters(game)
|
||||
.values()
|
||||
.stream()
|
||||
.map(Counter::copy)
|
||||
.collect(Collectors.toList());
|
||||
for (Counter counter : counters) {
|
||||
permanent.addCounters(counter, source, game);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
int existingCounters = permanent.getCounters(game).getCount(counterType);
|
||||
if (existingCounters > 0) {
|
||||
permanent.addCounters(counterType.createInstance(existingCounters), source.getControllerId(), source, game);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue