Merge branch 'master' into phantoms

This commit is contained in:
ingmargoudt 2017-03-23 13:43:34 +01:00 committed by GitHub
commit 5ae4ddce07
182 changed files with 572 additions and 355 deletions

View file

@ -80,42 +80,44 @@ public class AAT1 extends CardImpl {
public AAT1 copy() {
return new AAT1(this);
}
}
class AAT1TriggeredAbility extends TriggeredAbilityImpl {
private static class AAT1TriggeredAbility extends TriggeredAbilityImpl {
public AAT1TriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect);
}
public AAT1TriggeredAbility(AAT1TriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.COUNTER_REMOVED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Card card = game.getCard(event.getTargetId());
if (event.getPlayerId().equals(game.getControllerId(sourceId))
&& card.isCreature()
&& game.getState().getZone(card.getId()) == Zone.GRAVEYARD
&& event.getData().equals("repair")) {
return true;
public AAT1TriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect);
}
return false;
}
@Override
public String getRule() {
return "Whenever a repair counter is removed from a creature card in your graveyard " + super.getRule();
}
public AAT1TriggeredAbility(AAT1TriggeredAbility ability) {
super(ability);
}
@Override
public AAT1TriggeredAbility copy() {
return new AAT1TriggeredAbility(this);
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.COUNTER_REMOVED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Card card = game.getCard(event.getTargetId());
if (event.getPlayerId().equals(game.getControllerId(sourceId))
&& card.isCreature()
&& game.getState().getZone(card.getId()) == Zone.GRAVEYARD
&& event.getData().equals("repair")) {
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever a repair counter is removed from a creature card in your graveyard " + super.getRule();
}
@Override
public AAT1TriggeredAbility copy() {
return new AAT1TriggeredAbility(this);
}
}
}

View file

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

View file

@ -100,7 +100,7 @@ class CantBeBlockedByMoreThanOneAttachedEffect extends ContinuousEffectImpl {
super(duration, Outcome.Benefit);
this.amount = amount;
this.attachmentType = attachmentType;
staticText = (attachmentType.equals(AttachmentType.AURA) ? "Enchanted" : "Equipped") + " creature can't be blocked by more than " + CardUtil.numberToText(amount) + " creature" + (amount==1 ?"":"s");
staticText = (attachmentType == AttachmentType.AURA ? "Enchanted" : "Equipped") + " creature can't be blocked by more than " + CardUtil.numberToText(amount) + " creature" + (amount==1 ?"":"s");
}
public CantBeBlockedByMoreThanOneAttachedEffect(final CantBeBlockedByMoreThanOneAttachedEffect effect) {

View file

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

View file

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

View file

@ -117,7 +117,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl {
}
}
}
if (event.getType().equals(EventType.TURNFACEUP)) {
if (event.getType() == EventType.TURNFACEUP) {
if (event.getTargetId().equals(source.getSourceId())) {
return true;
}

View file

@ -136,7 +136,7 @@ class AthreosGodOfPassageReturnEffect extends OneShotEffect {
}
}
if (opponent == null || !paid) {
if (game.getState().getZone(creature.getId()).equals(Zone.GRAVEYARD)) {
if (game.getState().getZone(creature.getId()) == Zone.GRAVEYARD) {
controller.moveCards(game.getCard(creatureId), Zone.HAND, source, game);
}
}
@ -174,7 +174,7 @@ class AthreosDiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
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 = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) {
for (Effect effect : this.getEffects()) {

View file

@ -83,7 +83,7 @@ class BurningVengeanceOnCastAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(controllerId) && event.getZone().equals(Zone.GRAVEYARD);
return event.getPlayerId().equals(controllerId) && event.getZone() == Zone.GRAVEYARD;
}
@Override

View file

@ -273,7 +273,7 @@ class CelestialDawnSpendColorlessManaEffect extends AsThoughEffectImpl implement
@Override
public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) {
if (mana.getWhite() == 0 && !ManaType.COLORLESS.equals(manaType)) {
if (mana.getWhite() == 0 && ManaType.COLORLESS != manaType) {
return null;
}
return manaType;

View file

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

View file

@ -0,0 +1,75 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.c;
import java.util.UUID;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.common.combat.CantAttackYouAllEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.SuspendAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
/**
*
* @author spjspj
*/
public class ChronomanticEscape extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures");
public ChronomanticEscape(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{W}{W}");
// Until your next turn, creatures can't attack you. Exile Chronomantic Escape with three time counters on it.
getSpellAbility().addEffect(new CantAttackYouAllEffect(Duration.UntilYourNextTurn, filter));
getSpellAbility().addEffect(ExileSpellEffect.getInstance());
Effect effect = new AddCountersSourceEffect(CounterType.TIME.createInstance(), new StaticValue(3), true, true);
effect.setText("with 3 time counters on it");
getSpellAbility().addEffect(effect);
// Suspend 3-{2}{W}
this.addAbility(new SuspendAbility(3, new ManaCostsImpl("{2}{W}"), this));
}
public ChronomanticEscape(final ChronomanticEscape card) {
super(card);
}
@Override
public ChronomanticEscape copy() {
return new ChronomanticEscape(this);
}
}

View file

@ -0,0 +1,112 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
/**
*
* @author Alexsandr0x
*/
public class CitadelOfPain extends CardImpl {
public CitadelOfPain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
TriggeredAbility triggered = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE,
"beginning of the end step", true,
new CitadelOfPainEffect());
// At the beginning of each player's end step, Citadel of Pain deals X damage to that player, where X is the number of untapped lands he or she controls.
this.addAbility(triggered);
}
public CitadelOfPain(final CitadelOfPain card) {
super(card);
}
@Override
public CitadelOfPain copy() {
return new CitadelOfPain(this);
}
}
class CitadelOfPainEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterControlledLandPermanent();
@Override
public String getText(Mode mode) {
return "{this} deals X damage to that player, where X is the number of untapped lands he or she controls.";
}
static {
filter.add(Predicates.not(new TappedPredicate()));
}
public CitadelOfPainEffect() {
super(Outcome.Damage);
}
public CitadelOfPainEffect(Outcome outcome) {
super(outcome);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getActivePlayerId());
if (player != null) {
int damage = game.getBattlefield().countAll(filter, game.getActivePlayerId(), game);
player.damage(damage, source.getSourceId(), game, false, true);
return true;
}
return false;
}
@Override
public Effect copy() {
return new CitadelOfPainEffect();
}
}

View file

@ -138,11 +138,11 @@ class CoffinQueenDelayedTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (GameEvent.EventType.LOST_CONTROL.equals(event.getType())
if (EventType.LOST_CONTROL == event.getType()
&& event.getSourceId().equals(getSourceId())) {
return true;
}
return GameEvent.EventType.UNTAPPED.equals(event.getType())
return EventType.UNTAPPED == event.getType()
&& event.getTargetId() != null && event.getTargetId().equals(getSourceId());
}

View file

@ -218,7 +218,7 @@ class DanceOfTheDeadAttachEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
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
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null) {

View file

@ -76,63 +76,65 @@ public class DiviningWitch extends CardImpl {
public DiviningWitch copy() {
return new DiviningWitch(this);
}
}
class DiviningWitchEffect extends OneShotEffect {
private static class DiviningWitchEffect extends OneShotEffect {
DiviningWitchEffect() {
super(Outcome.Benefit);
this.staticText = "Name a card. Exile the top six cards of your library. Reveal cards from the top of your library until you reveal the named card, then put that card into your hand. Exile all other cards revealed this way";
}
DiviningWitchEffect() {
super(Outcome.Benefit);
this.staticText = "Name a card. Exile the top six cards of your library. Reveal cards from the top of your library until you reveal the named card, then put that card into your hand. Exile all other cards revealed this way";
}
DiviningWitchEffect(final DiviningWitchEffect effect) {
super(effect);
}
DiviningWitchEffect(final DiviningWitchEffect effect) {
super(effect);
}
@Override
public DiviningWitchEffect copy() {
return new DiviningWitchEffect(this);
}
@Override
public DiviningWitchEffect copy() {
return new DiviningWitchEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
// Name a card.
Choice choice = new ChoiceImpl();
choice.setChoices(CardRepository.instance.getNames());
while (!controller.choose(Outcome.Benefit, choice, game)) {
if (!controller.canRespond()) {
return false;
}
}
String name = choice.getChoice();
game.informPlayers("Card named: " + name);
// Exile the top six cards of your library,
controller.moveCards(controller.getLibrary().getTopCards(game, 6), Zone.EXILED, source, game);
// then reveal cards from the top of your library until you reveal the named card.
Cards cardsToReaveal = new CardsImpl();
Card cardToHand = null;
while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
cardsToReaveal.add(card);
// Put that card into your hand
if (card.getName().equals(name)) {
cardToHand = card;
break;
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
// Name a card.
Choice choice = new ChoiceImpl();
choice.setChoices(CardRepository.instance.getNames());
while (!controller.choose(Outcome.Benefit, choice, game)) {
if (!controller.canRespond()) {
return false;
}
}
String name = choice.getChoice();
game.informPlayers("Card named: " + name);
// Exile the top six cards of your library,
controller.moveCards(controller.getLibrary().getTopCards(game, 6), Zone.EXILED, source, game);
// then reveal cards from the top of your library until you reveal the named card.
Cards cardsToReaveal = new CardsImpl();
Card cardToHand = null;
while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
cardsToReaveal.add(card);
// Put that card into your hand
if (card.getName().equals(name)) {
cardToHand = card;
break;
}
}
}
controller.moveCards(cardToHand, Zone.HAND, source, game);
controller.revealCards(sourceObject.getIdName(), cardsToReaveal, game);
cardsToReaveal.remove(cardToHand);
controller.moveCards(cardsToReaveal, Zone.EXILED, source, game);
return true;
}
controller.moveCards(cardToHand, Zone.HAND, source, game);
controller.revealCards(sourceObject.getIdName(), cardsToReaveal, game);
cardsToReaveal.remove(cardToHand);
controller.moveCards(cardsToReaveal, Zone.EXILED, source, game);
return true;
return false;
}
return false;
}
}

View file

@ -168,7 +168,7 @@ class EliteArcanistCopyEffect extends OneShotEffect {
}
if (sourcePermanent != null && sourcePermanent.getImprinted() != null && !sourcePermanent.getImprinted().isEmpty()) {
Card imprintedInstant = game.getCard(sourcePermanent.getImprinted().get(0));
if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) {
if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()) == Zone.EXILED) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId());

View file

@ -145,7 +145,7 @@ class EpiphanyAtTheDrownyardEffect extends OneShotEffect {
pile2Zone = Zone.GRAVEYARD;
}
StringBuilder sb = new StringBuilder(sourceObject.getLogName() + ": Pile 1, going to ").append(pile1Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(": ");
StringBuilder sb = new StringBuilder(sourceObject.getLogName() + ": Pile 1, going to ").append(pile1Zone == Zone.HAND ? "Hand" : "Graveyard").append(": ");
int i = 0;
for (UUID cardUuid : pile1CardsIds) {
i++;
@ -160,7 +160,7 @@ class EpiphanyAtTheDrownyardEffect extends OneShotEffect {
}
game.informPlayers(sb.toString());
sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(':');
sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone == Zone.HAND ? "Hand" : "Graveyard").append(':');
i = 0;
for (UUID cardUuid : pile2CardsIds) {
Card card = game.getCard(cardUuid);

View file

@ -125,7 +125,7 @@ class FactOrFictionEffect extends OneShotEffect {
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 == Zone.HAND ? "Hand" : "Graveyard").append(": ");
int i = 0;
for (Card card : pile1) {
i++;

View file

@ -136,7 +136,7 @@ class GiftOfImmortalityReturnEnchantmentEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Card aura = game.getCard(source.getSourceId());
if (aura != null && game.getState().getZone(aura.getId()).equals(Zone.GRAVEYARD)) {
if (aura != null && game.getState().getZone(aura.getId()) == Zone.GRAVEYARD) {
Player controller = game.getPlayer(source.getControllerId());
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && creature != null) {

View file

@ -270,7 +270,7 @@ class GontiLordOfLuxuryLookEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).equals(Zone.EXILED)) {
if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId) == Zone.EXILED) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {

View file

@ -165,7 +165,7 @@ class GracefulReprieveDelayedEffect extends OneShotEffect {
Player player = game.getPlayer(permanent.getOwnerId());
if (player != null) {
Card card = game.getCard(target);
if (card != null && game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) {
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
return card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), player.getId());
}
return true;

View file

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

View file

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

View file

@ -167,7 +167,7 @@ class GrimoireThiefLookEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).equals(Zone.EXILED)) {
if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId) == Zone.EXILED) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {

View file

@ -150,8 +150,8 @@ class GruesomeEncoreReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getTargetId().equals(source.getFirstTarget())
&& ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)
&& !((ZoneChangeEvent) event).getToZone().equals(Zone.EXILED);
&& ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD
&& ((ZoneChangeEvent) event).getToZone() != Zone.EXILED;
}
@Override

View file

@ -117,7 +117,7 @@ class HavengulLichPlayEffect extends AsThoughEffectImpl {
if (targetId != null) {
return targetId.equals(objectId)
&& source.getControllerId().equals(affectedControllerId)
&& Zone.GRAVEYARD.equals(game.getState().getZone(objectId));
&& Zone.GRAVEYARD == game.getState().getZone(objectId);
} else {
// the target card has changed zone meanwhile, so the effect is no longer needed
discard();

View file

@ -110,7 +110,7 @@ class HomuraReturnFlippedSourceEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Card sourceCard = game.getCard(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (sourceCard != null && controller != null && game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) {
if (sourceCard != null && controller != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
ContinuousEffect effect = new ConditionalContinuousEffect(new CopyTokenEffect(flipToken), FlippedCondition.getInstance(), "");
game.addEffect(effect, source);
controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game);

View file

@ -95,7 +95,7 @@ class HumilityEffect extends ContinuousEffectImpl {
permanent.removeAllAbilities(source.getSourceId(), game);
break;
case PTChangingEffects_7:
if (sublayer.equals(SubLayer.SetPT_7b)) {
if (sublayer == SubLayer.SetPT_7b) {
permanent.getPower().setValue(1);
permanent.getToughness().setValue(1);
}

View file

@ -152,7 +152,7 @@ class IntetTheDreamerCastEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).equals(Zone.EXILED)) {
if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId) == Zone.EXILED) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
@ -200,7 +200,7 @@ class IntetTheDreamerLookEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).equals(Zone.EXILED)) {
if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId) == Zone.EXILED) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {

View file

@ -107,7 +107,7 @@ class IslandSanctuaryEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return source.getControllerId().equals(event.getPlayerId()) && game.getTurn().getStepType().equals(PhaseStep.DRAW);
return source.getControllerId().equals(event.getPlayerId()) && game.getTurn().getStepType() == PhaseStep.DRAW;
}
@Override

View file

@ -154,7 +154,7 @@ class IsochronScepterCopyEffect extends OneShotEffect {
Permanent scepter = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (scepter != null && scepter.getImprinted() != null && !scepter.getImprinted().isEmpty()) {
Card imprintedInstant = game.getCard(scepter.getImprinted().get(0));
if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) {
if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()) == Zone.EXILED) {
if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append('?').toString(), source, game)) {
Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId());
if (copiedCard != null) {

View file

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

View file

@ -94,7 +94,7 @@ class KembasLegionEffect extends ContinuousEffectImpl {
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null && !permanent.getAttachments().isEmpty()) {
if (layer.equals(Layer.RulesEffects)) {
if (layer == Layer.RulesEffects) {
// maxBlocks = 0 equals to "can block any number of creatures"
if (permanent.getMaxBlocks() > 0) {
List<UUID> attachments = permanent.getAttachments();

View file

@ -184,8 +184,8 @@ class KheruLichLordReplacementEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE
&& event.getTargetId().equals(getTargetPointer().getFirst(game, source))
&& ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)
&& !((ZoneChangeEvent) event).getToZone().equals(Zone.EXILED)) {
&& ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD
&& ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) {
return true;
}
return false;

View file

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

View file

@ -128,7 +128,7 @@ class LifeAndLimbEffect extends ContinuousEffectImpl {
}
break;
case PTChangingEffects_7:
if (sublayer.equals(SubLayer.SetPT_7b)) {
if (sublayer == SubLayer.SetPT_7b) {
permanent.getPower().setValue(1);
permanent.getToughness().setValue(1);
}

View file

@ -187,7 +187,7 @@ class MeanderingTowershellReturnEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card card = game.getCard(source.getSourceId());
if (card != null && game.getState().getZone(source.getSourceId()).equals(Zone.EXILED)) {
if (card != null && game.getState().getZone(source.getSourceId()) == Zone.EXILED) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
game.getCombat().addAttackingCreature(card.getId(), game);
return true;

View file

@ -151,7 +151,7 @@ class MindreaverNamePredicate implements Predicate<MageObject> {
// A split card has the chosen name if one of its two names matches the chosen name.
if (input instanceof SplitCard) {
return cardNames.contains(((SplitCard) input).getLeftHalfCard().getName()) || cardNames.contains(((SplitCard) input).getRightHalfCard().getName());
} else if (input instanceof Spell && ((Spell) input).getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
} else if (input instanceof Spell && ((Spell) input).getSpellAbility().getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) {
SplitCard card = (SplitCard) ((Spell) input).getCard();
return cardNames.contains(card.getLeftHalfCard().getName()) || cardNames.contains(card.getRightHalfCard().getName());
} else {

View file

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

View file

@ -176,7 +176,7 @@ class ObzedatGhostCouncilReturnEffect extends OneShotEffect {
if (card != null) {
Zone zone = game.getState().getZone(source.getSourceId());
// return it from every public zone - http://www.mtgsalvation.com/forums/magic-fundamentals/magic-rulings/magic-rulings-archives/513186-obzedat-gc-as-edh-commander
if (!zone.equals(Zone.BATTLEFIELD) && !zone.equals(Zone.LIBRARY) && !zone.equals(Zone.HAND)) {
if (zone != Zone.BATTLEFIELD && zone != Zone.LIBRARY && zone != Zone.HAND) {
Player owner = game.getPlayer(card.getOwnerId());
if (owner != null) {
owner.moveCards(card, Zone.BATTLEFIELD, source, game);

View file

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

View file

@ -94,7 +94,7 @@ class PersonalSanctuaryEffect extends PreventionEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)) {
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER) {
if (event.getTargetId().equals(source.getControllerId()) && game.getActivePlayerId().equals(source.getControllerId()))
return super.applies(event, source, game);
}

View file

@ -73,5 +73,4 @@ public class PhantomCentaur extends CardImpl {
public PhantomCentaur copy() {
return new PhantomCentaur(this);
}
}
}

View file

@ -108,7 +108,7 @@ class PharikaExileEffect extends OneShotEffect {
if (controller != null) {
Card targetCard = game.getCard(source.getFirstTarget());
if (targetCard != null) {
if (game.getState().getZone(source.getFirstTarget()).equals(Zone.GRAVEYARD)) {
if (game.getState().getZone(source.getFirstTarget()) == Zone.GRAVEYARD) {
controller.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true);
}
Player tokenController = game.getPlayer(targetCard.getOwnerId());

View file

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

View file

@ -101,7 +101,7 @@ class PithingNeedleEffect extends ContinuousRuleModifyingEffectImpl {
MageObject object = game.getObject(event.getSourceId());
Ability ability = game.getAbility(event.getTargetId(), event.getSourceId());
if (ability != null && object != null) {
if (!ability.getAbilityType().equals(AbilityType.MANA)
if (ability.getAbilityType() != AbilityType.MANA
&& object.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY))) {
return true;
}

View file

@ -78,7 +78,7 @@ public class PostmortemLunge extends CardImpl {
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getAbilityType().equals(AbilityType.SPELL)) { // otherwise the target is also added to the delayed triggered ability
if (ability.getAbilityType() == AbilityType.SPELL) { // otherwise the target is also added to the delayed triggered ability
ability.getTargets().clear();
int xValue = ability.getManaCostsToPay().getX();
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less from your graveyard");

View file

@ -101,7 +101,7 @@ class RosheenMeandererManaCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
if (AbilityType.SPELL.equals(source.getAbilityType())) {
if (AbilityType.SPELL == source.getAbilityType()) {
MageObject object = game.getObject(source.getSourceId());
return object != null
&& object.getManaCost().getText().contains("X");

View file

@ -88,7 +88,7 @@ class SacredGroundTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId()))) {
ZoneChangeEvent zce = (ZoneChangeEvent) event;
if (Zone.BATTLEFIELD.equals(zce.getFromZone()) && Zone.GRAVEYARD.equals(zce.getToZone())) {
if (Zone.BATTLEFIELD == zce.getFromZone() && Zone.GRAVEYARD == zce.getToZone()) {
Permanent targetPermanent = zce.getTarget();
if (targetPermanent.isLand() && targetPermanent.getControllerId().equals(getControllerId())) {
getEffects().get(0).setTargetPointer(new FixedTarget(targetPermanent.getId(), game.getState().getZoneChangeCounter(targetPermanent.getId())));

View file

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

View file

@ -152,7 +152,7 @@ class SharedFatePlayEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (game.getState().getZone(objectId).equals(Zone.EXILED)) {
if (game.getState().getZone(objectId) == Zone.EXILED) {
Player player = game.getPlayer(affectedControllerId);
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
UUID exileId = CardUtil.getExileZoneId(source.getSourceId().toString() + sourcePermanent.getZoneChangeCounter(game) + affectedControllerId.toString(), game);
@ -192,7 +192,7 @@ class SharedFateLookEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (game.getState().getZone(objectId).equals(Zone.EXILED)) {
if (game.getState().getZone(objectId) == Zone.EXILED) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
UUID exileId = CardUtil.getExileZoneId(source.getSourceId().toString() + sourcePermanent.getZoneChangeCounter(game) + affectedControllerId.toString(), game);
if (exileId != null) {

View file

@ -169,8 +169,8 @@ class SithMagicReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(source.getFirstTarget())
&& ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)
&& !((ZoneChangeEvent) event).getToZone().equals(Zone.EXILED)) {
&& ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD
&& ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) {
return true;
}
return false;

View file

@ -99,7 +99,7 @@ class ArtifactAbilityManaCondition extends ManaCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
if (source != null && source.getAbilityType().equals(AbilityType.ACTIVATED)) {
if (source != null && source.getAbilityType() == AbilityType.ACTIVATED) {
MageObject object = game.getObject(source.getSourceId());
if (object != null && object.isArtifact()) {
return true;

View file

@ -102,7 +102,7 @@ class SoulSeparatorEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (creatureCard != null && controller != null) {
boolean result = false;
if (game.getState().getZone(creatureCard.getId()).equals(Zone.GRAVEYARD)) {
if (game.getState().getZone(creatureCard.getId()) == Zone.GRAVEYARD) {
result = controller.moveCardToExileWithInfo(creatureCard, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true);
ZombieToken2 token = new ZombieToken2(creatureCard.getPower().getValue(), creatureCard.getToughness().getValue());
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());

View file

@ -188,7 +188,7 @@ class SpellbinderCopyEffect extends OneShotEffect {
Permanent spellbinder = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (spellbinder != null && spellbinder.getImprinted() != null && !spellbinder.getImprinted().isEmpty()) {
Card imprintedInstant = game.getCard(spellbinder.getImprinted().get(0));
if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()).equals(Zone.EXILED)) {
if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()) == Zone.EXILED) {
if (controller.chooseUse(outcome, new StringBuilder("Create a copy of ").append(imprintedInstant.getName()).append('?').toString(), source, game)) {
Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId());
if (copiedCard != null) {

View file

@ -147,7 +147,7 @@ class SphinxOfUthuunEffect extends OneShotEffect {
pile2Zone = Zone.GRAVEYARD;
}
StringBuilder sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 1, going to ").append(pile1Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (": ");
StringBuilder sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 1, going to ").append(pile1Zone == Zone.HAND ?"Hand":"Graveyard").append (": ");
int i = 0;
for (UUID cardUuid : pile1CardsIds) {
i++;
@ -162,7 +162,7 @@ class SphinxOfUthuunEffect extends OneShotEffect {
}
game.informPlayers(sb.toString());
sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (':');
sb = new StringBuilder(sourceObject.getLogName()).append(": Pile 2, going to ").append(pile2Zone == Zone.HAND ?"Hand":"Graveyard").append (':');
i = 0;
for (UUID cardUuid : pile2CardsIds) {
Card card = game.getCard(cardUuid);

View file

@ -98,7 +98,7 @@ class StartledAwakeReturnTransformedEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
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);
Card card = game.getCard(source.getSourceId());
if (card != null) {

View file

@ -146,7 +146,7 @@ class SteamAuguryEffect extends OneShotEffect {
pile2Zone = Zone.GRAVEYARD;
}
StringBuilder sb = new StringBuilder(sourceObject.getLogName() + ": Pile 1, going to ").append(pile1Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(": ");
StringBuilder sb = new StringBuilder(sourceObject.getLogName() + ": Pile 1, going to ").append(pile1Zone == Zone.HAND ? "Hand" : "Graveyard").append(": ");
int i = 0;
for (UUID cardUuid : pile1CardsIds) {
i++;
@ -161,7 +161,7 @@ class SteamAuguryEffect extends OneShotEffect {
}
game.informPlayers(sb.toString());
sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone.equals(Zone.HAND) ? "Hand" : "Graveyard").append(':');
sb = new StringBuilder(sourceObject.getLogName() + ": Pile 2, going to ").append(pile2Zone == Zone.HAND ? "Hand" : "Graveyard").append(':');
i = 0;
for (UUID cardUuid : pile2CardsIds) {
Card card = game.getCard(cardUuid);

View file

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

View file

@ -102,7 +102,7 @@ class OpponentsCantSearchLibarariesEffect extends ContinuousRuleModifyingEffectI
@Override
public boolean checksEventType(GameEvent event, Game game) {
return EventType.SEARCH_LIBRARY.equals(event.getType());
return EventType.SEARCH_LIBRARY == event.getType();
}
@Override
@ -145,7 +145,7 @@ class StrangleholdSkipExtraTurnsEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.EXTRA_TURN);
return event.getType() == EventType.EXTRA_TURN;
}
@Override

View file

@ -143,7 +143,7 @@ class SummonersEggPutOntoBattlefieldEffect extends OneShotEffect {
Permanent SummonersEgg = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (SummonersEgg != null && SummonersEgg.getImprinted() != null && !SummonersEgg.getImprinted().isEmpty()) {
Card imprintedCard = game.getCard(SummonersEgg.getImprinted().get(0));
if (imprintedCard != null && game.getState().getZone(imprintedCard.getId()).equals(Zone.EXILED)) {
if (imprintedCard != null && game.getState().getZone(imprintedCard.getId()) == Zone.EXILED) {
//turn the exiled card face up.
imprintedCard.turnFaceUp(game, source.getControllerId());
//If it's a creature card,

View file

@ -85,7 +85,7 @@ class SunglassesOfUrzaManaAsThoughtEffect extends AsThoughEffectImpl implements
@Override
public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) {
if (mana.getWhite() > 0 && ManaType.RED.equals(manaType)) {
if (mana.getWhite() > 0 && ManaType.RED == manaType) {
return ManaType.WHITE;
}
return manaType;

View file

@ -84,7 +84,7 @@ class SuppressionFieldCostReductionEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED);
return abilityToModify.getAbilityType() == AbilityType.ACTIVATED;
}
@Override

View file

@ -106,7 +106,7 @@ class SwordOfTheMeekEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Card equipment = game.getCard(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (equipment != null && controller != null && game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) {
if (equipment != null && controller != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
controller.moveCards(equipment, Zone.BATTLEFIELD, source, game);
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {

View file

@ -107,12 +107,12 @@ class TawnossCoffinTriggeredAbility extends LeavesBattlefieldTriggeredAbility {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return super.checkEventType(event, game) || event.getType().equals(GameEvent.EventType.UNTAPPED);
return super.checkEventType(event, game) || event.getType() == GameEvent.EventType.UNTAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(GameEvent.EventType.UNTAPPED)) {
if (event.getType() == GameEvent.EventType.UNTAPPED) {
return event.getTargetId().equals(sourceId);
} else {
return super.checkTrigger(event, game);

View file

@ -169,7 +169,7 @@ class ThoughtPrisonTriggeredAbility extends TriggeredAbilityImpl {
}
if (sourcePermanent != null && sourcePermanent.getImprinted() != null && !sourcePermanent.getImprinted().isEmpty()) {
Card imprintedCard = game.getCard(sourcePermanent.getImprinted().get(0));
if (imprintedCard != null && game.getState().getZone(imprintedCard.getId()).equals(Zone.EXILED)) {
if (imprintedCard != null && game.getState().getZone(imprintedCard.getId()) == Zone.EXILED) {
// Check if spell's color matches the imprinted card
ObjectColor spellColor = spell.getColor(game);
ObjectColor imprintedColor = imprintedCard.getColor(game);

View file

@ -93,7 +93,7 @@ class TreacherousPitDwellerTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getTargetId().equals(getSourceId()) && ((EntersTheBattlefieldEvent) event).getFromZone().equals(Zone.GRAVEYARD);
return event.getTargetId().equals(getSourceId()) && ((EntersTheBattlefieldEvent) event).getFromZone() == Zone.GRAVEYARD;
}
@Override

View file

@ -149,7 +149,7 @@ class TuktukScrapperEffect extends OneShotEffect {
if (controller != null && targetArtifact != null) {
targetArtifact.destroy(source.getSourceId(), game, false);
Player targetController = game.getPlayer(targetArtifact.getControllerId());
if (targetController != null && game.getState().getZone(targetArtifact.getId()).equals(Zone.GRAVEYARD)) {
if (targetController != null && game.getState().getZone(targetArtifact.getId()) == Zone.GRAVEYARD) {
int alliesControlled = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
if (alliesControlled > 0) {
targetController.damage(alliesControlled, source.getSourceId(), game, false, true);

View file

@ -92,7 +92,7 @@ class UnwindingClockEffect extends ContinuousEffectImpl {
if (applied == null) {
applied = Boolean.FALSE;
}
if (!applied && layer.equals(Layer.RulesEffects)) {
if (!applied && layer == Layer.RulesEffects) {
if (!game.getActivePlayerId().equals(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
game.getState().setValue(source.getSourceId() + "applied", true);
for (Permanent artifact : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
@ -105,7 +105,7 @@ class UnwindingClockEffect extends ContinuousEffectImpl {
}
}
}
} else if (applied && layer.equals(Layer.RulesEffects)) {
} else if (applied && layer == Layer.RulesEffects) {
if (game.getStep().getType() == PhaseStep.END_TURN) {
game.getState().setValue(source.getSourceId() + "applied", false);
}

View file

@ -106,7 +106,7 @@ class UrbanBurgeoningUntapEffect extends ContinuousEffectImpl {
if (applied == null) {
applied = Boolean.FALSE;
}
if (!applied && layer.equals(Layer.RulesEffects)) {
if (!applied && layer == Layer.RulesEffects) {
if (!game.getActivePlayerId().equals(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
game.getState().setValue(source.getSourceId() + "applied", true);
Permanent land = game.getPermanent(source.getSourceId());

View file

@ -93,7 +93,7 @@ class CantBeBlockedByMoreThanOneAttachedEffect extends ContinuousEffectImpl {
super(duration, Outcome.Benefit);
this.amount = amount;
this.attachmentType = attachmentType;
staticText = (attachmentType.equals(AttachmentType.AURA) ? "Enchanted" : "Equipped") + " creature can't be blocked by more than " + CardUtil.numberToText(amount) + " creature" + (amount==1 ?"":"s");
staticText = (attachmentType == AttachmentType.AURA ? "Enchanted" : "Equipped") + " creature can't be blocked by more than " + CardUtil.numberToText(amount) + " creature" + (amount==1 ?"":"s");
}
public CantBeBlockedByMoreThanOneAttachedEffect(final CantBeBlockedByMoreThanOneAttachedEffect effect) {

View file

@ -105,7 +105,7 @@ class WheelOfSunAndMoonEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone().equals(Zone.GRAVEYARD)) {
if (zEvent.getToZone() == Zone.GRAVEYARD) {
Card card = game.getCard(event.getTargetId());
if (card != null) {
Permanent enchantment = game.getPermanent(source.getSourceId());

View file

@ -127,7 +127,7 @@ class XenicPoltergeistEffect extends ContinuousEffectImpl {
if (super.isInactive(source, game)) {
return true;
}
if (durationPhaseStep != null && durationPhaseStep.equals(game.getPhase().getStep().getType())) {
if (durationPhaseStep != null && durationPhaseStep == game.getPhase().getStep().getType()) {
if (!sameStep && game.getActivePlayerId().equals(durationPlayerId) || game.getPlayer(durationPlayerId).hasReachedNextTurnAfterLeaving()) {
return true;
}

View file

@ -225,7 +225,7 @@ public class DragonsMaze extends ExpansionSet {
@Override
public List<CardInfo> getCardsByRarity(Rarity rarity) {
if (rarity.equals(Rarity.COMMON)) {
if (rarity == Rarity.COMMON) {
List<CardInfo> savedCardsInfos = savedCards.get(rarity);
if (savedCardsInfos == null) {
CardCriteria criteria = new CardCriteria();

View file

@ -256,7 +256,7 @@ public class FateReforged extends ExpansionSet {
@Override
public List<CardInfo> getCardsByRarity(Rarity rarity) {
// Common cards retrievement of Fate Reforged boosters - prevent the retrievement of the common lands (e.g. Blossoming Sands)
if (rarity.equals(Rarity.COMMON)) {
if (rarity == Rarity.COMMON) {
List<CardInfo> savedCardsInfos = savedCards.get(rarity);
if (savedCardsInfos == null) {
CardCriteria criteria = new CardCriteria();

View file

@ -75,6 +75,7 @@ public class FutureSight extends ExpansionSet {
cards.add(new SetCardInfo("Bridge from Below", 81, Rarity.RARE, mage.cards.b.BridgeFromBelow.class));
cards.add(new SetCardInfo("Centaur Omenreader", 143, Rarity.UNCOMMON, mage.cards.c.CentaurOmenreader.class));
cards.add(new SetCardInfo("Char-Rumbler", 96, Rarity.UNCOMMON, mage.cards.c.CharRumbler.class));
cards.add(new SetCardInfo("Chronomantic Escape", 4, Rarity.UNCOMMON, mage.cards.c.ChronomanticEscape.class));
cards.add(new SetCardInfo("Cloud Key", 160, Rarity.RARE, mage.cards.c.CloudKey.class));
cards.add(new SetCardInfo("Cloudseeder", 33, Rarity.UNCOMMON, mage.cards.c.Cloudseeder.class));
cards.add(new SetCardInfo("Coalition Relic", 161, Rarity.RARE, mage.cards.c.CoalitionRelic.class));

View file

@ -71,6 +71,7 @@ public class Prophecy extends ExpansionSet {
cards.add(new SetCardInfo("Calming Verse", 110, Rarity.COMMON, mage.cards.c.CalmingVerse.class));
cards.add(new SetCardInfo("Chilling Apparition", 59, Rarity.UNCOMMON, mage.cards.c.ChillingApparition.class));
cards.add(new SetCardInfo("Chimeric Idol", 136, Rarity.UNCOMMON, mage.cards.c.ChimericIdol.class));
cards.add(new SetCardInfo("Citadel of Pain", 86, Rarity.UNCOMMON, mage.cards.c.CitadelOfPain.class));
cards.add(new SetCardInfo("Coastal Hornclaw", 31, Rarity.COMMON, mage.cards.c.CoastalHornclaw.class));
cards.add(new SetCardInfo("Darba", 111, Rarity.UNCOMMON, mage.cards.d.Darba.class));
cards.add(new SetCardInfo("Denying Wind", 32, Rarity.RARE, mage.cards.d.DenyingWind.class));