mirror of
https://github.com/correl/mage.git
synced 2025-03-07 20:53:18 -10:00
* Eldrazi Mimic - Fixed that the P/T was not set if the triggering permanent left the battlefield meanwhile.
This commit is contained in:
parent
cf79baca2e
commit
1c3c8cafe6
5 changed files with 106 additions and 23 deletions
|
@ -54,10 +54,10 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public class DrownerOfHope extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("an Eldrazi Scion");
|
||||
private static final FilterControlledPermanent FILTER = new FilterControlledPermanent("an Eldrazi Scion");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.and(
|
||||
FILTER.add(Predicates.and(
|
||||
new SubtypePredicate("Eldrazi"),
|
||||
new SubtypePredicate("Scion")));
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class DrownerOfHope extends CardImpl {
|
|||
this.addAbility(new EntersBattlefieldTriggeredAbility(effect, false));
|
||||
|
||||
// Sacrifice an Eldrazi Scion: Tap target creature.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new SacrificeTargetCost(new TargetControlledPermanent(filter)));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new SacrificeTargetCost(new TargetControlledPermanent(FILTER)));
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -33,14 +33,13 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorlessPredicate;
|
||||
|
@ -48,18 +47,19 @@ import mage.filter.predicate.permanent.AnotherPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public class EldraziMimic extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another colorless creature");
|
||||
|
||||
|
||||
private static final FilterCreaturePermanent FILTER = new FilterCreaturePermanent("another colorless creature");
|
||||
|
||||
static {
|
||||
filter.add(new AnotherPredicate());
|
||||
filter.add(new ColorlessPredicate());
|
||||
FILTER.add(new AnotherPredicate());
|
||||
FILTER.add(new ColorlessPredicate());
|
||||
}
|
||||
|
||||
public EldraziMimic(UUID ownerId) {
|
||||
|
@ -69,11 +69,9 @@ public class EldraziMimic extends CardImpl {
|
|||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever another colorless creature enters the battlefield under your control, you may have the base power and toughness of Eldrazi Mimic
|
||||
// Whenever another colorless creature enters the battlefield under your control, you may have the base power and toughness of Eldrazi Mimic
|
||||
// become that creature's power and toughness until end of turn.
|
||||
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new EldraziMimicEffect(), filter, true, SetTargetPointer.PERMANENT,
|
||||
"Whenever another colorless creature enters the battlefield under your control, you may have the base power and toughness of {this} become "
|
||||
+ "that creature's power and toughness until end of turn"));
|
||||
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new EldraziMimicEffect(), FILTER, true, SetTargetPointer.PERMANENT, null));
|
||||
}
|
||||
|
||||
public EldraziMimic(final EldraziMimic card) {
|
||||
|
@ -90,6 +88,7 @@ class EldraziMimicEffect extends OneShotEffect {
|
|||
|
||||
public EldraziMimicEffect() {
|
||||
super(Outcome.Detriment);
|
||||
staticText = "you may have the base power and toughness of {this} become that creature's power and toughness until end of turn";
|
||||
}
|
||||
|
||||
public EldraziMimicEffect(final EldraziMimicEffect effect) {
|
||||
|
@ -105,9 +104,10 @@ class EldraziMimicEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
Permanent permanent = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game);
|
||||
if (permanent != null) {
|
||||
ContinuousEffect effect = new SetPowerToughnessSourceEffect(permanent.getPower().getValue(), permanent.getToughness().getValue(), Duration.EndOfTurn, SubLayer.SetPT_7b);
|
||||
ContinuousEffect effect = new SetPowerToughnessTargetEffect(permanent.getPower().getValue(), permanent.getToughness().getValue(), Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
package mage.sets.tenthedition;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
@ -45,20 +45,19 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public class Terror extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonartifact, nonblack creature");
|
||||
private static final FilterCreaturePermanent FILTER = new FilterCreaturePermanent("nonartifact, nonblack creature");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
|
||||
filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
|
||||
FILTER.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
|
||||
FILTER.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
|
||||
}
|
||||
|
||||
public Terror(UUID ownerId) {
|
||||
super(ownerId, 182, "Terror", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{B}");
|
||||
this.expansionSetCode = "10E";
|
||||
|
||||
|
||||
// Destroy target nonartifact, nonblack creature. It can't be regenerated.
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(FILTER));
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect(true));
|
||||
}
|
||||
|
||||
|
|
|
@ -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 org.mage.test.cards.copy;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class EldraziMimicTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Eldrazi Mimic also did not copy the last known P/T of a Drowner of Hope
|
||||
* that was killed with the trigger on the stack.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testCopyIfPermanentIsGone() {
|
||||
// Devoid
|
||||
// When Drowner of Hope enters the battlefield, put two 1/1 colorless Eldrazi Scion creature tokens onto the battlefield. They have "Sacrifice this creature: Add {C} to your mana pool."
|
||||
// Sacrifice an Eldrazi Scion: Tap target creature.
|
||||
addCard(Zone.HAND, playerA, "Drowner of Hope", 1); // {5}{U} 5/5
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
|
||||
// Whenever another colorless creature enters the battlefield under your control, you may have the base power and toughness of Eldrazi Mimic
|
||||
// become that creature's power and toughness until end of turn.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Eldrazi Mimic", 1); // 2/1
|
||||
|
||||
// Destroy target nonartifact, nonblack creature. It can't be regenerated.
|
||||
addCard(Zone.HAND, playerB, "Terror", 1); // {1}{B}
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Drowner of Hope");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Terror", "Drowner of Hope");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, "Terror", 1);
|
||||
assertGraveyardCount(playerA, "Drowner of Hope", 1);
|
||||
|
||||
assertPermanentCount(playerA, "Eldrazi Mimic", 1);
|
||||
assertPowerToughness(playerA, "Eldrazi Mimic", 5, 5);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -98,4 +99,12 @@ public class FixedTarget implements TargetPointer {
|
|||
return zoneChangeCounter;
|
||||
}
|
||||
|
||||
public Permanent getTargetedPermanentOrLKIBattlefield(Game game) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(targetId);
|
||||
if (permanent != null && permanent.getZoneChangeCounter(game) != zoneChangeCounter) {
|
||||
permanent = (Permanent) game.getLastKnownInformation(targetId, Zone.BATTLEFIELD, zoneChangeCounter);
|
||||
}
|
||||
return permanent;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue