* Fixed a problem that tapped for mana event was sent twice (fixes problem of 2 created spirits for Forbidden Orchard).

This commit is contained in:
LevelX2 2018-06-10 10:28:00 +02:00
parent 984bc0871b
commit 99864ccf5b
4 changed files with 50 additions and 16 deletions

View file

@ -1,5 +1,5 @@
/*
*
*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
@ -25,7 +25,7 @@
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*
*
*/
package mage.cards.f;
@ -48,17 +48,17 @@ import mage.target.common.TargetOpponent;
*/
public final class ForbiddenOrchard extends CardImpl {
public ForbiddenOrchard (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},null);
public ForbiddenOrchard(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, null);
// {T}: Add one mana of any color.
this.addAbility(new AnyColorManaAbility());
// Whenever you tap Forbidden Orchard for mana, create a 1/1 colorless Spirit creature token under target opponent's control.
this.addAbility(new ForbiddenOrchardTriggeredAbility());
}
public ForbiddenOrchard (final ForbiddenOrchard card) {
public ForbiddenOrchard(final ForbiddenOrchard card) {
super(card);
}
@ -83,7 +83,7 @@ class ForbiddenOrchardTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getSourceId().equals(getSourceId());
@ -91,7 +91,7 @@ class ForbiddenOrchardTriggeredAbility extends TriggeredAbilityImpl {
@Override
public String getRule() {
return new StringBuilder("Whenever you tap {this} for mana, ").append(super.getRule()).toString() ;
return "Whenever you tap {this} for mana, " + super.getRule();
}
@Override

View file

@ -210,12 +210,12 @@ public class ConstellationTest extends CardTestPlayerBase {
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Mephidross Vampire"); // give vampire to creatures
} else {
// Make sure not white mana is used here to cast the vampire
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {B}");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Mephidross Vampire"); // give vampire to creatures
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Archetype of Courage"); // make dax to creature
}

View file

@ -0,0 +1,35 @@
package org.mage.test.cards.mana;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class ForbiddenOrchardTest extends CardTestPlayerBase {
@Test
public void testSpiritCreation() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
// {T}: Add one mana of any color.
// Whenever you tap Forbidden Orchard for mana, create a 1/1 colorless Spirit creature token under target opponent's control.
addCard(Zone.BATTLEFIELD, playerA, "Forbidden Orchard", 1);
addCard(Zone.HAND, playerA, "Silvercoat Lion", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertPermanentCount(playerB, "Spirit", 1);
assertPermanentCount(playerA, "Spirit", 0);
}
}

View file

@ -47,7 +47,6 @@ public class AddManaOfAnyColorEffect extends BasicManaEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
checkToFirePossibleEvents(getMana(game, source), game, source);
controller.getManaPool().addMana(getMana(game, source), game, source);
return true;
}