mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
Merge branch 'master' into phantoms
This commit is contained in:
commit
5ae4ddce07
182 changed files with 572 additions and 355 deletions
|
|
@ -846,19 +846,19 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
|
|||
* in {@link ColoredManaSymbol}.
|
||||
*/
|
||||
public int getColor(final ColoredManaSymbol color) {
|
||||
if (color.equals(ColoredManaSymbol.G)) {
|
||||
if (color == ColoredManaSymbol.G) {
|
||||
return green;
|
||||
}
|
||||
if (color.equals(ColoredManaSymbol.R)) {
|
||||
if (color == ColoredManaSymbol.R) {
|
||||
return red;
|
||||
}
|
||||
if (color.equals(ColoredManaSymbol.B)) {
|
||||
if (color == ColoredManaSymbol.B) {
|
||||
return black;
|
||||
}
|
||||
if (color.equals(ColoredManaSymbol.U)) {
|
||||
if (color == ColoredManaSymbol.U) {
|
||||
return blue;
|
||||
}
|
||||
if (color.equals(ColoredManaSymbol.W)) {
|
||||
if (color == ColoredManaSymbol.W) {
|
||||
return white;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
PhyrexianManaCost phyrexianManaCost = (PhyrexianManaCost)cost;
|
||||
PayLifeCost payLifeCost = new PayLifeCost(2);
|
||||
if(payLifeCost.canPay(this, sourceId, controller.getId(), game) &&
|
||||
controller.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + "?", this, game)) {
|
||||
controller.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + '?', this, game)) {
|
||||
costIterator.remove();
|
||||
costs.add(payLifeCost);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class DealsDamageToAPlayerAttachedTriggeredAbility extends TriggeredAbili
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (targetController.equals(TargetController.OPPONENT)) {
|
||||
if (targetController == TargetController.OPPONENT) {
|
||||
Player controller = game.getPlayer(this.getControllerId());
|
||||
if (controller == null || !game.isOpponent(controller, event.getPlayerId())) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class DiesAttachedTriggeredAbility extends TriggeredAbilityImpl {
|
|||
for (Effect effect : getEffects()) {
|
||||
if (zEvent.getTarget() != null) {
|
||||
effect.setValue("attachedTo", zEvent.getTarget());
|
||||
if (setTargetPointer.equals(SetTargetPointer.ATTACHED_TO_CONTROLLER)) {
|
||||
if (setTargetPointer == SetTargetPointer.ATTACHED_TO_CONTROLLER) {
|
||||
Permanent attachment = game.getPermanentOrLKIBattlefield(getSourceId());
|
||||
if (attachment != null && attachment.getAttachedTo() != null) {
|
||||
Permanent attachedTo = (Permanent) game.getLastKnownInformation(attachment.getAttachedTo(), Zone.BATTLEFIELD, attachment.getAttachedToZoneChangeCounter());
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
UUID targetId = event.getTargetId();
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||
if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
|
||||
if (setTargetPointer != SetTargetPointer.NONE) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
switch (setTargetPointer) {
|
||||
case PERMANENT:
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getSourceId().equals(getSourceId())) {
|
||||
for (Effect effect: getEffects()) {
|
||||
if (setTargetPointer.equals(SetTargetPointer.PERMANENT)) {
|
||||
if (setTargetPointer == SetTargetPointer.PERMANENT) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ public class LimitedTimesPerTurnActivatedAbility extends ActivatedAbilityImpl {
|
|||
if (condition != null) {
|
||||
sb.append("only ").append(condition.toString()).append(" and ");
|
||||
}
|
||||
if (getTiming().equals(TimingRule.SORCERY)) {
|
||||
if (getTiming() == TimingRule.SORCERY) {
|
||||
sb.append("only any time you could cast a sorcery and ");
|
||||
}
|
||||
switch (maxActivationsPerTurn) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class ZoneChangeTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public ZoneChangeTriggeredAbility(Zone worksInZone, Zone fromZone, Zone toZone, Effect effect, String rule, boolean optional) {
|
||||
super(worksInZone, effect, optional);
|
||||
if (fromZone.equals(Zone.BATTLEFIELD)) {
|
||||
if (fromZone == Zone.BATTLEFIELD) {
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
this.fromZone = fromZone;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public class ColoredManaCost extends ManaCostImpl {
|
|||
|
||||
@Override
|
||||
public boolean containsColor(ColoredManaSymbol coloredManaSymbol) {
|
||||
return mana.equals(coloredManaSymbol);
|
||||
return mana == coloredManaSymbol;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class ManaSymbols extends ArrayList<ManaSymbol> {
|
|||
* @return
|
||||
*/
|
||||
private static boolean compareHybridCosts(HybridManaCost h1, HybridManaCost h2) {
|
||||
return h1.getMana1().equals(h2.getMana1()) && h1.getMana2().equals(h2.getMana2())
|
||||
|| h1.getMana1().equals(h2.getMana2()) && h1.getMana2().equals(h2.getMana1());
|
||||
return h1.getMana1() == h2.getMana1() && h1.getMana2() == h2.getMana2()
|
||||
|| h1.getMana1() == h2.getMana2() && h1.getMana2() == h2.getMana1();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public class MonoHybridManaCost extends ManaCostImpl {
|
|||
|
||||
@Override
|
||||
public boolean containsColor(ColoredManaSymbol coloredManaSymbol) {
|
||||
return mana.equals(coloredManaSymbol);
|
||||
return mana == coloredManaSymbol;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
|
|||
if (spellAbility.getTargets().isEmpty()) {
|
||||
for (Ability ability : card.getAbilities(game)) {
|
||||
if ((ability instanceof SpellAbility)
|
||||
&& SpellAbilityType.BASE_ALTERNATE.equals(((SpellAbility) ability).getSpellAbilityType())
|
||||
&& SpellAbilityType.BASE_ALTERNATE == ((SpellAbility) ability).getSpellAbilityType()
|
||||
&& !ability.getTargets().isEmpty()) {
|
||||
spellAbility = (SpellAbility) ability;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -418,8 +418,8 @@ public class ContinuousEffects implements Serializable {
|
|||
return true;
|
||||
}
|
||||
MageObject object;
|
||||
if (event.getType().equals(EventType.ZONE_CHANGE)
|
||||
&& ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)
|
||||
if (event.getType() == EventType.ZONE_CHANGE
|
||||
&& ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD
|
||||
&& event.getTargetId().equals(ability.getSourceId())) {
|
||||
object = ((ZoneChangeEvent) event).getTarget();
|
||||
} else {
|
||||
|
|
@ -645,7 +645,7 @@ public class ContinuousEffects implements Serializable {
|
|||
* @param game
|
||||
*/
|
||||
public void applySpliceEffects(Ability abilityToModify, Game game) {
|
||||
if (((SpellAbility) abilityToModify).getSpellAbilityType().equals(SpellAbilityType.SPLICE)) {
|
||||
if (((SpellAbility) abilityToModify).getSpellAbilityType() == SpellAbilityType.SPLICE) {
|
||||
// on a spliced ability of a spell can't be spliced again
|
||||
return;
|
||||
}
|
||||
|
|
@ -778,7 +778,7 @@ public class ContinuousEffects implements Serializable {
|
|||
if (rEffects.size() == 1) {
|
||||
ReplacementEffect effect = rEffects.keySet().iterator().next();
|
||||
HashSet<Ability> abilities;
|
||||
if (effect.getEffectType().equals(EffectType.REPLACEMENT)) {
|
||||
if (effect.getEffectType() == EffectType.REPLACEMENT) {
|
||||
abilities = replacementEffects.getAbility(effect.getId());
|
||||
} else {
|
||||
abilities = preventionEffects.getAbility(effect.getId());
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm
|
|||
case ATTACK:
|
||||
return event.getType() == GameEvent.EventType.DECLARE_ATTACKER;
|
||||
case BLOCK:
|
||||
return event.getType().equals(GameEvent.EventType.DECLARE_BLOCKER);
|
||||
return event.getType() == EventType.DECLARE_BLOCKER;
|
||||
case ATTACK_AND_BLOCK:
|
||||
return event.getType() == GameEvent.EventType.DECLARE_ATTACKER || event.getType() == EventType.DECLARE_BLOCKER;
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm
|
|||
Player player = game.getPlayer(event.getPlayerId());
|
||||
if (player != null) {
|
||||
String chooseText;
|
||||
if (event.getType().equals(GameEvent.EventType.DECLARE_ATTACKER)) {
|
||||
if (event.getType() == EventType.DECLARE_ATTACKER) {
|
||||
chooseText = "Pay " + attackBlockManaTax.getText() + " to attack?";
|
||||
} else {
|
||||
chooseText = "Pay " + attackBlockManaTax.getText() + " to block?";
|
||||
|
|
@ -171,7 +171,7 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm
|
|||
PhyrexianManaCost phyrexianManaCost = (PhyrexianManaCost)manaCost;
|
||||
PayLifeCost payLifeCost = new PayLifeCost(2);
|
||||
if(payLifeCost.canPay(source, source.getSourceId(), player.getId(), game) &&
|
||||
player.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + "?", source, game)) {
|
||||
player.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + '?', source, game)) {
|
||||
manaCostIterator.remove();
|
||||
costs.add(payLifeCost);
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm
|
|||
attackBlockOtherTax.clearPaid();
|
||||
if (attackBlockOtherTax.canPay(source, source.getSourceId(), event.getPlayerId(), game)
|
||||
&& player.chooseUse(Outcome.Neutral,
|
||||
attackBlockOtherTax.getText() + " to " + (event.getType().equals(EventType.DECLARE_ATTACKER) ? "attack?" : "block?"), source, game)) {
|
||||
attackBlockOtherTax.getText() + " to " + (event.getType() == EventType.DECLARE_ATTACKER ? "attack?" : "block?"), source, game)) {
|
||||
if (attackBlockOtherTax.pay(source, game, source.getSourceId(), event.getPlayerId(), false, null)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (getTargetPointer().getTargets(game, source).contains(event.getTargetId())) {
|
||||
if (targetController.equals(TargetController.OPPONENT)
|
||||
if (targetController == TargetController.OPPONENT
|
||||
&& !game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp
|
|||
sb.append(filterSource.getMessage());
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append("this turn");
|
||||
} else {
|
||||
sb.append(duration.toString());
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class CopyEffect extends ContinuousEffectImpl {
|
|||
Permanent permanent = game.getPermanent(copyToObjectId);
|
||||
if (permanent != null) {
|
||||
affectedObjectList.add(new MageObjectReference(permanent, game));
|
||||
} else if (source.getAbilityType().equals(AbilityType.STATIC)) {
|
||||
} else if (source.getAbilityType() == AbilityType.STATIC) {
|
||||
// for replacement effects that let a permanent enter the battlefield as a copy of another permanent we need to apply that copy
|
||||
// before the permanent is added to the battlefield
|
||||
permanent = game.getPermanentEntering(copyToObjectId);
|
||||
|
|
|
|||
|
|
@ -85,13 +85,13 @@ public class CounterTargetWithReplacementEffect extends OneShotEffect {
|
|||
StringBuilder sb = new StringBuilder("Counter target ");
|
||||
sb.append(mode.getTargets().get(0).getTargetName());
|
||||
sb.append(". If that spell is countered this way, ");
|
||||
if (targetZone.equals(Zone.EXILED)) {
|
||||
if (targetZone == Zone.EXILED) {
|
||||
sb.append("exile it instead of putting it into its owner's graveyard");
|
||||
}
|
||||
if (targetZone.equals(Zone.HAND)) {
|
||||
if (targetZone == Zone.HAND) {
|
||||
sb.append("put it into its owner's hand instead of into that player's graveyard");
|
||||
}
|
||||
if (targetZone.equals(Zone.LIBRARY)) {
|
||||
if (targetZone == Zone.LIBRARY) {
|
||||
sb.append("put it on ");
|
||||
switch (zoneDetail) {
|
||||
case BOTTOM:
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class EnterBattlefieldPayCostOrPutGraveyardEffect extends ReplacementEffe
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (source.getSourceId().equals(event.getTargetId())) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getToZone().equals(Zone.BATTLEFIELD)) {
|
||||
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,14 +106,14 @@ public class ExileTargetEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
Zone currentZone = game.getState().getZone(permanent.getId());
|
||||
if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(Zone.BATTLEFIELD))) {
|
||||
if (currentZone != Zone.EXILED && (onlyFromZone == null || onlyFromZone == Zone.BATTLEFIELD)) {
|
||||
toExile.add(permanent);
|
||||
}
|
||||
} else {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null) {
|
||||
Zone currentZone = game.getState().getZone(card.getId());
|
||||
if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(currentZone))) {
|
||||
if (currentZone != Zone.EXILED && (onlyFromZone == null || onlyFromZone == currentZone)) {
|
||||
toExile.add(card);
|
||||
}
|
||||
}
|
||||
|
|
@ -125,14 +125,14 @@ public class ExileTargetEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
Zone currentZone = game.getState().getZone(permanent.getId());
|
||||
if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(Zone.BATTLEFIELD))) {
|
||||
if (currentZone != Zone.EXILED && (onlyFromZone == null || onlyFromZone == Zone.BATTLEFIELD)) {
|
||||
toExile.add(permanent);
|
||||
}
|
||||
} else {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null) {
|
||||
Zone currentZone = game.getState().getZone(card.getId());
|
||||
if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(currentZone))) {
|
||||
if (currentZone != Zone.EXILED && (onlyFromZone == null || onlyFromZone == currentZone)) {
|
||||
toExile.add(card);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class PreventAllDamageToPlayersEffect extends PreventionEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game) && event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)) {
|
||||
if (super.applies(event, source, game) && event.getType() == GameEvent.EventType.DAMAGE_PLAYER) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && game.getState().getPlayersInRange(controller.getId(), game).contains(event.getTargetId())) {
|
||||
return true;
|
||||
|
|
@ -76,7 +76,7 @@ public class PreventAllDamageToPlayersEffect extends PreventionEffectImpl {
|
|||
sb.append("combat ");
|
||||
}
|
||||
sb.append("damage that would be dealt to players");
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append(" this turn");
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -132,8 +132,8 @@ public class PreventDamageToTargetMultiAmountEffect extends PreventionEffectImpl
|
|||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("prevent the next ").append(amountToPrevent).append(" damage that would be dealt ");
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
sb.append("prevent the next ").append(amountToPrevent).append(" damage that would be dealt ");
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append("this turn ");
|
||||
}
|
||||
sb.append("to any number of target creatures and/or players, divided as you choose");
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class PreventNextDamageFromChosenSourceToTargetEffect extends PreventionE
|
|||
StringBuilder sb = new StringBuilder("The next time a ").append(targetSource.getFilter().getMessage());
|
||||
sb.append(" of your choice would deal damage to target ");
|
||||
sb.append(mode.getTargets().get(0).getTargetName());
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append(" this turn");
|
||||
}
|
||||
sb.append(", prevent that damage");
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class PreventNextDamageFromChosenSourceToYouEffect extends PreventionEffe
|
|||
private String setText() {
|
||||
StringBuilder sb = new StringBuilder("The next time a ").append(targetSource.getFilter().getMessage());
|
||||
sb.append(" of your choice would deal damage to you");
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append(" this turn");
|
||||
}
|
||||
sb.append(", prevent that damage");
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class RegenerateTargetEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return EventType.DESTROY_PERMANENT.equals(event.getType());
|
||||
return EventType.DESTROY_PERMANENT == event.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
|
|||
}
|
||||
ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), permanentLeftBattlefield.getZoneChangeCounter(game)));
|
||||
if (exile != null) { // null is valid if source left battlefield before enters the battlefield effect resolved
|
||||
if (returnToZone.equals(Zone.BATTLEFIELD)) {
|
||||
if (returnToZone == Zone.BATTLEFIELD) {
|
||||
controller.moveCards(exile.getCards(game), returnToZone, source, game, false, false, true, null);
|
||||
} else {
|
||||
controller.moveCards(exile, returnToZone, source, game);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect
|
|||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
|
|
|
|||
|
|
@ -103,10 +103,10 @@ public class CanBlockAdditionalCreatureEffect extends ContinuousEffectImpl {
|
|||
default:
|
||||
text += CardUtil.numberToText(amount, "an") + " additional creature" + (amount > 1 ? "s" : "");
|
||||
}
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
text += " this turn";
|
||||
}
|
||||
if (duration.equals(Duration.WhileOnBattlefield)) {
|
||||
if (duration == Duration.WhileOnBattlefield) {
|
||||
text += " each combat";
|
||||
}
|
||||
return text;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class CantAttackAnyPlayerAllEffect extends RestrictionEffect {
|
|||
StringBuilder sb = new StringBuilder(filter.getMessage()).append(" can't attack");
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(' ');
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append(" this turn");
|
||||
} else {
|
||||
sb.append(' ').append(duration.toString());
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class CantBeBlockedTargetEffect extends RestrictionEffect {
|
|||
sb.append(" can't be blocked");
|
||||
}
|
||||
|
||||
if (Duration.EndOfTurn.equals(this.duration)) {
|
||||
if (Duration.EndOfTurn == this.duration) {
|
||||
sb.append(" this turn");
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class MustBeBlockedByAtLeastOneSourceEffect extends RequirementEffect {
|
|||
|
||||
public MustBeBlockedByAtLeastOneSourceEffect(Duration duration) {
|
||||
super(duration);
|
||||
staticText = "{this} must be blocked " + (duration.equals(Duration.EndOfTurn) ? "this turn " : "") + "if able";
|
||||
staticText = "{this} must be blocked " + (duration == Duration.EndOfTurn ? "this turn " : "") + "if able";
|
||||
}
|
||||
|
||||
public MustBeBlockedByAtLeastOneSourceEffect(final MustBeBlockedByAtLeastOneSourceEffect effect) {
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public class BecomesAuraSourceEffect extends ContinuousEffectImpl implements Sou
|
|||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return Layer.AbilityAddingRemovingEffects_6.equals(layer) || Layer.TypeChangingEffects_4.equals(layer);
|
||||
return Layer.AbilityAddingRemovingEffects_6 == layer || Layer.TypeChangingEffects_4 == layer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
|
|||
sb.append(landType);
|
||||
}
|
||||
}
|
||||
if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) {
|
||||
if (!duration.toString().isEmpty() && duration != Duration.EndOfGame) {
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
|
|||
}
|
||||
}
|
||||
return true;
|
||||
} else if (duration.equals(Duration.Custom)) {
|
||||
} else if (duration == Duration.Custom) {
|
||||
this.discard();
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
result = true;
|
||||
}
|
||||
}
|
||||
if (!result && this.duration.equals(Duration.Custom)) {
|
||||
if (!result && this.duration == Duration.Custom) {
|
||||
this.discard();
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class BecomesCreatureTypeTargetEffect extends ContinuousEffectImpl {
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
if (duration.equals(Duration.Custom)) {
|
||||
if (duration == Duration.Custom) {
|
||||
discard();
|
||||
}
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ public class BecomesCreatureTypeTargetEffect extends ContinuousEffectImpl {
|
|||
private String setText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Target creature becomes that type");
|
||||
if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) {
|
||||
if (!duration.toString().isEmpty() && duration != Duration.EndOfGame) {
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
|
|||
this.objectReference = objectReference;
|
||||
this.zoneChangeCounter = Integer.MIN_VALUE;
|
||||
if (turnFaceUpCosts != null) {
|
||||
this.turnFaceUpAbility = new TurnFaceUpAbility(turnFaceUpCosts, faceDownType.equals(FaceDownType.MEGAMORPHED));
|
||||
this.turnFaceUpAbility = new TurnFaceUpAbility(turnFaceUpCosts, faceDownType == FaceDownType.MEGAMORPHED);
|
||||
}
|
||||
staticText = "{this} becomes a 2/2 face-down creature, with no text, no name, no subtypes, and no mana cost";
|
||||
foundPermanent = false;
|
||||
|
|
@ -124,7 +124,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (faceDownType.equals(FaceDownType.MANUAL)) {
|
||||
if (faceDownType == FaceDownType.MANUAL) {
|
||||
Permanent permanent;
|
||||
if (objectReference != null) {
|
||||
permanent = objectReference.getPermanent(game);
|
||||
|
|
@ -200,7 +200,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
|
|||
permanent.getToughness().setValue(2);
|
||||
}
|
||||
}
|
||||
} else if (duration.equals(Duration.Custom) && foundPermanent == true) {
|
||||
} else if (duration == Duration.Custom && foundPermanent == true) {
|
||||
discard();
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class BecomesSubtypeAllEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
break;
|
||||
}
|
||||
} else if (duration.equals(Duration.Custom)) {
|
||||
} else if (duration == Duration.Custom) {
|
||||
discard();
|
||||
}
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ public class BecomesSubtypeAllEffect extends ContinuousEffectImpl {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Target creature becomes that type");
|
||||
if (!duration.toString().isEmpty()
|
||||
&& !duration.equals(Duration.EndOfGame)) {
|
||||
&& duration != Duration.EndOfGame) {
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
case GRAVEYARD:
|
||||
case EXILED:
|
||||
if (((ZoneChangeEvent) event).getFromZone().equals(Zone.STACK)) {
|
||||
if (((ZoneChangeEvent) event).getFromZone() == Zone.STACK) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && commanderId.equals(spell.getSourceId())) {
|
||||
return true;
|
||||
|
|
@ -147,7 +147,7 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
} else {
|
||||
Card card = null;
|
||||
if (((ZoneChangeEvent) event).getFromZone().equals(Zone.STACK)) {
|
||||
if (((ZoneChangeEvent) event).getFromZone() == Zone.STACK) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null) {
|
||||
card = game.getCard(spell.getSourceId());
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
|||
sb.append("Other ");
|
||||
}
|
||||
sb.append(filter.getMessage());
|
||||
if (duration.equals(Duration.WhileOnBattlefield)) {
|
||||
if (duration == Duration.WhileOnBattlefield) {
|
||||
if (filter.getMessage().toLowerCase().startsWith("each")) {
|
||||
sb.append(" has ");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class GainAbilityControllerEffect extends ContinuousEffectImpl {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.addAbility(ability);
|
||||
if (duration.equals(Duration.Custom)) {
|
||||
if (duration == Duration.Custom) {
|
||||
if (game.getPermanent(source.getSourceId()) == null) {
|
||||
discard();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl implements Sou
|
|||
return true;
|
||||
}
|
||||
}
|
||||
if (duration.equals(Duration.Custom)) {
|
||||
if (duration == Duration.Custom) {
|
||||
this.discard();
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (duration.equals(Duration.Custom) && affectedTargets == 0) {
|
||||
if (duration == Duration.Custom && affectedTargets == 0) {
|
||||
this.discard();
|
||||
}
|
||||
return affectedTargets > 0;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class GainSuspendEffect extends ContinuousEffectImpl implements SourceEff
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(mor.getSourceId());
|
||||
if (card != null && mor.refersTo(card, game) && game.getState().getZone(card.getId()).equals(Zone.EXILED)) {
|
||||
if (card != null && mor.refersTo(card, game) && game.getState().getZone(card.getId()) == Zone.EXILED) {
|
||||
SuspendAbility.addSuspendTemporaryToCard(card, source, game);
|
||||
} else {
|
||||
discard();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class LoseAllAbilitiesAllEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
if (duration == Duration.EndOfTurn) {
|
||||
sb.append(duration.toString()).append(", ");
|
||||
}
|
||||
sb.append(filter.getMessage()).append(" lose all abilities.");
|
||||
|
|
|
|||
|
|
@ -166,9 +166,9 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl {
|
|||
break;
|
||||
}
|
||||
sb.append("maximum hand size");
|
||||
if (handSizeModification.equals(HandSizeModification.INCREASE)) {
|
||||
if (handSizeModification == HandSizeModification.INCREASE) {
|
||||
sb.append(" is increased by ");
|
||||
} else if (handSizeModification.equals(HandSizeModification.REDUCE)) {
|
||||
} else if (handSizeModification == HandSizeModification.REDUCE) {
|
||||
sb.append(" is reduced by ");
|
||||
} else if ((handSize instanceof StaticValue && ((StaticValue) handSize).getValue() == Integer.MAX_VALUE) || !(handSize instanceof StaticValue)) {
|
||||
sb.append(" is ");
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl {
|
|||
|
||||
public SetPowerToughnessSourceEffect(DynamicValue amount, Duration duration, SubLayer subLayer) {
|
||||
super(duration, Layer.PTChangingEffects_7, subLayer, Outcome.BoostCreature);
|
||||
setCharacterDefining(subLayer.equals(SubLayer.CharacteristicDefining_7a));
|
||||
setCharacterDefining(subLayer == SubLayer.CharacteristicDefining_7a);
|
||||
this.amount = amount;
|
||||
staticText = "{this}'s power and toughness are each equal to the number of " + amount.getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class UntapAllDuringEachOtherPlayersUntapStepEffect extends ContinuousEff
|
|||
}
|
||||
}
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
|
|||
}
|
||||
} else {
|
||||
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());
|
||||
}
|
||||
if (permanent != null) {
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ class BestowEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return EventType.ENTERS_THE_BATTLEFIELD_SELF.equals(event.getType());
|
||||
return EventType.ENTERS_THE_BATTLEFIELD_SELF == event.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public class ConvokeAbility extends SimpleStaticAbility implements AlternateMana
|
|||
public void addSpecialAction(Ability source, Game game, ManaCost unpaid) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && game.getBattlefield().contains(filterUntapped, controller.getId(), 1, game)) {
|
||||
if (source.getAbilityType().equals(AbilityType.SPELL)) {
|
||||
if (source.getAbilityType() == AbilityType.SPELL) {
|
||||
SpecialAction specialAction = new ConvokeSpecialAction(unpaid);
|
||||
specialAction.setControllerId(source.getControllerId());
|
||||
specialAction.setSourceId(source.getSourceId());
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class DelveAbility extends SimpleStaticAbility implements AlternateManaPa
|
|||
public void addSpecialAction(Ability source, Game game, ManaCost unpaid) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && !controller.getGraveyard().isEmpty()) {
|
||||
if (unpaid.getMana().getGeneric() > 0 && source.getAbilityType().equals(AbilityType.SPELL)) {
|
||||
if (unpaid.getMana().getGeneric() > 0 && source.getAbilityType() == AbilityType.SPELL) {
|
||||
SpecialAction specialAction = new DelveSpecialAction();
|
||||
specialAction.setControllerId(source.getControllerId());
|
||||
specialAction.setSourceId(source.getSourceId());
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class EchoAbility extends TriggeredAbilityImpl {
|
|||
|
||||
this.echoPaid = false;
|
||||
}
|
||||
if (event.getType().equals(GameEvent.EventType.UPKEEP_STEP_PRE)) {
|
||||
if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) {
|
||||
if(lastController != null){
|
||||
if(!lastController.equals(this.controllerId)){
|
||||
this.echoPaid = false;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class ForecastAbility extends LimitedTimesPerTurnActivatedAbility {
|
|||
public boolean canActivate(UUID playerId, Game game) {
|
||||
// May be activated only during the upkeep step of the card's owner
|
||||
// Because it can only be activated from a players hand it should be ok to check here with controllerId instead of card.getOwnerId().
|
||||
if (!game.getActivePlayerId().equals(controllerId) || !PhaseStep.UPKEEP.equals(game.getStep().getType())) {
|
||||
if (!game.getActivePlayerId().equals(controllerId) || PhaseStep.UPKEEP != game.getStep().getType()) {
|
||||
return false;
|
||||
}
|
||||
return super.canActivate(playerId, game);
|
||||
|
|
|
|||
|
|
@ -98,12 +98,12 @@ public class HauntAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
switch (event.getType()) {
|
||||
case ENTERS_THE_BATTLEFIELD:
|
||||
if (game.getState().getZone(getSourceId()).equals(Zone.BATTLEFIELD)) {
|
||||
if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) {
|
||||
return event.getTargetId().equals(getSourceId());
|
||||
}
|
||||
break;
|
||||
case ZONE_CHANGE:
|
||||
if (!usedFromExile &&game.getState().getZone(getSourceId()).equals(Zone.EXILED)) {
|
||||
if (!usedFromExile && game.getState().getZone(getSourceId()) == Zone.EXILED) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.isDiesEvent()) {
|
||||
Card card = game.getCard(getSourceId());
|
||||
|
|
|
|||
|
|
@ -197,13 +197,13 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
|||
|
||||
private String getActivationKey(Ability source, String costText, Game game) {
|
||||
int zcc = 0;
|
||||
if (source.getAbilityType().equals(AbilityType.TRIGGERED)) {
|
||||
if (source.getAbilityType() == AbilityType.TRIGGERED) {
|
||||
zcc = source.getSourceObjectZoneChangeCounter();
|
||||
}
|
||||
if (zcc == 0) {
|
||||
zcc = game.getState().getZoneChangeCounter(source.getSourceId());
|
||||
}
|
||||
if (zcc > 0 && (source.getAbilityType().equals(AbilityType.TRIGGERED))) {
|
||||
if (zcc > 0 && (source.getAbilityType() == AbilityType.TRIGGERED)) {
|
||||
--zcc;
|
||||
}
|
||||
return String.valueOf(zcc) + ((kickerCosts.size() > 1) ? costText : "");
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost
|
|||
|
||||
@Override
|
||||
public boolean askToActivateAlternativeCosts(Ability ability, Game game) {
|
||||
if (ability.getAbilityType().equals(AbilityType.SPELL)) {
|
||||
if (ability.getAbilityType() == AbilityType.SPELL) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
Spell spell = game.getStack().getSpell(ability.getId());
|
||||
if (player != null && spell != null) {
|
||||
|
|
@ -233,7 +233,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost
|
|||
}
|
||||
}
|
||||
}
|
||||
if (ability.getAbilityType().equals(AbilityType.PLAY_LAND)) {
|
||||
if (ability.getAbilityType() == AbilityType.PLAY_LAND) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
if (player != null) {
|
||||
this.resetMorph();
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class ReboundCastFromHandReplacementEffect extends ReplacementEffectImpl {
|
|||
&& event.getSourceId() != null
|
||||
&& event.getSourceId().equals(source.getSourceId())) { // if countered the source.sourceId is different or null if it fizzles
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && spell.getFromZone().equals(Zone.HAND)) {
|
||||
if (spell != null && spell.getFromZone() == Zone.HAND) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ class UnearthLeavesBattlefieldEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return EventType.ZONE_CHANGE.equals(event.getType());
|
||||
return EventType.ZONE_CHANGE == event.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ public abstract class ExpansionSet implements Serializable {
|
|||
savedCardsInfos = CardRepository.instance.findCards(criteria);
|
||||
// Workaround after card number is numeric
|
||||
if (maxCardNumberInBooster != Integer.MAX_VALUE) {
|
||||
savedCardsInfos.removeIf(next -> Integer.valueOf(next.getCardNumber()) > maxCardNumberInBooster && !rarity.equals(Rarity.LAND));
|
||||
savedCardsInfos.removeIf(next -> Integer.valueOf(next.getCardNumber()) > maxCardNumberInBooster && rarity != Rarity.LAND);
|
||||
}
|
||||
|
||||
savedCards.put(rarity, savedCardsInfos);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public final class CardScanner {
|
|||
|| !expansionInfo.code.equals(set.getCode())
|
||||
|| (expansionInfo.blockName == null ? set.getBlockName() != null : !expansionInfo.blockName.equals(set.getBlockName()))
|
||||
|| !expansionInfo.releaseDate.equals(set.getReleaseDate())
|
||||
|| !expansionInfo.type.equals(set.getSetType())
|
||||
|| expansionInfo.type != set.getSetType()
|
||||
|| expansionInfo.boosters != set.hasBoosters()
|
||||
|| expansionInfo.basicLands != set.hasBasicLands()) {
|
||||
ExpansionRepository.instance.update(expansionInfo);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class FilterAbility extends FilterImpl<Ability> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Ability input, Game game) {
|
||||
return input.getAbilityType().equals(type);
|
||||
return input.getAbilityType() == type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class MulticoloredPredicate implements Predicate<MageObject> {
|
|||
// 708.3. Each split card that consists of two halves with different colored mana symbols in their mana costs
|
||||
// is a multicolored card while it’s not a spell on the stack. While it’s a spell on the stack, it’s only the
|
||||
// color or colors of the half or halves being cast. #
|
||||
if (input instanceof SplitCardHalf && !game.getState().getZone(input.getId()).equals(Zone.STACK)) {
|
||||
if (input instanceof SplitCardHalf && game.getState().getZone(input.getId()) != Zone.STACK) {
|
||||
return 1 < ((SplitCardHalf) input).getMainCard().getColor(game).getColorCount();
|
||||
} else {
|
||||
return 1 < input.getColor(game).getColorCount();
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class NamePredicate 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 name.equals(((SplitCard)input).getLeftHalfCard().getName()) || name.equals(((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 name.equals(card.getLeftHalfCard().getName()) || name.equals(card.getRightHalfCard().getName());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ public class Table implements Serializable {
|
|||
Player player = seats[i].getPlayer();
|
||||
if (player != null && player.getId().equals(playerId)) {
|
||||
seats[i].setPlayer(null);
|
||||
if (getState().equals(TableState.READY_TO_START)) {
|
||||
if (getState() == TableState.READY_TO_START) {
|
||||
setState(TableState.WAITING);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ public final class ZonesHandler {
|
|||
|
||||
private static Card takeAttributesFromSpell(Card card, ZoneChangeEvent event, Game game) {
|
||||
card = card.copy();
|
||||
if (Zone.STACK.equals(event.getFromZone())) {
|
||||
if (Zone.STACK == event.getFromZone()) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && !spell.isFaceDown(game)) {
|
||||
if (!card.getColor(game).equals(spell.getColor(game))) {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
id = ability.getId();
|
||||
this.ability = ability;
|
||||
this.ability.setControllerId(controllerId);
|
||||
if (ability.getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
|
||||
if (ability.getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) {
|
||||
spellCards.add(((SplitCard) card).getLeftHalfCard());
|
||||
spellAbilities.add(((SplitCard) card).getLeftHalfCard().getSpellAbility().copy());
|
||||
spellCards.add(((SplitCard) card).getRightHalfCard());
|
||||
|
|
@ -155,7 +155,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
ignoreAbility = false;
|
||||
} else {
|
||||
// costs for spliced abilities were added to main spellAbility, so pay no mana for spliced abilities
|
||||
payNoMana |= spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE);
|
||||
payNoMana |= spellAbility.getSpellAbilityType() == SpellAbilityType.SPLICE;
|
||||
if (!spellAbility.activate(game, payNoMana)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -375,15 +375,15 @@ public class Spell extends StackObjImpl implements Card {
|
|||
if (counteringObject instanceof StackObject) {
|
||||
counteringAbility = ((StackObject) counteringObject).getStackAbility();
|
||||
}
|
||||
if (zone.equals(Zone.LIBRARY)) {
|
||||
if (zoneDetail.equals(ZoneDetail.CHOOSE)) {
|
||||
if (zone == Zone.LIBRARY) {
|
||||
if (zoneDetail == ZoneDetail.CHOOSE) {
|
||||
if (player.chooseUse(Outcome.Detriment, "Move countered spell to the top of the library? (otherwise it goes to the bottom)", counteringAbility, game)) {
|
||||
zoneDetail = ZoneDetail.TOP;
|
||||
} else {
|
||||
zoneDetail = ZoneDetail.BOTTOM;
|
||||
}
|
||||
}
|
||||
if (zoneDetail.equals(ZoneDetail.TOP)) {
|
||||
if (zoneDetail == ZoneDetail.TOP) {
|
||||
player.putCardsOnTopOfLibrary(new CardsImpl(card), game, counteringAbility, false);
|
||||
} else {
|
||||
player.putCardsOnBottomOfLibrary(new CardsImpl(card), game, counteringAbility, false);
|
||||
|
|
@ -740,7 +740,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
// 706.10a If a copy of a spell is in a zone other than the stack, it ceases to exist.
|
||||
// If a copy of a card is in any zone other than the stack or the battlefield, it ceases to exist.
|
||||
// These are state-based actions. See rule 704.
|
||||
if (this.isCopiedSpell() && !zone.equals(Zone.STACK)) {
|
||||
if (this.isCopiedSpell() && zone != Zone.STACK) {
|
||||
return true;
|
||||
}
|
||||
return card.moveToZone(zone, sourceId, game, flag, appliedEffects);
|
||||
|
|
|
|||
|
|
@ -113,11 +113,11 @@ public class ManaPool implements Serializable {
|
|||
* @return
|
||||
*/
|
||||
public boolean pay(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay) {
|
||||
if (!autoPayment && !manaType.equals(unlockedManaType)) {
|
||||
if (!autoPayment && manaType != unlockedManaType) {
|
||||
// if manual payment and the needed mana type was not unlocked, nothing will be paid
|
||||
return false;
|
||||
}
|
||||
if (autoPayment && autoPaymentRestricted && !wasManaAddedBeyondStock() && !manaType.equals(unlockedManaType)) {
|
||||
if (autoPayment && autoPaymentRestricted && !wasManaAddedBeyondStock() && manaType != unlockedManaType) {
|
||||
// if automatic restricted payment and there is laready mana in the pool
|
||||
// and the needed mana type was not unlocked, nothing will be paid
|
||||
return false;
|
||||
|
|
@ -137,7 +137,7 @@ public class ManaPool implements Serializable {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!manaType.equals(unlockedManaType) && autoPayment && autoPaymentRestricted && mana.count() == mana.getStock()) {
|
||||
if (manaType != unlockedManaType && autoPayment && autoPaymentRestricted && mana.count() == mana.getStock()) {
|
||||
// no mana added beyond the stock so don't auto pay this
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class TargetActivatedAbility extends TargetObject {
|
|||
return false;
|
||||
}
|
||||
StackObject stackObject = game.getStack().getStackObject(id);
|
||||
return stackObject != null && stackObject.getStackAbility() != null && stackObject.getStackAbility().getAbilityType().equals(AbilityType.ACTIVATED);
|
||||
return stackObject != null && stackObject.getStackAbility() != null && stackObject.getStackAbility().getAbilityType() == AbilityType.ACTIVATED;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -92,7 +92,7 @@ public class TargetActivatedAbility extends TargetObject {
|
|||
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
for (StackObject stackObject : game.getStack()) {
|
||||
if (stackObject.getStackAbility().getAbilityType().equals(AbilityType.ACTIVATED) && game.getState().getPlayersInRange(sourceControllerId, game).contains(stackObject.getStackAbility().getControllerId())) {
|
||||
if (stackObject.getStackAbility().getAbilityType() == AbilityType.ACTIVATED && game.getState().getPlayersInRange(sourceControllerId, game).contains(stackObject.getStackAbility().getControllerId())) {
|
||||
possibleTargets.add(stackObject.getStackAbility().getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class CastFromGraveyardWatcher extends Watcher {
|
|||
* play from other zones during the same step. But at least the state is
|
||||
* reset if the game comes to a new step
|
||||
*/
|
||||
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone().equals(Zone.GRAVEYARD)) {
|
||||
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.GRAVEYARD) {
|
||||
Spell spell = (Spell) game.getObject(event.getTargetId());
|
||||
if (spell != null) {
|
||||
HashSet<Integer> zcc = spellsCastFromGraveyard.computeIfAbsent(spell.getSourceId(), k -> new HashSet<>());
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class SpellsCastWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (EventType.SPELL_CAST.equals(event.getType())) {
|
||||
if (EventType.SPELL_CAST == event.getType()) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell == null) {
|
||||
MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.STACK);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue