mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Merge branch 'fix-repeat-each' into 'master'
Fix repeat each not looping over cards See merge request core-developers/forge!2955
This commit is contained in:
@@ -12,6 +12,7 @@ import forge.game.spellability.SpellAbility;
|
|||||||
import forge.game.spellability.SpellAbilityStackInstance;
|
import forge.game.spellability.SpellAbilityStackInstance;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.util.collect.FCollection;
|
import forge.util.collect.FCollection;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ public class RepeatEachEffect extends SpellAbilityEffect {
|
|||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@Override
|
@Override
|
||||||
public void resolve(SpellAbility sa) {
|
public void resolve(SpellAbility sa) {
|
||||||
|
// Things to loop over: Cards, Players, or SAs
|
||||||
final Card source = sa.getHostCard();
|
final Card source = sa.getHostCard();
|
||||||
|
|
||||||
final AbilitySub repeat = sa.getAdditionalAbility("RepeatSubAbility");
|
final AbilitySub repeat = sa.getAdditionalAbility("RepeatSubAbility");
|
||||||
@@ -39,7 +41,7 @@ public class RepeatEachEffect extends SpellAbilityEffect {
|
|||||||
final Game game = player.getGame();
|
final Game game = player.getGame();
|
||||||
|
|
||||||
boolean useImprinted = sa.hasParam("UseImprinted");
|
boolean useImprinted = sa.hasParam("UseImprinted");
|
||||||
boolean loopOverCards = false;
|
|
||||||
CardCollectionView repeatCards = null;
|
CardCollectionView repeatCards = null;
|
||||||
List<SpellAbility> repeatSas = null;
|
List<SpellAbility> repeatSas = null;
|
||||||
|
|
||||||
@@ -69,17 +71,8 @@ public class RepeatEachEffect extends SpellAbilityEffect {
|
|||||||
repeatCards = CardLists.getValidCards(repeatCards,
|
repeatCards = CardLists.getValidCards(repeatCards,
|
||||||
sa.getParam("AdditionalRestriction"), source.getController(), source);
|
sa.getParam("AdditionalRestriction"), source.getController(), source);
|
||||||
}
|
}
|
||||||
if (!repeatCards.isEmpty()) {
|
|
||||||
loopOverCards = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Removing this throw since it doesn't account for Repeating by players or counters e.g. Tempting Wurm
|
boolean loopOverCards = repeatCards != null && !repeatCards.isEmpty();
|
||||||
// Feel free to re-add it if you account for every card that's scripted with RepeatEach
|
|
||||||
/*
|
|
||||||
else {
|
|
||||||
throw new IllegalAbilityException(sa, this);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
if (sa.hasParam("ClearRemembered")) {
|
if (sa.hasParam("ClearRemembered")) {
|
||||||
source.clearRemembered();
|
source.clearRemembered();
|
||||||
@@ -94,7 +87,6 @@ public class RepeatEachEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (loopOverCards) {
|
if (loopOverCards) {
|
||||||
// TODO (ArsenalNut 22 Dec 2012) Add logic to order cards for AI
|
|
||||||
if (sa.hasParam("ChooseOrder") && repeatCards.size() >= 2) {
|
if (sa.hasParam("ChooseOrder") && repeatCards.size() >= 2) {
|
||||||
repeatCards = player.getController().orderMoveToZoneList(repeatCards, ZoneType.Stack);
|
repeatCards = player.getController().orderMoveToZoneList(repeatCards, ZoneType.Stack);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user