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

@ -1,6 +1,6 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -12,14 +12,12 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetAdjustment;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.targetadjustment.VerseCounterAdjuster;
import java.util.UUID;
/** /**
* *
@ -40,7 +38,7 @@ public final class Recantation extends CardImpl {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{U}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{U}"));
ability.addCost(new SacrificeSourceCost()); ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetPermanent(0, 0, new FilterPermanent("up to X target permanents, where X is the number of verse counters on {this}."), false)); ability.addTarget(new TargetPermanent(0, 0, new FilterPermanent("up to X target permanents, where X is the number of verse counters on {this}."), false));
ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); ability.setTargetAdjuster(VerseCounterAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,4 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
@ -13,13 +12,13 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetAdjustment;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.targetadjustment.VerseCounterAdjuster;
/** /**
* *
@ -46,7 +45,7 @@ public final class RumblingCrescendo extends CardImpl {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{R}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{R}"));
ability.addCost(new SacrificeSourceCost()); ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetPermanent(0, 0, filter, false)); ability.addTarget(new TargetPermanent(0, 0, filter, false));
ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); ability.setTargetAdjuster(VerseCounterAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,4 +1,3 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID; import java.util.UUID;
@ -13,7 +12,6 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetAdjustment;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
@ -21,6 +19,7 @@ import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.targetadjustment.VerseCounterAdjuster;
/** /**
* *
@ -50,7 +49,7 @@ public final class SerrasLiturgy extends CardImpl {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{W}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{W}"));
ability.addCost(new SacrificeSourceCost()); ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetPermanent(0, 0, filter, false)); ability.addTarget(new TargetPermanent(0, 0, filter, false));
ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); ability.setTargetAdjuster(VerseCounterAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,4 +1,3 @@
package mage.cards.v; package mage.cards.v;
import java.util.UUID; import java.util.UUID;
@ -14,7 +13,6 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetAdjustment;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
@ -23,6 +21,7 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.targetadjustment.VerseCounterAdjuster;
/** /**
* *
@ -50,7 +49,7 @@ public final class VileRequiem extends CardImpl {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{B}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{B}"));
ability.addCost(new SacrificeSourceCost()); ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetPermanent(0, 0, filter, false)); ability.addTarget(new TargetPermanent(0, 0, filter, false));
ability.setTargetAdjustment(TargetAdjustment.VERSE_COUNTER_TARGETS); ability.setTargetAdjuster(VerseCounterAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -371,15 +371,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
ability.getTargets().clear(); ability.getTargets().clear();
ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false)); ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false));
break; 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: case X_CMC_EQUAL_GY_CARD:
xValue = ability.getManaCostsToPay().getX(); xValue = ability.getManaCostsToPay().getX();
FilterCard filterCard = ((TargetCard) ability.getTargets().get(0)).getFilter().copy(); FilterCard filterCard = ((TargetCard) ability.getTargets().get(0)).getFilter().copy();
@ -408,7 +399,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
ability.addTarget(oldTargetPermanent); ability.addTarget(oldTargetPermanent);
break; break;
case TREASURE_COUNTER_POWER: //Legacy's Allure only case TREASURE_COUNTER_POWER: //Legacy's Allure only
sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(ability.getSourceId());
if (sourcePermanent != null) { if (sourcePermanent != null) {
xValue = sourcePermanent.getCounters(game).getCount(CounterType.TREASURE); 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}"); 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));
}
}
}