mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
Minor changes to Phantasmal Image card and test.
This commit is contained in:
parent
3847f15e05
commit
0cf25a5c8e
2 changed files with 36 additions and 14 deletions
|
|
@ -28,10 +28,6 @@
|
||||||
package mage.sets.magic2012;
|
package mage.sets.magic2012;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BecomesTargetTriggeredAbility;
|
import mage.abilities.common.BecomesTargetTriggeredAbility;
|
||||||
|
|
@ -40,6 +36,10 @@ import mage.abilities.effects.EntersBattlefieldEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
@ -65,6 +65,9 @@ public class PhantasmalImage extends CardImpl<PhantasmalImage> {
|
||||||
this.power = new MageInt(0);
|
this.power = new MageInt(0);
|
||||||
this.toughness = new MageInt(0);
|
this.toughness = new MageInt(0);
|
||||||
|
|
||||||
|
// You may have Phantasmal Image enter the battlefield as a copy of any creature
|
||||||
|
// on the battlefield, except it's an Illusion in addition to its other types and
|
||||||
|
// it gains "When this creature becomes the target of a spell or ability, sacrifice it."
|
||||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(
|
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(
|
||||||
new PhantasmalImageCopyEffect(), abilityText, true));
|
new PhantasmalImageCopyEffect(), abilityText, true));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
@ -96,17 +99,18 @@ class PhantasmalImageCopyEffect extends OneShotEffect<PhantasmalImageCopyEffect>
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
if (player != null && sourcePermanent != null) {
|
if (player != null && sourcePermanent != null) {
|
||||||
Target target = new TargetPermanent(new FilterCreaturePermanent());
|
Target target = new TargetPermanent(new FilterCreaturePermanent());
|
||||||
if (target.canChoose(source.getControllerId(), game)) {
|
target.setRequired(true);
|
||||||
target.setRequired(true);
|
target.setNotTarget(true);
|
||||||
target.setNotTarget(true);
|
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
|
||||||
player.choose(Outcome.Copy, target, source.getSourceId(), game);
|
player.choose(Outcome.Copy, target, source.getSourceId(), game);
|
||||||
UUID targetId = target.getFirstTarget();
|
Permanent copyFromPermanent = game.getPermanent(target.getFirstTarget());
|
||||||
Permanent copyFromPermanent = game.getPermanent(targetId);
|
|
||||||
if (copyFromPermanent != null) {
|
if (copyFromPermanent != null) {
|
||||||
game.copyPermanent(copyFromPermanent, sourcePermanent, source, new ApplyToPermanent() {
|
game.copyPermanent(copyFromPermanent, sourcePermanent, source, new ApplyToPermanent() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean apply(Game game, Permanent permanent) {
|
public Boolean apply(Game game, Permanent permanent) {
|
||||||
permanent.getSubtype().add("Illusion");
|
if (!permanent.getSubtype().contains("Illusion")) {
|
||||||
|
permanent.getSubtype().add("Illusion");
|
||||||
|
}
|
||||||
permanent.addAbility(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()), game);
|
permanent.addAbility(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()), game);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -123,4 +127,4 @@ class PhantasmalImageCopyEffect extends OneShotEffect<PhantasmalImageCopyEffect>
|
||||||
public PhantasmalImageCopyEffect copy() {
|
public PhantasmalImageCopyEffect copy() {
|
||||||
return new PhantasmalImageCopyEffect(this);
|
return new PhantasmalImageCopyEffect(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,10 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
/**
|
/**
|
||||||
* @author noxx
|
* @author noxx
|
||||||
*
|
*
|
||||||
* Card: You may have {this} enter the battlefield as a copy of any creature on the battlefield, except it's an Illusion in addition to its other types and it gains "When this creature becomes the target of a spell or ability, sacrifice it."
|
* Card: You may have {this} enter the battlefield as a copy of any creature on the battlefield, except
|
||||||
|
* it's an Illusion in addition to its other types and it gains "When this creature becomes the target
|
||||||
|
* of a spell or ability, sacrifice it."
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class PhantasmalImageTest extends CardTestPlayerBase {
|
public class PhantasmalImageTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
|
@ -119,23 +122,38 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
|
||||||
assertPermanentCount(playerA, "Illusionary Servant", 3);
|
assertPermanentCount(playerA, "Illusionary Servant", 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// PhantasmalImageTest.testCopyAlreadyTransformed:143->
|
||||||
|
// CardTestPlayerAPIImpl.assertPowerToughness:351->CardTestPlayerAPIImpl.assertPowerToughness:337
|
||||||
|
// There is no such creature under player's control with specified power&toughness, player=PlayerA,
|
||||||
|
// cardName=Ravager of the Fells (found similar: 1, one of them: power=8 toughness=8)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests copying already transformed creature
|
* Tests copying already transformed creature
|
||||||
* Makes sure it still has "When this creature becomes the target of a spell or ability, sacrifice it"
|
* Makes sure it still has "When this creature becomes the target of a spell or ability, sacrifice it"
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCopyAlreadyTransformed() {
|
public void testCopyAlreadyTransformed() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Forest", 2);
|
addCard(Zone.BATTLEFIELD, playerB, "Forest", 2);
|
||||||
addCard(Zone.HAND, playerB, "Phantasmal Image");
|
addCard(Zone.HAND, playerB, "Phantasmal Image");
|
||||||
addCard(Zone.HAND, playerB, "Titanic Growth");
|
addCard(Zone.HAND, playerB, "Titanic Growth");
|
||||||
|
|
||||||
|
// Creatures you control have hexproof.
|
||||||
|
addCard(Zone.HAND, playerA, "Asceticism");
|
||||||
|
|
||||||
|
// Whenever this creature enters the battlefield or transforms into
|
||||||
|
// Huntmaster of the Fells, put a 2/2 green Wolf creature token onto
|
||||||
|
// the battlefield and you gain 2 life.
|
||||||
|
// At the beginning of each upkeep, if no spells were cast last turn, transform Huntmaster of the Fells.
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Huntmaster of the Fells");
|
addCard(Zone.BATTLEFIELD, playerA, "Huntmaster of the Fells");
|
||||||
|
|
||||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Phantasmal Image");
|
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Phantasmal Image");
|
||||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Titanic Growth", "Ravager of the Fells");
|
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Asceticism");
|
||||||
|
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Titanic Growth", "Ravager of the Fells");
|
||||||
|
|
||||||
setStopAt(2, PhaseStep.END_TURN);
|
setStopAt(3, PhaseStep.END_TURN);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertLife(playerB, 18);
|
assertLife(playerB, 18);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue