mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
* Fixed that casting spells without mana costs did not work correctly for spells with mono hybrid mana costs (e.g. Beseech the Queen by Omniscience) fixes #1404.
This commit is contained in:
parent
2619202931
commit
259d6744ae
3 changed files with 133 additions and 23 deletions
|
|
@ -41,4 +41,27 @@ public class OmniscienceTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Knight of the White Orchid", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* If you cast a card with monocolored hybrid mana with Omniscience's
|
||||
* alternate casting cost, you will be asked to pay 1 colorless mana per
|
||||
* monocolored hybrid mana in its cost. For example, while casting Beseech
|
||||
* the Queen, you are asked to pay {1}{1}{1}.
|
||||
*/
|
||||
@Test
|
||||
public void testMonocoloredHybridMana() {
|
||||
// You may cast nonland cards from your hand without paying their mana costs.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Omniscience", 1);
|
||||
|
||||
// ({2B} can be paid with any two mana or with {B}. This card's converted mana cost is 6.)
|
||||
// Search your library for a card with converted mana cost less than or equal to the number of lands you control, reveal it, and put it into your hand. Then shuffle your library.
|
||||
addCard(Zone.HAND, playerA, "Beseech the Queen", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Beseech the Queen");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
// Beseech the Queen is cast because it is free
|
||||
assertGraveyardCount(playerA, "Beseech the Queen", 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.mana.BasicManaAbility;
|
||||
|
|
@ -14,6 +15,7 @@ import mage.abilities.mana.RedManaAbility;
|
|||
import mage.abilities.mana.WhiteManaAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.ManaUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
|
@ -125,6 +127,49 @@ public class ManaUtilTest extends CardTestPlayerBase {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Mana.enough is used to check if a spell can be cast with an given amount
|
||||
* of avalable mana
|
||||
*/
|
||||
@Test
|
||||
public void testManaIncrease() {
|
||||
// cost - reduction - rest
|
||||
testManaReduction("{G}{G}", "{G}", "{G}");
|
||||
testManaReduction("{1}{G}{G}", "{G}", "{1}{G}");
|
||||
testManaReduction("{B}{B}", "{B}", "{B}");
|
||||
testManaReduction("{1}{B}{B}", "{B}", "{1}{B}");
|
||||
testManaReduction("{W}{W}", "{W}", "{W}");
|
||||
testManaReduction("{1}{W}{W}", "{W}", "{1}{W}");
|
||||
testManaReduction("{U}{U}", "{U}", "{U}");
|
||||
testManaReduction("{1}{U}{U}", "{U}", "{1}{U}");
|
||||
testManaReduction("{R}{R}", "{R}", "{R}");
|
||||
testManaReduction("{1}{R}{R}", "{R}", "{1}{R}");
|
||||
|
||||
testManaReduction("{R}{G}{B}{U}{W}", "{R}{G}{B}{U}{W}", "{0}");
|
||||
|
||||
// Hybrid Mana
|
||||
testManaReduction("{2/B}{2/B}{2/B}", "{B}{B}", "{2/B}");
|
||||
testManaReduction("{2/B}{2/B}{2/B}", "{B}{B}{B}", "{0}");
|
||||
testManaReduction("{2/W}{2/W}{2/W}", "{W}{W}", "{2/W}");
|
||||
testManaReduction("{2/W}{2/W}{2/W}", "{W}{W}{W}", "{0}");
|
||||
|
||||
testManaReduction("{G/B}{G/B}{G/B}", "{B}{G}{B}", "{0}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given mana reduction left the expected amount of mana costs
|
||||
*
|
||||
* @param manaCostsToPay
|
||||
* @param availablyAny
|
||||
* @param available
|
||||
* @param expected
|
||||
*/
|
||||
private void testManaReduction(String manaCostsToPay, String manaToReduce, String restMana) {
|
||||
SpellAbility spellAbility = new SpellAbility(new ManaCostsImpl(manaCostsToPay), "Test");
|
||||
CardUtil.adjustCost(spellAbility, new ManaCostsImpl(manaToReduce), true);
|
||||
Assert.assertTrue("The mana cost to pay " + manaCostsToPay + " reduced by " + manaToReduce + " should left " + restMana + " but the rest was " + spellAbility.getManaCostsToPay().getText(), spellAbility.getManaCostsToPay().getText().equals(restMana));
|
||||
}
|
||||
|
||||
/**
|
||||
* Common way to test ManaUtil.tryToAutoPay
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue