mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-11 16:26:22 +00:00
Refactor UnlockedDoors using PlayerProperty
This commit is contained in:
@@ -2543,34 +2543,13 @@ public class AbilityUtils {
|
||||
return doXMath(CardLists.getValidCardCount(game.getLeftGraveyardThisTurn(), validFilter, player, c, ctb), expr, c, ctb);
|
||||
}
|
||||
|
||||
// Count$UnlockedDoors <Valid>
|
||||
if (sq[0].startsWith("UnlockedDoors")) {
|
||||
final String[] workingCopy = l[0].split(" ", 2);
|
||||
final String validFilter = workingCopy[1];
|
||||
|
||||
int unlocked = 0;
|
||||
for (Card doorCard : CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), validFilter, player, c, ctb)) {
|
||||
unlocked += doorCard.getUnlockedRooms().size();
|
||||
}
|
||||
|
||||
return doXMath(unlocked, expr, c, ctb);
|
||||
if (sq[0].equals("UnlockedDoors")) {
|
||||
return doXMath(player.getUnlockedDoors().size(), expr, c, ctb);
|
||||
}
|
||||
|
||||
// Count$DistinctUnlockedDoors <Valid>
|
||||
// Counts the distinct names of unlocked doors. Used for the "Promising Stairs"
|
||||
if (sq[0].startsWith("DistinctUnlockedDoors")) {
|
||||
final String[] workingCopy = l[0].split(" ", 2);
|
||||
final String validFilter = workingCopy[1];
|
||||
|
||||
Set<String> viewedNames = new HashSet<>();
|
||||
for (Card doorCard : CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), validFilter, player, c, ctb)) {
|
||||
for(CardStateName stateName : doorCard.getUnlockedRooms()) {
|
||||
viewedNames.add(doorCard.getState(stateName).getName());
|
||||
}
|
||||
}
|
||||
int distinctUnlocked = viewedNames.size();
|
||||
|
||||
return doXMath(distinctUnlocked, expr, c, ctb);
|
||||
if (sq[0].equals("DistinctUnlockedDoors")) {
|
||||
return doXMath(Sets.newHashSet(player.getUnlockedDoors()).size(), expr, c, ctb);
|
||||
}
|
||||
|
||||
// Manapool
|
||||
|
||||
@@ -14,5 +14,5 @@ Types:Enchantment Room
|
||||
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigSurveil | TriggerDescription$ At the beginning of your upkeep, surveil 1. You win the game if there are eight or more different names among unlocked doors of Rooms you control.
|
||||
SVar:TrigSurveil:DB$ Surveil | SubAbility$ DBWin
|
||||
SVar:DBWin:DB$ WinsGame | Defined$ You | ConditionCheckSVar$ RoomsUnlocked | ConditionSVarCompare$ GE8
|
||||
SVar:RoomsUnlocked:Count$DistinctUnlockedDoors Card.Room+YouCtrl
|
||||
SVar:RoomsUnlocked:Count$DistinctUnlockedDoors
|
||||
Oracle:At the beginning of your upkeep, surveil 1. You win the game if there are eight or more different names among unlocked doors of Rooms you control.
|
||||
|
||||
@@ -3,5 +3,5 @@ ManaCost:2 R
|
||||
Types:Creature Spirit
|
||||
PT:1/4
|
||||
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 3 | CheckSVar$ X | SVarCompare$ GE2 | Description$ CARDNAME gets +3/+0 as long as there are two or more unlocked doors among Rooms you control.
|
||||
SVar:X:Count$UnlockedDoors Card.Room+YouCtrl
|
||||
SVar:X:Count$UnlockedDoors
|
||||
Oracle:Rampaging Soulrager gets +3/+0 as long as there are two or more unlocked doors among Rooms you control.
|
||||
|
||||
@@ -13,5 +13,5 @@ ManaCost:3 U
|
||||
Types:Enchantment Room
|
||||
T:Mode$ UnlockDoor | ValidPlayer$ You | ValidCard$ Card.Self | ThisDoor$ True | Execute$ TrigToken | TriggerDescription$ When you unlock this door, create an X/X blue Spirit creature token with flying, where X is the number of unlocked doors among Rooms you control.
|
||||
SVar:TrigToken:DB$ Token | TokenAmount$ 1 | TokenScript$ u_x_x_spirit_flying | TokenPower$ X | TokenToughness$ X | TokenOwner$ You
|
||||
SVar:X:Count$UnlockedDoors Card.Room+YouCtrl
|
||||
SVar:X:Count$UnlockedDoors
|
||||
Oracle:(You may cast either half. That door unlocks on the battlefield. As a sorcery, you may pay the mana cost of a locked door to unlock it.)\nWhen you unlock this door, create an X/X blue Spirit creature token with flying, where X is the number of unlocked doors among Rooms you control.
|
||||
|
||||
Reference in New Issue
Block a user