replaced verse counter adjustment

This commit is contained in:
Evan Kranzler 2018-09-17 13:40:27 -04:00
parent 0d3c068f50
commit 42417b6711
6 changed files with 37 additions and 24 deletions

View file

@ -371,15 +371,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
ability.getTargets().clear();
ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false));
break;
case VERSE_COUNTER_TARGETS:
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
if (sourcePermanent != null) {
xValue = sourcePermanent.getCounters(game).getCount(CounterType.VERSE);
permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter();
ability.getTargets().clear();
ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false));
}
break;
case X_CMC_EQUAL_GY_CARD:
xValue = ability.getManaCostsToPay().getX();
FilterCard filterCard = ((TargetCard) ability.getTargets().get(0)).getFilter().copy();
@ -408,7 +399,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
ability.addTarget(oldTargetPermanent);
break;
case TREASURE_COUNTER_POWER: //Legacy's Allure only
sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
if (sourcePermanent != null) {
xValue = sourcePermanent.getCounters(game).getCount(CounterType.TREASURE);
FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on {this}");

View file

@ -0,0 +1,27 @@
package mage.target.targetadjustment;
import mage.abilities.Ability;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
/**
*
* @author TheElk801
*/
public enum VerseCounterAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
if (sourcePermanent != null) {
int xValue = sourcePermanent.getCounters(game).getCount(CounterType.VERSE);
FilterPermanent permanentFilter = ((TargetPermanent) ability.getTargets().get(0)).getFilter();
ability.getTargets().clear();
ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false));
}
}
}