mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Some rework to framework classes. Used new framework classes in some cards.
This commit is contained in:
parent
28ed7f1b63
commit
79eabcbf12
62 changed files with 508 additions and 519 deletions
|
@ -34,7 +34,7 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.CascadeAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
@ -65,7 +65,7 @@ public class EnigmaSphinx extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Enigma Sphinx is put into your graveyard from the battlefield, put it into your library third from the top.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new EnigmaSphinxEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new EnigmaSphinxEffect()));
|
||||
|
||||
// Cascade
|
||||
this.addAbility(new CascadeAbility());
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.UUID;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.ExileTargetEffect;
|
||||
|
@ -57,7 +57,7 @@ public class LegacyWeapon extends CardImpl {
|
|||
ability.addTarget(new TargetPermanent());
|
||||
this.addAbility(ability);
|
||||
// If Legacy Weapon would be put into a graveyard from anywhere, reveal Legacy Weapon and shuffle it into its owner's library instead.
|
||||
this.addAbility(new PutIntoGraveFromAnywhereAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
|
||||
}
|
||||
|
||||
public LegacyWeapon(final LegacyWeapon card) {
|
||||
|
|
|
@ -27,38 +27,38 @@
|
|||
*/
|
||||
package mage.sets.avacynrestored;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.GetEmblemEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.abilities.effects.common.SkipNextUntapTargetEffect;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.abilities.effects.common.continious.MaximumHandSizeControllerEffect;
|
||||
import mage.abilities.effects.common.continious.MaximumHandSizeControllerEffect.HandSizeModification;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -130,65 +130,6 @@ class TappedCreaturesControlledByTargetCount implements DynamicValue {
|
|||
}
|
||||
}
|
||||
|
||||
class TamiyoTheMoonSageTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public TamiyoTheMoonSageTriggeredAbility() {
|
||||
super(Zone.COMMAND, new TamiyoTheMoonSageEffect(), true);
|
||||
}
|
||||
|
||||
public TamiyoTheMoonSageTriggeredAbility(final TamiyoTheMoonSageTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TamiyoTheMoonSageTriggeredAbility copy() {
|
||||
return new TamiyoTheMoonSageTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && !card.isCopy() && card.getOwnerId().equals(this.getControllerId())) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(card.getId()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a card is put into your graveyard from anywhere, you may return it to your hand.";
|
||||
}
|
||||
}
|
||||
|
||||
class TamiyoTheMoonSageEffect extends OneShotEffect {
|
||||
|
||||
public TamiyoTheMoonSageEffect() {
|
||||
super(Outcome.ReturnToHand);
|
||||
this.staticText = "return it to your hand";
|
||||
}
|
||||
|
||||
public TamiyoTheMoonSageEffect(final TamiyoTheMoonSageEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TamiyoTheMoonSageEffect copy() {
|
||||
return new TamiyoTheMoonSageEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(this.targetPointer.getFirst(game, source));
|
||||
if (card != null) {
|
||||
return card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Emblem with "You have no maximum hand size" and "Whenever a card is put into your graveyard from anywhere, you may return it to your hand."
|
||||
*/
|
||||
|
@ -198,6 +139,9 @@ class TamiyoTheMoonSageEmblem extends Emblem {
|
|||
this.setName("EMBLEM: Tamiyo, the Moon Sage");
|
||||
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new MaximumHandSizeControllerEffect(Integer.MAX_VALUE, Duration.EndOfGame, HandSizeModification.SET));
|
||||
this.getAbilities().add(ability);
|
||||
this.getAbilities().add(new TamiyoTheMoonSageTriggeredAbility());
|
||||
Effect effect = new ReturnToHandTargetEffect();
|
||||
effect.setText("return it to your hand");
|
||||
this.getAbilities().add(new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
Zone.COMMAND, effect, true, new FilterCard("a card"), TargetController.YOU, SetTargetPointer.CARD));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.sets.betrayersofkamigawa;
|
|||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -49,7 +49,7 @@ public class GodsEyeGateToTheReikai extends CardImpl {
|
|||
// {tap}: Add {1} to your mana pool.
|
||||
this.addAbility(new ColorlessManaAbility());
|
||||
// When Gods' Eye, Gate to the Reikai is put into a graveyard from the battlefield, put a 1/1 colorless Spirit creature token onto the battlefield.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new CreateTokenEffect(new SpiritToken(), 1), false));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new CreateTokenEffect(new SpiritToken(), 1), false));
|
||||
}
|
||||
|
||||
public GodsEyeGateToTheReikai(final GodsEyeGateToTheReikai card) {
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.sets.championsofkamigawa;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesAttachedTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.EquippedMatchesFilterCondition;
|
||||
|
@ -77,7 +77,7 @@ public class OathkeeperTakenosDaisho extends CardImpl {
|
|||
new OathkeeperEquippedMatchesFilterCondition(filter),
|
||||
""));
|
||||
// When Oathkeeper, Takeno's Daisho is put into a graveyard from the battlefield, exile equipped creature.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ExileEquippedEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ExileEquippedEffect()));
|
||||
// Equip {2}
|
||||
this.addAbility(new EquipAbility( Outcome.BoostCreature, new ManaCostsImpl("{2}")));
|
||||
}
|
||||
|
|
|
@ -29,18 +29,14 @@ package mage.sets.commander;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.TargetController;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -64,8 +60,8 @@ public class VulturousZombie extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Whenever a card is put into an opponent's graveyard from anywhere, put a +1/+1 counter on Vulturous Zombie.
|
||||
this.addAbility(new VulturousZombieTriggeredAbility());
|
||||
|
||||
this.addAbility(new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, TargetController.OPPONENT));
|
||||
}
|
||||
|
||||
public VulturousZombie(final VulturousZombie card) {
|
||||
|
@ -77,36 +73,3 @@ public class VulturousZombie extends CardImpl {
|
|||
return new VulturousZombie(this);
|
||||
}
|
||||
}
|
||||
|
||||
class VulturousZombieTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public VulturousZombieTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false);
|
||||
}
|
||||
|
||||
public VulturousZombieTriggeredAbility(final VulturousZombieTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VulturousZombieTriggeredAbility copy() {
|
||||
return new VulturousZombieTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && !card.isCopy()
|
||||
&& game.getOpponents(controllerId).contains(card.getOwnerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a card is put into an opponent's graveyard from anywhere, put a +1/+1 counter on {this}.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.EntersBattlefieldOrDiesSourceTriggeredAbility;
|
||||
import mage.abilities.common.EntersOrLeavesTheBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.VanishingSacrificeAbility;
|
||||
|
@ -42,7 +42,6 @@ import mage.constants.Rarity;
|
|||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.AnotherCardPredicate;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
|
@ -73,7 +72,7 @@ public class DeadwoodTreefolk extends CardImpl {
|
|||
this.addAbility(new VanishingUpkeepAbility(3));
|
||||
this.addAbility(new VanishingSacrificeAbility());
|
||||
// When Deadwood Treefolk enters the battlefield or leaves the battlefield, return another target creature card from your graveyard to your hand.
|
||||
ability = new EntersBattlefieldOrDiesSourceTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect(), false);
|
||||
ability = new EntersOrLeavesTheBattlefieldSourceTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect(), false);
|
||||
Target target = new TargetCardInYourGraveyard(filter);
|
||||
ability.addTarget(target);
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -74,7 +74,7 @@ public class CrownOfDoom extends CardImpl {
|
|||
// Whenever a creature attacks you or a planeswalker you control, it gets +2/+0 until end of turn.
|
||||
Effect effect = new BoostTargetEffect(2,0,Duration.EndOfTurn);
|
||||
effect.setText("it gets +2/+0 until end of turn");
|
||||
this.addAbility(new AttacksAllTriggeredAbility(effect, false, new FilterCreaturePermanent(), SetTargetPointer.CREATURE, true));
|
||||
this.addAbility(new AttacksAllTriggeredAbility(effect, false, new FilterCreaturePermanent(), SetTargetPointer.PERMANENT, true));
|
||||
|
||||
// {2}: Target player other than Crown of Doom's owner gains control of it. Activate this ability only during your turn.
|
||||
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new CrownOfDoomEffect(), new ManaCostsImpl("{2}"), MyTurnCondition.getInstance());
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.sets.commander2014;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesAttachedTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlAttachedEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
|
@ -66,7 +66,7 @@ public class FoolsDemise extends CardImpl {
|
|||
this.addAbility(new DiesAttachedTriggeredAbility(new ReturnToBattlefieldUnderYourControlAttachedEffect(), "enchanted creature"));
|
||||
|
||||
// When Fool's Demise is put into a graveyard from the battlefield, return Fool's Demise to its owner's hand.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public FoolsDemise(final FoolsDemise card) {
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.sets.conflux;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceAbility;
|
||||
import mage.abilities.effects.common.RevealAndShuffleIntoLibrarySourceEffect;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -69,7 +69,7 @@ public class Progenitus extends CardImpl {
|
|||
// Protection from everything
|
||||
this.addAbility(new ProgenitusProtectionAbility());
|
||||
// If Progenitus would be put into a graveyard from anywhere, reveal Progenitus and shuffle it into its owner's library instead.
|
||||
this.addAbility(new PutIntoGraveFromAnywhereAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
|
||||
}
|
||||
|
||||
public Progenitus(final Progenitus card) {
|
||||
|
|
|
@ -59,7 +59,7 @@ public class LostInTheWoods extends CardImpl {
|
|||
this.color.setGreen(true);
|
||||
|
||||
// Whenever a creature attacks you or a planeswalker you control, reveal the top card of your library. If it's a Forest card, remove that creature from combat. Then put the revealed card on the bottom of your library.
|
||||
this.addAbility(new AttacksAllTriggeredAbility(new LostInTheWoodsEffect(), true, new FilterCreaturePermanent(), SetTargetPointer.CREATURE, true));
|
||||
this.addAbility(new AttacksAllTriggeredAbility(new LostInTheWoodsEffect(), true, new FilterCreaturePermanent(), SetTargetPointer.PERMANENT, true));
|
||||
}
|
||||
|
||||
public LostInTheWoods(final LostInTheWoods card) {
|
||||
|
|
|
@ -33,7 +33,7 @@ import java.util.UUID;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceAbility;
|
||||
import mage.abilities.effects.common.RevealAndShuffleIntoLibrarySourceEffect;
|
||||
import mage.abilities.keyword.IndestructibleAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
|
@ -58,7 +58,7 @@ public class DarksteelColossus extends CardImpl {
|
|||
this.addAbility(IndestructibleAbility.getInstance());
|
||||
|
||||
// If Darksteel Colossus would be put into a graveyard from anywhere, reveal Darksteel Colossus and shuffle it into its owner's library instead.
|
||||
this.addAbility(new PutIntoGraveFromAnywhereAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
|
||||
}
|
||||
|
||||
public DarksteelColossus(final DarksteelColossus card) {
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.EntersOrLeavesTheBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -62,8 +63,7 @@ public class SunderingTitan extends CardImpl {
|
|||
this.toughness = new MageInt(10);
|
||||
|
||||
// When Sundering Titan enters the battlefield or leaves the battlefield, choose a land of each basic land type, then destroy those lands.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SunderingTitanDestroyLandEffect(), false));
|
||||
this.addAbility(new LeavesBattlefieldTriggeredAbility(new SunderingTitanDestroyLandEffect(), false));
|
||||
this.addAbility(new EntersOrLeavesTheBattlefieldSourceTriggeredAbility(new SunderingTitanDestroyLandEffect(), false));
|
||||
}
|
||||
|
||||
public SunderingTitan(final SunderingTitan card) {
|
||||
|
|
|
@ -28,25 +28,23 @@
|
|||
package mage.sets.gatecrash;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.keyword.HexproofAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
|
@ -70,7 +68,10 @@ public class LazavDimirMastermind extends CardImpl {
|
|||
this.addAbility(HexproofAbility.getInstance());
|
||||
|
||||
// Whenever a creature card is put into an opponent's graveyard from anywhere, you may have Lazav, Dimir Mastermind become a copy of that card except its name is still Lazav, Dimir Mastermind, it's legendary in addition to its other types, and it gains hexproof and this ability.
|
||||
this.addAbility(new CreatureCardPutOpponentGraveyardTriggeredAbility());
|
||||
this.addAbility(new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
new LazavDimirEffect(), true,
|
||||
new FilterCreatureCard("a creature card"),
|
||||
TargetController.OPPONENT, SetTargetPointer.CARD));
|
||||
}
|
||||
|
||||
public LazavDimirMastermind(final LazavDimirMastermind card) {
|
||||
|
@ -83,45 +84,6 @@ public class LazavDimirMastermind extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CreatureCardPutOpponentGraveyardTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public CreatureCardPutOpponentGraveyardTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new LazavDimirEffect(), true);
|
||||
}
|
||||
|
||||
public CreatureCardPutOpponentGraveyardTriggeredAbility(final CreatureCardPutOpponentGraveyardTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreatureCardPutOpponentGraveyardTriggeredAbility copy() {
|
||||
return new CreatureCardPutOpponentGraveyardTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.ZONE_CHANGE
|
||||
&& ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
if (game.getOpponents(controllerId).contains(event.getPlayerId())
|
||||
&& card.getCardType().contains(CardType.CREATURE)) {
|
||||
// store the card id to copy
|
||||
game.getState().setValue(new StringBuilder("CardToCopy").append(getSourceId().toString()).toString(), card.getId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature card is put into an opponent's graveyard from anywhere, you may have {this} become a copy of that card except its name is still {this}, it's legendary in addition to its other types, and it gains hexproof and this ability.";
|
||||
}
|
||||
}
|
||||
|
||||
class LazavDimirEffect extends ContinuousEffectImpl {
|
||||
|
||||
protected UUID IdOfCopiedCard;
|
||||
|
@ -129,6 +91,7 @@ class LazavDimirEffect extends ContinuousEffectImpl {
|
|||
|
||||
public LazavDimirEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.CopyEffects_1, SubLayer.NA, Outcome.BecomeCreature);
|
||||
staticText = "have {this} become a copy of that card except its name is still {this}, it's legendary in addition to its other types, and it gains hexproof and this ability";
|
||||
}
|
||||
|
||||
public LazavDimirEffect(final LazavDimirEffect effect) {
|
||||
|
@ -144,17 +107,13 @@ class LazavDimirEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Object object = game.getState().getValue(new StringBuilder("CardToCopy").append(source.getSourceId().toString()).toString());
|
||||
Card card = null;
|
||||
if (object instanceof UUID) {
|
||||
card = game.getCard((UUID) object);
|
||||
}
|
||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (card == null || permanent == null) {
|
||||
return false;
|
||||
}
|
||||
if (IdOfCopiedCard == null || !IdOfCopiedCard.equals((UUID) object)) {
|
||||
IdOfCopiedCard = (UUID) object;
|
||||
if (IdOfCopiedCard == null || !IdOfCopiedCard.equals(card.getId())) {
|
||||
IdOfCopiedCard = card.getId();
|
||||
cardToCopy = card.copy();
|
||||
cardToCopy.assignNewId();
|
||||
}
|
||||
|
@ -184,7 +143,10 @@ class LazavDimirEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||
permanent.addAbility(HexproofAbility.getInstance(), source.getSourceId(), game);
|
||||
permanent.addAbility(new CreatureCardPutOpponentGraveyardTriggeredAbility(), source.getSourceId(), game);
|
||||
permanent.addAbility(new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
new LazavDimirEffect(), true,
|
||||
new FilterCreatureCard("a creature card"),
|
||||
TargetController.OPPONENT, SetTargetPointer.CARD), source.getSourceId(), game);
|
||||
|
||||
for (Ability ability : cardToCopy.getAbilities()) {
|
||||
if (!permanent.getAbilities().contains(ability)) {
|
||||
|
|
|
@ -31,7 +31,7 @@ package mage.sets.guildpact;
|
|||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class HatchingPlans extends CardImpl {
|
|||
super(ownerId, 27, "Hatching Plans", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
|
||||
this.expansionSetCode = "GPT";
|
||||
this.color.setBlue(true);
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(3)));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new DrawCardSourceControllerEffect(3)));
|
||||
}
|
||||
|
||||
public HatchingPlans (final HatchingPlans card) {
|
||||
|
|
|
@ -29,7 +29,7 @@ package mage.sets.heroesvsmonsters;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
|
@ -75,7 +75,7 @@ public class UndyingRage extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// When Undying Rage is put into a graveyard from the battlefield, return Undying Rage to its owner's hand.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public UndyingRage(final UndyingRage card) {
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.sets.lorwyn;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect;
|
||||
|
@ -68,7 +68,7 @@ public class Dread extends CardImpl {
|
|||
this.addAbility(new DreadTriggeredAbility());
|
||||
|
||||
// When Dread is put into a graveyard from anywhere, shuffle it into its owner's library.
|
||||
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new ShuffleIntoLibrarySourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceTriggeredAbility(new ShuffleIntoLibrarySourceEffect()));
|
||||
}
|
||||
|
||||
public Dread(final Dread card) {
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.sets.lorwyn;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect;
|
||||
|
@ -69,7 +69,7 @@ public class Vigor extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new VigorReplacementEffect()));
|
||||
|
||||
// When Vigor is put into a graveyard from anywhere, shuffle it into its owner's library.
|
||||
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new ShuffleIntoLibrarySourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceTriggeredAbility(new ShuffleIntoLibrarySourceEffect()));
|
||||
}
|
||||
|
||||
public Vigor(final Vigor card) {
|
||||
|
|
|
@ -68,7 +68,7 @@ public class IllicitAuction extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
// effect is based on ExchangeControlTargetEffect
|
||||
// effect is based on GainControlTargetEffect
|
||||
class IllicitAuctionEffect extends GainControlTargetEffect {
|
||||
|
||||
public IllicitAuctionEffect() {
|
||||
|
@ -87,20 +87,20 @@ class IllicitAuctionEffect extends GainControlTargetEffect {
|
|||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
|
||||
if (targetCreature != null) {
|
||||
if (controller != null && targetCreature != null) {
|
||||
PlayerList playerList = game.getPlayerList().copy();
|
||||
playerList.setCurrent(game.getActivePlayerId());
|
||||
|
||||
Player winner = game.getPlayer(game.getActivePlayerId());
|
||||
int highBid = 0;
|
||||
game.informPlayers(new StringBuilder(winner.getName()).append(" bet 0 lifes").toString());
|
||||
game.informPlayers(new StringBuilder(winner.getName()).append(" has bet 0 lifes").toString());
|
||||
|
||||
Player currentPlayer = playerList.getNext(game);
|
||||
Player currentPlayer = playerList.getNextInRange(controller, game);
|
||||
while (currentPlayer != winner) {
|
||||
String text = new StringBuilder(winner.getName()).append(" bet ").append(highBid).append(" life")
|
||||
.append(highBid > 1 ? "s" : "").append(". Top the bid?").toString();
|
||||
if (currentPlayer.chooseUse(Outcome.GainControl, text, game)) {
|
||||
String text = winner.getName() + " has bet " + highBid + " life" + (highBid > 1 ? "s" : "") + ". Top the bid?";
|
||||
if (currentPlayer.chooseUse(Outcome.Detriment, text, game)) {
|
||||
int newBid = currentPlayer.getAmount(highBid + 1, Integer.MAX_VALUE, "Choose bid", game);
|
||||
if (newBid > highBid) {
|
||||
highBid = newBid;
|
||||
|
@ -109,15 +109,13 @@ class IllicitAuctionEffect extends GainControlTargetEffect {
|
|||
.append(newBid).append(" life").append(newBid > 1 ? "s" : "").toString());
|
||||
}
|
||||
}
|
||||
currentPlayer = playerList.getNext(game);
|
||||
currentPlayer = playerList.getNextInRange(controller, game);
|
||||
}
|
||||
|
||||
game.informPlayers(new StringBuilder(winner.getName()).append(" won auction with a bid of ").append(highBid).append(" life")
|
||||
.append(highBid > 1 ? "s" : "").toString());
|
||||
game.informPlayers(winner.getName() + " won the auction with a bid of " + highBid + " life" + (highBid > 1 ? "s" : ""));
|
||||
winner.loseLife(highBid, game);
|
||||
super.controllingPlayerId = winner.getId();
|
||||
}
|
||||
|
||||
}
|
||||
super.init(source, game);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import java.util.UUID;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceAbility;
|
||||
import mage.abilities.effects.common.RevealAndShuffleIntoLibrarySourceEffect;
|
||||
import mage.abilities.keyword.IndestructibleAbility;
|
||||
import mage.abilities.keyword.InfectAbility;
|
||||
|
@ -60,7 +60,7 @@ public class BlightsteelColossus extends CardImpl {
|
|||
this.addAbility(IndestructibleAbility.getInstance());
|
||||
|
||||
// If Blightsteel Colossus would be put into a graveyard from anywhere, reveal Blightsteel Colossus and shuffle it into its owner's library instead.
|
||||
this.addAbility(new PutIntoGraveFromAnywhereAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
|
||||
}
|
||||
|
||||
public BlightsteelColossus(final BlightsteelColossus card) {
|
||||
|
|
|
@ -31,7 +31,7 @@ package mage.sets.mirrodinbesieged;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.common.DiesTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
|
@ -48,7 +48,7 @@ public class IchorWellspring extends CardImpl {
|
|||
|
||||
// When Ichor Wellspring enters the battlefield or is put into a graveyard from the battlefield, draw a card.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new DrawCardSourceControllerEffect(1)));
|
||||
}
|
||||
|
||||
public IchorWellspring(final IchorWellspring card) {
|
||||
|
|
|
@ -32,7 +32,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Rarity;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.DiesTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -54,7 +54,7 @@ public class SpineOfIshSah extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// When Spine of Ish Sah is put into a graveyard from the battlefield, return Spine of Ish Sah to its owner's hand
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public SpineOfIshSah(final SpineOfIshSah card) {
|
||||
|
|
|
@ -34,8 +34,8 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.Card;
|
||||
|
@ -45,9 +45,8 @@ import mage.cards.CardsImpl;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterLandCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
|
@ -70,7 +69,11 @@ public class CountrysideCrusher extends CardImpl {
|
|||
// At the beginning of your upkeep, reveal the top card of your library. If it's a land card, put it into your graveyard and repeat this process.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CountrysideCrusherEffect(), TargetController.YOU, false));
|
||||
// Whenever a land card is put into your graveyard from anywhere, put a +1/+1 counter on Countryside Crusher.
|
||||
this.addAbility(new CountrysideCrusherTriggeredAbility());
|
||||
this.addAbility(new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
|
||||
false, new FilterLandCard("a land card"),TargetController.YOU
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
public CountrysideCrusher(final CountrysideCrusher card) {
|
||||
|
@ -123,36 +126,3 @@ class CountrysideCrusherEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CountrysideCrusherTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public CountrysideCrusherTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false);
|
||||
}
|
||||
|
||||
public CountrysideCrusherTriggeredAbility(final CountrysideCrusherTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CountrysideCrusherTriggeredAbility copy() {
|
||||
return new CountrysideCrusherTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && card.getOwnerId().equals(this.getControllerId()) && card.getCardType().contains(CardType.LAND)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a land card is put into your graveyard from anywhere, put a +1/+1 counter on {this}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.UUID;
|
|||
import mage.constants.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
|
@ -73,7 +73,7 @@ public class GlisteningOil extends CardImpl {
|
|||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new GlisteningOilEffect(), TargetController.YOU, false));
|
||||
|
||||
// When Glistening Oil is put into a graveyard from the battlefield, return Glistening Oil to its owner's hand.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public GlisteningOil(final GlisteningOil card) {
|
||||
|
|
|
@ -32,6 +32,7 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.EntersOrLeavesTheBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
|
@ -68,11 +69,9 @@ public class AvenRiftwatcher extends CardImpl {
|
|||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.TIME.createInstance(2))));
|
||||
this.addAbility(new VanishingUpkeepAbility(2));
|
||||
this.addAbility(new VanishingSacrificeAbility());
|
||||
|
||||
// When Aven Riftwatcher enters the battlefield or leaves the battlefield, you gain 2 life.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new GainLifeEffect(2), false);
|
||||
this.addAbility(ability);
|
||||
Ability ability2 = new LeavesBattlefieldTriggeredAbility(new GainLifeEffect(2), false);
|
||||
this.addAbility(ability2);
|
||||
this.addAbility(new EntersOrLeavesTheBattlefieldSourceTriggeredAbility(new GainLifeEffect(2), false));
|
||||
}
|
||||
|
||||
public AvenRiftwatcher(final AvenRiftwatcher card) {
|
||||
|
|
|
@ -33,7 +33,7 @@ import mage.constants.Rarity;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.EntersOrLeavesTheBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
|
@ -63,15 +63,11 @@ public class KeldonMarauders extends CardImpl {
|
|||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.TIME.createInstance(2))));
|
||||
this.addAbility(new VanishingUpkeepAbility(2));
|
||||
this.addAbility(new VanishingSacrificeAbility());
|
||||
|
||||
// When Keldon Marauders enters the battlefield or leaves the battlefield, it deals 1 damage to target player.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(1), false);
|
||||
Ability ability = new EntersOrLeavesTheBattlefieldSourceTriggeredAbility(new DamageTargetEffect(1), false);
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
Ability ability2 = new LeavesBattlefieldTriggeredAbility(new DamageTargetEffect(1), false);
|
||||
ability2.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public KeldonMarauders(final KeldonMarauders card) {
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.sets.ravnika;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
|
@ -60,7 +60,7 @@ public class Terrarion extends CardImpl {
|
|||
ability.addCost(new SacrificeSourceCost());
|
||||
this.addAbility(ability);
|
||||
// When Terrarion is put into a graveyard from the battlefield, draw a card.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new DrawCardSourceControllerEffect(1)));
|
||||
}
|
||||
|
||||
public Terrarion(final Terrarion card) {
|
||||
|
|
|
@ -30,7 +30,7 @@ package mage.sets.returntoravnica;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.DiesTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
|
@ -61,7 +61,7 @@ public class WorldspineWurm extends CardImpl {
|
|||
this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new WorldspineWurmToken(), 3)));
|
||||
|
||||
// When Worldspine Wurm is put into a graveyard from anywhere, shuffle it into its owner's library.
|
||||
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new ShuffleIntoLibrarySourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceTriggeredAbility(new ShuffleIntoLibrarySourceEffect()));
|
||||
}
|
||||
|
||||
public WorldspineWurm(final WorldspineWurm card) {
|
||||
|
|
|
@ -37,7 +37,7 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.CantCounterAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.AnnihilatorAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
@ -81,7 +81,7 @@ public class EmrakulTheAeonsTorn extends CardImpl {
|
|||
this.addAbility(new ProtectionAbility(filter));
|
||||
this.addAbility(new AnnihilatorAbility(6));
|
||||
// When Emrakul is put into a graveyard from anywhere, its owner shuffles his or her graveyard into his or her library.
|
||||
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new EmrakulTheAeonsTornEffect(), false));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceTriggeredAbility(new EmrakulTheAeonsTornEffect(), false));
|
||||
}
|
||||
|
||||
public EmrakulTheAeonsTorn(final EmrakulTheAeonsTorn card) {
|
||||
|
|
|
@ -37,7 +37,7 @@ import mage.constants.Zone;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.keyword.AnnihilatorAbility;
|
||||
|
@ -62,7 +62,7 @@ public class KozilekButcherOfTruth extends CardImpl {
|
|||
this.toughness = new MageInt(12);
|
||||
this.addAbility(new KozilekButcherOfTruthOnCastAbility());
|
||||
this.addAbility(new AnnihilatorAbility(4));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new KozilekButcherOfTruthEffect(), false));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceTriggeredAbility(new KozilekButcherOfTruthEffect(), false));
|
||||
}
|
||||
|
||||
public KozilekButcherOfTruth (final KozilekButcherOfTruth card) {
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.keyword.AnnihilatorAbility;
|
||||
|
@ -72,7 +72,7 @@ public class UlamogTheInfiniteGyre extends CardImpl {
|
|||
// Indestructible
|
||||
this.addAbility(IndestructibleAbility.getInstance());
|
||||
// When Ulamog is put into a graveyard from anywhere, its owner shuffles his or her graveyard into his or her library.
|
||||
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new UlamogTheInfiniteGyreEnterGraveyardEffect(), false));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceTriggeredAbility(new UlamogTheInfiniteGyreEnterGraveyardEffect(), false));
|
||||
}
|
||||
|
||||
public UlamogTheInfiniteGyre(final UlamogTheInfiniteGyre card) {
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenTargetEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
|
|
|
@ -34,7 +34,7 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
|
@ -62,7 +62,7 @@ public class PanicSpellbomb extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// When Panic Spellbomb is put into a graveyard from the battlefield, you may pay Red. If you do, draw a card.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{R}")), false));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{R}")), false));
|
||||
}
|
||||
|
||||
public PanicSpellbomb(final PanicSpellbomb card) {
|
||||
|
|
|
@ -28,17 +28,15 @@
|
|||
package mage.sets.seventhedition;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -46,6 +44,12 @@ import mage.game.events.ZoneChangeEvent;
|
|||
*/
|
||||
public class Compost extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a black card");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
}
|
||||
|
||||
public Compost(UUID ownerId) {
|
||||
super(ownerId, 235, "Compost", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
|
||||
this.expansionSetCode = "7ED";
|
||||
|
@ -53,7 +57,8 @@ public class Compost extends CardImpl {
|
|||
this.color.setGreen(true);
|
||||
|
||||
// Whenever a black card is put into an opponent's graveyard from anywhere, you may draw a card.
|
||||
this.addAbility(new CompostTriggeredAbility());
|
||||
this.addAbility(new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
new DrawCardSourceControllerEffect(1), true, TargetController.OPPONENT));
|
||||
}
|
||||
|
||||
public Compost(final Compost card) {
|
||||
|
@ -65,35 +70,3 @@ public class Compost extends CardImpl {
|
|||
return new Compost(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CompostTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
CompostTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), true);
|
||||
}
|
||||
|
||||
CompostTriggeredAbility(final CompostTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompostTriggeredAbility copy() {
|
||||
return new CompostTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && card.getColor().isBlack() && game.getOpponents(controllerId).contains(card.getOwnerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a black card is put into an opponent's graveyard from anywhere, you may draw a card";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.UUID;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
|
@ -52,7 +52,7 @@ public class ChromaticStar extends CardImpl {
|
|||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new DrawCardSourceControllerEffect(1)));
|
||||
}
|
||||
|
||||
public ChromaticStar(final ChromaticStar card) {
|
||||
|
|
|
@ -29,7 +29,7 @@ package mage.sets.timespiral;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
|
@ -70,7 +70,7 @@ public class AspectOfMongoose extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ShroudAbility.getInstance(), AttachmentType.AURA)));
|
||||
|
||||
// When Aspect of Mongoose is put into a graveyard from the battlefield, return Aspect of Mongoose to its owner's hand.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
package mage.sets.timespiral;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.abilities.mana.WhiteManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -59,7 +59,7 @@ public class FlagstonesOfTrokair extends CardImpl {
|
|||
this.addAbility(new WhiteManaAbility());
|
||||
|
||||
// When Flagstones of Trokair is put into a graveyard from the battlefield, you may search your library for a Plains card and put it onto the battlefield tapped. If you do, shuffle your library.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true, true), true));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true, true), true));
|
||||
}
|
||||
|
||||
public FlagstonesOfTrokair(final FlagstonesOfTrokair card) {
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.UUID;
|
|||
|
||||
import mage.constants.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
|
@ -65,7 +65,7 @@ public class Cessation extends CardImpl {
|
|||
//Enchanted creature can't attack.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackAttachedEffect(AttachmentType.AURA)));
|
||||
//When Cessation is put into a graveyard from the battlefield, return Cessation to its owner's hand.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public Cessation(final Cessation card) {
|
||||
|
|
|
@ -29,7 +29,7 @@ package mage.sets.urzaslegacy;
|
|||
|
||||
import mage.constants.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
|
@ -71,7 +71,7 @@ public class Rancor extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// When Rancor is put into a graveyard from the battlefield, return Rancor to its owner's hand.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public Rancor(final Rancor card) {
|
||||
|
|
|
@ -34,7 +34,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
|
@ -69,7 +69,7 @@ public class SleepersGuile extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FearAbility.getInstance(), AttachmentType.AURA)));
|
||||
|
||||
// When Sleeper's Guile is put into a graveyard from the battlefield, return Sleeper's Guile to its owner's hand.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public SleepersGuile(final SleepersGuile card) {
|
||||
|
|
|
@ -33,7 +33,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -73,7 +73,7 @@ public class SlowMotion extends CardImpl {
|
|||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeEquipedUnlessPaysEffect(new GenericManaCost(2)), TargetController.CONTROLLER_ATTACHED_TO, false ));
|
||||
|
||||
// When Slow Motion is put into a graveyard from the battlefield, return Slow Motion to its owner's hand.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public SlowMotion(final SlowMotion card) {
|
||||
|
|
|
@ -34,7 +34,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.combat.CantBlockAttachedEffect;
|
||||
|
@ -69,7 +69,7 @@ public class Sluggishness extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockAttachedEffect(AttachmentType.AURA)));
|
||||
|
||||
// When Sluggishness is put into a graveyard from the battlefield, return Sluggishness to its owner's hand.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public Sluggishness(final Sluggishness card) {
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.UUID;
|
|||
|
||||
import mage.constants.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
|
@ -63,7 +63,7 @@ public class BrilliantHalo extends CardImpl {
|
|||
// Enchanted creature gets +1/+2.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 2, Duration.WhileOnBattlefield)));
|
||||
// When Brilliant Halo is put into a graveyard from the battlefield, return Brilliant Halo to its owner's hand.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
}
|
||||
|
||||
public BrilliantHalo(final BrilliantHalo card) {
|
||||
|
|
|
@ -29,19 +29,18 @@ package mage.sets.urzassaga;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -58,7 +57,9 @@ public class EnergyField extends CardImpl {
|
|||
// Prevent all damage that would be dealt to you by sources you don't control.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EnergyFieldEffect()));
|
||||
// When a card is put into your graveyard from anywhere, sacrifice Energy Field.
|
||||
this.addAbility(new PutIntoYourGraveyardTriggeredAbility());
|
||||
this.addAbility(new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
new SacrificeSourceEffect(), false, TargetController.YOU));
|
||||
|
||||
}
|
||||
|
||||
public EnergyField(final EnergyField card) {
|
||||
|
@ -114,38 +115,3 @@ class EnergyFieldEffect extends PreventionEffectImpl {
|
|||
return new EnergyFieldEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PutIntoYourGraveyardTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public PutIntoYourGraveyardTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new SacrificeSourceEffect(), false);
|
||||
}
|
||||
|
||||
public PutIntoYourGraveyardTriggeredAbility(PutIntoYourGraveyardTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutIntoYourGraveyardTriggeredAbility copy() {
|
||||
return new PutIntoYourGraveyardTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getToZone() == Zone.GRAVEYARD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && card.getOwnerId().equals(getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When a card is put into your graveyard from anywhere, " + super.getRule();
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ package mage.sets.urzassaga;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromAnywhereSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.ControllerLifeCount;
|
||||
import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect;
|
||||
|
@ -59,7 +59,7 @@ public class SerraAvatar extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new ControllerLifeCount(), Duration.EndOfGame)));
|
||||
|
||||
// When Serra Avatar is put into a graveyard from anywhere, shuffle it into its owner's library.
|
||||
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new ShuffleIntoLibrarySourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromAnywhereSourceTriggeredAbility(new ShuffleIntoLibrarySourceEffect()));
|
||||
}
|
||||
|
||||
public SerraAvatar(final SerraAvatar card) {
|
||||
|
|
|
@ -33,7 +33,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
|
@ -79,7 +79,7 @@ public class SpreadingAlgae extends CardImpl {
|
|||
this.addAbility(new SpreadingAlgaeTriggeredAbility(new DestroyTargetEffect()));
|
||||
|
||||
// When Spreading Algae is put into a graveyard from the battlefield, return Spreading Algae to its owner's hand.
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -28,21 +28,26 @@
|
|||
package mage.sets.zendikar;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.SourceHasCounterCondition;
|
||||
import mage.abilities.condition.common.OpponentLostLifeCondition;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
|
@ -68,7 +73,13 @@ public class BloodchiefAscension extends CardImpl {
|
|||
true));
|
||||
|
||||
// Whenever a card is put into an opponent's graveyard from anywhere, if Bloodchief Ascension has three or more quest counters on it, you may have that player lose 2 life. If you do, you gain 2 life.
|
||||
this.addAbility(new BloodchiefAscensionTriggeredAbility());
|
||||
Ability ability = new ConditionalTriggeredAbility(
|
||||
new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
new LoseLifeTargetEffect(2), true, new FilterCard("a card"), TargetController.OPPONENT, SetTargetPointer.PLAYER),
|
||||
new SourceHasCounterCondition(CounterType.QUEST, 3),
|
||||
"Whenever a card is put into an opponent's graveyard from anywhere, if Bloodchief Ascension has three or more quest counters on it, you may have that player lose 2 life. If you do, you gain 2 life", true);
|
||||
ability.addEffect(new GainLifeEffect(2));
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
|
@ -81,47 +92,3 @@ public class BloodchiefAscension extends CardImpl {
|
|||
return new BloodchiefAscension(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BloodchiefAscensionTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private Condition condition;
|
||||
|
||||
public BloodchiefAscensionTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(2), true);
|
||||
this.addEffect(new GainLifeEffect(2));
|
||||
condition = new SourceHasCounterCondition(CounterType.QUEST, 3);
|
||||
}
|
||||
|
||||
public BloodchiefAscensionTriggeredAbility(final BloodchiefAscensionTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.condition = ability.condition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BloodchiefAscensionTriggeredAbility copy() {
|
||||
return new BloodchiefAscensionTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
return condition.apply(game, this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && !card.isCopy() && game.getOpponents(controllerId).contains(card.getOwnerId())) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(card.getOwnerId()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a card is put into an opponent's graveyard from anywhere, if {this} has three or more quest counters on it, you may have that player lose 2 life. If you do, you gain 2 life.";
|
||||
}
|
||||
}
|
|
@ -28,23 +28,21 @@
|
|||
package mage.sets.zendikar;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
|
@ -61,7 +59,9 @@ public class QuestForAncientSecrets extends CardImpl {
|
|||
this.color.setBlue(true);
|
||||
|
||||
// Whenever a card is put into your graveyard from anywhere, you may put a quest counter on Quest for Ancient Secrets.
|
||||
this.addAbility(new QuestForAncientSecretsTriggeredAbility());
|
||||
this.addAbility(new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true, TargetController.YOU));
|
||||
|
||||
// Remove five quest counters from Quest for Ancient Secrets and sacrifice it: Target player shuffles his or her graveyard into his or her library.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new QuestForAncientSecretsEffect(),
|
||||
|
@ -81,38 +81,6 @@ public class QuestForAncientSecrets extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class QuestForAncientSecretsTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public QuestForAncientSecretsTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true);
|
||||
}
|
||||
|
||||
public QuestForAncientSecretsTriggeredAbility(final QuestForAncientSecretsTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuestForAncientSecretsTriggeredAbility copy() {
|
||||
return new QuestForAncientSecretsTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && !card.isCopy() && card.getOwnerId().equals(this.getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a card is put into your graveyard from anywhere, you may put a quest counter on {this}";
|
||||
}
|
||||
}
|
||||
|
||||
class QuestForAncientSecretsEffect extends OneShotEffect {
|
||||
|
||||
public QuestForAncientSecretsEffect() {
|
||||
|
|
|
@ -90,7 +90,7 @@ public class AttacksAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (SetTargetPointer.CREATURE.equals(setTargetPointer)) {
|
||||
if (SetTargetPointer.PERMANENT.equals(setTargetPointer)) {
|
||||
for (Effect effect: getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getId()));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class EntersOrLeavesTheBattlefieldSourceTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public EntersOrLeavesTheBattlefieldSourceTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
}
|
||||
|
||||
public EntersOrLeavesTheBattlefieldSourceTriggeredAbility(final EntersOrLeavesTheBattlefieldSourceTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntersOrLeavesTheBattlefieldSourceTriggeredAbility copy() {
|
||||
return new EntersOrLeavesTheBattlefieldSourceTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|
||||
&& event.getTargetId().equals(getSourceId())) {
|
||||
return true;
|
||||
}
|
||||
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId())) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
||||
if (zEvent.getFromZone().equals(Zone.BATTLEFIELD)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When {this} enters the battlefield or leaves the battlefield, " + super.getRule();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.other.OwnerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class PutCardIntoGraveFromAnywhereAllTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final FilterCard filter;
|
||||
private final String ruleText;
|
||||
private final SetTargetPointer setTargetPointer;
|
||||
|
||||
public PutCardIntoGraveFromAnywhereAllTriggeredAbility(Effect effect, boolean optional, TargetController targetController) {
|
||||
this(effect, optional, new FilterCard("a card"), targetController);
|
||||
}
|
||||
|
||||
public PutCardIntoGraveFromAnywhereAllTriggeredAbility(Effect effect, boolean optional, FilterCard filter, TargetController targetController) {
|
||||
this(effect, optional, filter, targetController, SetTargetPointer.NONE);
|
||||
}
|
||||
|
||||
public PutCardIntoGraveFromAnywhereAllTriggeredAbility(Effect effect, boolean optional, FilterCard filter, TargetController targetController, SetTargetPointer setTargetPointer) {
|
||||
this(Zone.BATTLEFIELD, effect, optional, filter, targetController, setTargetPointer);
|
||||
}
|
||||
|
||||
public PutCardIntoGraveFromAnywhereAllTriggeredAbility(Zone zone, Effect effect, boolean optional, FilterCard filter, TargetController targetController, SetTargetPointer setTargetPointer) {
|
||||
super(zone, effect, optional);
|
||||
this.filter = filter.copy();
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
this.filter.add(new OwnerPredicate(targetController));
|
||||
StringBuilder sb = new StringBuilder("Whenever ");
|
||||
sb.append(filter.getMessage());
|
||||
sb.append(" is put into ");
|
||||
switch (targetController) {
|
||||
case OPPONENT:
|
||||
sb.append("an opponent's");
|
||||
break;
|
||||
case YOU:
|
||||
sb.append("your");
|
||||
break;
|
||||
default:
|
||||
sb.append("a");
|
||||
}
|
||||
sb.append(" graveyard, ");
|
||||
ruleText = sb.toString();
|
||||
|
||||
}
|
||||
|
||||
public PutCardIntoGraveFromAnywhereAllTriggeredAbility(final PutCardIntoGraveFromAnywhereAllTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.filter = ability.filter;
|
||||
this.ruleText = ability.ruleText;
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutCardIntoGraveFromAnywhereAllTriggeredAbility copy() {
|
||||
return new PutCardIntoGraveFromAnywhereAllTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && filter.match(card, getSourceId(), getControllerId(), game)) {
|
||||
switch (setTargetPointer) {
|
||||
case CARD:
|
||||
for (Effect effect: getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
}
|
||||
break;
|
||||
case PLAYER:
|
||||
for (Effect effect: getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(card.getOwnerId()));
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return ruleText + super.getRule();
|
||||
}
|
||||
}
|
|
@ -48,23 +48,23 @@ import mage.players.Player;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class PutIntoGraveFromAnywhereAbility extends SimpleStaticAbility {
|
||||
public class PutIntoGraveFromAnywhereSourceAbility extends SimpleStaticAbility {
|
||||
|
||||
public PutIntoGraveFromAnywhereAbility(Effect baseEffect) {
|
||||
public PutIntoGraveFromAnywhereSourceAbility(Effect baseEffect) {
|
||||
this(baseEffect, null, "", true, false);
|
||||
}
|
||||
|
||||
public PutIntoGraveFromAnywhereAbility(Effect baseEffect, Condition condition, String text, boolean selfScope, boolean optional) {
|
||||
public PutIntoGraveFromAnywhereSourceAbility(Effect baseEffect, Condition condition, String text, boolean selfScope, boolean optional) {
|
||||
super(Zone.ALL, new PutIntoGraveFromAnywhereEffect(baseEffect, condition, text, selfScope, optional));
|
||||
}
|
||||
|
||||
public PutIntoGraveFromAnywhereAbility(final PutIntoGraveFromAnywhereAbility ability) {
|
||||
public PutIntoGraveFromAnywhereSourceAbility(final PutIntoGraveFromAnywhereSourceAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleStaticAbility copy() {
|
||||
return new PutIntoGraveFromAnywhereAbility(this);
|
||||
return new PutIntoGraveFromAnywhereSourceAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -0,0 +1,26 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
|
||||
/**
|
||||
* @author Loki
|
||||
*/
|
||||
public class PutIntoGraveFromAnywhereSourceTriggeredAbility extends ZoneChangeTriggeredAbility {
|
||||
public PutIntoGraveFromAnywhereSourceTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.GRAVEYARD, effect, "When {this} is put into a graveyard from anywhere, ", optional);
|
||||
}
|
||||
|
||||
public PutIntoGraveFromAnywhereSourceTriggeredAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
}
|
||||
|
||||
public PutIntoGraveFromAnywhereSourceTriggeredAbility(final PutIntoGraveFromAnywhereSourceTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutIntoGraveFromAnywhereSourceTriggeredAbility copy() {
|
||||
return new PutIntoGraveFromAnywhereSourceTriggeredAbility(this);
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
|
||||
/**
|
||||
* @author Loki
|
||||
*/
|
||||
public class PutIntoGraveFromAnywhereTriggeredAbility extends ZoneChangeTriggeredAbility {
|
||||
public PutIntoGraveFromAnywhereTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.GRAVEYARD, effect, "When {this} is put into a graveyard from anywhere, ", optional);
|
||||
}
|
||||
|
||||
public PutIntoGraveFromAnywhereTriggeredAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
}
|
||||
|
||||
public PutIntoGraveFromAnywhereTriggeredAbility(final PutIntoGraveFromAnywhereTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutIntoGraveFromAnywhereTriggeredAbility copy() {
|
||||
return new PutIntoGraveFromAnywhereTriggeredAbility(this);
|
||||
}
|
||||
}
|
|
@ -11,23 +11,23 @@ import mage.game.permanent.Permanent;
|
|||
/**
|
||||
* @author nantuko, loki
|
||||
*/
|
||||
public class PutIntoGraveFromBattlefieldTriggeredAbility extends TriggeredAbilityImpl {
|
||||
public class PutIntoGraveFromBattlefieldSourceTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public PutIntoGraveFromBattlefieldTriggeredAbility(Effect effect) {
|
||||
public PutIntoGraveFromBattlefieldSourceTriggeredAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
}
|
||||
|
||||
public PutIntoGraveFromBattlefieldTriggeredAbility(Effect effect, boolean optional) {
|
||||
public PutIntoGraveFromBattlefieldSourceTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.ALL, effect, optional);
|
||||
}
|
||||
|
||||
PutIntoGraveFromBattlefieldTriggeredAbility(PutIntoGraveFromBattlefieldTriggeredAbility ability) {
|
||||
PutIntoGraveFromBattlefieldSourceTriggeredAbility(PutIntoGraveFromBattlefieldSourceTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutIntoGraveFromBattlefieldTriggeredAbility copy() {
|
||||
return new PutIntoGraveFromBattlefieldTriggeredAbility(this);
|
||||
public PutIntoGraveFromBattlefieldSourceTriggeredAbility copy() {
|
||||
return new PutIntoGraveFromBattlefieldSourceTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -28,11 +28,11 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class ReturnSourceFromGraveyardToHandEffect extends OneShotEffect {
|
|||
|
||||
public ReturnSourceFromGraveyardToHandEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
staticText = "Return {this} from your graveyard to your hand";
|
||||
staticText = "return {this} from your graveyard to your hand";
|
||||
}
|
||||
|
||||
public ReturnSourceFromGraveyardToHandEffect(final ReturnSourceFromGraveyardToHandEffect effect) {
|
||||
|
@ -58,12 +58,10 @@ public class ReturnSourceFromGraveyardToHandEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Card card = player.getGraveyard().get(source.getSourceId(), game);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Card card = controller.getGraveyard().get(source.getSourceId(), game);
|
||||
if (card != null) {
|
||||
player.removeFromGraveyard(card, game);
|
||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
||||
return true;
|
||||
return controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect {
|
|||
return "";
|
||||
}
|
||||
Target target = mode.getTargets().get(0);
|
||||
StringBuilder sb = new StringBuilder("Return ");
|
||||
StringBuilder sb = new StringBuilder("return ");
|
||||
if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) {
|
||||
sb.append("up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append(" to their owners' hand");
|
||||
return sb.toString();
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -58,7 +58,11 @@ public class SacrificeSourceEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
return permanent.sacrifice(source.getSourceId(), game);
|
||||
// you can only sacrifice a permanent you control
|
||||
if (source.getControllerId().equals(permanent.getControllerId())) {
|
||||
return permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ public class GainControlTargetEffect extends ContinuousEffectImpl {
|
|||
if (this.controllingPlayerId == null && fixedControl) {
|
||||
this.controllingPlayerId = source.getControllerId();
|
||||
}
|
||||
super.init(source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,5 +33,5 @@ package mage.constants;
|
|||
* @author LevelX2
|
||||
*/
|
||||
public enum SetTargetPointer {
|
||||
NONE, PLAYER, SPELL, CREATURE, PERMANENT;
|
||||
NONE, PLAYER, SPELL, CARD, PERMANENT;
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ import mage.watchers.Watcher;
|
|||
*/
|
||||
public class CardsPutIntoGraveyardWatcher extends Watcher {
|
||||
|
||||
private final Map<UUID, Integer> amountOfCardsThisTurn = new HashMap<UUID, Integer>();
|
||||
private final Set<UUID> cardsPutToGraveyardFromBattlefield = new HashSet<UUID>();
|
||||
private final Map<UUID, Integer> amountOfCardsThisTurn = new HashMap<>();
|
||||
private final Set<UUID> cardsPutToGraveyardFromBattlefield = new HashSet<>();
|
||||
|
||||
|
||||
public CardsPutIntoGraveyardWatcher() {
|
||||
|
@ -75,7 +75,7 @@ public class CardsPutIntoGraveyardWatcher extends Watcher {
|
|||
if (playerId != null && game.getCard(event.getTargetId()) != null) {
|
||||
Integer amount = amountOfCardsThisTurn.get(playerId);
|
||||
if (amount == null) {
|
||||
amount = new Integer(1);
|
||||
amount = 1;
|
||||
} else {
|
||||
++amount;
|
||||
}
|
||||
|
@ -90,13 +90,13 @@ public class CardsPutIntoGraveyardWatcher extends Watcher {
|
|||
public int getAmountCardsPutToGraveyard(UUID playerId) {
|
||||
Integer amount = amountOfCardsThisTurn.get(playerId);
|
||||
if (amount != null) {
|
||||
return amount.intValue();
|
||||
return amount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Set<UUID> getCardsPutToGraveyardFromBattlefield() {
|
||||
Set<UUID> cards = new HashSet<UUID>();
|
||||
Set<UUID> cards = new HashSet<>();
|
||||
cards.addAll(cardsPutToGraveyardFromBattlefield);
|
||||
return cards;
|
||||
}
|
||||
|
|
75
Mage/src/mage/watchers/common/CreaturesDiedWatcher.java
Normal file
75
Mage/src/mage/watchers/common/CreaturesDiedWatcher.java
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.watchers.common;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class CreaturesDiedWatcher extends Watcher {
|
||||
|
||||
private int amountOfCreaturesThatDied;
|
||||
|
||||
public CreaturesDiedWatcher() {
|
||||
super("CreaturesDiedWatcher", WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public CreaturesDiedWatcher(final CreaturesDiedWatcher watcher) {
|
||||
super(watcher);
|
||||
this.amountOfCreaturesThatDied = watcher.amountOfCreaturesThatDied;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) {
|
||||
amountOfCreaturesThatDied++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
amountOfCreaturesThatDied = 0;
|
||||
}
|
||||
|
||||
public int getAmountOfCreaturesDiesThisTurn() {
|
||||
return amountOfCreaturesThatDied;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreaturesDiedWatcher copy() {
|
||||
return new CreaturesDiedWatcher(this);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue