* Voice of Resurgence - Fixed a bug that the dies trigger did not work correctly if Voice of Resurgence was copied e.g. by a Phantasmal Image.

This commit is contained in:
LevelX2 2016-03-20 09:05:39 +01:00
parent c347dc18b4
commit 672ac28931
6 changed files with 46 additions and 13 deletions

View file

@ -80,6 +80,7 @@ class VoiceOfResurgenceTriggeredAbility extends TriggeredAbilityImpl {
public VoiceOfResurgenceTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new VoiceOfResurgenceToken()), false);
setLeavesTheBattlefieldTrigger(true);
}
public VoiceOfResurgenceTriggeredAbility(final VoiceOfResurgenceTriggeredAbility ability) {

View file

@ -576,4 +576,35 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
assertPermanentCount(playerB, "Wurm", 2);
}
/**
* A Phantasmal Image that was copying a Voice of Resurgence died and left
* no token behind.
*/
@Test
public void testVoiceOfResurgence() {
// Whenever an opponent casts a spell during your turn or when Voice of Resurgence dies, put a green and white Elemental creature token onto the battlefield with "This creature's power and toughness are each equal to the number of creatures you control."
addCard(Zone.BATTLEFIELD, playerB, "Voice of Resurgence");
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
addCard(Zone.HAND, playerA, "Phantasmal Image");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Phantasmal Image"); // not targeted
setChoice(playerB, "Voice of Resurgence");
attack(2, playerB, "Voice of Resurgence");
block(2, playerA, "Voice of Resurgence", "Voice of Resurgence");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerB, 20);
assertLife(playerA, 20);
assertGraveyardCount(playerA, "Phantasmal Image", 1);
assertGraveyardCount(playerB, "Voice of Resurgence", 1);
assertPermanentCount(playerB, "Elemental", 1);
assertPermanentCount(playerA, "Elemental", 1);
}
}

View file

@ -29,6 +29,7 @@ package org.mage.test.cards.triggers.dies;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.filter.Filter;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -72,8 +73,8 @@ public class VoiceOfResurgenceTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Treachery", 1);
assertGraveyardCount(playerB, "Voice of Resurgence", 1);
assertPermanentCount(playerA, "Elemental", 1);
assertPowerToughness(playerA, "Elemental", 2, 2);
assertPermanentCount(playerA, "Elemental", 2); // one from the Lightning Bolt and one from the Voice of Resurgence dying
assertPowerToughness(playerA, "Elemental", 3, 3, Filter.ComparisonScope.All);
assertTappedCount("Island", true, 0);
}

View file

@ -42,7 +42,7 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
super(Outcome.Benefit);
this.additionalEffect = additionalEffect;
this.staticText = "exile {this}, then return " + (gender.equals(Gender.MALE) ? "him" : "her")
+ " to the battlefield transformed under" + (gender.equals(Gender.MALE) ? "his" : "her") + " owner's control";
+ " to the battlefield transformed under " + (gender.equals(Gender.MALE) ? "his" : "her") + " owner's control";
}
public ExileAndReturnTransformedSourceEffect(final ExileAndReturnTransformedSourceEffect effect) {

View file

@ -24,14 +24,13 @@
* 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.choices;
import java.util.ArrayList;
import java.util.List;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
@ -43,11 +42,12 @@ public class Choices extends ArrayList<Choice> {
protected Outcome outcome;
public Choices() {}
public Choices() {
}
public Choices(final Choices choices) {
this.outcome = choices.outcome;
for (Choice choice: choices) {
for (Choice choice : choices) {
this.add(choice.copy());
}
}
@ -57,8 +57,8 @@ public class Choices extends ArrayList<Choice> {
}
public List<Choice> getUnchosen() {
List<Choice> unchosen = new ArrayList<Choice>();
for (Choice choice: this) {
List<Choice> unchosen = new ArrayList<>();
for (Choice choice : this) {
if (!choice.isChosen()) {
unchosen.add(choice);
}
@ -67,13 +67,13 @@ public class Choices extends ArrayList<Choice> {
}
public void clearChosen() {
for (Choice choice: this) {
for (Choice choice : this) {
choice.clearChoice();
}
}
public boolean isChosen() {
for (Choice choice: this) {
for (Choice choice : this) {
if (!choice.isChosen()) {
return false;
}

View file

@ -753,7 +753,7 @@ public interface Player extends MageItem, Copyable<Player> {
/**
* Uses card.moveToZone and posts a inform message about moving the card to
* graveyard into the game log
* library into the game log
*
* @param card
* @param sourceId