* Breath of Fury - Fixed that the enchnatment was no longer properly moved (fixes #3722).

This commit is contained in:
LevelX2 2017-07-24 00:41:03 +02:00
parent fbd90bb3e0
commit acf28d8aff
7 changed files with 129 additions and 42 deletions

View file

@ -0,0 +1,72 @@
/*
* 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.enchantments;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class BreathOfFuryTest extends CardTestPlayerBase {
@Test
public void testMoveEnchantment() {
// Enchant creature you control
// When enchanted creature deals combat damage to a player, sacrifice it and attach Breath of Fury to a creature you control.
// If you do, untap all creatures you control and after this phase, there is an additional combat phase.
addCard(Zone.HAND, playerA, "Breath of Fury", 1); // Enchantment - Aura {2}{R}{R}
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerA, "Pillarfield Ox");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Breath of Fury", "Silvercoat Lion");
attack(3, playerA, "Pillarfield Ox");
attack(3, playerA, "Silvercoat Lion");
addTarget(playerA, "Pillarfield Ox");
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 16);
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
assertTappedCount("Pillarfield Ox", false, 1);
assertPermanentCount(playerA, "Breath of Fury", 1);
}
}

View file

@ -10,16 +10,16 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
* @author BetaSteward
*/
public class FuryOfTheHordeTest extends CardTestPlayerBase {
/*
* Fury of the Horde
* Sorcery, 5RR (7)
* You may exile two red cards from your hand rather than pay Fury of the
* You may exile two red cards from your hand rather than pay Fury of the
* Horde's mana cost.
* Untap all creatures that attacked this turn. After this main phase, there
* Untap all creatures that attacked this turn. After this main phase, there
* is an additional combat phase followed by an additional main phase.
*
*/
*/
// test that creatures attack twice
@Test
public void testCreaturesAttackTwice() {
@ -27,16 +27,18 @@ public class FuryOfTheHordeTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Craw Wurm");
addCard(Zone.BATTLEFIELD, playerA, "Goblin Roughrider");
addCard(Zone.HAND, playerA, "Fury of the Horde");
attack(3, playerA, "Craw Wurm");
attack(3, playerA, "Goblin Roughrider");
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Fury of the Horde");
attack(3, playerA, "Craw Wurm");
attack(3, playerA, "Goblin Roughrider");
setStopAt(3, PhaseStep.END_TURN);
execute();
this.assertLife(playerB, 2);
}
// test that creatures attack once
@ -46,17 +48,17 @@ public class FuryOfTheHordeTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Craw Wurm");
addCard(Zone.BATTLEFIELD, playerA, "Goblin Roughrider");
addCard(Zone.HAND, playerA, "Fury of the Horde");
attack(3, playerA, "Craw Wurm");
attack(3, playerA, "Goblin Roughrider");
setStopAt(3, PhaseStep.END_TURN);
execute();
this.assertLife(playerB, 11);
}
// test that only creatures that attacked attack twice
@Test
public void testCreaturesThatAttacked() {
@ -64,15 +66,16 @@ public class FuryOfTheHordeTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Craw Wurm");
addCard(Zone.BATTLEFIELD, playerA, "Goblin Roughrider");
addCard(Zone.HAND, playerA, "Fury of the Horde");
attack(3, playerA, "Craw Wurm");
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Fury of the Horde");
attack(3, playerA, "Craw Wurm");
setStopAt(3, PhaseStep.END_TURN);
execute();
this.assertLife(playerB, 8);
}
}

View file

@ -27,6 +27,10 @@
*/
package org.mage.test.player;
import java.io.Serializable;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mage.MageObject;
import mage.MageObjectReference;
import mage.abilities.*;
@ -50,7 +54,6 @@ import mage.filter.FilterPermanent;
import mage.filter.common.*;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.permanent.AttackingPredicate;
import mage.filter.predicate.permanent.SummoningSicknessPredicate;
import mage.game.Game;
import mage.game.Graveyard;
@ -71,11 +74,6 @@ import mage.target.*;
import mage.target.common.*;
import org.junit.Ignore;
import java.io.Serializable;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author BetaSteward_at_googlemail.com
* @author Simown
@ -585,7 +583,9 @@ public class TestPlayer implements Player {
public void selectAttackers(Game game, UUID attackingPlayerId) {
// Loop through players and validate can attack/block this turn
UUID defenderId = null;
for (PlayerAction action : actions) {
//List<PlayerAction>
for (Iterator<org.mage.test.player.PlayerAction> it = actions.iterator(); it.hasNext();) {
PlayerAction action = it.next();
if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("attack:")) {
String command = action.getAction();
command = command.substring(command.indexOf("attack:") + 7);
@ -623,14 +623,16 @@ public class TestPlayer implements Player {
findPermanent(firstFilter, groups[0], computerPlayer.getId(), game);
// Second check to filter creature for combat - less strict to workaround issue in #3038
FilterCreatureForCombat secondFilter = new FilterCreatureForCombat();
secondFilter.add(Predicates.not(new AttackingPredicate()));
// secondFilter.add(Predicates.not(new AttackingPredicate()));
secondFilter.add(Predicates.not(new SummoningSicknessPredicate()));
// TODO: Cannot enforce legal attackers multiple times per combat. See issue #3038
Permanent attacker = findPermanent(secondFilter, groups[0], computerPlayer.getId(), game, false);
if (attacker != null && attacker.canAttack(defenderId, game)) {
computerPlayer.declareAttacker(attacker.getId(), defenderId, game, false);
it.remove();
}
}
}
}