change enum equals to == in cards

This commit is contained in:
ingmargoudt 2017-03-02 16:28:23 +01:00
parent 5087534fe4
commit 39c9420ad2
148 changed files with 237 additions and 238 deletions

View file

@ -105,7 +105,7 @@ class AccursedWitchReturnTransformedEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
if (game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) { if (game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE); game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
//note: should check for null after game.getCard //note: should check for null after game.getCard
Card card = game.getCard(source.getSourceId()); Card card = game.getCard(source.getSourceId());

View file

@ -101,7 +101,7 @@ class AeonChroniclerTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
return event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId()); return event.getData() == CounterType.TIME.getName() && event.getTargetId().equals(this.getSourceId());
} }
@Override @Override

View file

@ -152,12 +152,12 @@ class AjaniSteadfastPreventEffect extends PreventionEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER) if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER
&& event.getTargetId().equals(source.getControllerId())) { && event.getTargetId().equals(source.getControllerId())) {
return super.applies(event, source, game); return super.applies(event, source, game);
} }
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER)) { if (event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER) {
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) {
return super.applies(event, source, game); return super.applies(event, source, game);

View file

@ -142,7 +142,7 @@ class AlhammarretsArchiveReplacementEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getPlayerId().equals(source.getControllerId())) { if (event.getPlayerId().equals(source.getControllerId())) {
if (game.getActivePlayerId().equals(event.getPlayerId()) if (game.getActivePlayerId().equals(event.getPlayerId())
&& game.getPhase().getStep().getType().equals(PhaseStep.DRAW)) { && game.getPhase().getStep().getType() == PhaseStep.DRAW) {
CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep"); CardsDrawnDuringDrawStepWatcher watcher = (CardsDrawnDuringDrawStepWatcher) game.getState().getWatchers().get("CardsDrawnDuringDrawStep");
if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) { if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) > 0) {
return true; return true;

View file

@ -97,7 +97,7 @@ class AltarOfTheLostManaCondition implements Condition {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId()); MageObject object = game.getObject(source.getSourceId());
if (object instanceof Spell && ((Spell) object).getFromZone().equals(Zone.GRAVEYARD)) { if (object instanceof Spell && ((Spell) object).getFromZone() == Zone.GRAVEYARD) {
for (Ability ability : ((Spell) object).getAbilities(game)) { for (Ability ability : ((Spell) object).getAbilities(game)) {
if (ability instanceof FlashbackAbility) { if (ability instanceof FlashbackAbility) {
return true; return true;

View file

@ -118,7 +118,7 @@ class AnafenzaTheForemostEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
if (((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)) { if (((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) {
Permanent permanent = ((ZoneChangeEvent) event).getTarget(); Permanent permanent = ((ZoneChangeEvent) event).getTarget();
if (permanent != null) { if (permanent != null) {
return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true); return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true);

View file

@ -148,7 +148,7 @@ class AngelOfJubilationSacrificeFilterEffect extends CostModificationEffectImpl
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED) || return abilityToModify.getAbilityType() == AbilityType.ACTIVATED ||
abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility; abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility;
} }

View file

@ -117,7 +117,7 @@ class AngelsGraceReplacementEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS); return event.getType() == EventType.DAMAGE_CAUSES_LIFE_LOSS;
} }

View file

@ -205,7 +205,7 @@ class AnimateDeadAttachEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getFirstTarget()); Card card = game.getCard(source.getFirstTarget());
if (card != null && game.getState().getZone(source.getFirstTarget()).equals(Zone.GRAVEYARD)) { if (card != null && game.getState().getZone(source.getFirstTarget()) == Zone.GRAVEYARD) {
// Card have no attachedTo attribute yet so write ref only to enchantment now // Card have no attachedTo attribute yet so write ref only to enchantment now
Permanent enchantment = game.getPermanent(source.getSourceId()); Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null) { if (enchantment != null) {

View file

@ -95,7 +95,7 @@ class AnthemOfRakdosHellbentEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE) return event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|| event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); || event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER);
} }

View file

@ -154,7 +154,7 @@ class AvacynGuardianAngelPreventToCreaturePreventionEffect extends PreventionEff
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) { if (super.applies(event, source, game)) {
if (event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE) if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE
&& event.getTargetId().equals(getTargetPointer().getFirst(game, source))) { && event.getTargetId().equals(getTargetPointer().getFirst(game, source))) {
MageObject sourceObject = game.getObject(event.getSourceId()); MageObject sourceObject = game.getObject(event.getSourceId());
if (sourceObject != null && sourceObject.getColor(game).shares(this.color)) { if (sourceObject != null && sourceObject.getColor(game).shares(this.color)) {
@ -223,7 +223,7 @@ class AvacynGuardianAngelPreventToPlayerPreventionEffect extends PreventionEffec
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) { if (super.applies(event, source, game)) {
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER) if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER
&& event.getTargetId().equals(getTargetPointer().getFirst(game, source))) { && event.getTargetId().equals(getTargetPointer().getFirst(game, source))) {
MageObject sourceObject = game.getObject(event.getSourceId()); MageObject sourceObject = game.getObject(event.getSourceId());
if (sourceObject != null && sourceObject.getColor(game).shares(this.color)) { if (sourceObject != null && sourceObject.getColor(game).shares(this.color)) {

View file

@ -104,7 +104,7 @@ class AdjustingCostsAbility extends SimpleStaticAbility implements AdjustingSour
@Override @Override
public void adjustCosts(Ability ability, Game game) { public void adjustCosts(Ability ability, Game game) {
if (ability.getAbilityType().equals(AbilityType.SPELL)) { if (ability.getAbilityType() == AbilityType.SPELL) {
Player player = game.getPlayer(ability.getControllerId()); Player player = game.getPlayer(ability.getControllerId());
if (player != null && player.getLife() < 4) { if (player != null && player.getLife() < 4) {
CardUtil.adjustCost((SpellAbility)ability, 6); CardUtil.adjustCost((SpellAbility)ability, 6);

View file

@ -80,7 +80,7 @@ class AwakenTheSkyTyrantTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkEventType(GameEvent event, Game game) { public boolean checkEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER); return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
} }
@Override @Override

View file

@ -112,7 +112,7 @@ class BansheesBladeAbility extends TriggeredAbilityImpl {
return true; return true;
} }
} }
if (event.getType().equals(GameEvent.EventType.COMBAT_DAMAGE_STEP_PRE)) { if (event.getType() == EventType.COMBAT_DAMAGE_STEP_PRE) {
usedInPhase = false; usedInPhase = false;
} }
return false; return false;

View file

@ -101,7 +101,7 @@ class BattlefieldScroungerCost extends CostImpl {
if (targets.choose(Outcome.Removal, controllerId, sourceId, game)) { if (targets.choose(Outcome.Removal, controllerId, sourceId, game)) {
for (UUID targetId: targets.get(0).getTargets()) { for (UUID targetId: targets.get(0).getTargets()) {
Card card = game.getCard(targetId); Card card = game.getCard(targetId);
if (card == null || !game.getState().getZone(targetId).equals(Zone.GRAVEYARD)) { if (card == null || game.getState().getZone(targetId) != Zone.GRAVEYARD) {
return false; return false;
} }
paid |= controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.GRAVEYARD, false, true); paid |= controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.GRAVEYARD, false, true);

View file

@ -104,7 +104,7 @@ class BerserkReplacementEffect extends ContinuousRuleModifyingEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.CAST_SPELL) && event.getSourceId().equals(source.getSourceId())) { if (event.getType() == GameEvent.EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) {
CombatDamageStepStartedWatcher watcher = (CombatDamageStepStartedWatcher) game.getState().getWatchers().get("CombatDamageStepStarted"); CombatDamageStepStartedWatcher watcher = (CombatDamageStepStartedWatcher) game.getState().getWatchers().get("CombatDamageStepStarted");
return watcher == null || watcher.conditionMet(); return watcher == null || watcher.conditionMet();
} }

View file

@ -153,13 +153,13 @@ class BlindingBeamEffect2 extends ContinuousRuleModifyingEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.UNTAP); return event.getType() == EventType.UNTAP;
} }
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
// prevent untap event of creatures of target player // prevent untap event of creatures of target player
if (game.getTurn().getStepType().equals(PhaseStep.UNTAP)) { if (game.getTurn().getStepType() == PhaseStep.UNTAP) {
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getControllerId().equals(targetPlayerId) && filter.match(permanent, game)) { if (permanent != null && permanent.getControllerId().equals(targetPlayerId) && filter.match(permanent, game)) {
return true; return true;

View file

@ -140,7 +140,7 @@ class BloodBaronOfVizkopaEffect extends ContinuousEffectImpl {
@Override @Override
public boolean hasLayer(Layer layer) { public boolean hasLayer(Layer layer) {
return (layer.equals(Layer.AbilityAddingRemovingEffects_6) || layer.equals(layer.PTChangingEffects_7)); return (layer == Layer.AbilityAddingRemovingEffects_6 || layer == layer.PTChangingEffects_7);
} }

View file

@ -93,17 +93,17 @@ class BloodFrenzyCastRestriction extends ContinuousRuleModifyingEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.CAST_SPELL); return event.getType() == GameEvent.EventType.CAST_SPELL;
} }
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if(event.getSourceId().equals(source.getSourceId())) { if(event.getSourceId().equals(source.getSourceId())) {
if(game.getPhase().getType().equals(TurnPhase.COMBAT) if(game.getPhase().getType() == TurnPhase.COMBAT
// There cannot be a legal target before declare attackers, // There cannot be a legal target before declare attackers,
// so in practice it is limited to these two steps. // so in practice it is limited to these two steps.
&& (game.getStep().getType().equals(PhaseStep.DECLARE_ATTACKERS) && (game.getStep().getType() == PhaseStep.DECLARE_ATTACKERS
|| game.getStep().getType().equals(PhaseStep.DECLARE_BLOCKERS))) { || game.getStep().getType() == PhaseStep.DECLARE_BLOCKERS)) {
return false; return false;
} }
return true; return true;

View file

@ -94,7 +94,7 @@ class BoonReflectionEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.GAIN_LIFE); return event.getType() == EventType.GAIN_LIFE;
} }
@Override @Override

View file

@ -92,7 +92,7 @@ class CabalExecutionerAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkEventType(GameEvent event, Game game) { public boolean checkEventType(GameEvent event, Game game) {
return EventType.DAMAGED_PLAYER.equals(event.getType()); return event.getType() == EventType.DAMAGED_PLAYER;
} }

View file

@ -247,7 +247,7 @@ class ChandraPyromasterCastFromExileEffect extends AsThoughEffectImpl {
@Override @Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (targetPointer.getTargets(game, source).contains(sourceId)) { if (targetPointer.getTargets(game, source).contains(sourceId)) {
return game.getState().getZone(sourceId).equals(Zone.EXILED); return game.getState().getZone(sourceId) == Zone.EXILED;
} }
return false; return false;
} }

View file

@ -102,7 +102,7 @@ class ConsecrateLandRuleEffect extends ContinuousRuleModifyingEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.ATTACH) || event.getType().equals(EventType.STAY_ATTACHED); return event.getType() == EventType.ATTACH || event.getType() == EventType.STAY_ATTACHED;
} }
@Override @Override

View file

@ -128,7 +128,7 @@ class ConspiracyEffect extends ContinuousEffectImpl {
} }
// commander in command zone // commander in command zone
for (UUID commanderId : controller.getCommandersIds()) { for (UUID commanderId : controller.getCommandersIds()) {
if (game.getState().getZone(commanderId).equals(Zone.COMMAND)) { if (game.getState().getZone(commanderId) == Zone.COMMAND) {
Card card = game.getCard(commanderId); Card card = game.getCard(commanderId);
if (card.getCardType().contains(CardType.CREATURE)) { if (card.getCardType().contains(CardType.CREATURE)) {
setCreatureSubtype(card, choice, game); setCreatureSubtype(card, choice, game);

View file

@ -94,7 +94,7 @@ class CurseOfBloodlettingEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
} }
@Override @Override

View file

@ -91,7 +91,7 @@ class CurseOfInertiaTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkEventType(GameEvent event, Game game) { public boolean checkEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.DECLARED_ATTACKERS); return event.getType() == EventType.DECLARED_ATTACKERS;
} }
@Override @Override

View file

@ -240,7 +240,7 @@ class DarettiScrapSavantEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Card card = game.getCard(getTargetPointer().getFirst(game, source)); Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null && game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) { if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect(); Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game))); effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
effect.setText("return that card to the battlefield at the beginning of the next end step"); effect.setText("return that card to the battlefield at the beginning of the next end step");

View file

@ -211,7 +211,7 @@ class DaxosOfMeletisSpendAnyManaEffect extends AsThoughEffectImpl implements AsT
&& Objects.equals(objectId, ((FixedTarget) getTargetPointer()).getTarget()) && Objects.equals(objectId, ((FixedTarget) getTargetPointer()).getTarget())
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId) && ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
&& (((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)) && (((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId))
&& game.getState().getZone(objectId).equals(Zone.STACK); && game.getState().getZone(objectId) == Zone.STACK;
} }
@Override @Override

View file

@ -179,7 +179,7 @@ class DecayingSoilEffect extends OneShotEffect {
if (target != null) { if (target != null) {
Card card = game.getCard(target); Card card = game.getCard(target);
// check if it's still in graveyard // check if it's still in graveyard
if (card != null && game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) { if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, true); card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
return true; return true;
} }

View file

@ -96,7 +96,7 @@ class DelayEffect extends OneShotEffect {
Effect effect = new CounterTargetWithReplacementEffect(Zone.EXILED); Effect effect = new CounterTargetWithReplacementEffect(Zone.EXILED);
effect.setTargetPointer(targetPointer); effect.setTargetPointer(targetPointer);
Card card = game.getCard(spell.getSourceId()); Card card = game.getCard(spell.getSourceId());
if (card != null && effect.apply(game, source) && Zone.EXILED.equals(game.getState().getZone(card.getId()))) { if (card != null && effect.apply(game, source) && game.getState().getZone(card.getId()) == Zone.EXILED) {
boolean hasSuspend = card.getAbilities().containsClass(SuspendAbility.class); boolean hasSuspend = card.getAbilities().containsClass(SuspendAbility.class);
UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game); UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game);
if (controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getLogName(), source.getSourceId(), game, Zone.HAND, true)) { if (controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getLogName(), source.getSourceId(), game, Zone.HAND, true)) {

View file

@ -139,7 +139,7 @@ class DereviEmpyrialTacticianTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean canActivate(UUID playerId, Game game) { public boolean canActivate(UUID playerId, Game game) {
Zone currentZone = game.getState().getZone(this.getSourceId()); Zone currentZone = game.getState().getZone(this.getSourceId());
if (currentZone == null || !currentZone.equals(Zone.COMMAND)) { if (currentZone == null || currentZone != Zone.COMMAND) {
return false; return false;
} }
return super.canActivate(playerId, game); return super.canActivate(playerId, game);

View file

@ -130,7 +130,7 @@ class DescentIntoMadnessEffect extends OneShotEffect {
// move permanents and hand cards to exile // move permanents and hand cards to exile
for (UUID objectId : selectedObjects) { for (UUID objectId : selectedObjects) {
if (game.getState().getZone(objectId).equals(Zone.BATTLEFIELD)) { if (game.getState().getZone(objectId) == Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(objectId); Permanent permanent = game.getPermanent(objectId);
if (permanent != null) { if (permanent != null) {
Player player = game.getPlayer(permanent.getControllerId()); Player player = game.getPlayer(permanent.getControllerId());
@ -138,7 +138,7 @@ class DescentIntoMadnessEffect extends OneShotEffect {
player.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); player.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true);
} }
} }
} else if (game.getState().getZone(objectId).equals(Zone.HAND)) { } else if (game.getState().getZone(objectId) == Zone.HAND) {
Card card = game.getCard(objectId); Card card = game.getCard(objectId);
if (card != null) { if (card != null) {
Player player = game.getPlayer(card.getOwnerId()); Player player = game.getPlayer(card.getOwnerId());

View file

@ -85,7 +85,7 @@ class DoublingSeasonTokenEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.CREATE_TOKEN); return event.getType() == GameEvent.EventType.CREATE_TOKEN;
} }
@Override @Override

View file

@ -75,7 +75,7 @@ public class DraconicRoar extends CardImpl {
@Override @Override
public void adjustCosts(Ability ability, Game game) { public void adjustCosts(Ability ability, Game game) {
if (ability.getAbilityType().equals(AbilityType.SPELL)) { if (ability.getAbilityType() == AbilityType.SPELL) {
Player controller = game.getPlayer(ability.getControllerId()); Player controller = game.getPlayer(ability.getControllerId());
if (controller != null) { if (controller != null) {
if (controller.getHand().count(filter, game) > 0) { if (controller.getHand().count(filter, game) > 0) {

View file

@ -111,7 +111,7 @@ class DralnusPetEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId()); Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent == null && source.getAbilityType().equals(AbilityType.STATIC)) { if (permanent == null && source.getAbilityType() == AbilityType.STATIC) {
permanent = game.getPermanentEntering(source.getSourceId()); permanent = game.getPermanentEntering(source.getSourceId());
} }
if (controller != null && permanent != null) { if (controller != null && permanent != null) {

View file

@ -118,7 +118,7 @@ class EchoBaseCommandoEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED) || (abilityToModify.getAbilityType().equals(AbilityType.MANA) && (abilityToModify instanceof ActivatedAbility))) { if (abilityToModify.getAbilityType() == AbilityType.ACTIVATED || (abilityToModify.getAbilityType() == AbilityType.MANA && (abilityToModify instanceof ActivatedAbility))) {
Permanent permanent = game.getPermanent(abilityToModify.getSourceId()); Permanent permanent = game.getPermanent(abilityToModify.getSourceId());
if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
return true; return true;

View file

@ -66,7 +66,7 @@ public class EliminateTheCompetition extends CardImpl {
@Override @Override
public void adjustTargets(Ability ability, Game game) { public void adjustTargets(Ability ability, Game game) {
if (ability.getAbilityType().equals(AbilityType.SPELL)) { if (ability.getAbilityType() == AbilityType.SPELL) {
ability.getTargets().clear(); ability.getTargets().clear();
int sac = new GetXValue().calculate(game, ability, null); int sac = new GetXValue().calculate(game, ability, null);
ability.addTarget(new TargetCreaturePermanent(sac, sac)); ability.addTarget(new TargetCreaturePermanent(sac, sac));

View file

@ -99,7 +99,7 @@ class ReturnSourceToBattlefieldEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
if (!game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) { if (game.getState().getZone(source.getSourceId()) != Zone.GRAVEYARD) {
return false; return false;
} }
Card card = game.getCard(source.getSourceId()); Card card = game.getCard(source.getSourceId());

View file

@ -105,7 +105,7 @@ class EpochrasiteEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Card card = game.getCard(source.getSourceId()); Card card = game.getCard(source.getSourceId());
if (controller != null && card != null) { if (controller != null && card != null) {
if (game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) { if (game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game); UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game);
controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getName(), source.getSourceId(), game, Zone.GRAVEYARD, true); controller.moveCardToExileWithInfo(card, exileId, "Suspended cards of " + controller.getName(), source.getSourceId(), game, Zone.GRAVEYARD, true);
card.addCounters(CounterType.TIME.createInstance(3), source, game); card.addCounters(CounterType.TIME.createInstance(3), source, game);

View file

@ -85,7 +85,7 @@ class ErdwalIlluminatorTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkEventType(GameEvent event, Game game) { public boolean checkEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.INVESTIGATED); return event.getType() == EventType.INVESTIGATED;
} }
@Override @Override
@ -124,7 +124,7 @@ class InvestigatedWatcher extends Watcher {
@Override @Override
public void watch(GameEvent event, Game game) { public void watch(GameEvent event, Game game) {
if (EventType.INVESTIGATED.equals(event.getType())) { if (event.getType() == EventType.INVESTIGATED) {
if (!timesInvestigated.containsKey(event.getPlayerId())) { if (!timesInvestigated.containsKey(event.getPlayerId())) {
timesInvestigated.put(event.getPlayerId(), 1); timesInvestigated.put(event.getPlayerId(), 1);
} else { } else {

View file

@ -114,7 +114,7 @@ class ErebossTitanTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone().equals(Zone.GRAVEYARD)) { if (zEvent.getFromZone() == Zone.GRAVEYARD) {
Card card = game.getCard(zEvent.getTargetId()); Card card = game.getCard(zEvent.getTargetId());
Player controller = game.getPlayer(getControllerId()); Player controller = game.getPlayer(getControllerId());
return card != null return card != null

View file

@ -143,7 +143,7 @@ class ExtraplanarLensTriggeredAbility extends TriggeredManaAbility {
&& !extraplanarLens.getImprinted().isEmpty()) { && !extraplanarLens.getImprinted().isEmpty()) {
Card imprinted = game.getCard(extraplanarLens.getImprinted().get(0)); Card imprinted = game.getCard(extraplanarLens.getImprinted().get(0));
if (imprinted != null if (imprinted != null
&& game.getState().getZone(imprinted.getId()).equals(Zone.EXILED)) { && game.getState().getZone(imprinted.getId()) == Zone.EXILED) {
if (landTappedForMana.getName().equals(imprinted.getName()) if (landTappedForMana.getName().equals(imprinted.getName())
&& landTappedForMana.getCardType().contains(CardType.LAND)) { && landTappedForMana.getCardType().contains(CardType.LAND)) {
ManaEvent mEvent = (ManaEvent) event; ManaEvent mEvent = (ManaEvent) event;

View file

@ -31,6 +31,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -48,13 +49,12 @@ import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
/** /**
*
* @author North * @author North
*/ */
public class FactOrFiction extends CardImpl { public class FactOrFiction extends CardImpl {
public FactOrFiction(UUID ownerId, CardSetInfo setInfo) { public FactOrFiction(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}");
// Reveal the top five cards of your library. An opponent separates those cards into two piles. Put one pile into your hand and the other into your graveyard. // Reveal the top five cards of your library. An opponent separates those cards into two piles. Put one pile into your hand and the other into your graveyard.
this.getSpellAbility().addEffect(new FactOrFictionEffect()); this.getSpellAbility().addEffect(new FactOrFictionEffect());
@ -125,21 +125,21 @@ class FactOrFictionEffect extends OneShotEffect {
pile2Zone = Zone.GRAVEYARD; pile2Zone = Zone.GRAVEYARD;
} }
StringBuilder sb = new StringBuilder("Pile 1, going to ").append(pile1Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (": "); StringBuilder sb = new StringBuilder("Pile 1, going to ").append(pile1Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(": ");
int i = 0; int i = 0;
for (Card card : pile1) { for (Card card : pile1) {
i++; i++;
sb.append(card.getName()); sb.append(card.getName());
if (i < pile1.size()) { if (i < pile1.size()) {
sb.append(", "); sb.append(", ");
} }
card.moveToZone(pile1Zone, source.getSourceId(), game, false); card.moveToZone(pile1Zone, source.getSourceId(), game, false);
} }
game.informPlayers(sb.toString()); game.informPlayers(sb.toString());
sb = new StringBuilder("Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (':'); sb = new StringBuilder("Pile 2, going to ").append(pile2Zone == Zone.HAND ? "Hand" : "Graveyard").append(':');
i = 0; i = 0;
for (Card card: pile2) { for (Card card : pile2) {
i++; i++;
sb.append(' ').append(card.getName()); sb.append(' ').append(card.getName());
if (i < pile2.size()) { if (i < pile2.size()) {

View file

@ -155,7 +155,7 @@ class FellShepherdEffect extends OneShotEffect {
if (watcher != null) { if (watcher != null) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (UUID creatureId : watcher.getCreaturesIds()) { for (UUID creatureId : watcher.getCreaturesIds()) {
if (game.getState().getZone(creatureId).equals(Zone.GRAVEYARD)) { if (game.getState().getZone(creatureId) == Zone.GRAVEYARD) {
Card card = game.getCard(creatureId); Card card = game.getCard(creatureId);
if (card != null) { if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false); card.moveToZone(Zone.HAND, source.getSourceId(), game, false);

View file

@ -89,9 +89,9 @@ class FireServantEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE) || return event.getType() == GameEvent.EventType.DAMAGE_CREATURE ||
event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER) || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER ||
event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
} }
@Override @Override

View file

@ -96,8 +96,8 @@ class SourceOnBattelfieldOrGraveyardCondition implements Condition {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
return (game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD) return game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD
|| game.getState().getZone(source.getSourceId()).equals(Zone.BATTLEFIELD)); || game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD;
} }
@Override @Override

View file

@ -102,7 +102,7 @@ class FluctuatorEffect extends CostModificationEffectImpl {
} }
if (reduceMax > 0) { if (reduceMax > 0) {
int reduce = 0; int reduce = 0;
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED) if (abilityToModify.getAbilityType() == AbilityType.ACTIVATED
&& ((ActivatedAbility) abilityToModify).isCheckPlayableMode()) { && ((ActivatedAbility) abilityToModify).isCheckPlayableMode()) {
reduce = reduceMax; reduce = reduceMax;
} else { } else {

View file

@ -110,7 +110,7 @@ class FoeRazerRegentTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkEventType(GameEvent event, Game game) { public boolean checkEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.FIGHTED_PERMANENT); return event.getType() == EventType.FIGHTED_PERMANENT;
} }
@Override @Override

View file

@ -76,7 +76,7 @@ public class FoulTongueInvocation extends CardImpl {
@Override @Override
public void adjustCosts(Ability ability, Game game) { public void adjustCosts(Ability ability, Game game) {
if (ability.getAbilityType().equals(AbilityType.SPELL)) { if (ability.getAbilityType() == AbilityType.SPELL) {
Player controller = game.getPlayer(ability.getControllerId()); Player controller = game.getPlayer(ability.getControllerId());
if (controller != null) { if (controller != null) {
if (controller.getHand().count(filter, game) > 0) { if (controller.getHand().count(filter, game) > 0) {

View file

@ -112,7 +112,7 @@ class GhostlyFlickerEffect extends OneShotEffect {
Set<Card> toBattlefield = new HashSet<>(); Set<Card> toBattlefield = new HashSet<>();
for (Card card : toExile) { for (Card card : toExile) {
Zone currentZone = game.getState().getZone(card.getId()); Zone currentZone = game.getState().getZone(card.getId());
if (!Zone.BATTLEFIELD.equals(currentZone) && Zone.isPublicZone(currentZone)) { if (!(Zone.BATTLEFIELD == currentZone) && Zone.isPublicZone(currentZone)) {
toBattlefield.add(game.getCard(card.getId())); toBattlefield.add(game.getCard(card.getId()));
} }
} }

View file

@ -28,6 +28,7 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; 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;
@ -46,13 +47,12 @@ import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
/** /**
*
* @author noxx * @author noxx
*/ */
public class GiselaBladeOfGoldnight extends CardImpl { public class GiselaBladeOfGoldnight extends CardImpl {
public GiselaBladeOfGoldnight(UUID ownerId, CardSetInfo setInfo) { public GiselaBladeOfGoldnight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{W}{W}");
this.supertype.add("Legendary"); this.supertype.add("Legendary");
this.subtype.add("Angel"); this.subtype.add("Angel");
@ -82,7 +82,7 @@ class GiselaBladeOfGoldnightDoubleDamageEffect extends ReplacementEffectImpl {
public GiselaBladeOfGoldnightDoubleDamageEffect() { public GiselaBladeOfGoldnightDoubleDamageEffect() {
super(Duration.WhileOnBattlefield, Outcome.Damage); super(Duration.WhileOnBattlefield, Outcome.Damage);
staticText = "If a source would deal damage to an opponent or a permanent an opponent controls, that source deals double that damage to that player or permanent instead." staticText = "If a source would deal damage to an opponent or a permanent an opponent controls, that source deals double that damage to that player or permanent instead."
+ "If a source would deal damage to you or a permanent you control, prevent half that damage, rounded up"; + "If a source would deal damage to you or a permanent you control, prevent half that damage, rounded up";
} }
public GiselaBladeOfGoldnightDoubleDamageEffect(final GiselaBladeOfGoldnightDoubleDamageEffect effect) { public GiselaBladeOfGoldnightDoubleDamageEffect(final GiselaBladeOfGoldnightDoubleDamageEffect effect) {
@ -96,9 +96,9 @@ class GiselaBladeOfGoldnightDoubleDamageEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.DAMAGE_CREATURE) || return event.getType() == EventType.DAMAGE_CREATURE ||
event.getType().equals(EventType.DAMAGE_PLANESWALKER) || event.getType() == EventType.DAMAGE_PLANESWALKER ||
event.getType().equals(EventType.DAMAGE_PLAYER); event.getType() == EventType.DAMAGE_PLAYER;
} }
@ -108,7 +108,7 @@ class GiselaBladeOfGoldnightDoubleDamageEffect extends ReplacementEffectImpl {
} }
private void preventDamage(GameEvent event, Ability source, UUID target, Game game) { private void preventDamage(GameEvent event, Ability source, UUID target, Game game) {
int amount = (int)Math.ceil(event.getAmount() / 2.0); int amount = (int) Math.ceil(event.getAmount() / 2.0);
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, target, source.getSourceId(), source.getControllerId(), amount, false); GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, target, source.getSourceId(), source.getControllerId(), amount, false);
if (!game.replaceEvent(preventEvent)) { if (!game.replaceEvent(preventEvent)) {
event.setAmount(event.getAmount() - amount); event.setAmount(event.getAmount() - amount);

View file

@ -98,7 +98,7 @@ class GloomCostIncreaseEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
boolean isWhiteEnchantment = false; boolean isWhiteEnchantment = false;
boolean isActivated = abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED); boolean isActivated = abilityToModify.getAbilityType() == AbilityType.ACTIVATED;
if (isActivated) { if (isActivated) {
MageObject permanent = game.getPermanent(abilityToModify.getSourceId()); MageObject permanent = game.getPermanent(abilityToModify.getSourceId());
if (permanent != null) { if (permanent != null) {

View file

@ -97,8 +97,8 @@ class GoldnightCastigatorDoubleDamageEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.DAMAGE_CREATURE) || return event.getType() == EventType.DAMAGE_CREATURE ||
event.getType().equals(EventType.DAMAGE_PLAYER); event.getType() == EventType.DAMAGE_PLAYER;
} }

View file

@ -28,6 +28,7 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -45,13 +46,12 @@ import mage.game.events.GameEvent;
import mage.game.stack.StackObject; import mage.game.stack.StackObject;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public class GroundSeal extends CardImpl { public class GroundSeal extends CardImpl {
public GroundSeal(UUID ownerId, CardSetInfo setInfo) { public GroundSeal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
// When Ground Seal enters the battlefield, draw a card. // When Ground Seal enters the battlefield, draw a card.
@ -96,10 +96,10 @@ class GroundSealEffect extends ContinuousRuleModifyingEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.TARGET) { if (event.getType() == GameEvent.EventType.TARGET) {
Card targetCard = game.getCard(event.getTargetId()); Card targetCard = game.getCard(event.getTargetId());
StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId()); StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
if (targetCard != null && stackObject != null) { if (targetCard != null && stackObject != null) {
Zone zone = game.getState().getZone(targetCard.getId()); Zone zone = game.getState().getZone(targetCard.getId());
if (zone != null && zone.equals(Zone.GRAVEYARD)) { if (zone != null && zone == Zone.GRAVEYARD) {
return true; return true;
} }
} }

View file

@ -107,7 +107,7 @@ class GryffsBoonEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Card aura = game.getCard(source.getSourceId()); Card aura = game.getCard(source.getSourceId());
if (aura != null if (aura != null
&& game.getState().getZone(aura.getId()).equals(Zone.GRAVEYARD)) { && game.getState().getZone(aura.getId()) == Zone.GRAVEYARD) {
Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (!targetPermanent.cantBeAttachedBy(aura, game)) { if (!targetPermanent.cantBeAttachedBy(aura, game)) {
game.getState().setValue("attachTo:" + aura.getId(), targetPermanent); game.getState().setValue("attachTo:" + aura.getId(), targetPermanent);

View file

@ -83,7 +83,7 @@ class GuardianSeraphEffect extends PreventionEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
} }
@Override @Override

View file

@ -91,7 +91,7 @@ class HarshJudgmentEffect extends RedirectionEffect {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
} }
@Override @Override

View file

@ -93,7 +93,7 @@ class HarvestHandReturnTransformedEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
if (game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) { if (game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE); game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
Card card = game.getCard(source.getSourceId()); Card card = game.getCard(source.getSourceId());
if (card != null) { if (card != null) {

View file

@ -99,8 +99,8 @@ class HeartstoneEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED) if (abilityToModify.getAbilityType() == AbilityType.ACTIVATED
|| (abilityToModify.getAbilityType().equals(AbilityType.MANA) && (abilityToModify instanceof ActivatedAbility))) { || (abilityToModify.getAbilityType() == AbilityType.MANA && (abilityToModify instanceof ActivatedAbility))) {
// Activated abilities of creatures // Activated abilities of creatures
Permanent permanent = game.getPermanent(abilityToModify.getSourceId()); Permanent permanent = game.getPermanent(abilityToModify.getSourceId());
if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {

View file

@ -108,12 +108,12 @@ class HedronFieldPuristsEffect extends PreventionEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER) if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER
&& event.getTargetId().equals(source.getControllerId())) { && event.getTargetId().equals(source.getControllerId())) {
return super.applies(event, source, game); return super.applies(event, source, game);
} }
if (event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)) { if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE) {
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) {
return super.applies(event, source, game); return super.applies(event, source, game);

View file

@ -113,7 +113,7 @@ class HelmOfObedienceEffect extends OneShotEffect {
if (sourcePermanent != null) { if (sourcePermanent != null) {
sourcePermanent.sacrifice(source.getSourceId(), game); sourcePermanent.sacrifice(source.getSourceId(), game);
} }
if (game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) { if (game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId()); card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
} }
break; break;

View file

@ -107,7 +107,7 @@ class HushwingGryffEffect extends ContinuousRuleModifyingEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
Ability ability = (Ability) getValue("targetAbility"); Ability ability = (Ability) getValue("targetAbility");
if (ability != null && AbilityType.TRIGGERED.equals(ability.getAbilityType())) { if (ability != null && ability.getAbilityType() == AbilityType.TRIGGERED) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) { if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
return true; return true;

View file

@ -146,8 +146,8 @@ class IllusionistsGambitRequirementEffect extends RequirementEffect {
@Override @Override
public boolean isInactive(Ability source, Game game) { public boolean isInactive(Ability source, Game game) {
if (game.getTurn().getStepType().equals(PhaseStep.END_COMBAT)) { if (game.getTurn().getStepType() == PhaseStep.END_COMBAT) {
if (!game.getTurn().getPhase().equals(phase)) { if (game.getTurn().getPhase() != phase) {
return true; return true;
} }
} }
@ -190,8 +190,8 @@ class IllusionistsGambitRestrictionEffect extends RestrictionEffect {
@Override @Override
public boolean isInactive(Ability source, Game game) { public boolean isInactive(Ability source, Game game) {
if (game.getTurn().getStepType().equals(PhaseStep.END_COMBAT)) { if (game.getTurn().getStepType() == PhaseStep.END_COMBAT) {
if (!game.getTurn().getPhase().equals(phase)) { if (game.getTurn().getPhase() != phase) {
return true; return true;
} }
} }

View file

@ -91,9 +91,9 @@ class InquisitorsFlailEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE) || return event.getType() == GameEvent.EventType.DAMAGE_CREATURE ||
event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER) || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER ||
event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
} }
@Override @Override

View file

@ -115,7 +115,7 @@ class JaceMindseekerEffect extends OneShotEffect {
Zone zone = game.getState().getZone(card.getId()); Zone zone = game.getState().getZone(card.getId());
// If the five cards are put into a public zone such as exile instead of a graveyard (perhaps due to the ability of Rest in Peace), // If the five cards are put into a public zone such as exile instead of a graveyard (perhaps due to the ability of Rest in Peace),
// you can cast one of those instant or sorcery cards from that zone. // you can cast one of those instant or sorcery cards from that zone.
if (zone.equals(Zone.GRAVEYARD) || zone.equals(Zone.EXILED)) { if (zone == Zone.GRAVEYARD || zone == Zone.EXILED) {
cardsToCast.add(card); cardsToCast.add(card);
} }
} }

View file

@ -90,7 +90,7 @@ class JotunGruntCost extends CostImpl {
if (targets.choose(Outcome.Removal, controllerId, sourceId, game)) { if (targets.choose(Outcome.Removal, controllerId, sourceId, game)) {
for (UUID targetId: targets.get(0).getTargets()) { for (UUID targetId: targets.get(0).getTargets()) {
Card card = game.getCard(targetId); Card card = game.getCard(targetId);
if (card == null || !game.getState().getZone(targetId).equals(Zone.GRAVEYARD)) { if (card == null || game.getState().getZone(targetId) != Zone.GRAVEYARD) {
return false; return false;
} }
paid |= controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.GRAVEYARD, false, true); paid |= controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.GRAVEYARD, false, true);

View file

@ -127,7 +127,7 @@ class KalitasTraitorOfGhetEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
if (((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)) { if (((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) {
Permanent permanent = ((ZoneChangeEvent) event).getTarget(); Permanent permanent = ((ZoneChangeEvent) event).getTarget();
if (permanent != null) { if (permanent != null) {
controller.moveCards(permanent, Zone.EXILED, source, game); controller.moveCards(permanent, Zone.EXILED, source, game);

View file

@ -115,7 +115,7 @@ class KothophedSoulHoarderTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone().equals(Zone.GRAVEYARD) && zEvent.getFromZone().equals(Zone.BATTLEFIELD)) { if (zEvent.getToZone() == Zone.GRAVEYARD && zEvent.getFromZone() == Zone.BATTLEFIELD) {
Card card = game.getCard(zEvent.getTargetId()); Card card = game.getCard(zEvent.getTargetId());
Player controller = game.getPlayer(getControllerId()); Player controller = game.getPlayer(getControllerId());
return card != null && controller != null && controller.hasOpponent(card.getOwnerId(), game); return card != null && controller != null && controller.hasOpponent(card.getOwnerId(), game);

View file

@ -29,6 +29,7 @@
package mage.cards.l; package mage.cards.l;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
@ -48,13 +49,12 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class LeylineOfTheVoid extends CardImpl { public class LeylineOfTheVoid extends CardImpl {
public LeylineOfTheVoid(UUID ownerId, CardSetInfo setInfo) { public LeylineOfTheVoid(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
// If Leyline of the Void is in your opening hand, you may begin the game with it on the battlefield. // If Leyline of the Void is in your opening hand, you may begin the game with it on the battlefield.
this.addAbility(LeylineAbility.getInstance()); this.addAbility(LeylineAbility.getInstance());
@ -93,16 +93,15 @@ class LeylineOfTheVoidEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
if (((ZoneChangeEvent)event).getFromZone().equals(Zone.BATTLEFIELD)) { if (((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) {
Permanent permanent = ((ZoneChangeEvent)event).getTarget(); Permanent permanent = ((ZoneChangeEvent) event).getTarget();
if (permanent != null) { if (permanent != null) {
return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true); return controller.moveCardToExileWithInfo(permanent, null, null, source.getSourceId(), game, Zone.BATTLEFIELD, true);
} }
} } else {
else {
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (card != null) { if (card != null) {
return controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, ((ZoneChangeEvent)event).getFromZone(), true); return controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true);
} }
} }
} }
@ -116,7 +115,7 @@ class LeylineOfTheVoidEffect extends ReplacementEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD) { if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (card != null && game.getOpponents(source.getControllerId()).contains(card.getOwnerId())) { if (card != null && game.getOpponents(source.getControllerId()).contains(card.getOwnerId())) {
return true; return true;

View file

@ -99,18 +99,18 @@ class LibraryOfLengEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.DISCARD_CARD) return event.getType() == EventType.DISCARD_CARD
|| event.getType().equals(EventType.ZONE_CHANGE); || event.getType() == EventType.ZONE_CHANGE;
} }
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(EventType.DISCARD_CARD)) { if (event.getType() == EventType.DISCARD_CARD) {
return event.getPlayerId().equals(source.getControllerId()); return event.getPlayerId().equals(source.getControllerId());
} }
if (event.getType().equals(EventType.ZONE_CHANGE)) { if (event.getType() == EventType.ZONE_CHANGE) {
if (event.getTargetId().equals(cardId) && game.getState().getZoneChangeCounter(event.getTargetId()) == zoneChangeCounter) { if (event.getTargetId().equals(cardId) && game.getState().getZoneChangeCounter(event.getTargetId()) == zoneChangeCounter) {
if (((ZoneChangeEvent) event).getFromZone().equals(Zone.HAND) && ((ZoneChangeEvent) event).getToZone().equals(Zone.GRAVEYARD)) { if (((ZoneChangeEvent) event).getFromZone() == Zone.HAND && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
return true; return true;
} }
} }
@ -120,7 +120,7 @@ class LibraryOfLengEffect extends ReplacementEffectImpl {
@Override @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
if (event.getType().equals(EventType.DISCARD_CARD)) { if (event.getType() == EventType.DISCARD_CARD) {
// only save card info // only save card info
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (card != null) { if (card != null) {
@ -129,7 +129,7 @@ class LibraryOfLengEffect extends ReplacementEffectImpl {
} }
return false; return false;
} }
if (event.getType().equals(EventType.ZONE_CHANGE)) { if (event.getType() == EventType.ZONE_CHANGE) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (controller != null && card != null) { if (controller != null && card != null) {

View file

@ -119,7 +119,7 @@ class LichLifeGainReplacementEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.GAIN_LIFE); return event.getType() == EventType.GAIN_LIFE;
} }
@Override @Override

View file

@ -112,7 +112,7 @@ class DeathEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (creatureCard != null && controller != null) { if (creatureCard != null && controller != null) {
boolean result = false; boolean result = false;
if (game.getState().getZone(creatureCard.getId()).equals(Zone.GRAVEYARD)) { if (game.getState().getZone(creatureCard.getId()) == Zone.GRAVEYARD) {
controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game); controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game);
} }
controller.loseLife(creatureCard.getConvertedManaCost(), game, false); controller.loseLife(creatureCard.getConvertedManaCost(), game, false);

View file

@ -80,7 +80,7 @@ class LightOfSanctionEffect extends PreventionEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)) { if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE) {
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) {
MageObject damageSource = game.getObject(event.getSourceId()); MageObject damageSource = game.getObject(event.getSourceId());

View file

@ -173,7 +173,7 @@ class LongRoadHomeEntersBattlefieldEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return EventType.ENTERS_THE_BATTLEFIELD.equals(event.getType()); return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
} }
@Override @Override

View file

@ -81,9 +81,9 @@ class LuminescePreventionEffect extends PreventionEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) { if (super.applies(event, source, game)) {
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER) if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER
|| event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE) || event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|| event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER)) { || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER) {
MageObject sourceObject = game.getObject(event.getSourceId()); MageObject sourceObject = game.getObject(event.getSourceId());
if (sourceObject != null if (sourceObject != null
&& (sourceObject.getColor(game).shares(ObjectColor.BLACK) || sourceObject.getColor(game).shares(ObjectColor.RED))) { && (sourceObject.getColor(game).shares(ObjectColor.BLACK) || sourceObject.getColor(game).shares(ObjectColor.RED))) {

View file

@ -91,7 +91,7 @@ class HasAbilityWithTapSymbolPredicate implements Predicate<MageObject> {
} }
for (Ability ability : abilities) { for (Ability ability : abilities) {
if (ability.getAbilityType().equals(AbilityType.ACTIVATED) && !ability.getCosts().isEmpty()) { if (ability.getAbilityType() == AbilityType.ACTIVATED && !ability.getCosts().isEmpty()) {
for (Cost cost : ability.getCosts()) { for (Cost cost : ability.getCosts()) {
if (cost instanceof TapSourceCost) { if (cost instanceof TapSourceCost) {
return true; return true;

View file

@ -130,7 +130,7 @@ class LastSpellCastWatcher extends Watcher {
@Override @Override
public void watch(GameEvent event, Game game) { public void watch(GameEvent event, Game game) {
if (EventType.SPELL_CAST.equals(event.getType())) { if (event.getType() == EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell == null) { if (spell == null) {
MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.STACK); MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.STACK);

View file

@ -147,13 +147,13 @@ class MeriekeRiBeritDelayedTriggeredAbility extends DelayedTriggeredAbility {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId() != null) { if (event.getTargetId() != null) {
if (GameEvent.EventType.ZONE_CHANGE.equals(event.getType()) if (event.getType() == EventType.ZONE_CHANGE
&& event.getTargetId().equals(getSourceId())) { && event.getTargetId().equals(getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
return zEvent.getFromZone().equals(Zone.BATTLEFIELD); return zEvent.getFromZone() == Zone.BATTLEFIELD;
} }
} }
return GameEvent.EventType.UNTAPPED.equals(event.getType()) return EventType.UNTAPPED == event.getType()
&& event.getTargetId() != null && event.getTargetId().equals(getSourceId()); && event.getTargetId() != null && event.getTargetId().equals(getSourceId());
} }

View file

@ -86,7 +86,7 @@ class MichikoKondaTruthSeekerAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkEventType(GameEvent event, Game game) { public boolean checkEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER); return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
} }
@Override @Override

View file

@ -102,7 +102,7 @@ class MinamosMeddlingCounterTargetEffect extends OneShotEffect {
spellController.revealCards(sourceObject.getName(), spellController.getHand(), game); spellController.revealCards(sourceObject.getName(), spellController.getHand(), game);
Cards cardsToDiscard = new CardsImpl(); Cards cardsToDiscard = new CardsImpl();
for (SpellAbility spellAbility : spell.getSpellAbilities()) { for (SpellAbility spellAbility : spell.getSpellAbilities()) {
if (spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE)) { if (spellAbility.getSpellAbilityType() == SpellAbilityType.SPLICE) {
for (Card card: spellController.getHand().getCards(game)) { for (Card card: spellController.getHand().getCards(game)) {
if (card.getName().equals(spellAbility.getCardName())) { if (card.getName().equals(spellAbility.getCardName())) {
cardsToDiscard.add(card); cardsToDiscard.add(card);

View file

@ -127,7 +127,7 @@ class MoxDiamondReplacementEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (source.getSourceId().equals(event.getTargetId())) { if (source.getSourceId().equals(event.getTargetId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if(zEvent.getToZone().equals(Zone.BATTLEFIELD)){ if(zEvent.getToZone() == Zone.BATTLEFIELD){
return true; return true;
} }
} }

View file

@ -97,12 +97,12 @@ class MysticBarrierTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkEventType(GameEvent event, Game game) { public boolean checkEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.ENTERS_THE_BATTLEFIELD) || event.getType().equals(EventType.UPKEEP_STEP_PRE); return event.getType() == EventType.ENTERS_THE_BATTLEFIELD || event.getType() == EventType.UPKEEP_STEP_PRE;
} }
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(EventType.ENTERS_THE_BATTLEFIELD)) { if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
return event.getTargetId().equals(this.getSourceId()); return event.getTargetId().equals(this.getSourceId());
} else { } else {
return event.getPlayerId().equals(this.getControllerId()); return event.getPlayerId().equals(this.getControllerId());
@ -196,7 +196,7 @@ class MysticBarrierReplacementEffect extends ReplacementEffectImpl {
} }
if (defender != null) { if (defender != null) {
PlayerList playerList = game.getState().getPlayerList(event.getPlayerId()); PlayerList playerList = game.getState().getPlayerList(event.getPlayerId());
if (allowedDirection.equals(MysticBarrier.ALLOW_ATTACKING_LEFT)) { if (allowedDirection == MysticBarrier.ALLOW_ATTACKING_LEFT) {
if (!playerList.getNext().equals(defender.getId())) { if (!playerList.getNext().equals(defender.getId())) {
// the defender is not the player to the left // the defender is not the player to the left
Player attacker = game.getPlayer(event.getPlayerId()); Player attacker = game.getPlayer(event.getPlayerId());
@ -206,7 +206,7 @@ class MysticBarrierReplacementEffect extends ReplacementEffectImpl {
return true; return true;
} }
} }
if (allowedDirection.equals(MysticBarrier.ALLOW_ATTACKING_RIGHT)) { if (allowedDirection == MysticBarrier.ALLOW_ATTACKING_RIGHT) {
if (!playerList.getPrevious().equals(defender.getId())) { if (!playerList.getPrevious().equals(defender.getId())) {
// the defender is not the player to the right // the defender is not the player to the right
Player attacker = game.getPlayer(event.getPlayerId()); Player attacker = game.getPlayer(event.getPlayerId());

View file

@ -153,7 +153,7 @@ class NarsetTranscendentTriggeredAbility extends DelayedTriggeredAbility {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())) { if (event.getPlayerId().equals(this.getControllerId())) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getFromZone().equals(Zone.HAND)) { if (spell != null && spell.getFromZone() == Zone.HAND) {
if (spell.getCard() != null if (spell.getCard() != null
&& spell.getCard().getCardType().contains(CardType.INSTANT) || spell.getCard().getCardType().contains(CardType.SORCERY)) { && spell.getCard().getCardType().contains(CardType.INSTANT) || spell.getCard().getCardType().contains(CardType.SORCERY)) {
for (Effect effect : getEffects()) { for (Effect effect : getEffects()) {

View file

@ -108,7 +108,7 @@ class NaturesWillTriggeredAbility extends TriggeredAbilityImpl {
damagedPlayers.add(event.getPlayerId()); damagedPlayers.add(event.getPlayerId());
} }
} }
if (event.getType().equals(EventType.COMBAT_DAMAGE_STEP_POST)) { if (event.getType() == EventType.COMBAT_DAMAGE_STEP_POST) {
if (madeDamge) { if (madeDamge) {
Set<UUID> damagedPlayersCopy = new HashSet<>(); Set<UUID> damagedPlayersCopy = new HashSet<>();
damagedPlayersCopy.addAll(damagedPlayers); damagedPlayersCopy.addAll(damagedPlayers);

View file

@ -130,13 +130,13 @@ class NecromancersMagemarkEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.ZONE_CHANGE); return event.getType() == GameEvent.EventType.ZONE_CHANGE;
} }
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone().equals(Zone.BATTLEFIELD) && zEvent.getToZone().equals(Zone.GRAVEYARD)) { if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
Permanent permanent = ((ZoneChangeEvent) event).getTarget(); Permanent permanent = ((ZoneChangeEvent) event).getTarget();
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) {
for (UUID attachmentId : permanent.getAttachments()) { for (UUID attachmentId : permanent.getAttachments()) {

View file

@ -235,7 +235,7 @@ class NecromancyChangeAbilityEffect extends ContinuousEffectImpl implements Sour
@Override @Override
public boolean hasLayer(Layer layer) { public boolean hasLayer(Layer layer) {
return Layer.AbilityAddingRemovingEffects_6.equals(layer) || Layer.TypeChangingEffects_4.equals(layer); return layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.TypeChangingEffects_4;
} }
} }

View file

@ -108,7 +108,7 @@ class NecromanticSelectionEffect extends OneShotEffect {
Cards cards = new CardsImpl(); Cards cards = new CardsImpl();
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), controller.getId(), source.getSourceId(), game)) { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), controller.getId(), source.getSourceId(), game)) {
permanent.destroy(source.getSourceId(), game, false); permanent.destroy(source.getSourceId(), game, false);
if (game.getState().getZone(permanent.getId()).equals(Zone.GRAVEYARD)) { if (game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) {
cards.add(permanent); cards.add(permanent);
} }
} }

View file

@ -163,7 +163,7 @@ class NefariousLichLifeGainReplacementEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.GAIN_LIFE); return event.getType() == EventType.GAIN_LIFE;
} }
@Override @Override

View file

@ -98,18 +98,18 @@ class NephaliaAcademyEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DISCARD_CARD) return event.getType() == GameEvent.EventType.DISCARD_CARD
|| event.getType().equals(GameEvent.EventType.ZONE_CHANGE); || event.getType() == GameEvent.EventType.ZONE_CHANGE;
} }
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.DISCARD_CARD)) { if (event.getType() == GameEvent.EventType.DISCARD_CARD) {
return event.getPlayerId().equals(source.getControllerId()); return event.getPlayerId().equals(source.getControllerId());
} }
if (event.getType().equals(GameEvent.EventType.ZONE_CHANGE)) { if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
if (event.getTargetId().equals(cardId) && game.getState().getZoneChangeCounter(event.getTargetId()) == zoneChangeCounter) { if (event.getTargetId().equals(cardId) && game.getState().getZoneChangeCounter(event.getTargetId()) == zoneChangeCounter) {
if (((ZoneChangeEvent) event).getFromZone().equals(Zone.HAND) && ((ZoneChangeEvent) event).getToZone().equals(Zone.GRAVEYARD)) { if (((ZoneChangeEvent) event).getFromZone() == Zone.HAND && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
return true; return true;
} }
} }
@ -119,7 +119,7 @@ class NephaliaAcademyEffect extends ReplacementEffectImpl {
@Override @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.DISCARD_CARD)) { if (event.getType() == GameEvent.EventType.DISCARD_CARD) {
// only save card info if it's an opponent effect // only save card info if it's an opponent effect
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (card != null) { if (card != null) {
@ -142,7 +142,7 @@ class NephaliaAcademyEffect extends ReplacementEffectImpl {
} }
return false; return false;
} }
if (event.getType().equals(GameEvent.EventType.ZONE_CHANGE)) { if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (controller != null && card != null) { if (controller != null && card != null) {

View file

@ -158,7 +158,7 @@ class NimDeathmantleEffect extends OneShotEffect {
if (target != null) { if (target != null) {
Card card = game.getCard(target); Card card = game.getCard(target);
// check if it's still in graveyard // check if it's still in graveyard
if (card != null && game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) { if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) { if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
Permanent permanent = game.getPermanent(card.getId()); Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) { if (permanent != null) {

View file

@ -140,6 +140,6 @@ class NivixAerieOfTheFiremindCanCastEffect extends AsThoughEffectImpl {
return this.getTargetPointer().getFirst(game, source) != null return this.getTargetPointer().getFirst(game, source) != null
&& this.getTargetPointer().getFirst(game, source).equals(sourceId) && this.getTargetPointer().getFirst(game, source).equals(sourceId)
&& source.getControllerId().equals(affectedControllerId) && source.getControllerId().equals(affectedControllerId)
&& game.getState().getZone(sourceId).equals(Zone.EXILED); && game.getState().getZone(sourceId) == Zone.EXILED;
} }
} }

View file

@ -128,7 +128,7 @@ class OathOfChandraWatcher extends Watcher {
public void watch(GameEvent event, Game game) { public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone().equals(Zone.BATTLEFIELD) if (zEvent.getToZone() == Zone.BATTLEFIELD
&& zEvent.getTarget().getCardType().contains(CardType.PLANESWALKER)) { && zEvent.getTarget().getCardType().contains(CardType.PLANESWALKER)) {
players.add(zEvent.getTarget().getControllerId()); players.add(zEvent.getTarget().getControllerId());
} }

View file

@ -119,7 +119,7 @@ class OathOfLilianaWatcher extends Watcher {
public void watch(GameEvent event, Game game) { public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone().equals(Zone.BATTLEFIELD) if (zEvent.getToZone() == Zone.BATTLEFIELD
&& zEvent.getTarget().getCardType().contains(CardType.PLANESWALKER)) { && zEvent.getTarget().getCardType().contains(CardType.PLANESWALKER)) {
players.add(zEvent.getTarget().getControllerId()); players.add(zEvent.getTarget().getControllerId());
} }

View file

@ -116,7 +116,7 @@ class OngoingInvestigationTriggeredAbility extends TriggeredAbilityImpl {
damagedPlayers.add(event.getPlayerId()); damagedPlayers.add(event.getPlayerId());
} }
} }
if (event.getType().equals(EventType.COMBAT_DAMAGE_STEP_POST)) { if (event.getType() == EventType.COMBAT_DAMAGE_STEP_POST) {
if (madeDamage) { if (madeDamage) {
Set<UUID> damagedPlayersCopy = new HashSet<>(); Set<UUID> damagedPlayersCopy = new HashSet<>();
damagedPlayersCopy.addAll(damagedPlayers); damagedPlayersCopy.addAll(damagedPlayers);

View file

@ -115,9 +115,9 @@ class OpalEyeKondasYojimboRedirectionEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE ) || return event.getType() == GameEvent.EventType.DAMAGE_CREATURE ||
event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER ) || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER ||
event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER ); event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
} }
@Override @Override

View file

@ -84,7 +84,7 @@ public class OratorOfOjutai extends CardImpl {
@Override @Override
public void adjustCosts(Ability ability, Game game) { public void adjustCosts(Ability ability, Game game) {
if (ability.getAbilityType().equals(AbilityType.SPELL)) { if (ability.getAbilityType() == AbilityType.SPELL) {
Player controller = game.getPlayer(ability.getControllerId()); Player controller = game.getPlayer(ability.getControllerId());
if (controller != null) { if (controller != null) {
if (controller.getHand().count(filter, game) > 0) { if (controller.getHand().count(filter, game) > 0) {

View file

@ -81,7 +81,7 @@ class OrbsOfWardingEffect extends PreventionEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
} }
@Override @Override

View file

@ -94,7 +94,7 @@ class OrimsChantCantCastEffect extends ContinuousRuleModifyingEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return GameEvent.EventType.CAST_SPELL.equals(event.getType()); return event.getType() == GameEvent.EventType.CAST_SPELL;
} }
@Override @Override

View file

@ -86,8 +86,8 @@ class FireServantEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE) || return event.getType() == GameEvent.EventType.DAMAGE_CREATURE ||
event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER); event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
} }
@Override @Override

View file

@ -83,7 +83,7 @@ class ParallelLivesEffect extends ReplacementEffectImpl {
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.CREATE_TOKEN); return event.getType() == EventType.CREATE_TOKEN;
} }
@Override @Override

Some files were not shown because too many files have changed in this diff Show more