mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
prevent npe mojhosto
This commit is contained in:
@@ -63,6 +63,7 @@ public class SacrificeAi extends SpellAbilityAi {
|
|||||||
final boolean destroy = sa.hasParam("Destroy");
|
final boolean destroy = sa.hasParam("Destroy");
|
||||||
|
|
||||||
Player opp = ai.getWeakestOpponent();
|
Player opp = ai.getWeakestOpponent();
|
||||||
|
|
||||||
if (tgt != null) {
|
if (tgt != null) {
|
||||||
sa.resetTargets();
|
sa.resetTargets();
|
||||||
if (!opp.canBeTargetedBy(sa)) {
|
if (!opp.canBeTargetedBy(sa)) {
|
||||||
@@ -74,8 +75,16 @@ public class SacrificeAi extends SpellAbilityAi {
|
|||||||
num = (num == null) ? "1" : num;
|
num = (num == null) ? "1" : num;
|
||||||
final int amount = AbilityUtils.calculateAmount(sa.getHostCard(), num, sa);
|
final int amount = AbilityUtils.calculateAmount(sa.getHostCard(), num, sa);
|
||||||
|
|
||||||
List<Card> list =
|
List<Card> list = null;
|
||||||
CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
|
try {
|
||||||
|
list = CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid.split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
if (list == null)
|
||||||
|
return false;
|
||||||
|
}//prevent NPE on MoJhoSto
|
||||||
|
|
||||||
for (Card c : list) {
|
for (Card c : list) {
|
||||||
if (c.hasSVar("SacMe") && Integer.parseInt(c.getSVar("SacMe")) > 3) {
|
if (c.hasSVar("SacMe") && Integer.parseInt(c.getSVar("SacMe")) > 3) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user