use of mage.abilities.mana.ManaOptions in project mage by magefree.
the class HarvestMageTest method test_AncientTomb.
@Test
public void test_AncientTomb() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Ancient Tomb", 1);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.HAND, playerA, "Silvercoat Lion");
// {G}, {T}, Discard a card: Until end of turn, if you tap a land for mana, it produces one mana of a color of your choice instead of any other type and amount.
// Creature 1/1 {G}
addCard(Zone.HAND, playerA, "Harvest Mage", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Harvest Mage");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{G}, {T}, Discard a card: Until end of turn");
setChoice(playerA, "Silvercoat Lion");
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Harvest Mage", 1);
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
assertManaOptions("{Any}{Any}", manaOptions);
}
use of mage.abilities.mana.ManaOptions in project mage by magefree.
the class NonTappingManaAbilitiesTest method testAvailableManaWithSpiritGuides.
@Test
public void testAvailableManaWithSpiritGuides() {
// Exile Simian Spirit Guide from your hand: Add {R}.
addCard(Zone.HAND, playerA, "Simian Spirit Guide", 1);
// Exile Simian Spirit Guide from your hand: Add {R}.
addCard(Zone.HAND, playerA, "Elvish Spirit Guide", 1);
setStopAt(1, PhaseStep.UPKEEP);
execute();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
assertManaOptions("{R}{G}", manaOptions);
}
use of mage.abilities.mana.ManaOptions in project mage by magefree.
the class NonTappingManaAbilitiesTest method TestCoalGolemAndDromarsAttendant.
@Test
public void TestCoalGolemAndDromarsAttendant() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
// {1}, Sacrifice Dromar's Attendant: Add {W}{U}{B}.
addCard(Zone.BATTLEFIELD, playerA, "Dromar's Attendant", 1);
// {3}, Sacrifice Coal Golem: Add {R}{R}{R}.
addCard(Zone.BATTLEFIELD, playerA, "Coal Golem", 1);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 3, manaOptions.size());
assertManaOptions("{G}", manaOptions);
assertManaOptions("{W}{U}{B}", manaOptions);
assertManaOptions("{R}{R}{R}", manaOptions);
}
use of mage.abilities.mana.ManaOptions in project mage by magefree.
the class ManaReflectionTest method ManaReflectionWithGoblinClearcutterTest.
@Test
public void ManaReflectionWithGoblinClearcutterTest() {
// If you tap a permanent for mana, it produces twice as much of that mana instead.
addCard(Zone.BATTLEFIELD, playerA, "Mana Reflection");
// {T}, Sacrifice a Forest: Add three mana in any combination of {R} and/or {G}.
addCard(Zone.BATTLEFIELD, playerA, "Goblin Clearcutter");
addCard(Zone.BATTLEFIELD, playerA, "Forest");
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
assertDuplicatedManaOptions(manaOptions);
Assert.assertEquals("mana variations don't fit", 4, manaOptions.size());
assertManaOptions("{R}{R}{R}{R}{R}{R}{G}{G}", manaOptions);
assertManaOptions("{R}{R}{R}{R}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{R}{R}{G}{G}{G}{G}{G}{G}", manaOptions);
assertManaOptions("{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
}
use of mage.abilities.mana.ManaOptions in project mage by magefree.
the class PlayerImpl method findActivatedAbilityFromPlayable.
protected ActivatedAbility findActivatedAbilityFromPlayable(MageObject object, ManaOptions availableMana, Ability ability, Game game) {
// special mana to pay spell cost
ManaOptions manaFull = availableMana.copy();
if (ability instanceof SpellAbility) {
for (AlternateManaPaymentAbility altAbility : CardUtil.getAbilities(object, game).stream().filter(a -> a instanceof AlternateManaPaymentAbility).map(a -> (AlternateManaPaymentAbility) a).collect(Collectors.toList())) {
ManaOptions manaSpecial = altAbility.getManaOptions(ability, game, ability.getManaCostsToPay());
manaFull.addMana(manaSpecial);
}
}
// replace alternative abilities by real play abilities (e.g. morph/facedown static ability by play land)
if (ability instanceof ActivatedManaAbilityImpl) {
// mana ability
if (((ActivatedManaAbilityImpl) ability).canActivate(this.getId(), game).canActivate()) {
return (ActivatedManaAbilityImpl) ability;
}
} else if (ability instanceof AlternativeSourceCosts) {
// alternative cost must be replaced by real play ability
return findActivatedAbilityFromAlternativeSourceCost(object, manaFull, ability, game);
} else if (ability instanceof ActivatedAbility) {
// all other activated ability
if (canPlay((ActivatedAbility) ability, manaFull, object, game)) {
return (ActivatedAbility) ability;
}
}
// non playable abilities like static
return null;
}
Aggregations