forked from External/mage
Clockwork Dragon
This commit is contained in:
parent
725f0ad4a8
commit
78e60ce457
2 changed files with 202 additions and 0 deletions
|
|
@ -0,0 +1,37 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.counters.Counter;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
public class RemoveCounterSourceEffect extends OneShotEffect<RemoveCounterSourceEffect> {
|
||||
private Counter counter;
|
||||
|
||||
public RemoveCounterSourceEffect(Counter counter) {
|
||||
super(Constants.Outcome.UnboostCreature);
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
public RemoveCounterSourceEffect(RemoveCounterSourceEffect effect) {
|
||||
super(effect);
|
||||
this.counter = effect.counter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent p = game.getPermanent(source.getSourceId());
|
||||
if (p != null && p.getCounters().getCount(counter.getName()) >= counter.getCount()) {
|
||||
p.removeCounters(counter.getName(), counter.getCount(), game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoveCounterSourceEffect copy() {
|
||||
return new RemoveCounterSourceEffect(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue