mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[XLN] refactor some TDFCs
This commit is contained in:
parent
f024e3b092
commit
b70362416b
9 changed files with 98 additions and 255 deletions
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealsDamageToAPlayerAttachedTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
|
@ -13,16 +11,16 @@ import mage.abilities.effects.common.TransformSourceEffect;
|
|||
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.keyword.TransformAbility;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.permanent.token.DefenderPlantToken;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
|
|
@ -37,8 +35,7 @@ public final class DowsingDagger extends CardImpl {
|
|||
|
||||
// When Dowsing Dagger enters the battlefield, target opponent creates two 0/2 green Plant creature tokens with defender.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new CreateTokenTargetEffect(new DefenderPlantToken(), 2), false);
|
||||
Target target = new TargetOpponent();
|
||||
ability.addTarget(target);
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
||||
// Equipped creature gets +2/+1.
|
||||
|
|
|
|||
|
|
@ -1,23 +1,19 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.TransformSourceEffect;
|
||||
import mage.abilities.keyword.TransformAbility;
|
||||
import mage.constants.SuperType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.constants.SuperType;
|
||||
import mage.game.permanent.token.IxalanVampireToken;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
|
|
@ -35,7 +31,7 @@ public final class LegionsLanding extends CardImpl {
|
|||
|
||||
// When you attack with three or more creatures, transform Legion's Landing.
|
||||
this.addAbility(new TransformAbility());
|
||||
this.addAbility(new LegionsLandingTriggeredAbility(new TransformSourceEffect()));
|
||||
this.addAbility(new AttacksWithCreaturesTriggeredAbility(new TransformSourceEffect(), 3).setTriggerPhrase("When you attack with three or more creatures, "));
|
||||
}
|
||||
|
||||
private LegionsLanding(final LegionsLanding card) {
|
||||
|
|
@ -47,30 +43,3 @@ public final class LegionsLanding extends CardImpl {
|
|||
return new LegionsLanding(this);
|
||||
}
|
||||
}
|
||||
|
||||
class LegionsLandingTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public LegionsLandingTriggeredAbility(Effect effect) {
|
||||
super(Zone.BATTLEFIELD, effect, false);
|
||||
setTriggerPhrase("When you attack with three or more creatures, " );
|
||||
}
|
||||
|
||||
private LegionsLandingTriggeredAbility(final LegionsLandingTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LegionsLandingTriggeredAbility copy() {
|
||||
return new LegionsLandingTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return game.getCombat().getAttackers().size() >= 3 && game.getCombat().getAttackingPlayerId().equals(getControllerId());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +1,15 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
|
||||
import mage.abilities.mana.SimpleManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class LostVale extends CardImpl {
|
||||
|
|
@ -22,7 +20,7 @@ public final class LostVale extends CardImpl {
|
|||
this.nightCard = true;
|
||||
|
||||
// T: Add three mana of any one color.
|
||||
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(3), new TapSourceCost()));
|
||||
this.addAbility(new SimpleManaAbility(new AddManaOfAnyColorEffect(3), new TapSourceCost()));
|
||||
}
|
||||
|
||||
private LostVale(final LostVale card) {
|
||||
|
|
|
|||
|
|
@ -4,14 +4,13 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.TransformSourceEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.TransformAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
|
|
@ -27,7 +26,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class PrimalAmulet extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("Instant and sorcery spells");
|
||||
private static final FilterCard filter = new FilterCard("instant and sorcery spells");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
|
|
@ -45,7 +44,12 @@ public final class PrimalAmulet extends CardImpl {
|
|||
|
||||
// Whenever you cast an instant or sorcery spell, put a charge counter on Primal Amulet. Then if there are four or more charge counters on it, you may remove those counters and transform it.
|
||||
this.addAbility(new TransformAbility());
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(new PrimalAmuletEffect(), StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY, false));
|
||||
Ability ability = new SpellCastControllerTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.CHARGE.createInstance()),
|
||||
StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY, false
|
||||
);
|
||||
ability.addEffect(new PrimalAmuletEffect());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private PrimalAmulet(final PrimalAmulet card) {
|
||||
|
|
@ -62,9 +66,8 @@ class PrimalAmuletEffect extends OneShotEffect {
|
|||
|
||||
PrimalAmuletEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "put a charge counter on {this}. "
|
||||
+ "Then if there are four or more charge counters on it, "
|
||||
+ "you may remove those counters and transform it";
|
||||
this.staticText = "Then if there are four or more charge counters on it, " +
|
||||
"you may remove those counters and transform it";
|
||||
}
|
||||
|
||||
private PrimalAmuletEffect(final PrimalAmuletEffect effect) {
|
||||
|
|
@ -79,16 +82,15 @@ class PrimalAmuletEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && player != null) {
|
||||
permanent.addCounters(CounterType.CHARGE.createInstance(), source.getControllerId(), source, game);
|
||||
int counters = permanent.getCounters(game).getCount(CounterType.CHARGE);
|
||||
if (counters > 3 && player.chooseUse(Outcome.Benefit, "Transform this?", source, game)) {
|
||||
permanent.removeCounters(CounterType.CHARGE.getName(), counters, source, game);
|
||||
new TransformSourceEffect().apply(game, source);
|
||||
}
|
||||
return true;
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null
|
||||
|| player == null
|
||||
|| permanent.getCounters(game).getCount(CounterType.CHARGE) <= 3
|
||||
|| !player.chooseUse(Outcome.Benefit, "Remove all charge counters from this and transform it?", source, game)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
permanent.removeAllCounters(CounterType.CHARGE.getName(), source, game);
|
||||
permanent.transform(source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
|
@ -17,8 +15,9 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.stack.Spell;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PrimalWellspring extends CardImpl {
|
||||
|
|
@ -33,9 +32,10 @@ public final class PrimalWellspring extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// When that mana is spent to cast an instant or sorcery spell, copy that spell and you may choose new targets for the copy.
|
||||
Effect effect = new CopyTargetStackObjectEffect(true);
|
||||
effect.setText("copy that spell and you may choose new targets for the copy");
|
||||
this.addAbility(new PyrimalWellspringTriggeredAbility(ability.getOriginalId(), effect));
|
||||
this.addAbility(new PrimalWellspringTriggeredAbility(
|
||||
ability.getOriginalId(), new CopyTargetStackObjectEffect(true)
|
||||
.setText("copy that spell and you may choose new targets for the copy")
|
||||
));
|
||||
}
|
||||
|
||||
private PrimalWellspring(final PrimalWellspring card) {
|
||||
|
|
@ -48,26 +48,26 @@ public final class PrimalWellspring extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class PyrimalWellspringTriggeredAbility extends TriggeredAbilityImpl {
|
||||
class PrimalWellspringTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private static final FilterInstantOrSorcerySpell filter = new FilterInstantOrSorcerySpell();
|
||||
|
||||
String abilityOriginalId;
|
||||
|
||||
public PyrimalWellspringTriggeredAbility(UUID abilityOriginalId, Effect effect) {
|
||||
public PrimalWellspringTriggeredAbility(UUID abilityOriginalId, Effect effect) {
|
||||
super(Zone.ALL, effect, false);
|
||||
this.abilityOriginalId = abilityOriginalId.toString();
|
||||
setTriggerPhrase("When that mana is used to cast an instant or sorcery spell, ");
|
||||
}
|
||||
|
||||
private PyrimalWellspringTriggeredAbility(final PyrimalWellspringTriggeredAbility ability) {
|
||||
private PrimalWellspringTriggeredAbility(final PrimalWellspringTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.abilityOriginalId = ability.abilityOriginalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PyrimalWellspringTriggeredAbility copy() {
|
||||
return new PyrimalWellspringTriggeredAbility(this);
|
||||
public PrimalWellspringTriggeredAbility copy() {
|
||||
return new PrimalWellspringTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,35 +1,30 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.RemoveFromCombatTargetEffect;
|
||||
import mage.abilities.effects.common.UntapTargetEffect;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterOpponentsCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.AttackingPredicate;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SpiresOfOrazca extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("attacking creature an opponent controls");
|
||||
private static final FilterPermanent filter = new FilterOpponentsCreaturePermanent("attacking creature an opponent controls");
|
||||
|
||||
static {
|
||||
filter.add(AttackingPredicate.instance);
|
||||
filter.add(TargetController.OPPONENT.getControllerPredicate());
|
||||
}
|
||||
|
||||
public SpiresOfOrazca(UUID ownerId, CardSetInfo setInfo) {
|
||||
|
|
@ -40,12 +35,12 @@ public final class SpiresOfOrazca extends CardImpl {
|
|||
this.addAbility(new ColorlessManaAbility());
|
||||
|
||||
// {T}: Untap target attacking creature an opponent controls and remove it from combat.
|
||||
Effect effect = new UntapTargetEffect();
|
||||
effect.setText("Untap target attacking creature an opponent controls and remove it from combat.");
|
||||
Ability ability = new SimpleActivatedAbility(effect, new TapSourceCost());
|
||||
effect = new RemoveFromCombatTargetEffect();
|
||||
effect.setText(" ");
|
||||
ability.addEffect(effect);
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
new UntapTargetEffect()
|
||||
.setText("Untap target attacking creature an opponent controls"),
|
||||
new TapSourceCost()
|
||||
);
|
||||
ability.addEffect(new RemoveFromCombatTargetEffect().setText("and remove it from combat"));
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,21 @@
|
|||
|
||||
package mage.cards.t;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.dynamicvalue.common.SacrificeCostCreaturesToughness;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.mana.BlackManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TempleOfAclazotz extends CardImpl {
|
||||
|
|
@ -36,7 +30,8 @@ public final class TempleOfAclazotz extends CardImpl {
|
|||
this.addAbility(new BlackManaAbility());
|
||||
|
||||
// {T}, Sacrifice a creature: You gain life equal to the sacrificed creature's toughness.
|
||||
Ability ability = new SimpleActivatedAbility(new TempleOfAclazotzEffect(), new TapSourceCost());
|
||||
Ability ability = new SimpleActivatedAbility(new GainLifeEffect(SacrificeCostCreaturesToughness.instance)
|
||||
.setText("you gain life equal to the sacrificed creature's toughness"), new TapSourceCost());
|
||||
ability.addCost(new SacrificeTargetCost(StaticFilters.FILTER_PERMANENT_CREATURE));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
@ -50,37 +45,3 @@ public final class TempleOfAclazotz extends CardImpl {
|
|||
return new TempleOfAclazotz(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TempleOfAclazotzEffect extends OneShotEffect {
|
||||
|
||||
TempleOfAclazotzEffect() {
|
||||
super(Outcome.GainLife);
|
||||
this.staticText = "You gain life equal to the sacrificed creature's toughness";
|
||||
}
|
||||
|
||||
private TempleOfAclazotzEffect(final TempleOfAclazotzEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TempleOfAclazotzEffect copy() {
|
||||
return new TempleOfAclazotzEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost) {
|
||||
int amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue();
|
||||
if (amount > 0) {
|
||||
controller.gainLife(amount, game, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,22 +2,22 @@ package mage.cards.t;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.SourceHasCounterCondition;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.RemoveAllCountersSourceEffect;
|
||||
import mage.abilities.effects.common.TransformSourceEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.keyword.ScryEffect;
|
||||
import mage.abilities.keyword.TransformAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.TreasureToken;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -26,6 +26,8 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class TreasureMap extends CardImpl {
|
||||
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.LANDMARK, 3);
|
||||
|
||||
public TreasureMap(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
|
|
@ -33,8 +35,13 @@ public final class TreasureMap extends CardImpl {
|
|||
|
||||
// {1}, {T}: Scry 1. Put a landmark counter on Treasure Map. Then if there are three or more landmark counters on it, remove those counters, transform Treasure Map, and create three colorless Treasure artifact tokens with "{T}, Sacrifice this artifact: Add one mana of any color."
|
||||
this.addAbility(new TransformAbility());
|
||||
Ability ability = new SimpleActivatedAbility(new TreasureMapEffect(), new ManaCostsImpl<>("{1}"));
|
||||
Ability ability = new SimpleActivatedAbility(new ScryEffect(1, false), new ManaCostsImpl<>("{1}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addEffect(new AddCountersSourceEffect(CounterType.LANDMARK.createInstance()));
|
||||
ability.addEffect(new ConditionalOneShotEffect(
|
||||
new RemoveAllCountersSourceEffect(CounterType.LANDMARK), condition, "Then if there are three or " +
|
||||
"more landmark counters on it, remove those counters, transform {this}, and create three Treasure tokens"
|
||||
).addEffect(new TransformSourceEffect()).addEffect(new CreateTokenEffect(new TreasureToken(), 3)));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
@ -47,43 +54,3 @@ public final class TreasureMap extends CardImpl {
|
|||
return new TreasureMap(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TreasureMapEffect extends OneShotEffect {
|
||||
|
||||
TreasureMapEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Scry 1. Put a landmark counter on {this}. "
|
||||
+ "Then if there are three or more landmark counters on it, "
|
||||
+ "remove those counters, transform {this}, and create "
|
||||
+ "three Treasure tokens";
|
||||
}
|
||||
|
||||
private TreasureMapEffect(final TreasureMapEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreasureMapEffect copy() {
|
||||
return new TreasureMapEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.scry(1, source, game);
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.LANDMARK.createInstance(), source.getControllerId(), source, game);
|
||||
int counters = permanent.getCounters(game).getCount(CounterType.LANDMARK);
|
||||
if (counters > 2) {
|
||||
permanent.removeCounters(CounterType.LANDMARK.getName(), counters, source, game);
|
||||
new TransformSourceEffect().apply(game, source);
|
||||
new CreateTokenEffect(new TreasureToken(), 3).apply(game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,21 +3,18 @@ package mage.cards.v;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.TransformSourceEffect;
|
||||
import mage.abilities.keyword.TransformAbility;
|
||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
import mage.watchers.common.CastSpellLastTurnWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -38,7 +35,7 @@ public final class VancesBlastingCannons extends CardImpl {
|
|||
|
||||
// Whenever you cast your third spell in a turn, transform Vance's Blasting Cannons.
|
||||
this.addAbility(new TransformAbility());
|
||||
this.addAbility(new VancesBlastingCannonsFlipTrigger());
|
||||
this.addAbility(new VancesBlastingCannonsTriggeredAbility());
|
||||
}
|
||||
|
||||
private VancesBlastingCannons(final VancesBlastingCannons card) {
|
||||
|
|
@ -69,72 +66,36 @@ class VancesBlastingCannonsExileEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (controller != null && sourcePermanent != null) {
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card != null) {
|
||||
String exileName = sourcePermanent.getIdName() + (card.isLand(game) ? "" : " <this card may be cast the turn it was exiled");
|
||||
controller.moveCardsToExile(card, source, game, true, source.getSourceId(), exileName);
|
||||
if (game.getState().getZone(card.getId()) == Zone.EXILED && !card.isLand(game)) {
|
||||
ContinuousEffect effect = new CastFromNonHandZoneTargetEffect(Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(card, game));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
player.moveCards(card, Zone.EXILED, source, game);
|
||||
if (!card.isLand(game)) {
|
||||
CardUtil.makeCardPlayable(game, source, card, true, Duration.EndOfTurn, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class CastFromNonHandZoneTargetEffect extends AsThoughEffectImpl {
|
||||
|
||||
CastFromNonHandZoneTargetEffect(Duration duration) {
|
||||
super(AsThoughEffectType.CAST_FROM_NOT_OWN_HAND_ZONE, duration, Outcome.Benefit);
|
||||
staticText = "If it's a nonland card, you may cast that card this turn";
|
||||
}
|
||||
|
||||
private CastFromNonHandZoneTargetEffect(final CastFromNonHandZoneTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CastFromNonHandZoneTargetEffect copy() {
|
||||
return new CastFromNonHandZoneTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
if (getTargetPointer().getTargets(game, source).contains(objectId)
|
||||
&& source.isControlledBy(affectedControllerId)) {
|
||||
Card card = game.getCard(objectId);
|
||||
if (card != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class VancesBlastingCannonsFlipTrigger extends TriggeredAbilityImpl {
|
||||
class VancesBlastingCannonsTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public VancesBlastingCannonsFlipTrigger() {
|
||||
public VancesBlastingCannonsTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new TransformSourceEffect(), true);
|
||||
setTriggerPhrase("Whenever you cast your third spell in a turn, ");
|
||||
}
|
||||
|
||||
private VancesBlastingCannonsFlipTrigger(final VancesBlastingCannonsFlipTrigger ability) {
|
||||
private VancesBlastingCannonsTriggeredAbility(final VancesBlastingCannonsTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VancesBlastingCannonsFlipTrigger copy() {
|
||||
return new VancesBlastingCannonsFlipTrigger(this);
|
||||
public VancesBlastingCannonsTriggeredAbility copy() {
|
||||
return new VancesBlastingCannonsTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -144,17 +105,10 @@ class VancesBlastingCannonsFlipTrigger extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(controllerId)) {
|
||||
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
|
||||
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 3) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever you cast your third spell in a turn, you may transform {this}";
|
||||
return isControlledBy(event.getPlayerId())
|
||||
&& game
|
||||
.getState()
|
||||
.getWatcher(CastSpellLastTurnWatcher.class)
|
||||
.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 3;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue