Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 2 additions & 39 deletions Mage.Sets/src/mage/cards/g/GenesisOfTheDaleks.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import mage.abilities.Ability;
import mage.abilities.common.SagaAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DestroyAllEffect;
Expand All @@ -19,7 +18,6 @@
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.DalekToken;
import mage.players.Player;
import mage.target.common.TargetOpponent;
Expand All @@ -44,7 +42,7 @@ public GenesisOfTheDaleks(UUID ownerId, CardSetInfo setInfo) {
// I, II, III -- Create a 3/3 black Dalek artifact creature token with menace for each lore counter on Genesis of the Daleks.
sagaAbility.addChapterEffect(
this, SagaChapter.CHAPTER_I, SagaChapter.CHAPTER_III,
new CreateTokenEffect(new DalekToken(), GenesisOfTheDaleksValue.instance)
new CreateTokenEffect(new DalekToken(), new CountersSourceCount(CounterType.LORE))
);

// IV -- Target opponent faces a villainous choice -- Destroy all Dalek creatures and each of your opponents loses life equal to the total power of Daleks that died this turn, or destroy all non-Dalek creatures.
Expand All @@ -65,41 +63,6 @@ public GenesisOfTheDaleks copy() {
}
}

enum GenesisOfTheDaleksValue implements DynamicValue {
instance;

@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent permanent = sourceAbility.getSourcePermanentOrLKI(game);
if (permanent != null) {
return permanent
.getCounters(game)
.getCount(CounterType.LORE);
}
return Optional
.ofNullable(sourceAbility)
.map(Ability::getSourceId)
.map(game::getPermanentOrLKIBattlefield)
.map(p -> p.getCounters(game).getCount(CounterType.LORE))
.orElse(0);
}

@Override
public GenesisOfTheDaleksValue copy() {
return this;
}

@Override
public String getMessage() {
return "lore counter on {this}";
}

@Override
public String toString() {
return "1";
}
}

class GenesisOfTheDaleksEffect extends OneShotEffect {

private static final FaceVillainousChoice choice = new FaceVillainousChoice(
Expand Down
13 changes: 5 additions & 8 deletions Mage.Sets/src/mage/cards/l/LongListOfTheEnts.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public LongListOfTheEnts copy() {
return new LongListOfTheEnts(this);
}

static String getKey(Game game, Ability source, int offset) {
return "EntList_" + source.getSourceId() + "_" + (offset + CardUtil.getActualSourceObjectZoneChangeCounter(game, source));
static String getKey(Game game, Ability source) {
return "EntList_" + source.getSourceId() + "_" + CardUtil.getActualSourceObjectZoneChangeCounter(game, source);
}

}
Expand All @@ -67,7 +67,7 @@ public String getText(Game game, Ability ability) {
if (ability.getSourcePermanentIfItStillExists(game) == null) {
return null;
}
Set<SubType> subTypes = (Set<SubType>) game.getState().getValue(LongListOfTheEnts.getKey(game, ability, 0));
Set<SubType> subTypes = (Set<SubType>) game.getState().getValue(LongListOfTheEnts.getKey(game, ability));
if (subTypes == null || subTypes.isEmpty()) {
return "No creature types have been noted yet.";
}
Expand Down Expand Up @@ -109,14 +109,11 @@ public boolean apply(Game game, Ability source) {
return false;
}

Object existingEntList = game.getState().getValue(LongListOfTheEnts.getKey(game, source, 0));
int offset;
Object existingEntList = game.getState().getValue(LongListOfTheEnts.getKey(game, source));
Set<SubType> newEntList;
if (existingEntList == null) {
offset = 1; // zcc is off-by-one due to still entering battlefield
newEntList = new LinkedHashSet<>();
} else {
offset = 0;
newEntList = new LinkedHashSet<>((Set<SubType>) existingEntList);
}
Set<String> chosenTypes = newEntList
Expand All @@ -132,7 +129,7 @@ public boolean apply(Game game, Ability source) {
SubType subType = SubType.byDescription(choice.getChoiceKey());
game.informPlayers(player.getLogName() + " notes the creature type " + subType);
newEntList.add(subType);
game.getState().setValue(LongListOfTheEnts.getKey(game, source, offset), newEntList);
game.getState().setValue(LongListOfTheEnts.getKey(game, source), newEntList);
FilterSpell filter = new FilterCreatureSpell("a creature spell of that type");
filter.add(subType.getPredicate());
game.addDelayedTriggeredAbility(new AddCounterNextSpellDelayedTriggeredAbility(filter), source);
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/s/SummonEsperValigarmanda.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public boolean apply(Game game, Ability source) {
return !cards.isEmpty()
&& controller.moveCardsToExile(
cards.getCards(game), source, game, true,
CardUtil.getExileZoneId(game, source, 1),
CardUtil.getExileZoneId(game, source),
CardUtil.getSourceName(game, source)
);
}
Expand Down
8 changes: 4 additions & 4 deletions Mage.Sets/src/mage/cards/t/TheAesirEscapeValhalla.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package mage.cards.t;

import java.util.UUID;

import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SagaAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.ExileZone;
Expand All @@ -20,6 +18,8 @@
import mage.target.common.TargetControlledCreaturePermanent;
import mage.util.CardUtil;

import java.util.UUID;

/**
*
* @author Grath
Expand Down Expand Up @@ -83,7 +83,7 @@ public boolean apply(Game game, Ability source) {
controller.choose(outcome, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
UUID exileId = CardUtil.getExileZoneId(game, source, 1);
UUID exileId = CardUtil.getExileZoneId(game, source);
MageObject sourceObject = source.getSourceObject(game);
String exileName = sourceObject != null ? sourceObject.getName() : "";
controller.moveCardsToExile(card, source, game, false, exileId, exileName);
Expand Down
2 changes: 1 addition & 1 deletion Mage.Sets/src/mage/cards/t/TheCreationOfAvacyn.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public boolean apply(Game game, Ability source) {
if (card != null) {
// exile it face down
card.setFaceDown(true, game);
UUID exileId = CardUtil.getExileZoneId(game, source, 1);
UUID exileId = CardUtil.getExileZoneId(game, source);
MageObject sourceObject = source.getSourceObject(game);
String exileName = sourceObject != null ? sourceObject.getName() : "";
controller.moveCardsToExile(card, source, game, false, exileId, exileName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;

Expand All @@ -19,7 +18,6 @@ public class BattleAtTheHelvaultTest extends CardTestPlayerBase {
*/
private static final String battle = "Battle at the Helvault";

@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay() {
addCard(Zone.HAND, playerA, battle, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.player.TestPlayer;
import org.mage.test.serverside.base.CardTestPlayerBase;
Expand All @@ -23,7 +22,6 @@ public class SummonIxionTest extends CardTestPlayerBase {
*/
private static final String ixion = "Summon: Ixion";

@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay() {
addCard(Zone.HAND, playerA, ixion, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.player.TestPlayer;
import org.mage.test.serverside.base.CardTestPlayerBase;
Expand All @@ -21,7 +20,6 @@ public class Vault13DwellersJourneyTest extends CardTestPlayerBase {
*/
private static final String vault = "Vault 13: Dweller's Journey";

@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay_ReturnOne() {
addCard(Zone.HAND, playerA, vault, 1);
Expand Down Expand Up @@ -49,7 +47,6 @@ public void test_SimplePlay_ReturnOne() {
assertPermanentCount(playerA, "Memnite", 1);
assertLife(playerA, 20 + 2);
}
@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay_Return() {
addCard(Zone.HAND, playerA, vault, 1);
Expand Down Expand Up @@ -81,7 +78,6 @@ public void test_SimplePlay_Return() {
assertLife(playerA, 20 + 2);
}

@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay_NoReturn() {
addCard(Zone.HAND, playerA, vault, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;

Expand All @@ -18,7 +17,6 @@ public class DayOfTheMoonTest extends CardTestPlayerBase {
*/
private static final String day = "Day of the Moon";

@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay() {
addCard(Zone.HAND, playerA, day, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;

Expand All @@ -20,7 +19,6 @@ public class TheWarGamesTest extends CardTestPlayerBase {
*/
private static final String war = "The War Games";

@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay_NoExile() {
addCard(Zone.HAND, playerA, war, 1);
Expand Down Expand Up @@ -63,7 +61,6 @@ public void test_SimplePlay_NoExile() {
assertLife(playerB, 20 - 6 - 9);
}

@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay_Exile() {
addCard(Zone.HAND, playerA, war, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;

Expand All @@ -20,7 +19,6 @@ public class TrialOfATimeLordTest extends CardTestPlayerBase {
*/
private static final String trial = "Trial of a Time Lord";

@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay() {
addCard(Zone.HAND, playerA, trial, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import mage.abilities.keyword.FlyingAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;

Expand All @@ -21,7 +20,6 @@ public class ThePrincessTakesFlightTest extends CardTestPlayerBase {
*/
private static final String flight = "The Princess Takes Flight";

@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay() {
addCard(Zone.HAND, playerA, flight, 1);
Expand Down Expand Up @@ -54,7 +52,6 @@ public void test_SimplePlay() {
assertExileCount(playerB, "Memnite", 0);
assertPermanentCount(playerB, "Memnite", 1);
}
@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void testFlicker() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
Expand Down Expand Up @@ -82,4 +79,73 @@ public void testFlicker() {
assertPermanentCount(playerA, "Memnite", 1);
assertGraveyardCount(playerA, flight, 1);
}

@Test
public void test_TokenCopy() {
addCard(Zone.HAND, playerA, flight, 1);
addCard(Zone.HAND, playerA, "Swords to Plowshares", 1);
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1);
addCard(Zone.BATTLEFIELD, playerA, "Ondu Spiritdancer", 1);
addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);

castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, flight);
setChoice(playerA, "I - ");
addTarget(playerA, "Memnite");
setChoice(playerA, true);
addTarget(playerA, "Grizzly Bears");

checkExileCount("after I, exiled Memnite", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Memnite", 1);
checkExileCount("after I, exiled Grizzly Bears", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Grizzly Bears", 1);

castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Swords to Plowshares", "Ondu Spiritdancer");

// turn 3
setChoice(playerA, "II - ");
// No targets available

// turn 5
setChoice(playerA, "III - ");
setStrictChooseMode(true);
setStopAt(5, PhaseStep.POSTCOMBAT_MAIN);
execute();

assertExileCount(playerA, "Grizzly Bears", 0);
assertExileCount(playerB, "Memnite", 0);
assertPermanentCount(playerA, "Grizzly Bears", 1);
assertPermanentCount(playerB, "Memnite", 1);
}
@Test
public void test_SpellCopy() {
addCard(Zone.HAND, playerA, flight, 1);
addCard(Zone.HAND, playerA, "Swords to Plowshares", 1);
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1);
addCard(Zone.BATTLEFIELD, playerA, "The Sixth Doctor", 1);
addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);

castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, flight);
addTarget(playerA, "Memnite");
addTarget(playerA, "Grizzly Bears");

checkExileCount("after I, exiled Memnite", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Memnite", 1);
checkExileCount("after I, exiled Grizzly Bears", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Grizzly Bears", 1);

castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Swords to Plowshares", "The Sixth Doctor");

// turn 3
setChoice(playerA, "II - ");
// No targets available

// turn 5
setChoice(playerA, "III - ");
setStrictChooseMode(true);
setStopAt(5, PhaseStep.POSTCOMBAT_MAIN);
execute();

assertExileCount(playerA, "Grizzly Bears", 0);
assertExileCount(playerB, "Memnite", 0);
assertPermanentCount(playerA, "Grizzly Bears", 1);
assertPermanentCount(playerB, "Memnite", 1);
}
}
Loading