forked from External/mage
reimplement remaining cards
This commit is contained in:
parent
a7cda75b22
commit
832a70a135
7 changed files with 93 additions and 337 deletions
|
|
@ -1,8 +1,8 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.BecomesTargetAnyTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.FightTargetSourceEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
|
||||
|
|
@ -10,16 +10,12 @@ import mage.abilities.keyword.VigilanceAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -48,9 +44,12 @@ public final class GargosViciousWatcher extends CardImpl {
|
|||
// Hydra spells you cast cost {4} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 4)));
|
||||
|
||||
// Whenever a creature you control becomes the target of a spell, Gargos,
|
||||
// Vicious Watcher fights up to one target creature you don't control.
|
||||
this.addAbility(new GargosViciousWatcherTriggeredAbility());
|
||||
// Whenever a creature you control becomes the target of a spell, Gargos, Vicious Watcher fights up to one target creature you don't control.
|
||||
TriggeredAbility ability = new BecomesTargetAnyTriggeredAbility(new FightTargetSourceEffect(),
|
||||
StaticFilters.FILTER_CONTROLLED_A_CREATURE, StaticFilters.FILTER_SPELL_A,
|
||||
SetTargetPointer.NONE, false);
|
||||
ability.addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private GargosViciousWatcher(final GargosViciousWatcher card) {
|
||||
|
|
@ -62,44 +61,3 @@ public final class GargosViciousWatcher extends CardImpl {
|
|||
return new GargosViciousWatcher(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GargosViciousWatcherTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
GargosViciousWatcherTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new FightTargetSourceEffect());
|
||||
this.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false));
|
||||
}
|
||||
|
||||
private GargosViciousWatcherTriggeredAbility(final GargosViciousWatcherTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GargosViciousWatcherTriggeredAbility copy() {
|
||||
return new GargosViciousWatcherTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.TARGETED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (permanent == null
|
||||
|| object == null
|
||||
|| !permanent.isControlledBy(this.controllerId)
|
||||
|| !permanent.isCreature(game)) {
|
||||
return false;
|
||||
}
|
||||
return object instanceof Spell; // must be a type of spell (instant, sorcery, or aura)
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature you control becomes the target of a spell, "
|
||||
+ "{this} fights up to one target creature you don't control.";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.BecomesTargetSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
|
|
@ -11,21 +11,21 @@ import mage.abilities.costs.common.TapSourceCost;
|
|||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
|
||||
import mage.abilities.mana.SimpleManaAbility;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.abilities.mana.SimpleManaAbility;
|
||||
import mage.abilities.meta.OrTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.permanent.token.TreasureToken;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -49,7 +49,10 @@ public final class GoldspanDragon extends CardImpl {
|
|||
this.addAbility(HasteAbility.getInstance());
|
||||
|
||||
// Whenever Goldspan Dragon attacks or becomes the target of a spell, create a Treasure token.
|
||||
this.addAbility(new GoldspanDragonTriggeredAbility());
|
||||
this.addAbility(new OrTriggeredAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new TreasureToken()), false,
|
||||
"Whenever {this} attacks or becomes the target of a spell, ",
|
||||
new AttacksTriggeredAbility(null),
|
||||
new BecomesTargetSourceTriggeredAbility(null, StaticFilters.FILTER_SPELL_A)));
|
||||
|
||||
// Treasures you control have "{T}, Sacrifice this artifact: Add two mana of any one color."
|
||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(2), new TapSourceCost());
|
||||
|
|
@ -68,41 +71,3 @@ public final class GoldspanDragon extends CardImpl {
|
|||
return new GoldspanDragon(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GoldspanDragonTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
GoldspanDragonTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CreateTokenEffect(new TreasureToken()));
|
||||
setTriggerPhrase("Whenever {this} attacks or becomes the target of a spell, ");
|
||||
}
|
||||
|
||||
private GoldspanDragonTriggeredAbility(final GoldspanDragonTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS
|
||||
|| event.getType() == GameEvent.EventType.TARGETED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
switch (event.getType()) {
|
||||
case DECLARED_ATTACKERS:
|
||||
return game.getCombat().getAttackers().contains(this.getSourceId());
|
||||
case TARGETED:
|
||||
if (event.getTargetId().equals(getSourceId())) {
|
||||
StackObject sourceObject = game.getStack().getStackObject(event.getSourceId());
|
||||
return sourceObject instanceof Spell;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GoldspanDragonTriggeredAbility copy() {
|
||||
return new GoldspanDragonTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package mage.cards.r;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BecomesTargetControllerTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
|
|
@ -17,12 +17,13 @@ import mage.cards.CardSetInfo;
|
|||
import mage.cards.ModalDoubleFacedCard;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -33,10 +34,12 @@ import java.util.UUID;
|
|||
public final class ReidaneGodOfTheWorthy extends ModalDoubleFacedCard {
|
||||
|
||||
private static final FilterPermanent filter = new FilterLandPermanent("snow lands your opponents control");
|
||||
private static final FilterPermanent filterAnother = new FilterControlledPermanent("another permanent you control");
|
||||
|
||||
static {
|
||||
filter.add(SuperType.SNOW.getPredicate());
|
||||
filter.add(TargetController.OPPONENT.getControllerPredicate());
|
||||
filterAnother.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
public ReidaneGodOfTheWorthy(UUID ownerId, CardSetInfo setInfo) {
|
||||
|
|
@ -70,8 +73,10 @@ public final class ReidaneGodOfTheWorthy extends ModalDoubleFacedCard {
|
|||
// If a source an opponent controls would deal damage to you or a permanent you control, prevent 1 of that damage.
|
||||
this.getRightHalfCard().addAbility(new SimpleStaticAbility(new ValkmiraProtectorsShieldPreventionEffect()));
|
||||
|
||||
// Whenever you or a permanent you control becomes the target of a spell or ability an opponent controls, counter that spell or ability unless its controller pays {1}.
|
||||
this.getRightHalfCard().addAbility(new ValkmiraProtectorsShieldTriggeredAbility());
|
||||
// Whenever you or another permanent you control becomes the target of a spell or ability an opponent controls, counter that spell or ability unless its controller pays {1}.
|
||||
this.getRightHalfCard().addAbility(new BecomesTargetControllerTriggeredAbility(new CounterUnlessPaysEffect(new GenericManaCost(1))
|
||||
.setText("counter that spell or ability unless its controller pays {1}"),
|
||||
filterAnother, StaticFilters.FILTER_SPELL_OR_ABILITY_OPPONENTS, SetTargetPointer.SPELL, false));
|
||||
}
|
||||
|
||||
private ReidaneGodOfTheWorthy(final ReidaneGodOfTheWorthy card) {
|
||||
|
|
@ -158,51 +163,3 @@ class ValkmiraProtectorsShieldPreventionEffect extends PreventionEffectImpl {
|
|||
return new ValkmiraProtectorsShieldPreventionEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ValkmiraProtectorsShieldTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
ValkmiraProtectorsShieldTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(new GenericManaCost(1)));
|
||||
}
|
||||
|
||||
private ValkmiraProtectorsShieldTriggeredAbility(final ValkmiraProtectorsShieldTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValkmiraProtectorsShieldTriggeredAbility copy() {
|
||||
return new ValkmiraProtectorsShieldTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.TARGETED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getTargetId().equals(getSourceId())) {
|
||||
return false;
|
||||
}
|
||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackObject == null || !game.getOpponents(getControllerId()).contains(stackObject.getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
if (isControlledBy(event.getTargetId())) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(stackObject.getId(), game));
|
||||
return true;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent == null || !permanent.isControlledBy(getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
this.getEffects().setTargetPointer(new FixedTarget(stackObject.getId(), game));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever you or another permanent you control becomes the target of a spell or ability " +
|
||||
"an opponent controls, counter that spell or ability unless its controller pays {1}.";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,24 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.common.BecomesTargetAnyTriggeredAbility;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.common.FilterNonlandPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
|
|
@ -37,7 +36,7 @@ public final class ScalelordReckoner extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Whenever a Dragon you control becomes the target of a spell or ability an opponent controls, destroy target nonland permanent that player controls.
|
||||
this.addAbility(new ScalelardReckonerTriggeredAbility(new DestroyTargetEffect()));
|
||||
this.addAbility(new ScalelordReckonerTriggeredAbility());
|
||||
}
|
||||
|
||||
private ScalelordReckoner(final ScalelordReckoner card) {
|
||||
|
|
@ -50,49 +49,38 @@ public final class ScalelordReckoner extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class ScalelardReckonerTriggeredAbility extends TriggeredAbilityImpl {
|
||||
class ScalelordReckonerTriggeredAbility extends BecomesTargetAnyTriggeredAbility {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Dragon creature you control");
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("a Dragon you control");
|
||||
|
||||
static {
|
||||
filter.add(SubType.DRAGON.getPredicate());
|
||||
}
|
||||
|
||||
public ScalelardReckonerTriggeredAbility(Effect effect) {
|
||||
super(Zone.BATTLEFIELD, new DestroyTargetEffect(), false);
|
||||
ScalelordReckonerTriggeredAbility() {
|
||||
super(new DestroyTargetEffect().setText("destroy target nonland permanent that player controls"),
|
||||
filter, StaticFilters.FILTER_SPELL_OR_ABILITY_OPPONENTS, SetTargetPointer.NONE, false);
|
||||
}
|
||||
|
||||
private ScalelardReckonerTriggeredAbility(final ScalelardReckonerTriggeredAbility ability) {
|
||||
private ScalelordReckonerTriggeredAbility(final ScalelordReckonerTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScalelardReckonerTriggeredAbility copy() {
|
||||
return new ScalelardReckonerTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.TARGETED;
|
||||
public ScalelordReckonerTriggeredAbility copy() {
|
||||
return new ScalelordReckonerTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||
Permanent creature = game.getPermanent(event.getTargetId());
|
||||
if (creature != null && filter.match(creature, getControllerId(), this, game)) {
|
||||
FilterNonlandPermanent filter = new FilterNonlandPermanent("nonland permanent that player controls");
|
||||
filter.add(new ControllerIdPredicate(event.getPlayerId()));
|
||||
this.getTargets().clear();
|
||||
this.addTarget(new TargetPermanent(filter));
|
||||
return true;
|
||||
}
|
||||
if (!super.checkTrigger(event, game)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
FilterNonlandPermanent targetFilter = new FilterNonlandPermanent("nonland permanent that player controls");
|
||||
targetFilter.add(new ControllerIdPredicate(event.getPlayerId()));
|
||||
this.getTargets().clear();
|
||||
this.addTarget(new TargetPermanent(targetFilter));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a Dragon you control becomes the target of a spell or ability an opponent controls, destroy target nonland permanent that player controls.";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,20 +2,21 @@ package mage.cards.s;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BecomesTargetSourceTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
|
||||
import mage.abilities.meta.OrTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -43,7 +44,10 @@ public final class ShieldMare extends CardImpl {
|
|||
));
|
||||
|
||||
// When Shield Mare enters the battlefield or becomes the target of a spell or ability and opponent controls, you gain 3 life.
|
||||
this.addAbility(new ShieldMareTriggeredAbility());
|
||||
this.addAbility(new OrTriggeredAbility(Zone.ALL, new GainLifeEffect(3), false,
|
||||
"When {this} enters the battlefield or becomes the target of a spell or ability an opponent controls, ",
|
||||
new EntersBattlefieldTriggeredAbility(null),
|
||||
new BecomesTargetSourceTriggeredAbility(null, StaticFilters.FILTER_SPELL_OR_ABILITY_OPPONENTS)));
|
||||
}
|
||||
|
||||
private ShieldMare(final ShieldMare card) {
|
||||
|
|
@ -55,45 +59,3 @@ public final class ShieldMare extends CardImpl {
|
|||
return new ShieldMare(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ShieldMareTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public ShieldMareTriggeredAbility() {
|
||||
super(Zone.ALL, new GainLifeEffect(3));
|
||||
}
|
||||
|
||||
private ShieldMareTriggeredAbility(final ShieldMareTriggeredAbility effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShieldMareTriggeredAbility copy() {
|
||||
return new ShieldMareTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|
||||
|| event.getType() == GameEvent.EventType.TARGETED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
switch (event.getType()) {
|
||||
case ENTERS_THE_BATTLEFIELD:
|
||||
return event.getTargetId().equals(getSourceId());
|
||||
case TARGETED:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return event.getTargetId().equals(this.getSourceId())
|
||||
&& game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When {this} enters the battlefield or becomes the target "
|
||||
+ "of a spell or ability an opponent controls, you gain 3 life";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,38 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.BecomesTargetSourceTriggeredAbility;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamagePlayersEffect;
|
||||
import mage.abilities.meta.OrTriggeredAbility;
|
||||
import mage.cards.*;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInExile;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TectonicGiant extends CardImpl {
|
||||
|
||||
private static final FilterSpell filter = new FilterSpell("a spell an opponent controls");
|
||||
static {
|
||||
filter.add(TargetController.OPPONENT.getControllerPredicate());
|
||||
}
|
||||
|
||||
public TectonicGiant(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
|
||||
|
||||
|
|
@ -37,7 +44,12 @@ public final class TectonicGiant extends CardImpl {
|
|||
// Whenever Tectonic Giant attacks or becomes the target of a spell an opponent controls, choose one —
|
||||
// • Tectonic Giant deals 3 damage to each opponent.
|
||||
// • Exile the top two cards of your library. Choose one of them. Until the end of your next turn, you may play that card.
|
||||
this.addAbility(new TectonicGiantTriggeredAbility());
|
||||
TriggeredAbility ability = new OrTriggeredAbility(Zone.BATTLEFIELD, new DamagePlayersEffect(3, TargetController.OPPONENT), false,
|
||||
"Whenever {this} attacks or becomes the target of a spell an opponent controls, ",
|
||||
new AttacksTriggeredAbility(null),
|
||||
new BecomesTargetSourceTriggeredAbility(null, filter));
|
||||
ability.addMode(new Mode(new TectonicGiantEffect()));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private TectonicGiant(final TectonicGiant card) {
|
||||
|
|
@ -50,48 +62,6 @@ public final class TectonicGiant extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class TectonicGiantTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
TectonicGiantTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DamagePlayersEffect(3, TargetController.OPPONENT), false);
|
||||
this.addMode(new Mode(new TectonicGiantEffect()));
|
||||
setTriggerPhrase("Whenever {this} attacks or becomes the target of a spell an opponent controls, ");
|
||||
}
|
||||
|
||||
private TectonicGiantTriggeredAbility(final TectonicGiantTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS
|
||||
|| event.getType() == GameEvent.EventType.TARGETED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
switch (event.getType()) {
|
||||
case DECLARED_ATTACKERS:
|
||||
return game.getCombat().getAttackers().contains(this.getSourceId());
|
||||
case TARGETED:
|
||||
if (event.getTargetId().equals(getSourceId())) {
|
||||
MageObject mageObject = game.getObject(event.getSourceId());
|
||||
Player player = game.getPlayer(getControllerId());
|
||||
return mageObject != null
|
||||
&& mageObject instanceof Spell
|
||||
&& player != null
|
||||
&& player.hasOpponent(((Spell) mageObject).getControllerId(), game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TectonicGiantTriggeredAbility copy() {
|
||||
return new TectonicGiantTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TectonicGiantEffect extends OneShotEffect {
|
||||
|
||||
TectonicGiantEffect() {
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
package mage.cards.w;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BecomesTargetAnyTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.filter.StaticFilters;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
* @author xenohedron
|
||||
*/
|
||||
public final class Willbreaker extends CardImpl {
|
||||
|
||||
private static final FilterStackObject filter = new FilterStackObject("a spell or ability you control");
|
||||
static {
|
||||
filter.add(TargetController.YOU.getControllerPredicate());
|
||||
}
|
||||
|
||||
public Willbreaker(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
|
|
@ -29,7 +29,8 @@ public final class Willbreaker extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Whenever a creature an opponent controls becomes the target of a spell or ability you control, gain control of that creature for as long as you control Willbreaker.
|
||||
this.addAbility(new WillbreakerTriggeredAbility());
|
||||
this.addAbility(new BecomesTargetAnyTriggeredAbility(new GainControlTargetEffect(Duration.WhileControlled),
|
||||
StaticFilters.FILTER_OPPONENTS_PERMANENT_A_CREATURE, filter, SetTargetPointer.PERMANENT, false));
|
||||
}
|
||||
|
||||
private Willbreaker(final Willbreaker card) {
|
||||
|
|
@ -41,48 +42,3 @@ public final class Willbreaker extends CardImpl {
|
|||
return new Willbreaker(this);
|
||||
}
|
||||
}
|
||||
|
||||
class WillbreakerTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
WillbreakerTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new GainControlTargetEffect(Duration.WhileControlled));
|
||||
}
|
||||
|
||||
private WillbreakerTriggeredAbility(final WillbreakerTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.TARGETED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (!isControlledBy(event.getPlayerId())) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
Permanent willbreaker = game.getPermanent(sourceId);
|
||||
if (willbreaker == null // If you lose control of Willbreaker before its ability resolves, you won’t gain control of the creature at all.
|
||||
|| permanent == null
|
||||
|| !permanent.isCreature(game)
|
||||
|| !game.getOpponents(getControllerId()).contains(permanent.getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
// always call this method for FixedTargets in case it is blinked
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature an opponent controls becomes the target of a spell or ability you control, "
|
||||
+ "gain control of that creature for as long as you control {this}.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public WillbreakerTriggeredAbility copy() {
|
||||
return new WillbreakerTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue