Search in sources :

Example 76 with ManaOptions

use of mage.abilities.mana.ManaOptions in project mage by magefree.

the class SasayaOrochiAscendantTest method testSasayasEssence2.

@Test
public void testSasayasEssence2() {
    addCard(Zone.HAND, playerA, "Plains", 7);
    addCard(Zone.BATTLEFIELD, playerA, "Brushland", 3);
    // Reveal your hand: If you have seven or more land cards in your hand, flip Sasaya, Orochi Ascendant.
    // Sasaya's Essence: Legendary Enchantment
    // Whenever a land you control is tapped for mana, for each other land you control with the same name, add one mana of any type that land produced.
    addCard(Zone.BATTLEFIELD, playerA, "Sasaya, Orochi Ascendant", 1);
    // Mana pools don't empty as steps and phases end.
    // Enchantment {3}{G}
    addCard(Zone.HAND, playerA, "Upwelling", 1);
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reveal your hand: If you have seven or more land cards in your hand, flip");
    activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
    activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
    castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Upwelling");
    setStrictChooseMode(true);
    setStopAt(1, PhaseStep.END_TURN);
    execute();
    assertAllCommandsUsed();
    assertPermanentCount(playerA, "Sasaya's Essence", 1);
    assertPermanentCount(playerA, "Upwelling", 1);
    assertManaPool(playerA, ManaType.GREEN, 2);
    assertLife(playerA, 18);
    ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
    assertDuplicatedManaOptions(manaOptions);
    Assert.assertEquals("mana variations don't fit", 3, manaOptions.size());
    assertManaOptions("{C}{C}{C}{G}{G}", manaOptions);
    assertManaOptions("{G}{G}{G}{G}{G}", manaOptions);
    assertManaOptions("{G}{G}{W}{W}{W}", manaOptions);
}
Also used : ManaOptions(mage.abilities.mana.ManaOptions) ManaOptionsTestUtils.assertManaOptions(org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions) ManaOptionsTestUtils.assertDuplicatedManaOptions(org.mage.test.utils.ManaOptionsTestUtils.assertDuplicatedManaOptions) Test(org.junit.Test)

Example 77 with ManaOptions

use of mage.abilities.mana.ManaOptions in project mage by magefree.

the class SasayaOrochiAscendantTest method testSasayasEssence.

@Test
public void testSasayasEssence() {
    addCard(Zone.HAND, playerA, "Plains", 7);
    addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
    // Reveal your hand: If you have seven or more land cards in your hand, flip Sasaya, Orochi Ascendant.
    // Sasaya's Essence: Legendary Enchantment
    // Whenever a land you control is tapped for mana, for each other land you control with the same name, add one mana of any type that land produced.
    addCard(Zone.BATTLEFIELD, playerA, "Sasaya, Orochi Ascendant", 1);
    // Mana pools don't empty as steps and phases end.
    // Enchantment {3}{G}
    addCard(Zone.HAND, playerA, "Upwelling", 1);
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reveal your hand: If you have seven or more land cards in your hand, flip");
    activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
    activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
    castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Upwelling");
    setStrictChooseMode(true);
    setStopAt(1, PhaseStep.END_TURN);
    execute();
    assertAllCommandsUsed();
    assertPermanentCount(playerA, "Sasaya's Essence", 1);
    assertPermanentCount(playerA, "Upwelling", 1);
    assertManaPool(playerA, ManaType.GREEN, 2);
    ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
    assertDuplicatedManaOptions(manaOptions);
    Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
    assertManaOptions("{G}{G}{G}{G}{G}", manaOptions);
}
Also used : ManaOptions(mage.abilities.mana.ManaOptions) ManaOptionsTestUtils.assertManaOptions(org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions) ManaOptionsTestUtils.assertDuplicatedManaOptions(org.mage.test.utils.ManaOptionsTestUtils.assertDuplicatedManaOptions) Test(org.junit.Test)

Example 78 with ManaOptions

use of mage.abilities.mana.ManaOptions in project mage by magefree.

the class SasayaOrochiAscendantTest method testSasayasEssence3.

@Test
public void testSasayasEssence3() {
    addCard(Zone.HAND, playerA, "Plains", 7);
    addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
    // {1}, {T}: Add {R}{G}.
    addCard(Zone.BATTLEFIELD, playerA, "Mossfire Valley", 2);
    // Reveal your hand: If you have seven or more land cards in your hand, flip Sasaya, Orochi Ascendant.
    // Sasaya's Essence: Legendary Enchantment
    // Whenever a land you control is tapped for mana, for each other land you control with the same name, add one mana of any type that land produced.
    addCard(Zone.BATTLEFIELD, playerA, "Sasaya, Orochi Ascendant", 1);
    // Mana pools don't empty as steps and phases end.
    // Enchantment {3}{G}
    addCard(Zone.HAND, playerA, "Upwelling", 1);
    activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reveal your hand: If you have seven or more land cards in your hand, flip");
    activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
    activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {G}");
    castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Upwelling");
    setStrictChooseMode(true);
    setStopAt(1, PhaseStep.END_TURN);
    execute();
    assertAllCommandsUsed();
    assertPermanentCount(playerA, "Sasaya's Essence", 1);
    assertPermanentCount(playerA, "Upwelling", 1);
    assertManaPool(playerA, ManaType.GREEN, 2);
    assertLife(playerA, 20);
    ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
    assertDuplicatedManaOptions(manaOptions);
    Assert.assertEquals("mana variations don't fit", 4, manaOptions.size());
    assertManaOptions("{R}{R}{R}{R}{G}{G}{G}{G}{G}", manaOptions);
    assertManaOptions("{R}{R}{R}{G}{G}{G}{G}{G}{G}", manaOptions);
    assertManaOptions("{R}{R}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
    assertManaOptions("{R}{G}{G}{G}{G}{G}{G}{G}{G}", manaOptions);
}
Also used : ManaOptions(mage.abilities.mana.ManaOptions) ManaOptionsTestUtils.assertManaOptions(org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions) ManaOptionsTestUtils.assertDuplicatedManaOptions(org.mage.test.utils.ManaOptionsTestUtils.assertDuplicatedManaOptions) Test(org.junit.Test)

Example 79 with ManaOptions

use of mage.abilities.mana.ManaOptions in project mage by magefree.

the class EmergeAbility method getMinimumCostToActivate.

@Override
public ManaOptions getMinimumCostToActivate(UUID playerId, Game game) {
    int maxCMC = 0;
    for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), playerId, this.getSourceId(), game)) {
        int cmc = creature.getManaValue();
        if (cmc > maxCMC) {
            maxCMC = cmc;
        }
    }
    ManaOptions manaOptions = super.getMinimumCostToActivate(playerId, game);
    for (Mana mana : manaOptions) {
        if (mana.getGeneric() > maxCMC) {
            mana.setGeneric(mana.getGeneric() - maxCMC);
        } else {
            mana.setGeneric(0);
        }
    }
    return manaOptions;
}
Also used : ManaOptions(mage.abilities.mana.ManaOptions) Mana(mage.Mana) Permanent(mage.game.permanent.Permanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent)

Example 80 with ManaOptions

use of mage.abilities.mana.ManaOptions in project mage by magefree.

the class ConvokeEffect method getManaOptions.

@Override
public ManaOptions getManaOptions(Ability source, Game game, ManaCost unpaid) {
    ManaOptions options = new ManaOptions();
    FilterControlledCreaturePermanent filterBasic = new FilterControlledCreaturePermanent();
    // each creature can give {1} or color mana
    game.getBattlefield().getActivePermanents(filterBasic, source.getControllerId(), source.getSourceId(), game).stream().filter(permanent -> !permanent.isTapped()).forEach(permanent -> {
        ManaOptions permMana = new ManaOptions();
        permMana.add(Mana.GenericMana(1));
        for (ObjectColor color : permanent.getColor(game).getColors()) {
            if (color.isBlack())
                permMana.add(Mana.BlackMana(1));
            if (color.isBlue())
                permMana.add(Mana.BlueMana(1));
            if (color.isGreen())
                permMana.add(Mana.GreenMana(1));
            if (color.isRed())
                permMana.add(Mana.RedMana(1));
            if (color.isWhite())
                permMana.add(Mana.WhiteMana(1));
        }
        options.addMana(permMana);
    });
    options.removeDuplicated();
    return options;
}
Also used : Target(mage.target.Target) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Zone(mage.constants.Zone) SpecialAction(mage.abilities.SpecialAction) TappedPredicate(mage.filter.predicate.permanent.TappedPredicate) Predicates(mage.filter.predicate.Predicates) Player(mage.players.Player) ArrayList(java.util.ArrayList) ManaOptions(mage.abilities.mana.ManaOptions) ValueHint(mage.abilities.hint.ValueHint) AbilityType(mage.constants.AbilityType) ManaPool(mage.players.ManaPool) ManaCost(mage.abilities.costs.mana.ManaCost) Locale(java.util.Locale) ManaType(mage.constants.ManaType) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) ColorPredicate(mage.filter.predicate.mageobject.ColorPredicate) Spell(mage.game.stack.Spell) ObjectColor(mage.ObjectColor) ChoiceColor(mage.choices.ChoiceColor) Choice(mage.choices.Choice) ActivationManaAbilityStep(mage.abilities.costs.mana.ActivationManaAbilityStep) AlternateManaPaymentAbility(mage.abilities.costs.mana.AlternateManaPaymentAbility) Outcome(mage.constants.Outcome) OneShotEffect(mage.abilities.effects.OneShotEffect) UUID(java.util.UUID) Game(mage.game.Game) List(java.util.List) GameEvent(mage.game.events.GameEvent) Permanent(mage.game.permanent.Permanent) PermanentsOnBattlefieldCount(mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) Mana(mage.Mana) Ability(mage.abilities.Ability) ManaOptions(mage.abilities.mana.ManaOptions) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) ObjectColor(mage.ObjectColor)

Aggregations

ManaOptions (mage.abilities.mana.ManaOptions)99 Test (org.junit.Test)85 ManaOptionsTestUtils.assertManaOptions (org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions)75 ManaOptionsTestUtils.assertDuplicatedManaOptions (org.mage.test.utils.ManaOptionsTestUtils.assertDuplicatedManaOptions)38 Permanent (mage.game.permanent.Permanent)9 Mana (mage.Mana)8 Player (mage.players.Player)5 ActivatedManaAbilityImpl (mage.abilities.mana.ActivatedManaAbilityImpl)4 FilterCard (mage.filter.FilterCard)4 FilterPermanent (mage.filter.FilterPermanent)4 TargetPermanent (mage.target.TargetPermanent)4 AlternateManaPaymentAbility (mage.abilities.costs.mana.AlternateManaPaymentAbility)3 ManaCost (mage.abilities.costs.mana.ManaCost)3 ValueHint (mage.abilities.hint.ValueHint)3 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)3 UUID (java.util.UUID)2 ConditionalMana (mage.ConditionalMana)2 PassAbility (mage.abilities.common.PassAbility)2 PlayLandAsCommanderAbility (mage.abilities.common.PlayLandAsCommanderAbility)2 WhileSearchingPlayFromLibraryAbility (mage.abilities.common.WhileSearchingPlayFromLibraryAbility)2