* Essence of the Wild - Fixed the copy effect.

This commit is contained in:
LevelX2 2020-07-21 00:20:12 +02:00
parent 601fb525a8
commit 7f3b24365e
4 changed files with 48 additions and 23 deletions

View file

@ -1,5 +1,6 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.ConditionalMana; import mage.ConditionalMana;
import mage.MageInt; import mage.MageInt;
import mage.Mana; import mage.Mana;
@ -24,8 +25,6 @@ import mage.constants.SubType;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import java.util.UUID;
/** /**
* @author TheElk801 * @author TheElk801
*/ */
@ -45,9 +44,8 @@ public final class CrypticTrilobite extends CardImpl {
// Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities. // Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities.
this.addAbility(new ConditionalColorlessManaAbility( this.addAbility(new ConditionalColorlessManaAbility(
new RemoveCountersSourceCost( new RemoveCountersSourceCost(CounterType.P1P1.createInstance()),
CounterType.P1P1.createInstance() 2, new CrypticTrilobiteManaBuilder()
), 2, new CrypticTrilobiteManaBuilder()
)); ));
// {1}, {T}: Put a +1/+1 counter on Cryptic Trilobite. // {1}, {T}: Put a +1/+1 counter on Cryptic Trilobite.

View file

@ -1,10 +1,10 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CopyEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
@ -14,8 +14,6 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
* @author BetaSteward * @author BetaSteward
*/ */
@ -68,7 +66,7 @@ class EssenceOfTheWildEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourceObject != null) { if (sourceObject != null) {
game.addEffect(new CopyEffect(Duration.Custom, sourceObject, event.getTargetId()), source); game.copyPermanent(sourceObject, event.getTargetId(), source, null);
} }
return false; return false;
} }

View file

@ -7,7 +7,6 @@ import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect; import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
@ -19,7 +18,6 @@ import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.target.targetpointer.FixedTargets;
/** /**
* @author TheElk801 * @author TheElk801

View file

@ -1,19 +1,19 @@
package org.mage.test.cards.copy; package org.mage.test.cards.copy;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.game.Game;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* @author JayDi85 * @author JayDi85
@ -22,7 +22,6 @@ public class EssenceOfTheWildCopyTest extends CardTestPlayerBase {
// Essence of the Wild {3}{G}{G}{G} // Essence of the Wild {3}{G}{G}{G}
// Creatures you control enter the battlefield as a copy of Essence of the Wild. // Creatures you control enter the battlefield as a copy of Essence of the Wild.
private Permanent findCopyPermanent(Game game, int num) { private Permanent findCopyPermanent(Game game, int num) {
int currentCopyNumber = 1; int currentCopyNumber = 1;
for (Permanent perm : game.getBattlefield().getAllActivePermanents()) { for (Permanent perm : game.getBattlefield().getAllActivePermanents()) {
@ -169,4 +168,36 @@ public class EssenceOfTheWildCopyTest extends CardTestPlayerBase {
Assert.assertEquals("copy must have 6 p/t", 6, copy.getPower().getValue()); Assert.assertEquals("copy must have 6 p/t", 6, copy.getPower().getValue());
Assert.assertEquals("copy must have 6 p/t", 6, copy.getToughness().getValue()); Assert.assertEquals("copy must have 6 p/t", 6, copy.getToughness().getValue());
} }
@Test
public void testCopyFromTheCopy() {
// Creatures you control enter the battlefield as a copy of Essence of the Wild.
addCard(Zone.BATTLEFIELD, playerA, "Essence of the Wild", 1);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
addCard(Zone.HAND, playerA, "Silvercoat Lion", 2);
// Destroy target nonartifact, nonblack creature. It can't be regenerated.
addCard(Zone.HAND, playerB, "Terror", 1); // Instant {1}{B}
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion");
castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Terror", "Essence of the Wild[no copy]");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Silvercoat Lion");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertGraveyardCount(playerB, "Terror", 1);
assertGraveyardCount(playerA, "Essence of the Wild", 1);
assertPermanentCount(playerA, "Silvercoat Lion", 0);
assertPermanentCount(playerA, "Essence of the Wild", 2);
assertPowerToughness(playerA, "Essence of the Wild", 6, 6, Filter.ComparisonScope.All);
}
} }