PlayAi: Fix NPE with Invoke Calamity

This commit is contained in:
tool4EvEr
2022-04-13 10:21:48 +02:00
parent 80c51f4ef5
commit 4e63a9431d
12 changed files with 17 additions and 33 deletions

View File

@@ -2047,7 +2047,7 @@ public class AbilityUtils {
return doXMath(c.getNetToughness(), expr, c, ctb);
}
if (sq[0].contains("CardSumPT")) {
return doXMath((c.getNetPower() + c.getNetToughness()), expr, c, ctb);
return doXMath(c.getNetPower() + c.getNetToughness(), expr, c, ctb);
}
if (sq[0].contains("CardNumTypes")) {
Card ce;
@@ -2814,14 +2814,7 @@ public class AbilityUtils {
if (sq[0].startsWith("HighestCMC_")) {
final String restriction = l[0].substring(11);
CardCollection list = CardLists.getValidCards(game.getCardsInGame(), restriction, player, c, ctb);
int highest = 0;
for (final Card crd : list) {
// dont check for Split card anymore
if (crd.getCMC() > highest) {
highest = crd.getCMC();
}
}
return highest;
return Aggregates.max(list, CardPredicates.Accessors.fnGetCmc);
}
if (sq[0].startsWith("MostCardName")) {
@@ -2918,12 +2911,6 @@ public class AbilityUtils {
// Complex counting methods
CardCollectionView someCards = getCardListForXCount(c, player, sq, ctb);
// 1/10 - Count$MaxCMCYouCtrl
if (sq[0].startsWith("MaxCMC")) {
int mmc = Aggregates.max(someCards, CardPredicates.Accessors.fnGetCmc);
return doXMath(mmc, expr, c, ctb);
}
return doXMath(someCards.size(), expr, c, ctb);
}
@@ -3861,6 +3848,7 @@ public class AbilityUtils {
CardCollection list = null;
if (sa instanceof SpellAbility) {
SpellAbility root = ((SpellAbility)sa).getRootAbility();
// TODO do we really need these checks?
if (defined.startsWith("SacrificedCards")) {
list = root.getPaidList("SacrificedCards");
} else if (defined.startsWith("Sacrificed")) {

View File

@@ -5575,7 +5575,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
}
public final boolean isTributed() { return tributed; }
public final void setTributed(final boolean b) {
tributed = b;
}
@@ -5670,7 +5669,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
public boolean isForetoldByEffect() {
return foretoldByEffect;
}
public void setForetoldByEffect(final boolean val) {
this.foretoldByEffect = val;
}
@@ -5678,7 +5676,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
public boolean isForetoldThisTurn() {
return foretoldThisTurn;
}
public final void setForetoldThisTurn(final boolean foretoldThisTurn) {
this.foretoldThisTurn = foretoldThisTurn;
}
@@ -5690,11 +5687,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
public int getTimesCrewedThisTurn() {
return timesCrewedThisTurn;
}
public final void setTimesCrewedThisTurn(final int t) {
this.timesCrewedThisTurn = t;
}
public void resetTimesCrewedThisTurn() {
timesCrewedThisTurn = 0;
}
@@ -6208,7 +6203,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
int xPaid = 0;
// 2012-07-22 - If a card is on the stack, count the xManaCost in with it's CMC
// If a card is on the stack, count the xManaCost in with it's CMC
if (isInZone(ZoneType.Stack) && getManaCost() != null) {
xPaid = getXManaCostPaid() * getManaCost().countX();
}