Fire discard cards event when discarding as a cost (#7436)

Fire discard cards event when discarding as a cost, fixes #7368
This commit is contained in:
smartinsempere 2021-01-31 20:03:30 +01:00 committed by GitHub
parent 2d96d36ec8
commit 68613672b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 79 additions and 1 deletions

View file

@ -0,0 +1,78 @@
package org.mage.test.cards.abilities.other;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author smartinsempere
*/
public class RielleTheEverwiseTest extends CardTestPlayerBase {
@Test
public void testRielleTheEverwiseAbilityDiscarding() {
addCard(Zone.HAND, playerA, "Faithless Looting");
addCard(Zone.HAND, playerA, "Brainwash");
addCard(Zone.HAND, playerA, "Brainwash");
addCard(Zone.HAND, playerA, "Brainwash");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.BATTLEFIELD, playerA, "Rielle, the Everwise");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Faithless Looting");
setChoice(playerA, "Brainwash"); // discard
setChoice(playerA, "Brainwash"); // discard
setStrictChooseMode(true);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertHandCount(playerA, 5);
}
@Test
public void testRielleTheEverwiseAbilityCycling() {
addCard(Zone.HAND, playerA, "Unearth");
addCard(Zone.HAND, playerA, "Brainwash");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
addCard(Zone.BATTLEFIELD, playerA, "Rielle, the Everwise");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling {2}");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertHandCount(playerA, 3);
}
@Test
public void testRielleTheEverwiseAbilityTransmute() {
addCard(Zone.HAND, playerA, "Tolaria West");
addCard(Zone.HAND, playerA, "Brainwash");
addCard(Zone.LIBRARY, playerA, "Memnite");
addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Zone.BATTLEFIELD, playerA, "Rielle, the Everwise");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transmute {1}{U}{U}");
addTarget(playerA, "Memnite");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertHandCount(playerA, 3);
}
}

View file

@ -783,7 +783,7 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public boolean discard(Card card, boolean payForCost, Ability source, Game game) {
return doDiscard(card, source, game, payForCost, false);
return doDiscard(card, source, game, payForCost, true);
}
private boolean doDiscard(Card card, Ability source, Game game, boolean payForCost, boolean fireFinalEvent) {