forked from External/mage
Refactoring: replace custom creature tokens with basic class (1 card);
Added blink test;
This commit is contained in:
parent
3da2f98eac
commit
593df43758
3 changed files with 41 additions and 25 deletions
|
|
@ -17,6 +17,7 @@ import mage.constants.Duration;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.permanent.token.TokenImpl;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.permanent.token.custom.CreatureToken;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -32,7 +33,12 @@ public final class DimirKeyrune extends CardImpl {
|
|||
this.addAbility(new BlackManaAbility());
|
||||
|
||||
// {U}{B}: Dimir Keyrune becomes a 2/2 blue and black Horror and can't be blocked this turn
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new DimirKeyruneToken(), "", Duration.EndOfTurn), new ManaCostsImpl("{U}{B}")));
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
|
||||
new CreatureToken(2, 2, "2/2 blue and black Horror creature that can't be blocked")
|
||||
.withColor("UB")
|
||||
.withSubType(SubType.HORROR)
|
||||
.withAbility(new CantBeBlockedSourceAbility()),
|
||||
"", Duration.EndOfTurn), new ManaCostsImpl("{U}{B}")));
|
||||
}
|
||||
|
||||
public DimirKeyrune(final DimirKeyrune card) {
|
||||
|
|
@ -43,25 +49,4 @@ public final class DimirKeyrune extends CardImpl {
|
|||
public DimirKeyrune copy() {
|
||||
return new DimirKeyrune(this);
|
||||
}
|
||||
|
||||
private static class DimirKeyruneToken extends TokenImpl {
|
||||
DimirKeyruneToken() {
|
||||
super("Horror", "2/2 blue and black Horror until end of turn and can't be blocked this turn");
|
||||
cardType.add(CardType.ARTIFACT);
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setBlue(true);
|
||||
color.setBlack(true);
|
||||
subtype.add(SubType.HORROR);
|
||||
power = new MageInt(2);
|
||||
toughness = new MageInt(2);
|
||||
this.addAbility(new CantBeBlockedSourceAbility());
|
||||
}
|
||||
public DimirKeyruneToken(final DimirKeyruneToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
public DimirKeyruneToken copy() {
|
||||
return new DimirKeyruneToken(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
package org.mage.test.cards.continuous;
|
||||
|
||||
import mage.abilities.keyword.IndestructibleAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
|
@ -16,8 +18,9 @@ public class EnsoulArtifactTest extends CardTestPlayerBase {
|
|||
/**
|
||||
* Tests boost disappeared after creature died
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testBoostWithUndying() {
|
||||
public void test_Boost() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Darksteel Citadel", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
|
||||
|
|
@ -30,7 +33,33 @@ public class EnsoulArtifactTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertAbility(playerA, "Darksteel Citadel", IndestructibleAbility.getInstance(), true);
|
||||
assertType("Darksteel Citadel", CardType.CREATURE, true);
|
||||
assertPowerToughness(playerA, "Darksteel Citadel", 5, 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_BoostDisappearedOnBlink() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Darksteel Citadel", 1);
|
||||
|
||||
// blink
|
||||
addCard(Zone.HAND, playerA, "Momentary Blink", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
|
||||
// Enchanted artifact is a creature with base power and toughness 5/5 in addition to its other types.
|
||||
addCard(Zone.HAND, playerA, "Ensoul Artifact");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ensoul Artifact", "Darksteel Citadel");
|
||||
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Momentary Blink", "Darksteel Citadel");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Momentary Blink", 0);
|
||||
assertPermanentCount(playerA, "Darksteel Citadel", 1);
|
||||
assertPowerToughness(playerA, "Darksteel Citadel", 0, 0);
|
||||
assertType("Darksteel Citadel", CardType.CREATURE, false);
|
||||
assertAbility(playerA, "Darksteel Citadel", IndestructibleAbility.getInstance(), true);
|
||||
assertPermanentCount(playerA, "Ensoul Artifact", 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import mage.game.permanent.token.Token;
|
|||
public class BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect extends ContinuousEffectImpl {
|
||||
|
||||
public enum LoseType {
|
||||
|
||||
NONE, ALL, ALL_BUT_COLOR, ABILITIES, ABILITIES_SUBTYPE_AND_PT
|
||||
}
|
||||
|
||||
|
|
@ -102,6 +101,7 @@ public class BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect extends Co
|
|||
|
||||
}
|
||||
break;
|
||||
|
||||
case ColorChangingEffects_5:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (loseType == LoseType.ALL) {
|
||||
|
|
@ -116,6 +116,7 @@ public class BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect extends Co
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
switch (loseType) {
|
||||
|
|
@ -132,12 +133,13 @@ public class BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect extends Co
|
|||
|
||||
}
|
||||
break;
|
||||
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
permanentAttachedTo.getPower().setValue(token.getPower().getValue());
|
||||
permanentAttachedTo.getToughness().setValue(token.getToughness().getValue());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!attachedExists) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue