mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Add a parameter for battle protection RE that can be used to override it for custom types.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user