Fixed that alternative spell always selected to cast if available;

This commit is contained in:
Oleg Agafonov 2019-06-23 17:20:04 +04:00
parent 4bf9153bc2
commit 63a9a505e1
8 changed files with 62 additions and 2 deletions

View file

@ -1,4 +1,3 @@
package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep;
@ -8,7 +7,6 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class AwakenTest extends CardTestPlayerBase {
@ -122,4 +120,59 @@ public class AwakenTest extends CardTestPlayerBase {
}
/**
* Select spell ability with different targets
*/
@Test
public void test_CastNormalSpell() {
// Counter target spell.
// Awaken 3{4}{U}{U} (If you cast this spell for {4}{U}{U}, also put three +1/+1 counters on target land you control
// and it becomes a 0/0 Elemental creature with haste. Its still a land.)
addCard(Zone.HAND, playerA, "Scatter to the Winds", 1); // {1}{U}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
//
addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
// cast
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
// counter by normal cast
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Scatter to the Winds", "Lightning Bolt");
checkLife("after", 1, PhaseStep.BEGIN_COMBAT, playerB, 20);
checkHandCardCount("after", 1, PhaseStep.BEGIN_COMBAT, playerA, "Lightning Bolt", 0);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
}
@Test
public void test_CastAwakenSpell() {
// Counter target spell.
// Awaken 3{4}{U}{U} (If you cast this spell for {4}{U}{U}, also put three +1/+1 counters on target land you control
// and it becomes a 0/0 Elemental creature with haste. Its still a land.)
addCard(Zone.HAND, playerA, "Scatter to the Winds", 1); // {1}{U}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
//
addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
// cast
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
// counter by normal cast
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Scatter to the Winds with awaken", "Lightning Bolt");
addTarget(playerA, "Island");
checkLife("after", 1, PhaseStep.BEGIN_COMBAT, playerB, 20);
checkHandCardCount("after", 1, PhaseStep.BEGIN_COMBAT, playerA, "Lightning Bolt", 0);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
}
}

View file

@ -12,6 +12,7 @@ public class CastCommanderAbility extends SpellAbility {
public CastCommanderAbility(Card card) {
super(card.getSpellAbility());
this.newId();
this.setCardName(cardName = card.getName());
zone = Zone.COMMAND;
spellAbilityType = SpellAbilityType.BASE;

View file

@ -38,6 +38,7 @@ public class AwakenAbility extends SpellAbility {
public AwakenAbility(Card card, int awakenValue, String awakenCosts) {
super(card.getSpellAbility());
this.newId();
this.setCardName(card.getName() + " with awaken");
zone = Zone.HAND;
spellAbilityType = SpellAbilityType.BASE_ALTERNATE;

View file

@ -30,6 +30,7 @@ public class EmergeAbility extends SpellAbility {
public EmergeAbility(Card card, ManaCosts<ManaCost> emergeCost) {
super(card.getSpellAbility());
this.newId();
this.setCardName(card.getName() + " with emerge");
zone = Zone.HAND;
spellAbilityType = SpellAbilityType.BASE_ALTERNATE;

View file

@ -37,6 +37,7 @@ public class JumpStartAbility extends SpellAbility {
public JumpStartAbility(Card card) {
super(card.getSpellAbility());
this.newId();
this.setCardName(card.getName() + " with jump-start");
zone = Zone.GRAVEYARD;
spellAbilityType = SpellAbilityType.BASE_ALTERNATE;

View file

@ -16,6 +16,7 @@ public class RetraceAbility extends SpellAbility {
public RetraceAbility(Card card) {
super(card.getSpellAbility());
this.newId();
this.setCardName(card.getName() + " with retrace");
zone = Zone.GRAVEYARD;
spellAbilityType = SpellAbilityType.BASE_ALTERNATE;

View file

@ -23,6 +23,7 @@ public class SpectacleAbility extends SpellAbility {
public SpectacleAbility(Card card, ManaCost spectacleCosts) {
super(card.getSpellAbility());
this.newId();
this.setCardName(card.getName() + " with spectacle");
zone = Zone.HAND;
spellAbilityType = SpellAbilityType.BASE_ALTERNATE;

View file

@ -23,6 +23,7 @@ public class SurgeAbility extends SpellAbility {
public SurgeAbility(Card card, String surgeCosts) {
super(card.getSpellAbility());
this.newId();
this.setCardName(card.getName() + " with surge");
zone = Zone.HAND;
spellAbilityType = SpellAbilityType.BASE_ALTERNATE;