* Vizier of Remedies - Fixed a possible null pointer exception.

This commit is contained in:
LevelX2 2017-04-23 14:10:27 +02:00
parent eb96c85578
commit ceb7dbcdf2

View file

@ -31,9 +31,7 @@ import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
@ -42,14 +40,11 @@ import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.DamageCreatureEvent;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/** /**
* *
* @author anonymous * @author Stravant
*/ */
public class VizierOfRemedies extends CardImpl { public class VizierOfRemedies extends CardImpl {
@ -80,7 +75,7 @@ class VizierOfRemediesReplacementEffect extends ReplacementEffectImpl {
public VizierOfRemediesReplacementEffect() { public VizierOfRemediesReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit); super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "If one or more -1/-1 counters would be put on a creature you control, that many -1/-1 counters minus one are put on it instead."; staticText = "If one or more -1/-1 counters would be put on a creature you control, that many -1/-1 counters minus one are put on it instead";
} }
public VizierOfRemediesReplacementEffect(final VizierOfRemediesReplacementEffect effect) { public VizierOfRemediesReplacementEffect(final VizierOfRemediesReplacementEffect effect) {
@ -105,9 +100,13 @@ class VizierOfRemediesReplacementEffect extends ReplacementEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
boolean weControlTarget = game.getControllerId(event.getTargetId()).equals(source.getControllerId()); if (source != null && source.getControllerId() != null) {
boolean isM1M1Counters = event.getData().equals(CounterType.M1M1.getName()); if (source.getControllerId().equals(game.getControllerId(event.getTargetId()))
boolean isOneOrMore = event.getAmount() > 0; && event.getData() != null && event.getData().equals(CounterType.M1M1.getName())
return weControlTarget && isM1M1Counters && isOneOrMore; && event.getAmount() > 0) {
return true;
}
}
return false;
} }
} }