Add a parameter for battle protection RE that can be used to override it for custom types.

This commit is contained in:
Jetz
2025-05-02 17:27:08 -04:00
committed by Chris H
parent 3915f316e2
commit 75a056abe6
2 changed files with 5 additions and 2 deletions

View File

@@ -307,10 +307,13 @@ public class CardFactory {
CardFactoryUtil.setupSiegeAbilities(card);
}
else if (card.getType().getBattleTypes().isEmpty()) {
//Probably a custom card? Check if it already has an RE for designating a protector.
if(card.getReplacementEffects().stream().anyMatch((re) -> re.hasParam("BattleProtector")))
return;
//Battles with no battle type enter protected by their controller.
String abProtector = "DB$ ChoosePlayer | Choices$ You | Protect$ True | DontNotify$ True";
String reText = "Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplacementResult$ Updated"
+ " | Description$ (As this Battle enters, its controller becomes its protector.)";
+ " | BattleProtector$ True | Description$ (As this Battle enters, its controller becomes its protector.)";
ReplacementEffect re = ReplacementHandler.parseReplacement(reText, card, true);
re.setOverridingAbility(AbilityFactory.getAbility(abProtector, card));
card.addReplacementEffect(re);

View File

@@ -4124,7 +4124,7 @@ public class CardFactoryUtil {
public static void setupSiegeAbilities(Card card) {
StringBuilder chooseSB = new StringBuilder();
chooseSB.append("Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplacementResult$ Updated");
chooseSB.append("Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplacementResult$ Updated | BattleProtector$ True");
chooseSB.append(" | Description$ (As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.)");
String chooseProtector = "DB$ ChoosePlayer | Defined$ You | Choices$ Opponent | Protect$ True | ChoiceTitle$ Choose an opponent to protect this battle";