mirror of
https://github.com/correl/mage.git
synced 2025-03-07 20:53:18 -10:00
[SOI] Fixed Altered Ego if no creature to copy was selected..
This commit is contained in:
parent
60e4830c0b
commit
f7e4ed40e5
2 changed files with 52 additions and 1 deletions
|
@ -29,6 +29,7 @@ package mage.sets.shadowsoverinnistrad;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.CantBeCounteredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
@ -37,8 +38,11 @@ import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -60,7 +64,7 @@ public class AlteredEgo extends CardImpl {
|
|||
Effect effect = new CopyPermanentEffect(new FilterCreaturePermanent(), null);
|
||||
effect.setText("a copy of any creature on the battlefield");
|
||||
EntersBattlefieldAbility ability = new EntersBattlefieldAbility(effect, true);
|
||||
effect = new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance());
|
||||
effect = new AlteredEgoAddCountersEffect(CounterType.P1P1.createInstance());
|
||||
effect.setText(", except it enters with an additional X +1/+1 counters on it");
|
||||
ability.addEffect(effect);
|
||||
this.addAbility(ability);
|
||||
|
@ -75,3 +79,32 @@ public class AlteredEgo extends CardImpl {
|
|||
return new AlteredEgo(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AlteredEgoAddCountersEffect extends EntersBattlefieldWithXCountersEffect {
|
||||
|
||||
public AlteredEgoAddCountersEffect(Counter counter) {
|
||||
super(counter);
|
||||
}
|
||||
|
||||
public AlteredEgoAddCountersEffect(EntersBattlefieldWithXCountersEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
// except only takes place if something was copied
|
||||
if (permanent.isCopy()) {
|
||||
return super.apply(game, source);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntersBattlefieldWithXCountersEffect copy() {
|
||||
return new AlteredEgoAddCountersEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,4 +58,22 @@ public class AlteredEgoTest extends CardTestPlayerBase {
|
|||
assertPowerToughness(playerA, "Silvercoat Lion", 5, 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoCreatureToCopyAvailable() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
|
||||
// Altered Ego can't be countered.
|
||||
// You may have Altered Ego enter the battlefield as a copy of any creature on the battlefield, except it enters with an additional X +1/+1 counters on it.
|
||||
addCard(Zone.HAND, playerA, "Altered Ego"); // {X}{2}{G}{U}
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Altered Ego");
|
||||
setChoice(playerA, "X=3");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Altered Ego", 0);
|
||||
assertGraveyardCount(playerA, "Altered Ego", 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue