mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Merge branch 'NPE' into 'master'
Fix NPE with Thunderous Might See merge request core-developers/forge!5223
This commit is contained in:
@@ -331,7 +331,6 @@ public class ComputerUtilCombat {
|
||||
* @return a int.
|
||||
*/
|
||||
public static int resultingPoison(final Player ai, final Combat combat) {
|
||||
|
||||
// ai can't get poison counters, so the value can't change
|
||||
if (!ai.canReceiveCounters(CounterEnumType.POISON)) {
|
||||
return ai.getPoisonCounters();
|
||||
@@ -343,7 +342,6 @@ public class ComputerUtilCombat {
|
||||
final List<Card> unblocked = Lists.newArrayList();
|
||||
|
||||
for (final Card attacker : attackers) {
|
||||
|
||||
final List<Card> blockers = combat.getBlockers(attacker);
|
||||
|
||||
if ((blockers.size() == 0)
|
||||
@@ -392,7 +390,6 @@ public class ComputerUtilCombat {
|
||||
public static boolean lifeInDanger(final Player ai, final Combat combat) {
|
||||
return lifeInDanger(ai, combat, 0);
|
||||
}
|
||||
|
||||
public static boolean lifeInDanger(final Player ai, final Combat combat, final int payment) {
|
||||
// life in danger only cares about the player's life. Not Planeswalkers' life
|
||||
if (ai.cantLose() || combat == null || combat.getAttackingPlayer() == ai) {
|
||||
@@ -485,7 +482,6 @@ public class ComputerUtilCombat {
|
||||
public static boolean lifeInSeriousDanger(final Player ai, final Combat combat) {
|
||||
return lifeInSeriousDanger(ai, combat, 0);
|
||||
}
|
||||
|
||||
public static boolean lifeInSeriousDanger(final Player ai, final Combat combat, final int payment) {
|
||||
// life in danger only cares about the player's life. Not about a Planeswalkers life
|
||||
if (ai.cantLose() || combat == null) {
|
||||
@@ -1264,8 +1260,9 @@ public class ComputerUtilCombat {
|
||||
continue;
|
||||
}
|
||||
|
||||
sa.setActivatingPlayer(source.getController());
|
||||
|
||||
if (sa.hasParam("Cost")) {
|
||||
sa.setActivatingPlayer(source.getController());
|
||||
if (!CostPayment.canPayAdditionalCosts(sa.getPayCosts(), sa)) {
|
||||
continue;
|
||||
}
|
||||
@@ -1471,7 +1468,6 @@ public class ComputerUtilCombat {
|
||||
toughness -= predictDamageTo(attacker, damage, 0, source, false);
|
||||
continue;
|
||||
} else if (ApiType.Pump.equals(sa.getApi())) {
|
||||
|
||||
if (sa.hasParam("Cost")) {
|
||||
if (!CostPayment.canPayAdditionalCosts(sa.getPayCosts(), sa)) {
|
||||
continue;
|
||||
@@ -1504,7 +1500,6 @@ public class ComputerUtilCombat {
|
||||
toughness += AbilityUtils.calculateAmount(source, bonus, sa);
|
||||
}
|
||||
} else if (ApiType.PumpAll.equals(sa.getApi())) {
|
||||
|
||||
if (sa.hasParam("Cost")) {
|
||||
if (!CostPayment.canPayAdditionalCosts(sa.getPayCosts(), sa)) {
|
||||
continue;
|
||||
@@ -1839,7 +1834,6 @@ public class ComputerUtilCombat {
|
||||
}
|
||||
|
||||
public static boolean canDestroyBlockerBeforeFirstStrike(final Card blocker, final Card attacker, final boolean withoutAbilities) {
|
||||
|
||||
if (attacker.isEquippedBy("Godsend")) {
|
||||
return true;
|
||||
}
|
||||
@@ -1850,7 +1844,6 @@ public class ComputerUtilCombat {
|
||||
|
||||
int flankingMagnitude = 0;
|
||||
if (attacker.hasKeyword(Keyword.FLANKING) && !blocker.hasKeyword(Keyword.FLANKING)) {
|
||||
|
||||
flankingMagnitude = attacker.getAmountOfKeyword(Keyword.FLANKING);
|
||||
|
||||
if (flankingMagnitude >= blocker.getNetToughness()) {
|
||||
@@ -2301,8 +2294,6 @@ public class ComputerUtilCombat {
|
||||
* a boolean.
|
||||
* @return a int.
|
||||
*/
|
||||
// This function helps the AI calculate the actual amount of damage an
|
||||
// effect would deal
|
||||
public final static int predictDamageTo(final Card target, final int damage, final Card source, final boolean isCombat) {
|
||||
return predictDamageTo(target, damage, 0, source, isCombat);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if ((!noCall) && (amount == 1)) {
|
||||
flipMultiplier = getFilpMultiplier(caller.get(0));
|
||||
flipMultiplier = getFlipMultiplier(caller.get(0));
|
||||
victory = flipCoinCall(caller.get(0), sa, flipMultiplier, varName);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
||||
|
||||
for (final Player flipper : playersToFlip) {
|
||||
if (noCall) {
|
||||
flipMultiplier = getFilpMultiplier(flipper);
|
||||
flipMultiplier = getFlipMultiplier(flipper);
|
||||
|
||||
int countHeads = 0;
|
||||
int countTails = 0;
|
||||
@@ -112,8 +112,8 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
||||
AbilityUtils.resolve(sub);
|
||||
}
|
||||
}
|
||||
} else if (amount > 1){
|
||||
flipMultiplier = getFilpMultiplier(flipper);
|
||||
} else if (amount > 1) {
|
||||
flipMultiplier = getFlipMultiplier(flipper);
|
||||
|
||||
int countWins = 0;
|
||||
int countLosses = 0;
|
||||
@@ -258,7 +258,7 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
||||
return wonFlip;
|
||||
}
|
||||
|
||||
public static int getFilpMultiplier(final Player flipper) {
|
||||
public static int getFlipMultiplier(final Player flipper) {
|
||||
String str = "If you would flip a coin, instead flip two coins and ignore one.";
|
||||
return 1 + flipper.getKeywords().getAmount(str);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class CostFlipCoin extends CostPart {
|
||||
|
||||
@Override
|
||||
public boolean payAsDecided(Player payer, PaymentDecision pd, SpellAbility sa) {
|
||||
int m = FlipCoinEffect.getFilpMultiplier(payer);
|
||||
int m = FlipCoinEffect.getFlipMultiplier(payer);
|
||||
for (int i = 0; i < pd.c; i++) {
|
||||
FlipCoinEffect.flipCoinCall(payer, sa, m);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ public class TriggerBlocks extends Trigger {
|
||||
* @param runParams*/
|
||||
@Override
|
||||
public final boolean performTest(final Map<AbilityKey, Object> runParams) {
|
||||
|
||||
if (!matchesValidParam("ValidCard", runParams.get(AbilityKey.Blocker))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ ManaCost:1 R
|
||||
Types:Creature Goblin Warrior
|
||||
PT:2/1
|
||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigClash | TriggerDescription$ When CARDNAME enters the battlefield, clash with an opponent. If you win, put a +1/+1 counter on CARDNAME.
|
||||
SVar:TrigClash:DB$Clash | WinSubAbility$ DBPutCounter
|
||||
SVar:DBPutCounter:DB$PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1
|
||||
SVar:TrigClash:DB$ Clash | WinSubAbility$ DBPutCounter
|
||||
SVar:DBPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/adder_staff_boggart.jpg
|
||||
Oracle:When Adder-Staff Boggart enters the battlefield, clash with an opponent. If you win, put a +1/+1 counter on Adder-Staff Boggart. (Each clashing player reveals the top card of their library, then puts that card on the top or bottom. A player wins if their card had a higher mana value.)
|
||||
|
||||
@@ -4,7 +4,7 @@ Types:Creature Goblin Warrior
|
||||
PT:4/1
|
||||
K:CARDNAME can't block.
|
||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigClash | TriggerDescription$ When CARDNAME enters the battlefield, clash with an opponent. If you win, put a +1/+1 counter on CARDNAME.
|
||||
SVar:TrigClash:DB$Clash | WinSubAbility$ DBPutCounter
|
||||
SVar:DBPutCounter:DB$PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1
|
||||
SVar:TrigClash:DB$ Clash | WinSubAbility$ DBPutCounter
|
||||
SVar:DBPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/bog_hoodlums.jpg
|
||||
Oracle:Bog Hoodlums can't block.\nWhen Bog Hoodlums enters the battlefield, clash with an opponent. If you win, put a +1/+1 counter on Bog Hoodlums. (Each clashing player reveals the top card of their library, then puts that card on the top or bottom. A player wins if their card had a higher mana value.)
|
||||
|
||||
Reference in New Issue
Block a user