From 04de56860aebc363da711d4ecc51998edcdf3f16 Mon Sep 17 00:00:00 2001 From: drmDev Date: Fri, 8 Apr 2016 00:16:12 -0400 Subject: [PATCH] Oracle Text fixes. NPE fixes --- .../sets/darkascension/MondronenShaman.java | 10 +++++----- .../NivixAerieOfTheFiremind.java | 4 ++-- .../khansoftarkir/AnafenzaTheForemost.java | 4 ++-- .../mage/sets/planarchaos/RealityAcid.java | 2 +- .../CrawlingSensation.java | 19 ++++++++++++++----- .../TheGitrogMonster.java | 18 ++++++++++-------- .../keyword/VanishingUpkeepAbility.java | 12 ++++++++++-- .../game/permanent/token/InsectToken.java | 3 +-- 8 files changed, 45 insertions(+), 27 deletions(-) diff --git a/Mage.Sets/src/mage/sets/darkascension/MondronenShaman.java b/Mage.Sets/src/mage/sets/darkascension/MondronenShaman.java index b6e7822feb2..c18aee2b1d3 100644 --- a/Mage.Sets/src/mage/sets/darkascension/MondronenShaman.java +++ b/Mage.Sets/src/mage/sets/darkascension/MondronenShaman.java @@ -28,9 +28,6 @@ package mage.sets.darkascension; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.TargetController; import mage.MageInt; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; @@ -39,6 +36,9 @@ import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.TransformSourceEffect; import mage.abilities.keyword.TransformAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; /** * @@ -49,9 +49,9 @@ public class MondronenShaman extends CardImpl { public MondronenShaman(UUID ownerId) { super(ownerId, 98, "Mondronen Shaman", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}"); this.expansionSetCode = "DKA"; - this.subtype.add("Human"); - this.subtype.add("Werewolf"); + this.subtype.add("Human"); this.subtype.add("Shaman"); + this.subtype.add("Werewolf"); this.power = new MageInt(3); this.toughness = new MageInt(2); diff --git a/Mage.Sets/src/mage/sets/izzetvsgolgari/NivixAerieOfTheFiremind.java b/Mage.Sets/src/mage/sets/izzetvsgolgari/NivixAerieOfTheFiremind.java index 006beb5e712..c7172e3ca39 100644 --- a/Mage.Sets/src/mage/sets/izzetvsgolgari/NivixAerieOfTheFiremind.java +++ b/Mage.Sets/src/mage/sets/izzetvsgolgari/NivixAerieOfTheFiremind.java @@ -62,7 +62,7 @@ public class NivixAerieOfTheFiremind extends CardImpl { // {tap}: Add {C} to your mana pool. this.addAbility(new ColorlessManaAbility()); - // {2}{U}{R}, {tap}: Exile the top card of your library. Until your next turn, you may cast that card if it's an instant or sorcery. + // {2}{U}{R}, {tap}: Exile the top card of your library. Until your next turn, you may cast that card if it's an instant or sorcery card. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new NivixAerieOfTheFiremindEffect(), new ManaCostsImpl<>("{2}{U}{R}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); @@ -82,7 +82,7 @@ class NivixAerieOfTheFiremindEffect extends OneShotEffect { NivixAerieOfTheFiremindEffect() { super(Outcome.Benefit); - this.staticText = "Exile the top card of your library. Until your next turn, you may cast that card if it's an instant or sorcery"; + this.staticText = "Exile the top card of your library. Until your next turn, you may cast that card if it's an instant or sorcery card"; } NivixAerieOfTheFiremindEffect(final NivixAerieOfTheFiremindEffect effect) { diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/AnafenzaTheForemost.java b/Mage.Sets/src/mage/sets/khansoftarkir/AnafenzaTheForemost.java index 232964e4733..b7ab36c1da6 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/AnafenzaTheForemost.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/AnafenzaTheForemost.java @@ -80,7 +80,7 @@ public class AnafenzaTheForemost extends CardImpl { ability.addTarget(new TargetControlledCreaturePermanent(filter)); this.addAbility(ability); - // If a creature card would be put into an opponent's graveyard from anywhere, exile it instead. + // If a nontoken creature an opponent owns would die or a creature card not on the battlefield would be put into an opponent's graveyard, exile that card instead. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AnafenzaTheForemostEffect())); } @@ -98,7 +98,7 @@ class AnafenzaTheForemostEffect extends ReplacementEffectImpl { public AnafenzaTheForemostEffect() { super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "If a creature card would be put into an opponent's graveyard from anywhere, exile it instead"; + staticText = "If a nontoken creature an opponent owns would die or a creature card not on the battlefield would be put into an opponent's graveyard, exile that card instead"; } public AnafenzaTheForemostEffect(final AnafenzaTheForemostEffect effect) { diff --git a/Mage.Sets/src/mage/sets/planarchaos/RealityAcid.java b/Mage.Sets/src/mage/sets/planarchaos/RealityAcid.java index ac39868c19b..b915833f75f 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/RealityAcid.java +++ b/Mage.Sets/src/mage/sets/planarchaos/RealityAcid.java @@ -72,7 +72,7 @@ public class RealityAcid extends CardImpl { ability = new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.TIME.createInstance(3))); ability.setRuleVisible(false); this.addAbility(ability); - this.addAbility(new VanishingUpkeepAbility(3)); + this.addAbility(new VanishingUpkeepAbility(3, "aura")); this.addAbility(new VanishingSacrificeAbility()); // When Reality Acid leaves the battlefield, enchanted permanent's controller sacrifices it. diff --git a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/CrawlingSensation.java b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/CrawlingSensation.java index 37dbc25f9b7..6a6629b75e1 100644 --- a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/CrawlingSensation.java +++ b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/CrawlingSensation.java @@ -27,6 +27,7 @@ */ package mage.sets.shadowsoverinnistrad; +import java.util.List; import java.util.UUID; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.OnEventTriggeredAbility; @@ -87,13 +88,21 @@ class CrawlingSensationTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; - if (Zone.GRAVEYARD == zEvent.getToZone()) { + if (zEvent != null && Zone.GRAVEYARD == zEvent.getToZone() && zEvent.getCards() != null) { Integer usedOnTurn = (Integer) game.getState().getValue("usedOnTurn" + getOriginalId()); if (usedOnTurn == null || usedOnTurn < game.getTurnNum()) { - for (Card card : zEvent.getCards()) { - if (card.getOwnerId().equals(getControllerId()) && card.getCardType().contains(CardType.LAND)) { - game.getState().setValue("usedOnTurn" + getOriginalId(), game.getTurnNum()); - return true; + for (Card card : zEvent.getCards()) { + if (card != null) { + UUID cardOwnerId = card.getOwnerId(); + List cardType = card.getCardType(); + + if (cardOwnerId != null + && card.getOwnerId().equals(getControllerId()) + && cardType != null + && card.getCardType().contains(CardType.LAND)) { + game.getState().setValue("usedOnTurn" + getOriginalId(), game.getTurnNum()); + return true; + } } } } diff --git a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/TheGitrogMonster.java b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/TheGitrogMonster.java index 34932ba8130..de237730a76 100644 --- a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/TheGitrogMonster.java +++ b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/TheGitrogMonster.java @@ -107,15 +107,17 @@ class TheGitrogMonsterTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; - if (Zone.GRAVEYARD == zEvent.getToZone() && zEvent.getCards() != null) { + if (zEvent != null && Zone.GRAVEYARD == zEvent.getToZone() && zEvent.getCards() != null) { for (Card card : zEvent.getCards()) { - UUID cardOwnerId = card.getOwnerId(); - List cardType = card.getCardType(); - if (cardOwnerId != null - && card.getOwnerId().equals(getControllerId()) - && cardType != null - && cardType.contains(CardType.LAND)) { - return true; + if (card != null) { + UUID cardOwnerId = card.getOwnerId(); + List cardType = card.getCardType(); + if (cardOwnerId != null + && card.getOwnerId().equals(getControllerId()) + && cardType != null + && cardType.contains(CardType.LAND)) { + return true; + } } } } diff --git a/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java b/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java index 211867bbae4..2b5bf00431a 100644 --- a/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java @@ -13,10 +13,18 @@ import mage.util.CardUtil; public class VanishingUpkeepAbility extends BeginningOfUpkeepTriggeredAbility { private int vanishingAmount; + private String permanentType; public VanishingUpkeepAbility(int vanishingEffect) { super(new VanishingEffect(), TargetController.YOU, false); this.vanishingAmount = vanishingEffect; + this.permanentType = "creature"; + } + + public VanishingUpkeepAbility(int vanishingEffect, String permanentType) { + super(new VanishingEffect(), TargetController.YOU, false); + this.vanishingAmount = vanishingEffect; + this.permanentType = permanentType; } public VanishingUpkeepAbility(final VanishingUpkeepAbility ability) { @@ -33,11 +41,11 @@ public class VanishingUpkeepAbility extends BeginningOfUpkeepTriggeredAbility { public String getRule() { if(vanishingAmount > 0) { return "Vanishing " + vanishingAmount - + " (This permanent enters the battlefield with " + CardUtil.numberToText(vanishingAmount) + + " (This " + permanentType + " enters the battlefield with " + CardUtil.numberToText(vanishingAmount) + " time counters on it. At the beginning of your upkeep, remove a time counter from it. When the last is removed, sacrifice it.)"; } else { - return "Vanishing (At the beginning of your upkeep, remove a time counter from this permanent. When the last is removed, sacrifice it.)"; + return "Vanishing (At the beginning of your upkeep, remove a time counter from this " + permanentType + ". When the last is removed, sacrifice it.)"; } } } diff --git a/Mage/src/main/java/mage/game/permanent/token/InsectToken.java b/Mage/src/main/java/mage/game/permanent/token/InsectToken.java index cd1e1be1686..f9c0ce97dc9 100644 --- a/Mage/src/main/java/mage/game/permanent/token/InsectToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/InsectToken.java @@ -31,7 +31,6 @@ package mage.game.permanent.token; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - import mage.MageInt; import mage.constants.CardType; @@ -44,7 +43,7 @@ public class InsectToken extends Token { final static private List tokenImageSets = new ArrayList<>(); static { - tokenImageSets.addAll(Arrays.asList("M10", "MM2")); + tokenImageSets.addAll(Arrays.asList("M10", "MM2", "SOI")); } public InsectToken() {