mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
[BLB] Implement Byrke, Long Ear of the Law (#11860)
New common class DoubleCountersTargetEffect
This commit is contained in:
parent
0ba00620db
commit
ddcd54c0df
10 changed files with 128 additions and 191 deletions
|
|
@ -0,0 +1,43 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
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 PurpleCrowbar
|
||||
*/
|
||||
public class DoubleCountersTargetEffect extends OneShotEffect {
|
||||
|
||||
private final CounterType counterType;
|
||||
|
||||
public DoubleCountersTargetEffect(CounterType counterType) {
|
||||
super(Outcome.Benefit);
|
||||
this.counterType = counterType;
|
||||
staticText = "double the number of " + counterType.getName() + " counters on it";
|
||||
}
|
||||
|
||||
private DoubleCountersTargetEffect(final DoubleCountersTargetEffect effect) {
|
||||
super(effect);
|
||||
this.counterType = effect.counterType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleCountersTargetEffect copy() {
|
||||
return new DoubleCountersTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
return permanent.addCounters(counterType.createInstance(
|
||||
permanent.getCounters(game).getCount(counterType)
|
||||
), source.getControllerId(), source, game);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue