mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
UNF Embiggen - take four (#5156)
* - UNF Embiggen by tehdiplomat * - Undo some obsolete changes. --------- Co-authored-by: Chris H <zenchristo@gmail.com>
This commit is contained in:
@@ -2634,6 +2634,16 @@ public class AbilityUtils {
|
||||
return game.getPhaseHandler().getPlanarDiceSpecialActionThisTurn();
|
||||
}
|
||||
|
||||
if (sq[0].equals("AllTypes")) {
|
||||
List<Card> cards = getDefinedCards(c, sq[1], ctb);
|
||||
|
||||
int amount = countCardTypesFromList(cards, false) +
|
||||
countSuperTypesFromList(cards) +
|
||||
countSubTypesFromList(cards);
|
||||
|
||||
return doXMath(amount, expr, c, ctb);
|
||||
}
|
||||
|
||||
if (sq[0].equals("TotalTurns")) {
|
||||
return doXMath(game.getPhaseHandler().getTurn(), expr, c, ctb);
|
||||
}
|
||||
@@ -3364,7 +3374,7 @@ public class AbilityUtils {
|
||||
|
||||
//SacrificedPermanentTypesThisTurn
|
||||
if (l[0].startsWith("SacrificedPermanentTypesThisTurn")) {
|
||||
return doXMath(getCardTypesFromList(player.getSacrificedThisTurn(), true), m, source, ctb);
|
||||
return doXMath(countCardTypesFromList(player.getSacrificedThisTurn(), true), m, source, ctb);
|
||||
}
|
||||
|
||||
final String[] sq = l[0].split("\\.");
|
||||
@@ -3647,7 +3657,7 @@ public class AbilityUtils {
|
||||
}
|
||||
|
||||
if (string.startsWith("CardTypes")) {
|
||||
return doXMath(getCardTypesFromList(paidList, string.startsWith("CardTypesPermanent")), CardFactoryUtil.extractOperators(string), source, ctb);
|
||||
return doXMath(countCardTypesFromList(paidList, string.startsWith("CardTypesPermanent")), CardFactoryUtil.extractOperators(string), source, ctb);
|
||||
}
|
||||
|
||||
String filteredString = string;
|
||||
@@ -3865,7 +3875,7 @@ public class AbilityUtils {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static int getCardTypesFromList(final Iterable<Card> list, boolean permanentTypes) {
|
||||
public static int countCardTypesFromList(final Iterable<Card> list, boolean permanentTypes) {
|
||||
EnumSet<CardType.CoreType> types = EnumSet.noneOf(CardType.CoreType.class);
|
||||
for (Card c1 : list) {
|
||||
Iterables.addAll(types, c1.getType().getCoreTypes());
|
||||
@@ -3875,6 +3885,24 @@ public class AbilityUtils {
|
||||
return types.size();
|
||||
}
|
||||
|
||||
public static int countSuperTypesFromList(final Iterable<Card> list) {
|
||||
EnumSet<CardType.Supertype> types = EnumSet.noneOf(CardType.Supertype.class);
|
||||
for (Card c1 : list) {
|
||||
Iterables.addAll(types, c1.getType().getSupertypes());
|
||||
}
|
||||
|
||||
return types.size();
|
||||
}
|
||||
|
||||
public static int countSubTypesFromList(final Iterable<Card> list) {
|
||||
Set<String> types = new HashSet<>();
|
||||
for (Card c1 : list) {
|
||||
Iterables.addAll(types, c1.getType().getSubtypes());
|
||||
}
|
||||
|
||||
return types.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an ability source can be considered a "broken link" on a specific host
|
||||
* (which usually means it won't have its normal effect).
|
||||
|
||||
Reference in New Issue
Block a user