mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Fixed NPE errors
This commit is contained in:
parent
dc7ccc6c4e
commit
e39dc1124b
12 changed files with 29 additions and 70 deletions
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
@ -22,8 +20,9 @@ import mage.game.events.GameEvent.EventType;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
*/
|
||||
public final class CarpetOfFlowers extends CardImpl {
|
||||
|
@ -74,12 +73,7 @@ class CarpetOfFlowersTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
Boolean activatedThisTurn = (Boolean) game.getState().getValue(this.originalId.toString() + "addMana");
|
||||
if (activatedThisTurn == null) {
|
||||
return true;
|
||||
} else {
|
||||
return !activatedThisTurn;
|
||||
}
|
||||
return !Boolean.TRUE.equals(game.getState().getValue(this.originalId.toString() + "addMana"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.StateTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
|
@ -19,8 +13,9 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.token.TokenImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class HiddenPredators extends CardImpl {
|
||||
|
@ -80,11 +75,7 @@ class HiddenPredatorsStateTriggeredAbility extends StateTriggeredAbility {
|
|||
@Override
|
||||
public boolean canTrigger(Game game) {
|
||||
//20100716 - 603.8
|
||||
Boolean triggered = (Boolean) game.getState().getValue(getSourceId().toString() + "triggered");
|
||||
if (triggered == null) {
|
||||
triggered = Boolean.FALSE;
|
||||
}
|
||||
return !triggered;
|
||||
return !Boolean.TRUE.equals(game.getState().getValue(getSourceId().toString() + "triggered"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -20,8 +19,9 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class IntetTheDreamer extends CardImpl {
|
||||
|
@ -190,7 +190,7 @@ class IntetTheDreamerLookEffect extends AsThoughEffectImpl {
|
|||
return (card != null
|
||||
&& card.isFaceDown(game)
|
||||
&& game.getExile().containsId(card.getId(), game)
|
||||
&& (Boolean) game.getState().getValue("Exiled_IntetTheDreamer" + card.getId()));
|
||||
&& Boolean.TRUE.equals(game.getState().getValue("Exiled_IntetTheDreamer" + card.getId())));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.StateTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
|
||||
|
@ -14,8 +13,9 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.token.TokenImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class LurkingJackals extends CardImpl {
|
||||
|
@ -75,11 +75,7 @@ class LurkingJackalsStateTriggeredAbility extends StateTriggeredAbility {
|
|||
@Override
|
||||
public boolean canTrigger(Game game) {
|
||||
//20100716 - 603.8
|
||||
Boolean triggered = (Boolean) game.getState().getValue(getSourceId().toString() + "triggered");
|
||||
if (triggered == null) {
|
||||
triggered = Boolean.FALSE;
|
||||
}
|
||||
return !triggered;
|
||||
return !Boolean.TRUE.equals(game.getState().getValue(getSourceId().toString() + "triggered"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.StateTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
|
||||
|
@ -14,8 +13,9 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.token.TokenImpl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class OpalAvenger extends CardImpl {
|
||||
|
@ -71,11 +71,7 @@ class OpalAvengerStateTriggeredAbility extends StateTriggeredAbility {
|
|||
@Override
|
||||
public boolean canTrigger(Game game) {
|
||||
//20100716 - 603.8
|
||||
Boolean triggered = (Boolean) game.getState().getValue(getSourceId().toString() + "triggered");
|
||||
if (triggered == null) {
|
||||
triggered = Boolean.FALSE;
|
||||
}
|
||||
return !triggered;
|
||||
return !Boolean.TRUE.equals(game.getState().getValue(getSourceId().toString() + "triggered"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -108,7 +108,7 @@ class TogglodyteToggleEffect extends OneShotEffect {
|
|||
if (game.getState().getValue(mageObject.getId() + "_toggle") == null) {
|
||||
return false;
|
||||
}
|
||||
boolean toggled = (Boolean) game.getState().getValue(mageObject.getId() + "_toggle");
|
||||
boolean toggled = Boolean.TRUE.equals(game.getState().getValue(mageObject.getId() + "_toggle"));
|
||||
game.getState().setValue(mageObject.getId() + "_toggle", !toggled);
|
||||
((Permanent) mageObject).addInfo("toggle", CardUtil.addToolTipMarkTags("Switch: " + (!toggled ? "ON" : "OFF")), game);
|
||||
return true;
|
||||
|
@ -184,8 +184,8 @@ class TogglodyteCondition implements Condition {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (mageObject != null && game.getState().getValue(mageObject.getId() + "_toggle") != null) {
|
||||
return !((Boolean) game.getState().getValue(mageObject.getId() + "_toggle"));
|
||||
if (mageObject != null) {
|
||||
return !Boolean.TRUE.equals(game.getState().getValue(mageObject.getId() + "_toggle"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -55,10 +55,7 @@ class UnwindingClockEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Boolean applied = (Boolean) game.getState().getValue(source.getSourceId() + "applied");
|
||||
if (applied == null) {
|
||||
applied = Boolean.FALSE;
|
||||
}
|
||||
boolean applied = Boolean.TRUE.equals(game.getState().getValue(source.getSourceId() + "applied"));
|
||||
if (!applied && layer == Layer.RulesEffects) {
|
||||
if (!game.isActivePlayer(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
|
||||
game.getState().setValue(source.getSourceId() + "applied", true);
|
||||
|
|
|
@ -68,10 +68,7 @@ class UrbanBurgeoningUntapEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Boolean applied = (Boolean) game.getState().getValue(source.getSourceId() + "applied");
|
||||
if (applied == null) {
|
||||
applied = Boolean.FALSE;
|
||||
}
|
||||
boolean applied = Boolean.TRUE.equals(game.getState().getValue(source.getSourceId() + "applied"));
|
||||
if (!applied && layer == Layer.RulesEffects) {
|
||||
if (!game.isActivePlayer(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
|
||||
game.getState().setValue(source.getSourceId() + "applied", true);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.v;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.StateTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
|
||||
|
@ -15,8 +14,9 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.token.TokenImpl;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class VeiledCrocodile extends CardImpl {
|
||||
|
@ -76,11 +76,7 @@ class VeiledCrocodileStateTriggeredAbility extends StateTriggeredAbility {
|
|||
@Override
|
||||
public boolean canTrigger(Game game) {
|
||||
//20100716 - 603.8
|
||||
Boolean triggered = (Boolean) game.getState().getValue(getSourceId().toString() + "triggered");
|
||||
if (triggered == null) {
|
||||
triggered = Boolean.FALSE;
|
||||
}
|
||||
return !triggered;
|
||||
return !Boolean.TRUE.equals(game.getState().getValue(getSourceId().toString() + "triggered"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
package mage.abilities;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class StateTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
@ -23,11 +22,7 @@ public abstract class StateTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public boolean canTrigger(Game game) {
|
||||
//20100716 - 603.8
|
||||
Boolean triggered = (Boolean) game.getState().getValue(getSourceId().toString() + "triggered");
|
||||
if (triggered == null) {
|
||||
triggered = Boolean.FALSE;
|
||||
}
|
||||
return !triggered;
|
||||
return !Boolean.TRUE.equals(game.getState().getValue(getSourceId().toString() + "triggered"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,10 +28,7 @@ public class UntapSourceDuringEachOtherPlayersUntapStepEffect extends Continuous
|
|||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Boolean applied = (Boolean) game.getState().getValue(source.getSourceId() + "applied");
|
||||
if (applied == null) {
|
||||
applied = Boolean.FALSE;
|
||||
}
|
||||
boolean applied = Boolean.TRUE.equals(game.getState().getValue(source.getSourceId() + "applied"));
|
||||
if (!applied && layer == Layer.RulesEffects) {
|
||||
if (!source.isControlledBy(game.getActivePlayerId())
|
||||
&& game.getStep() != null
|
||||
|
|
|
@ -122,7 +122,7 @@ public class BuybackAbility extends StaticAbility implements OptionalAdditionalS
|
|||
}
|
||||
|
||||
public boolean isBuybackActivated(Game game) {
|
||||
return (Boolean) game.getState().getValue(this.getSourceId().toString() + "_activatedBuyback");
|
||||
return Boolean.TRUE.equals(game.getState().getValue(this.getSourceId().toString() + "_activatedBuyback"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue