mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Fix NPE
This commit is contained in:
@@ -236,7 +236,7 @@ public class CombatUtil {
|
|||||||
// attacker got goaded by defender or defender is not player
|
// attacker got goaded by defender or defender is not player
|
||||||
if (goadedByDefender || !(defender instanceof Player)) {
|
if (goadedByDefender || !(defender instanceof Player)) {
|
||||||
for (GameEntity ge : getAllPossibleDefenders(attacker.getController())) {
|
for (GameEntity ge : getAllPossibleDefenders(attacker.getController())) {
|
||||||
if (!defender.equals(ge) && ge instanceof Player) {
|
if (!ge.equals(defender) && ge instanceof Player) {
|
||||||
// found a player which does not goad that creature
|
// found a player which does not goad that creature
|
||||||
// and creature can attack this player or planeswalker
|
// and creature can attack this player or planeswalker
|
||||||
if (!attacker.isGoadedBy((Player) ge) && !ge.hasKeyword("Creatures your opponents control attack a player other than you if able.") && canAttack(attacker, ge)) {
|
if (!attacker.isGoadedBy((Player) ge) && !ge.hasKeyword("Creatures your opponents control attack a player other than you if able.") && canAttack(attacker, ge)) {
|
||||||
@@ -250,7 +250,7 @@ public class CombatUtil {
|
|||||||
// Quasi-goad logic for "Kardur, Doomscourge" etc. that isn't goad but behaves the same
|
// Quasi-goad logic for "Kardur, Doomscourge" etc. that isn't goad but behaves the same
|
||||||
if (defender != null && defender.hasKeyword("Creatures your opponents control attack a player other than you if able.")) {
|
if (defender != null && defender.hasKeyword("Creatures your opponents control attack a player other than you if able.")) {
|
||||||
for (GameEntity ge : getAllPossibleDefenders(attacker.getController())) {
|
for (GameEntity ge : getAllPossibleDefenders(attacker.getController())) {
|
||||||
if (!defender.equals(ge) && ge instanceof Player) {
|
if (!ge.equals(defender) && ge instanceof Player) {
|
||||||
if (!ge.hasKeyword("Creatures your opponents control attack a player other than you if able.") && canAttack(attacker, ge)) {
|
if (!ge.hasKeyword("Creatures your opponents control attack a player other than you if able.") && canAttack(attacker, ge)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,12 +55,6 @@ public class TriggerCounterAddedOnce extends Trigger {
|
|||||||
* @param runParams*/
|
* @param runParams*/
|
||||||
@Override
|
@Override
|
||||||
public final boolean performTest(final Map<AbilityKey, Object> runParams) {
|
public final boolean performTest(final Map<AbilityKey, Object> runParams) {
|
||||||
if (hasParam("FirstTime")) {
|
|
||||||
if (!(boolean) runParams.get(AbilityKey.FirstTime)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasParam("CounterType")) {
|
if (hasParam("CounterType")) {
|
||||||
final CounterType addedType = (CounterType) runParams.get(AbilityKey.CounterType);
|
final CounterType addedType = (CounterType) runParams.get(AbilityKey.CounterType);
|
||||||
final String type = getParam("CounterType");
|
final String type = getParam("CounterType");
|
||||||
@@ -83,6 +77,12 @@ public class TriggerCounterAddedOnce extends Trigger {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasParam("FirstTime")) {
|
||||||
|
if (!(boolean) runParams.get(AbilityKey.FirstTime)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user