StaticAbilityContinous now have AffectedDefined for card list (#6986)

* StaticAbilityContinous now have AffectedDefined for card list
This commit is contained in:
Hans Mackowiak
2025-02-09 10:49:19 +01:00
committed by GitHub
parent cf18808a70
commit 83438ef72b
2 changed files with 31 additions and 23 deletions

View File

@@ -4139,7 +4139,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
eff.setRenderForUI(false);
eff.addRemembered(this);
String s = "Mode$ Continuous | Affected$ Card.IsRemembered | EffectZone$ Command | RemoveType$ Creature";
String s = "Mode$ Continuous | AffectedDefined$ RememberedCard | EffectZone$ Command | RemoveType$ Creature";
eff.addStaticAbility(s);
GameCommand until = SpellAbilityEffect.exileEffectCommand(game, eff);

View File

@@ -452,29 +452,11 @@ public final class StaticAbilityContinuous {
if (layer == StaticAbilityLayer.COLOR) {
if (params.containsKey("AddColor")) {
final String colors = params.get("AddColor");
if (colors.equals("ChosenColor")) {
if (hostCard.hasChosenColor()) {
addColors = ColorSet.fromNames(hostCard.getChosenColors());
}
} else if (colors.equals("All")) {
addColors = ColorSet.ALL_COLORS;
} else {
addColors = ColorSet.fromNames(colors.split(" & "));
}
addColors = getColorsFromParam(stAb, params.get("AddColor"));
}
if (params.containsKey("SetColor")) {
final String colors = params.get("SetColor");
if (colors.equals("ChosenColor")) {
if (hostCard.hasChosenColor()) {
addColors = ColorSet.fromNames(hostCard.getChosenColors());
}
} else if (colors.equals("All")) {
addColors = ColorSet.ALL_COLORS;
} else {
addColors = ColorSet.fromNames(colors.split(" & "));
}
addColors = getColorsFromParam(stAb, params.get("SetColor"));
overwriteColors = true;
}
}
@@ -933,6 +915,22 @@ public final class StaticAbilityContinuous {
return affectedCards;
}
private static ColorSet getColorsFromParam(StaticAbility stAb, final String colors) {
final Card hostCard = stAb.getHostCard();
ColorSet addColors;
if (colors.equals("ChosenColor")) {
if (hostCard.hasChosenColor()) {
addColors = ColorSet.fromNames(hostCard.getChosenColors());
}
return null;
} else if (colors.equals("All")) {
addColors = ColorSet.ALL_COLORS;
} else {
addColors = ColorSet.fromNames(colors.split(" & "));
}
return addColors;
}
private static void buildIgnorEffectAbility(final StaticAbility stAb, final String costString, final List<Player> players, final CardCollectionView cards) {
final List<Player> validActivator = new ArrayList<>(players);
for (final Card c : cards) {
@@ -1032,10 +1030,18 @@ public final class StaticAbilityContinuous {
// non - CharacteristicDefining
CardCollection affectedCards = new CardCollection();
CardCollection definedCards = null;
if (stAb.hasParam("AffectedDefined")) {
definedCards = AbilityUtils.getDefinedCards(hostCard, stAb.getParam("AffectedDefined"), stAb).filter(CardPredicates.phasedIn());
}
// add preList in addition to the normal affected cards
// need to add before game cards to have preference over them
if (!preList.isEmpty()) {
if (stAb.hasParam("AffectedZone")) {
if (stAb.hasParam("AffectedDefined")) {
affectedCards.addAll(preList);
affectedCards.retainAll(definedCards);
} else if (stAb.hasParam("AffectedZone")) {
affectedCards.addAll(CardLists.filter(preList, CardPredicates.inZone(
ZoneType.listValueOf(stAb.getParam("AffectedZone")))));
} else {
@@ -1043,7 +1049,9 @@ public final class StaticAbilityContinuous {
}
}
if (stAb.hasParam("AffectedZone")) {
if (stAb.hasParam("AffectedDefined")) {
affectedCards.addAll(definedCards);
} else if (stAb.hasParam("AffectedZone")) {
affectedCards.addAll(game.getCardsIn(ZoneType.listValueOf(stAb.getParam("AffectedZone"))));
} else {
affectedCards.addAll(game.getCardsIn(ZoneType.Battlefield));