Skip to content

Commit 2092f38

Browse files
authored
Fix Saga first chapter ZCC
I've given JayDi enough opportunity to find his own fix, I'm merging this with a TODO to consider fixing it another way that JayDi's happy with.
2 parents b5118f2 + 9e475fc commit 2092f38

File tree

13 files changed

+85
-71
lines changed

13 files changed

+85
-71
lines changed

Mage.Sets/src/mage/cards/g/GenesisOfTheDaleks.java

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
import mage.abilities.Ability;
44
import mage.abilities.common.SagaAbility;
5-
import mage.abilities.dynamicvalue.DynamicValue;
6-
import mage.abilities.effects.Effect;
5+
import mage.abilities.dynamicvalue.common.CountersSourceCount;
76
import mage.abilities.effects.OneShotEffect;
87
import mage.abilities.effects.common.CreateTokenEffect;
98
import mage.abilities.effects.common.DestroyAllEffect;
@@ -19,7 +18,6 @@
1918
import mage.game.Game;
2019
import mage.game.events.GameEvent;
2120
import mage.game.events.ZoneChangeEvent;
22-
import mage.game.permanent.Permanent;
2321
import mage.game.permanent.token.DalekToken;
2422
import mage.players.Player;
2523
import mage.target.common.TargetOpponent;
@@ -44,7 +42,7 @@ public GenesisOfTheDaleks(UUID ownerId, CardSetInfo setInfo) {
4442
// I, II, III -- Create a 3/3 black Dalek artifact creature token with menace for each lore counter on Genesis of the Daleks.
4543
sagaAbility.addChapterEffect(
4644
this, SagaChapter.CHAPTER_I, SagaChapter.CHAPTER_III,
47-
new CreateTokenEffect(new DalekToken(), GenesisOfTheDaleksValue.instance)
45+
new CreateTokenEffect(new DalekToken(), new CountersSourceCount(CounterType.LORE))
4846
);
4947

5048
// 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.
@@ -65,41 +63,6 @@ public GenesisOfTheDaleks copy() {
6563
}
6664
}
6765

68-
enum GenesisOfTheDaleksValue implements DynamicValue {
69-
instance;
70-
71-
@Override
72-
public int calculate(Game game, Ability sourceAbility, Effect effect) {
73-
Permanent permanent = sourceAbility.getSourcePermanentOrLKI(game);
74-
if (permanent != null) {
75-
return permanent
76-
.getCounters(game)
77-
.getCount(CounterType.LORE);
78-
}
79-
return Optional
80-
.ofNullable(sourceAbility)
81-
.map(Ability::getSourceId)
82-
.map(game::getPermanentOrLKIBattlefield)
83-
.map(p -> p.getCounters(game).getCount(CounterType.LORE))
84-
.orElse(0);
85-
}
86-
87-
@Override
88-
public GenesisOfTheDaleksValue copy() {
89-
return this;
90-
}
91-
92-
@Override
93-
public String getMessage() {
94-
return "lore counter on {this}";
95-
}
96-
97-
@Override
98-
public String toString() {
99-
return "1";
100-
}
101-
}
102-
10366
class GenesisOfTheDaleksEffect extends OneShotEffect {
10467

10568
private static final FaceVillainousChoice choice = new FaceVillainousChoice(

Mage.Sets/src/mage/cards/l/LongListOfTheEnts.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public LongListOfTheEnts copy() {
5353
return new LongListOfTheEnts(this);
5454
}
5555

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

6060
}
@@ -67,7 +67,7 @@ public String getText(Game game, Ability ability) {
6767
if (ability.getSourcePermanentIfItStillExists(game) == null) {
6868
return null;
6969
}
70-
Set<SubType> subTypes = (Set<SubType>) game.getState().getValue(LongListOfTheEnts.getKey(game, ability, 0));
70+
Set<SubType> subTypes = (Set<SubType>) game.getState().getValue(LongListOfTheEnts.getKey(game, ability));
7171
if (subTypes == null || subTypes.isEmpty()) {
7272
return "No creature types have been noted yet.";
7373
}
@@ -109,14 +109,11 @@ public boolean apply(Game game, Ability source) {
109109
return false;
110110
}
111111

112-
Object existingEntList = game.getState().getValue(LongListOfTheEnts.getKey(game, source, 0));
113-
int offset;
112+
Object existingEntList = game.getState().getValue(LongListOfTheEnts.getKey(game, source));
114113
Set<SubType> newEntList;
115114
if (existingEntList == null) {
116-
offset = 1; // zcc is off-by-one due to still entering battlefield
117115
newEntList = new LinkedHashSet<>();
118116
} else {
119-
offset = 0;
120117
newEntList = new LinkedHashSet<>((Set<SubType>) existingEntList);
121118
}
122119
Set<String> chosenTypes = newEntList
@@ -132,7 +129,7 @@ public boolean apply(Game game, Ability source) {
132129
SubType subType = SubType.byDescription(choice.getChoiceKey());
133130
game.informPlayers(player.getLogName() + " notes the creature type " + subType);
134131
newEntList.add(subType);
135-
game.getState().setValue(LongListOfTheEnts.getKey(game, source, offset), newEntList);
132+
game.getState().setValue(LongListOfTheEnts.getKey(game, source), newEntList);
136133
FilterSpell filter = new FilterCreatureSpell("a creature spell of that type");
137134
filter.add(subType.getPredicate());
138135
game.addDelayedTriggeredAbility(new AddCounterNextSpellDelayedTriggeredAbility(filter), source);

Mage.Sets/src/mage/cards/s/SummonEsperValigarmanda.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public boolean apply(Game game, Ability source) {
107107
return !cards.isEmpty()
108108
&& controller.moveCardsToExile(
109109
cards.getCards(game), source, game, true,
110-
CardUtil.getExileZoneId(game, source, 1),
110+
CardUtil.getExileZoneId(game, source),
111111
CardUtil.getSourceName(game, source)
112112
);
113113
}

Mage.Sets/src/mage/cards/t/TheAesirEscapeValhalla.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public boolean apply(Game game, Ability source) {
8383
controller.choose(outcome, target, source, game);
8484
Card card = game.getCard(target.getFirstTarget());
8585
if (card != null) {
86-
UUID exileId = CardUtil.getExileZoneId(game, source, 1);
86+
UUID exileId = CardUtil.getExileZoneId(game, source);
8787
MageObject sourceObject = source.getSourceObject(game);
8888
String exileName = sourceObject != null ? sourceObject.getName() : "";
8989
controller.moveCardsToExile(card, source, game, false, exileId, exileName);

Mage.Sets/src/mage/cards/t/TheCreationOfAvacyn.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public boolean apply(Game game, Ability source) {
8181
if (card != null) {
8282
// exile it face down
8383
card.setFaceDown(true, game);
84-
UUID exileId = CardUtil.getExileZoneId(game, source, 1);
84+
UUID exileId = CardUtil.getExileZoneId(game, source);
8585
MageObject sourceObject = source.getSourceObject(game);
8686
String exileName = sourceObject != null ? sourceObject.getName() : "";
8787
controller.moveCardsToExile(card, source, game, false, exileId, exileName);

Mage.Tests/src/test/java/org/mage/test/cards/single/cmm/BattleAtTheHelvaultTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import mage.constants.PhaseStep;
44
import mage.constants.Zone;
5-
import org.junit.Ignore;
65
import org.junit.Test;
76
import org.mage.test.serverside.base.CardTestPlayerBase;
87

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

22-
@Ignore // TODO: goal of #11619 is to fix this nicely
2321
@Test
2422
public void test_SimplePlay() {
2523
addCard(Zone.HAND, playerA, battle, 1);

Mage.Tests/src/test/java/org/mage/test/cards/single/fic/SummonIxionTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import mage.constants.PhaseStep;
44
import mage.constants.Zone;
55
import mage.counters.CounterType;
6-
import org.junit.Ignore;
76
import org.junit.Test;
87
import org.mage.test.player.TestPlayer;
98
import org.mage.test.serverside.base.CardTestPlayerBase;
@@ -23,7 +22,6 @@ public class SummonIxionTest extends CardTestPlayerBase {
2322
*/
2423
private static final String ixion = "Summon: Ixion";
2524

26-
@Ignore // TODO: goal of #11619 is to fix this nicely
2725
@Test
2826
public void test_SimplePlay() {
2927
addCard(Zone.HAND, playerA, ixion, 1);

Mage.Tests/src/test/java/org/mage/test/cards/single/pip/Vault13DwellersJourneyTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

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

24-
@Ignore // TODO: goal of #11619 is to fix this nicely
2523
@Test
2624
public void test_SimplePlay_ReturnOne() {
2725
addCard(Zone.HAND, playerA, vault, 1);
@@ -49,7 +47,6 @@ public void test_SimplePlay_ReturnOne() {
4947
assertPermanentCount(playerA, "Memnite", 1);
5048
assertLife(playerA, 20 + 2);
5149
}
52-
@Ignore // TODO: goal of #11619 is to fix this nicely
5350
@Test
5451
public void test_SimplePlay_Return() {
5552
addCard(Zone.HAND, playerA, vault, 1);
@@ -81,7 +78,6 @@ public void test_SimplePlay_Return() {
8178
assertLife(playerA, 20 + 2);
8279
}
8380

84-
@Ignore // TODO: goal of #11619 is to fix this nicely
8581
@Test
8682
public void test_SimplePlay_NoReturn() {
8783
addCard(Zone.HAND, playerA, vault, 1);

Mage.Tests/src/test/java/org/mage/test/cards/single/who/DayOfTheMoonTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import mage.constants.PhaseStep;
44
import mage.constants.Zone;
5-
import org.junit.Ignore;
65
import org.junit.Test;
76
import org.mage.test.serverside.base.CardTestPlayerBase;
87

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

21-
@Ignore // TODO: goal of #11619 is to fix this nicely
2220
@Test
2321
public void test_SimplePlay() {
2422
addCard(Zone.HAND, playerA, day, 1);

Mage.Tests/src/test/java/org/mage/test/cards/single/who/TheWarGamesTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import mage.constants.PhaseStep;
44
import mage.constants.Zone;
5-
import org.junit.Ignore;
65
import org.junit.Test;
76
import org.mage.test.serverside.base.CardTestPlayerBase;
87

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

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

66-
@Ignore // TODO: goal of #11619 is to fix this nicely
6764
@Test
6865
public void test_SimplePlay_Exile() {
6966
addCard(Zone.HAND, playerA, war, 1);

0 commit comments

Comments
 (0)