mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38: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);
|
CardFactoryUtil.setupSiegeAbilities(card);
|
||||||
}
|
}
|
||||||
else if (card.getType().getBattleTypes().isEmpty()) {
|
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.
|
//Battles with no battle type enter protected by their controller.
|
||||||
String abProtector = "DB$ ChoosePlayer | Choices$ You | Protect$ True | DontNotify$ True";
|
String abProtector = "DB$ ChoosePlayer | Choices$ You | Protect$ True | DontNotify$ True";
|
||||||
String reText = "Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplacementResult$ Updated"
|
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);
|
ReplacementEffect re = ReplacementHandler.parseReplacement(reText, card, true);
|
||||||
re.setOverridingAbility(AbilityFactory.getAbility(abProtector, card));
|
re.setOverridingAbility(AbilityFactory.getAbility(abProtector, card));
|
||||||
card.addReplacementEffect(re);
|
card.addReplacementEffect(re);
|
||||||
|
|||||||
@@ -4124,7 +4124,7 @@ public class CardFactoryUtil {
|
|||||||
|
|
||||||
public static void setupSiegeAbilities(Card card) {
|
public static void setupSiegeAbilities(Card card) {
|
||||||
StringBuilder chooseSB = new StringBuilder();
|
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.)");
|
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";
|
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