mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
[DSK] Implement Cursed Recording
This commit is contained in:
parent
f0a77a8551
commit
f53fb22916
3 changed files with 60 additions and 45 deletions
|
|
@ -1,45 +0,0 @@
|
|||
|
||||
package mage.abilities.effects.common.counter;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class RemoveAllCountersSourceEffect extends OneShotEffect {
|
||||
|
||||
private final CounterType counterType;
|
||||
|
||||
public RemoveAllCountersSourceEffect(CounterType counterType) {
|
||||
super(Outcome.Neutral);
|
||||
this.counterType = counterType;
|
||||
staticText = "remove all " + counterType.getName() + " counters from {this}.";
|
||||
}
|
||||
|
||||
public RemoveAllCountersSourceEffect(RemoveAllCountersSourceEffect effect) {
|
||||
super(effect);
|
||||
this.counterType = effect.counterType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent != null) {
|
||||
int count = permanent.getCounters(game).getCount(counterType);
|
||||
permanent.removeCounters(counterType.getName(), count, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoveAllCountersSourceEffect copy() {
|
||||
return new RemoveAllCountersSourceEffect(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue