* Sasaya's Essence - Fixed not correctly working mana production.

This commit is contained in:
LevelX2 2018-06-09 12:04:22 +02:00
parent 006af33625
commit 4ceffd17ef
2 changed files with 59 additions and 9 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.s;
import java.util.UUID;
@ -100,7 +99,7 @@ class SasayasEssence extends TokenImpl {
// 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.
this.addAbility(new TapForManaAllTriggeredManaAbility(
new SasayasEssenceManaEffectEffect(),
new SasayasEssenceManaEffect(),
new FilterControlledLandPermanent(), SetTargetPointer.PERMANENT));
}
@ -114,28 +113,28 @@ class SasayasEssence extends TokenImpl {
}
}
class SasayasEssenceManaEffectEffect extends ManaEffect {
class SasayasEssenceManaEffect extends ManaEffect {
public SasayasEssenceManaEffectEffect() {
public SasayasEssenceManaEffect() {
super();
this.staticText = "for each other land you control with the same name, add one mana of any type that land produced";
}
public SasayasEssenceManaEffectEffect(final SasayasEssenceManaEffectEffect effect) {
public SasayasEssenceManaEffect(final SasayasEssenceManaEffect effect) {
super(effect);
}
@Override
public SasayasEssenceManaEffectEffect copy() {
return new SasayasEssenceManaEffectEffect(this);
public SasayasEssenceManaEffect copy() {
return new SasayasEssenceManaEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.getManaPool().addMana(getMana(game, source), game, source);
checkToFirePossibleEvents(getMana(game, source), game, source);
controller.getManaPool().addMana(getMana(game, source), game, source);
return true;
}
@ -211,7 +210,7 @@ class SasayasEssenceManaEffectEffect extends ManaEffect {
}
}
return mana;
return newMana;
}
return null;
}

View file

@ -0,0 +1,51 @@
package org.mage.test.cards.flip;
import mage.abilities.mana.ManaOptions;
import mage.constants.ManaType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import static org.mage.test.utils.ManaOptionsTestUtils.assertDuplicatedManaOptions;
import static org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions;
/**
*
* @author LevelX2
*/
public class SasayaOrochiAscendantTest extends CardTestPlayerBase {
@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.
addCard(Zone.HAND, playerA, "Upwelling", 1); // Enchantment {3}{G}
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");
setStopAt(1, PhaseStep.END_TURN);
execute();
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}", manaOptions);
}
}