mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Fixed a bug that prevented to show cards as playable if castable by alternateSourceCosts (fixes Dream Halls problem related to #6698).
This commit is contained in:
parent
c48331f216
commit
818952bf2d
2 changed files with 8 additions and 4 deletions
|
@ -13,22 +13,26 @@ public class UseAlternateSourceCostsTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void DreamHallsCastColoredSpell() {
|
public void DreamHallsCastColoredSpell() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
// Rather than pay the mana cost for a spell, its controller may discard a card that shares a color with that spell.
|
// Rather than pay the mana cost for a spell, its controller may discard a card that shares a color with that spell.
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Dream Halls", 1);
|
addCard(Zone.BATTLEFIELD, playerA, "Dream Halls", 1);
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); // Add the mountains so the spell is included in teh available spells
|
|
||||||
|
|
||||||
addCard(Zone.HAND, playerA, "Gray Ogre", 1); // Creature 3/1
|
addCard(Zone.HAND, playerA, "Gray Ogre", 1); // Creature 3/1
|
||||||
addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
|
addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
|
||||||
|
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gray Ogre"); // Cast Orgre by discarding the Lightning Bolt
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gray Ogre"); // Cast Orgre by discarding the Lightning Bolt
|
||||||
|
setChoice(playerA, "Yes"); // Pay alternative costs? (Discard a card that shares a color with that spell)
|
||||||
|
setChoice(playerA, "Lightning Bolt");
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
//Gray Ogre is cast with the discard
|
//Gray Ogre is cast with the discard
|
||||||
assertPermanentCount(playerA, "Gray Ogre", 1);
|
assertPermanentCount(playerA, "Gray Ogre", 1);
|
||||||
assertGraveyardCount(playerA, "Lightning Bolt", 1);
|
assertGraveyardCount(playerA, "Lightning Bolt", 1);
|
||||||
assertTapped("Mountain", false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -3208,7 +3208,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
// if cast for noMana no Alternative costs are allowed
|
// if cast for noMana no Alternative costs are allowed
|
||||||
if (alternateSourceCostsAbility instanceof AlternativeSourceCosts) {
|
if (alternateSourceCostsAbility instanceof AlternativeSourceCosts) {
|
||||||
if (((AlternativeSourceCosts) alternateSourceCostsAbility).isAvailable(ability, game)) {
|
if (((AlternativeSourceCosts) alternateSourceCostsAbility).isAvailable(ability, game)) {
|
||||||
if (alternateSourceCostsAbility.getCosts().canPay(ability, playerId, playerId, game)) {
|
if (alternateSourceCostsAbility.getCosts().canPay(ability, sourceObject.getId(), playerId, game)) {
|
||||||
ManaCostsImpl manaCosts = new ManaCostsImpl();
|
ManaCostsImpl manaCosts = new ManaCostsImpl();
|
||||||
for (Cost cost : alternateSourceCostsAbility.getCosts()) {
|
for (Cost cost : alternateSourceCostsAbility.getCosts()) {
|
||||||
if (cost instanceof ManaCost) {
|
if (cost instanceof ManaCost) {
|
||||||
|
@ -3250,7 +3250,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
for (AlternativeSourceCosts alternateSourceCosts : getAlternativeSourceCosts()) {
|
for (AlternativeSourceCosts alternateSourceCosts : getAlternativeSourceCosts()) {
|
||||||
if (alternateSourceCosts instanceof Ability) {
|
if (alternateSourceCosts instanceof Ability) {
|
||||||
if (alternateSourceCosts.isAvailable(ability, game)) {
|
if (alternateSourceCosts.isAvailable(ability, game)) {
|
||||||
if (((Ability) alternateSourceCosts).getCosts().canPay(ability, playerId, playerId, game)) {
|
if (((Ability) alternateSourceCosts).getCosts().canPay(ability, sourceObject.getId(), playerId, game)) {
|
||||||
ManaCostsImpl manaCosts = new ManaCostsImpl();
|
ManaCostsImpl manaCosts = new ManaCostsImpl();
|
||||||
for (Cost cost : ((Ability) alternateSourceCosts).getCosts()) {
|
for (Cost cost : ((Ability) alternateSourceCosts).getCosts()) {
|
||||||
if (cost instanceof ManaCost) {
|
if (cost instanceof ManaCost) {
|
||||||
|
|
Loading…
Reference in a new issue