Merge origin/master

This commit is contained in:
fireshoes 2016-09-04 11:27:11 -05:00
commit a143d86e92
5 changed files with 149 additions and 26 deletions

View file

@ -52,8 +52,8 @@ public class OrcishSpy1 extends CardImpl {
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// {tap}: Look at the top three cards of target player's library. // {T}: Look at the top three cards of target player's library.
Ability ability = new SimpleActivatedAbility(Zone.LIBRARY, new LookLibraryTopCardTargetPlayerEffect(3), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LookLibraryTopCardTargetPlayerEffect(3), new TapSourceCost());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -29,11 +29,9 @@ package mage.sets.guildpact;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -46,6 +44,11 @@ import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.EnchantedPredicate; import mage.filter.predicate.permanent.EnchantedPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -55,7 +58,8 @@ import mage.target.common.TargetCreaturePermanent;
*/ */
public class NecromancersMagemark extends CardImpl { public class NecromancersMagemark extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control that are enchanted"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control that are enchanted");
static { static {
filter.add(new EnchantedPredicate()); filter.add(new EnchantedPredicate());
filter.add(new ControllerPredicate(TargetController.YOU)); filter.add(new ControllerPredicate(TargetController.YOU));
@ -72,13 +76,13 @@ public class NecromancersMagemark extends CardImpl {
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability); this.addAbility(ability);
// Creatures you control that are enchanted get +1/+1. // Creatures you control that are enchanted get +1/+1.
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1,1, Duration.WhileOnBattlefield, filter, false)); ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false));
this.addAbility(ability); this.addAbility(ability);
// If a creature you control that's enchanted would die, return it to its owner's hand instead. // If a creature you control that's enchanted would die, return it to its owner's hand instead.
Effect effect = new ReturnToHandSourceEffect(); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new NecromancersMagemarkEffect()));
ability = new DiesCreatureTriggeredAbility(effect,false);
this.addAbility(ability);
} }
public NecromancersMagemark(final NecromancersMagemark card) { public NecromancersMagemark(final NecromancersMagemark card) {
@ -90,3 +94,61 @@ public class NecromancersMagemark extends CardImpl {
return new NecromancersMagemark(this); return new NecromancersMagemark(this);
} }
} }
class NecromancersMagemarkEffect extends ReplacementEffectImpl {
public NecromancersMagemarkEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "If a creature you control that's enchanted would die, return it to its owner's hand instead";
}
public NecromancersMagemarkEffect(final NecromancersMagemarkEffect effect) {
super(effect);
}
@Override
public NecromancersMagemarkEffect copy() {
return new NecromancersMagemarkEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
if (permanent != null) {
controller.moveCards(permanent, Zone.HAND, source, game);
return true;
}
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.ZONE_CHANGE);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone().equals(Zone.BATTLEFIELD) && zEvent.getToZone().equals(Zone.GRAVEYARD)) {
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) {
for (UUID attachmentId : permanent.getAttachments()) {
Permanent attachment = game.getPermanentOrLKIBattlefield(attachmentId);
if (attachment != null && attachment.getSubtype(game).contains("Aura")) {
return true;
}
}
}
}
return false;
}
}

View file

@ -131,7 +131,7 @@ class KalitasTraitorOfGhetEffect extends ReplacementEffectImpl {
if (((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)) { if (((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)) {
Permanent permanent = ((ZoneChangeEvent) event).getTarget(); Permanent permanent = ((ZoneChangeEvent) event).getTarget();
if (permanent != null) { if (permanent != null) {
controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true); controller.moveCards(permanent, Zone.EXILED, source, game);
new CreateTokenEffect(new ZombieToken()).apply(game, source); new CreateTokenEffect(new ZombieToken()).apply(game, source);
return true; return true;
} }

View file

@ -72,4 +72,32 @@ public class PutToGraveyardTest extends CardTestPlayerBase {
} }
/**
* Oracle of Dust does not seem to actually move cards from exile into the
* opponent's graveyard, even though every other part of the ability works
* just fine.
*/
@Test
public void testExileToGraveyard2() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
// Devoid
// {2}, Put a card an opponent owns from exile into that player's graveyard: Draw a card, then discard a card.
addCard(Zone.BATTLEFIELD, playerA, "Oracle of Dust", 1); // {4}{U}
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
// Exile target creature. Its controller gains life equal to its power.
addCard(Zone.HAND, playerA, "Swords to Plowshares");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Swords to Plowshares", "Silvercoat Lion");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{2}");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerA, "Swords to Plowshares", 1);
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
assertGraveyardCount(playerA, 2);
}
} }

View file

@ -52,4 +52,37 @@ public class KalitasTraitorOfGhetTest extends CardTestPlayerBase {
assertExileCount("Kalitas, Traitor of Ghet", 0); // player controlled, not opponent so not exiled assertExileCount("Kalitas, Traitor of Ghet", 0); // player controlled, not opponent so not exiled
assertPermanentCount(playerA, "Zombie", 3); // 3 tokens generated from exiling 3 opponent's creatures assertPermanentCount(playerA, "Zombie", 3); // 3 tokens generated from exiling 3 opponent's creatures
} }
@Test
public void testDamnationGraveyard() {
/*
Kalitas, Traitor of Ghet {2}{B}{B} 3/4 lifelink - Legendary Vampire
If a nontoken creature an opponent controls would die, instead exile that card and put a 2/2 black Zombie creature token onto the battlefield.
*/
addCard(Zone.GRAVEYARD, playerA, "Kalitas, Traitor of Ghet", 1);
/*
Damnation {2}{B}{B} - Sorcery
Destroy all creatures. They can't be regenerated.
*/
addCard(Zone.HAND, playerA, "Damnation", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
addCard(Zone.BATTLEFIELD, playerB, "Bronze Sable", 1);
addCard(Zone.BATTLEFIELD, playerB, "Wall of Roots", 1);
addCard(Zone.BATTLEFIELD, playerB, "Sigiled Starfish", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Damnation");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Kalitas, Traitor of Ghet", 1);
assertGraveyardCount(playerA, "Damnation", 1);
assertGraveyardCount(playerB, "Bronze Sable", 1);
assertGraveyardCount(playerB, "Wall of Roots", 1);
assertGraveyardCount(playerB, "Sigiled Starfish", 1);
assertPermanentCount(playerA, "Zombie", 0); // 3 tokens generated from exiling 3 opponent's creatures
}
} }