some cards, start effects moving

This commit is contained in:
Loki 2011-02-07 22:09:47 +02:00
parent f377eee8e0
commit 6d188d76d7
54 changed files with 467 additions and 199 deletions

View file

@ -0,0 +1,37 @@
package mage.abilities.effects.common.counter;
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);
}
}