mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
new RemoveAllCountersAllEffect
This commit is contained in:
parent
21f1aa559b
commit
3497facd6b
4 changed files with 59 additions and 139 deletions
|
|
@ -0,0 +1,42 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* @author xenohedron
|
||||
*/
|
||||
public class RemoveAllCountersAllEffect extends OneShotEffect {
|
||||
|
||||
private final CounterType counterType;
|
||||
private final FilterPermanent filter;
|
||||
|
||||
public RemoveAllCountersAllEffect(CounterType counterType, FilterPermanent filter) {
|
||||
super(Outcome.Neutral);
|
||||
this.counterType = counterType;
|
||||
this.filter = filter;
|
||||
staticText = "remove all " + counterType.getName() + " counters from all " + filter.getMessage();
|
||||
}
|
||||
|
||||
protected RemoveAllCountersAllEffect(final RemoveAllCountersAllEffect effect) {
|
||||
super(effect);
|
||||
this.counterType = effect.counterType;
|
||||
this.filter = effect.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoveAllCountersAllEffect copy() {
|
||||
return new RemoveAllCountersAllEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)
|
||||
.forEach(p -> p.removeAllCounters(counterType.getName(), source, game));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue