mirror of
https://github.com/correl/mage.git
synced 2024-11-28 11:09:54 +00:00
Bugfixes with != instead of equals and default toString calls
This commit is contained in:
parent
752392fc46
commit
a15220d51e
74 changed files with 187 additions and 147 deletions
|
@ -18,6 +18,7 @@ import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
|
@ -102,7 +103,7 @@ public class UI {
|
||||||
Object o = elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
|
Object o = elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
|
||||||
if (o instanceof HTML.Tag) {
|
if (o instanceof HTML.Tag) {
|
||||||
HTML.Tag kind = (HTML.Tag) o;
|
HTML.Tag kind = (HTML.Tag) o;
|
||||||
if (kind == HTML.Tag.IMG) {
|
if (Objects.equals(kind, HTML.Tag.IMG)) {
|
||||||
return new ImageView(elem) {
|
return new ImageView(elem) {
|
||||||
@Override
|
@Override
|
||||||
public URL getImageURL() {
|
public URL getImageURL() {
|
||||||
|
|
|
@ -296,10 +296,10 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
||||||
}
|
}
|
||||||
} else if (card.getCardNumber().isEmpty() || "0".equals(card.getCardNumber())) {
|
} else if (card.getCardNumber().isEmpty() || "0".equals(card.getCardNumber())) {
|
||||||
System.err.println("There was a critical error!");
|
System.err.println("There was a critical error!");
|
||||||
logger.error("Card has no collector ID and won't be sent to client: " + card);
|
logger.error("Card has no collector ID and won't be sent to client: " + card.getName());
|
||||||
} else if (card.getSetCode().isEmpty()) {
|
} else if (card.getSetCode().isEmpty()) {
|
||||||
System.err.println("There was a critical error!");
|
System.err.println("There was a critical error!");
|
||||||
logger.error("Card has no set name and won't be sent to client:" + card);
|
logger.error("Card has no set name and won't be sent to client:" + card.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
numberWithoutTokens = allCards.size();
|
numberWithoutTokens = allCards.size();
|
||||||
|
|
|
@ -752,7 +752,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
return !controllingPlayer.getUserData().getUserSkipPrioritySteps().getOpponentTurn().isPhaseStepSet(game.getStep().getType());
|
return !controllingPlayer.getUserData().getUserSkipPrioritySteps().getOpponentTurn().isPhaseStepSet(game.getStep().getType());
|
||||||
}
|
}
|
||||||
} catch (NullPointerException ex) {
|
} catch (NullPointerException ex) {
|
||||||
logger.error("null pointer exception UserData = " + userData == null ? "null" : "not null");
|
String isNull = userData == null ? "null" : "not null";
|
||||||
|
logger.error("null pointer exception UserData = " + isNull);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ import org.w3c.dom.Element;
|
||||||
import javax.management.MBeanServer;
|
import javax.management.MBeanServer;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -401,7 +402,7 @@ public class Main {
|
||||||
try {
|
try {
|
||||||
classLoader.addURL(new File(pluginFolder, plugin.getJar()).toURI().toURL());
|
classLoader.addURL(new File(pluginFolder, plugin.getJar()).toURI().toURL());
|
||||||
logger.debug("Loading game type: " + plugin.getClassName());
|
logger.debug("Loading game type: " + plugin.getClassName());
|
||||||
return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance();
|
return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).getConstructor().newInstance();
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
logger.warn("Game type not found:" + plugin.getJar() + " - check plugin folder", ex);
|
logger.warn("Game type not found:" + plugin.getJar() + " - check plugin folder", ex);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -414,7 +415,7 @@ public class Main {
|
||||||
try {
|
try {
|
||||||
classLoader.addURL(new File(pluginFolder, plugin.getJar()).toURI().toURL());
|
classLoader.addURL(new File(pluginFolder, plugin.getJar()).toURI().toURL());
|
||||||
logger.debug("Loading tournament type: " + plugin.getClassName());
|
logger.debug("Loading tournament type: " + plugin.getClassName());
|
||||||
return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance();
|
return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).getConstructor().newInstance();
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
logger.warn("Tournament type not found:" + plugin.getName() + " / " + plugin.getJar() + " - check plugin folder", ex);
|
logger.warn("Tournament type not found:" + plugin.getName() + " / " + plugin.getJar() + " - check plugin folder", ex);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
|
@ -104,7 +105,7 @@ class AdviceFromTheFaeEffect extends OneShotEffect {
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||||
filter.add(new ControllerIdPredicate(playerId));
|
filter.add(new ControllerIdPredicate(playerId));
|
||||||
if (playerId != controller.getId()) {
|
if (!Objects.equals(playerId, controller.getId())) {
|
||||||
if (max < game.getBattlefield().countAll(filter, playerId, game)) {
|
if (max < game.getBattlefield().countAll(filter, playerId, game)) {
|
||||||
max = game.getBattlefield().countAll(filter, playerId, game);
|
max = game.getBattlefield().countAll(filter, playerId, game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
|
@ -108,7 +109,7 @@ class AlhammarretHighArbiterEffect extends OneShotEffect {
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
Cards revealedCards = new CardsImpl();
|
Cards revealedCards = new CardsImpl();
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
if (playerId != controller.getId()) {
|
if (!Objects.equals(playerId, controller.getId())) {
|
||||||
Player opponent = game.getPlayer(playerId);
|
Player opponent = game.getPlayer(playerId);
|
||||||
if (opponent != null) {
|
if (opponent != null) {
|
||||||
Cards cards = new CardsImpl(opponent.getHand());
|
Cards cards = new CardsImpl(opponent.getHand());
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.Cost;
|
||||||
|
@ -90,7 +91,7 @@ class AllianceOfArmsEffect extends OneShotEffect {
|
||||||
int xSum = 0;
|
int xSum = 0;
|
||||||
xSum += playerPaysXGenericMana(controller, source, game);
|
xSum += playerPaysXGenericMana(controller, source, game);
|
||||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
if (playerId != controller.getId()) {
|
if (!Objects.equals(playerId, controller.getId())) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
xSum += playerPaysXGenericMana(player, source, game);
|
xSum += playerPaysXGenericMana(player, source, game);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.a;
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -97,12 +98,12 @@ class ArrogantBloodlordTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
Permanent blocker = game.getPermanent(event.getSourceId());
|
Permanent blocker = game.getPermanent(event.getSourceId());
|
||||||
Permanent blocked = game.getPermanent(event.getTargetId());
|
Permanent blocked = game.getPermanent(event.getTargetId());
|
||||||
Permanent arrogantBloodlord = game.getPermanent(sourceId);
|
Permanent arrogantBloodlord = game.getPermanent(sourceId);
|
||||||
if (blocker != null && blocker != arrogantBloodlord
|
if (blocker != null && !Objects.equals(blocker, arrogantBloodlord)
|
||||||
&& blocker.getPower().getValue() < 2
|
&& blocker.getPower().getValue() < 2
|
||||||
&& blocked == arrogantBloodlord) {
|
&& Objects.equals(blocked, arrogantBloodlord)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (blocker != null && blocker == arrogantBloodlord
|
if (blocker != null && Objects.equals(blocker, arrogantBloodlord)
|
||||||
&& game.getPermanent(event.getTargetId()).getPower().getValue() < 2) {
|
&& game.getPermanent(event.getTargetId()).getPower().getValue() < 2) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -108,7 +109,7 @@ class CanalCourierTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
Player attackedPlayer = game.getPlayer(sourceDefenderId);
|
Player attackedPlayer = game.getPlayer(sourceDefenderId);
|
||||||
if (attackedPlayer != null) {
|
if (attackedPlayer != null) {
|
||||||
for (UUID attacker : game.getCombat().getAttackers()) {
|
for (UUID attacker : game.getCombat().getAttackers()) {
|
||||||
if (attacker != permanent.getId()) {
|
if (!Objects.equals(attacker, permanent.getId())) {
|
||||||
UUID defenderId = game.getCombat().getDefenderId(attacker);
|
UUID defenderId = game.getCombat().getDefenderId(attacker);
|
||||||
Player attackedPlayer2 = game.getPlayer(defenderId);
|
Player attackedPlayer2 = game.getPlayer(defenderId);
|
||||||
if (attackedPlayer2 != null && attackedPlayer.getId().equals(attackedPlayer2.getId())) {
|
if (attackedPlayer2 != null && attackedPlayer.getId().equals(attackedPlayer2.getId())) {
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -88,7 +89,7 @@ class CityOfTraitorsTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
Permanent land = game.getPermanent(event.getTargetId());
|
Permanent land = game.getPermanent(event.getTargetId());
|
||||||
return land.getCardType().contains(CardType.LAND)
|
return land.getCardType().contains(CardType.LAND)
|
||||||
&& land.getControllerId().equals(this.controllerId)
|
&& land.getControllerId().equals(this.controllerId)
|
||||||
&& event.getTargetId() != this.getSourceId();
|
&& !Objects.equals(event.getTargetId(), this.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.Cost;
|
||||||
|
@ -90,7 +91,7 @@ class CollectiveVoyageEffect extends OneShotEffect {
|
||||||
int xSum = 0;
|
int xSum = 0;
|
||||||
xSum += playerPaysXGenericMana(controller, source, game);
|
xSum += playerPaysXGenericMana(controller, source, game);
|
||||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
if (playerId != controller.getId()) {
|
if (!Objects.equals(playerId, controller.getId())) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
xSum += playerPaysXGenericMana(player, source, game);
|
xSum += playerPaysXGenericMana(player, source, game);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||||
|
@ -122,7 +123,7 @@ class CrownOfDoomEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player newController = game.getPlayer(getTargetPointer().getFirst(game, source));
|
Player newController = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null && newController != null && controller.getId() != newController.getId()) {
|
if (controller != null && newController != null && !Objects.equals(controller.getId(), newController.getId())) {
|
||||||
// Duration.Custom = effect ends if Artifact leaves the current zone (battlefield)
|
// Duration.Custom = effect ends if Artifact leaves the current zone (battlefield)
|
||||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId());
|
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId());
|
||||||
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
|
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.d;
|
package mage.cards.d;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
|
@ -207,7 +208,7 @@ class DaxosOfMeletisSpendAnyManaEffect extends AsThoughEffectImpl implements AsT
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
return source.getControllerId().equals(affectedControllerId)
|
return source.getControllerId().equals(affectedControllerId)
|
||||||
&& objectId == ((FixedTarget) getTargetPointer()).getTarget()
|
&& Objects.equals(objectId, ((FixedTarget) getTargetPointer()).getTarget())
|
||||||
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
|
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
|
||||||
&& (((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId))
|
&& (((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId))
|
||||||
&& game.getState().getZone(objectId).equals(Zone.STACK);
|
&& game.getState().getZone(objectId).equals(Zone.STACK);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.d;
|
package mage.cards.d;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -111,9 +112,9 @@ public class DivineIntervention extends CardImpl {
|
||||||
for (StackObject stackObject : game.getStack()) {
|
for (StackObject stackObject : game.getStack()) {
|
||||||
|
|
||||||
if (stackObject.getControllerId() != null && !firstOnStack) {
|
if (stackObject.getControllerId() != null && !firstOnStack) {
|
||||||
if (you != stackObject.getControllerId()) {
|
if (!Objects.equals(you, stackObject.getControllerId())) {
|
||||||
onlyYouOnStack = false;
|
onlyYouOnStack = false;
|
||||||
} else if (you == stackObject.getControllerId()) {
|
} else if (Objects.equals(you, stackObject.getControllerId())) {
|
||||||
onlyOpponentOnStack = false;
|
onlyOpponentOnStack = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.d;
|
package mage.cards.d;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -93,7 +94,7 @@ class DuneblastEffect extends OneShotEffect {
|
||||||
creatureToKeep = game.getPermanent(target.getFirstTarget());
|
creatureToKeep = game.getPermanent(target.getFirstTarget());
|
||||||
}
|
}
|
||||||
for(Permanent creature: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
for(Permanent creature: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (creature != creatureToKeep) {
|
if (!Objects.equals(creature, creatureToKeep)) {
|
||||||
creature.destroy(source.getSourceId(), game, false);
|
creature.destroy(source.getSourceId(), game, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.e;
|
package mage.cards.e;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -101,7 +102,7 @@ class EnergyFieldEffect extends PreventionEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER) {
|
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER) {
|
||||||
if (event.getTargetId().equals(source.getControllerId()) && game.getControllerId(event.getSourceId()) != source.getControllerId()) {
|
if (event.getTargetId().equals(source.getControllerId()) && !Objects.equals(game.getControllerId(event.getSourceId()), source.getControllerId())) {
|
||||||
return super.applies(event, source, game);
|
return super.applies(event, source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.e;
|
package mage.cards.e;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
|
@ -94,7 +95,7 @@ class EquipoiseEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null && targetPlayer != null) {
|
if (controller != null && targetPlayer != null) {
|
||||||
if (targetPlayer != controller) {
|
if (!Objects.equals(targetPlayer, controller)) {
|
||||||
phaseOutCardType(controller, targetPlayer, CardType.LAND, source, game);
|
phaseOutCardType(controller, targetPlayer, CardType.LAND, source, game);
|
||||||
phaseOutCardType(controller, targetPlayer, CardType.ARTIFACT, source, game);
|
phaseOutCardType(controller, targetPlayer, CardType.ARTIFACT, source, game);
|
||||||
phaseOutCardType(controller, targetPlayer, CardType.CREATURE, source, game);
|
phaseOutCardType(controller, targetPlayer, CardType.CREATURE, source, game);
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.cards.e;
|
package mage.cards.e;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -191,7 +192,7 @@ class EyeOfSingularityTriggeredEffect extends OneShotEffect {
|
||||||
|
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
String cardName = permanent.getName();
|
String cardName = permanent.getName();
|
||||||
if (cardName.equals(cn) && permanent.getId() != etbPermanent.getId()) {
|
if (cardName.equals(cn) && !Objects.equals(permanent.getId(), etbPermanent.getId())) {
|
||||||
toDestroy.put(permanent.getId(), 1);
|
toDestroy.put(permanent.getId(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.f;
|
package mage.cards.f;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -97,7 +98,7 @@ class FabricationModuleTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getData().equals(CounterType.ENERGY.getName())) {
|
if (event.getData().equals(CounterType.ENERGY.getName())) {
|
||||||
return event.getTargetId() == this.getControllerId();
|
return Objects.equals(event.getTargetId(), this.getControllerId());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.g;
|
package mage.cards.g;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -139,14 +140,14 @@ class GuardianBeastConditionalEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetPermanent.getControllerId() != guardianBeast.getControllerId()) {
|
if (!Objects.equals(targetPermanent.getControllerId(), guardianBeast.getControllerId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
StackObject spell = game.getStack().getStackObject(event.getSourceId());
|
StackObject spell = game.getStack().getStackObject(event.getSourceId());
|
||||||
if (event.getType() == EventType.LOSE_CONTROL || event.getType() == EventType.ATTACH || event.getType() == EventType.TARGET && spell != null && spell.getCardType().contains(CardType.ENCHANTMENT) && spell.getSubtype(game).contains("Aura")) {
|
if (event.getType() == EventType.LOSE_CONTROL || event.getType() == EventType.ATTACH || event.getType() == EventType.TARGET && spell != null && spell.getCardType().contains(CardType.ENCHANTMENT) && spell.getSubtype(game).contains("Aura")) {
|
||||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (perm != null && perm.getId() == targetPermanent.getId() && !perm.getCardType().contains(CardType.CREATURE)) {
|
if (perm != null && Objects.equals(perm.getId(), targetPermanent.getId()) && !perm.getCardType().contains(CardType.CREATURE)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.h;
|
package mage.cards.h;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
@ -95,7 +96,7 @@ class HellcarverDemonEffect extends OneShotEffect {
|
||||||
Permanent hellcarverDemon = game.getPermanent(source.getSourceId());
|
Permanent hellcarverDemon = game.getPermanent(source.getSourceId());
|
||||||
|
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filterPermanents, source.getControllerId(), game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(filterPermanents, source.getControllerId(), game)) {
|
||||||
if (permanent != hellcarverDemon) {
|
if (!Objects.equals(permanent, hellcarverDemon)) {
|
||||||
permanent.sacrifice(source.getSourceId(), game);
|
permanent.sacrifice(source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.h;
|
package mage.cards.h;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -101,7 +102,7 @@ class HotSoupTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent equipment = game.getPermanent(this.getSourceId());
|
Permanent equipment = game.getPermanent(this.getSourceId());
|
||||||
if (equipment != null && equipment.getAttachedTo() != null) {
|
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||||
if (event.getTargetId() == equipment.getAttachedTo()) {
|
if (Objects.equals(event.getTargetId(), equipment.getAttachedTo())) {
|
||||||
for(Effect effect : this.getEffects())
|
for(Effect effect : this.getEffects())
|
||||||
{
|
{
|
||||||
effect.setTargetPointer(new FixedTarget(equipment.getAttachedTo()));
|
effect.setTargetPointer(new FixedTarget(equipment.getAttachedTo()));
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.h;
|
package mage.cards.h;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
|
@ -90,7 +91,7 @@ class HydraOmnivoreEffect extends OneShotEffect {
|
||||||
MageObject object = game.getObject(source.getSourceId());
|
MageObject object = game.getObject(source.getSourceId());
|
||||||
if (object != null && amount > 0 && damagedOpponent != null) {
|
if (object != null && amount > 0 && damagedOpponent != null) {
|
||||||
for (UUID playerId :game.getOpponents(source.getControllerId())) {
|
for (UUID playerId :game.getOpponents(source.getControllerId())) {
|
||||||
if (playerId != damagedOpponent) {
|
if (!Objects.equals(playerId, damagedOpponent)) {
|
||||||
Player opponent = game.getPlayer(playerId);
|
Player opponent = game.getPlayer(playerId);
|
||||||
if (opponent != null) {
|
if (opponent != null) {
|
||||||
int dealtDamage = opponent.damage(amount, source.getSourceId(), game, false, true);
|
int dealtDamage = opponent.damage(amount, source.getSourceId(), game, false, true);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.i;
|
package mage.cards.i;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||||
|
@ -95,7 +96,7 @@ class IllicitAuctionEffect extends GainControlTargetEffect {
|
||||||
game.informPlayers(winner.getLogName()+ " has bet 0 lifes");
|
game.informPlayers(winner.getLogName()+ " has bet 0 lifes");
|
||||||
|
|
||||||
Player currentPlayer = playerList.getNextInRange(controller, game);
|
Player currentPlayer = playerList.getNextInRange(controller, game);
|
||||||
while (currentPlayer != winner) {
|
while (!Objects.equals(currentPlayer, winner)) {
|
||||||
String text = winner.getLogName() + " has bet " + highBid + " life" + (highBid > 1 ? "s" : "") + ". Top the bid?";
|
String text = winner.getLogName() + " has bet " + highBid + " life" + (highBid > 1 ? "s" : "") + ". Top the bid?";
|
||||||
if (currentPlayer.chooseUse(Outcome.Detriment, text, source, game)) {
|
if (currentPlayer.chooseUse(Outcome.Detriment, text, source, game)) {
|
||||||
int newBid = currentPlayer.getAmount(highBid + 1, Integer.MAX_VALUE, "Choose bid", game);
|
int newBid = currentPlayer.getAmount(highBid + 1, Integer.MAX_VALUE, "Choose bid", game);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.k;
|
package mage.cards.k;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -101,7 +102,7 @@ class KazuulTyrantOfTheCliffsTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
Permanent attacker = game.getPermanent(event.getSourceId());
|
Permanent attacker = game.getPermanent(event.getSourceId());
|
||||||
Player defender = game.getPlayer(event.getTargetId());
|
Player defender = game.getPlayer(event.getTargetId());
|
||||||
Player you = game.getPlayer(controllerId);
|
Player you = game.getPlayer(controllerId);
|
||||||
if (attacker.getControllerId() != you.getId() && defender == you) {
|
if (!Objects.equals(attacker.getControllerId(), you.getId()) && Objects.equals(defender, you)) {
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(attacker.getControllerId()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(attacker.getControllerId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ class KnowledgeExploitationEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||||
if (controller != null & opponent != null) {
|
if (controller != null && opponent != null) {
|
||||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, new FilterInstantOrSorceryCard());
|
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, new FilterInstantOrSorceryCard());
|
||||||
if (controller.searchLibrary(target, game, opponent.getId())) {
|
if (controller.searchLibrary(target, game, opponent.getId())) {
|
||||||
Card card = opponent.getLibrary().remove(target.getFirstTarget(), game);
|
Card card = opponent.getLibrary().remove(target.getFirstTarget(), game);
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.cards.k;
|
package mage.cards.k;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -127,7 +128,7 @@ class KynaiosAndTirosEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!playedLand && currentPlayer != controller) {
|
if (!playedLand && !Objects.equals(currentPlayer, controller)) {
|
||||||
noLandPlayers.put(currentPlayer.getId(), playedLand);
|
noLandPlayers.put(currentPlayer.getId(), playedLand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.l;
|
package mage.cards.l;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -93,10 +94,10 @@ class LudevicNecroAlchemistCondition implements Condition {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (watcher != null && currentPlayer != null) {
|
while (watcher != null && currentPlayer != null) {
|
||||||
if (currentPlayer != null && currentPlayer.getId() != sourcePlayerId && watcher.getLiveLost(currentPlayer.getId()) > 0) {
|
if (currentPlayer != null && !Objects.equals(currentPlayer.getId(), sourcePlayerId) && watcher.getLiveLost(currentPlayer.getId()) > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (currentPlayer == firstPlayer) {
|
if (Objects.equals(currentPlayer, firstPlayer)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
currentPlayer = playerList.getNext(game);
|
currentPlayer = playerList.getNext(game);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
@ -86,7 +87,7 @@ class MagneticMineTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD
|
if (zEvent.getFromZone() == Zone.BATTLEFIELD
|
||||||
&& zEvent.getToZone() == Zone.GRAVEYARD
|
&& zEvent.getToZone() == Zone.GRAVEYARD
|
||||||
&& zEvent.getTarget().getCardType().contains(CardType.ARTIFACT)
|
&& zEvent.getTarget().getCardType().contains(CardType.ARTIFACT)
|
||||||
&& zEvent.getTarget().getId() != this.getSourceId()) {
|
&& !Objects.equals(zEvent.getTarget().getId(), this.getSourceId())) {
|
||||||
this.getTargets().get(0).add(zEvent.getTarget().getControllerId(), game);
|
this.getTargets().get(0).add(zEvent.getTarget().getControllerId(), game);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -129,7 +130,7 @@ class ManaChargedDragonEffect extends OneShotEffect {
|
||||||
int xSum = 0;
|
int xSum = 0;
|
||||||
xSum += playerPaysXGenericMana(controller, source, game);
|
xSum += playerPaysXGenericMana(controller, source, game);
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
if (playerId != controller.getId()) {
|
if (!Objects.equals(playerId, controller.getId())) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
xSum += playerPaysXGenericMana(player, source, game);
|
xSum += playerPaysXGenericMana(player, source, game);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -145,7 +146,7 @@ class ManaWebeffect extends OneShotEffect {
|
||||||
|
|
||||||
boolean tappedLands = false;
|
boolean tappedLands = false;
|
||||||
for (Permanent opponentPermanent : game.getBattlefield().getActivePermanents(filter, permanent.getControllerId(), game)) {
|
for (Permanent opponentPermanent : game.getBattlefield().getActivePermanents(filter, permanent.getControllerId(), game)) {
|
||||||
if (opponentPermanent.getControllerId() == permanent.getControllerId()) {
|
if (Objects.equals(opponentPermanent.getControllerId(), permanent.getControllerId())) {
|
||||||
Mana opponentLandMana = new Mana();
|
Mana opponentLandMana = new Mana();
|
||||||
|
|
||||||
for (ActivatedManaAbilityImpl ability : opponentPermanent.getAbilities().getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, game)) {
|
for (ActivatedManaAbilityImpl ability : opponentPermanent.getAbilities().getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, game)) {
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.Cost;
|
||||||
|
@ -87,7 +88,7 @@ class MindsAglowEffect extends OneShotEffect {
|
||||||
int xSum = 0;
|
int xSum = 0;
|
||||||
xSum += playerPaysXGenericMana(controller, source, game);
|
xSum += playerPaysXGenericMana(controller, source, game);
|
||||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
if (playerId != controller.getId()) {
|
if (!Objects.equals(playerId, controller.getId())) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
xSum += playerPaysXGenericMana(player, source, game);
|
xSum += playerPaysXGenericMana(player, source, game);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Abilities;
|
import mage.abilities.Abilities;
|
||||||
|
@ -98,7 +99,7 @@ class NoAbilityPredicate implements Predicate<MageObject> {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Ability ability : abilities) {
|
for (Ability ability : abilities) {
|
||||||
if (ability.getClass() != SpellAbility.class) {
|
if (!Objects.equals(ability.getClass(), SpellAbility.class)) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
@ -104,7 +105,7 @@ class MysticRemoraTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (spell != null && !spell.getCardType().contains(CardType.CREATURE)) {
|
if (spell != null && !spell.getCardType().contains(CardType.CREATURE)) {
|
||||||
Player controller = game.getPlayer(game.getControllerId(this.controllerId));
|
Player controller = game.getPlayer(game.getControllerId(this.controllerId));
|
||||||
Player player = game.getPlayer(spell.getControllerId());
|
Player player = game.getPlayer(spell.getControllerId());
|
||||||
if (controller != player) {
|
if (!Objects.equals(controller, player)) {
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.n;
|
package mage.cards.n;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -103,7 +104,7 @@ public class NightDealings extends CardImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
// to another player
|
// to another player
|
||||||
if (this.getControllerId() != event.getTargetId()) {
|
if (!Objects.equals(this.getControllerId(), event.getTargetId())) {
|
||||||
// a source you control
|
// a source you control
|
||||||
UUID sourceControllerId = game.getControllerId(event.getSourceId());
|
UUID sourceControllerId = game.getControllerId(event.getSourceId());
|
||||||
if (sourceControllerId != null && sourceControllerId.equals(this.getControllerId())) {
|
if (sourceControllerId != null && sourceControllerId.equals(this.getControllerId())) {
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.cards.o;
|
package mage.cards.o;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -121,7 +122,7 @@ class OrzhovAdvokistEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (UUID playerId : players) {
|
for (UUID playerId : players) {
|
||||||
if (playerId != source.getControllerId()) {
|
if (!Objects.equals(playerId, source.getControllerId())) {
|
||||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||||
filter.add(new ControllerIdPredicate(playerId));
|
filter.add(new ControllerIdPredicate(playerId));
|
||||||
game.addEffect(new CantAttackYouAllEffect(Duration.UntilYourNextTurn, filter, true), source);
|
game.addEffect(new CantAttackYouAllEffect(Duration.UntilYourNextTurn, filter, true), source);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.p;
|
package mage.cards.p;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -91,7 +92,7 @@ class PainsRewardEffect extends OneShotEffect {
|
||||||
game.informPlayers(winner.getLogName() + " has bet " + highBid + " lifes");
|
game.informPlayers(winner.getLogName() + " has bet " + highBid + " lifes");
|
||||||
|
|
||||||
Player currentPlayer = playerList.getNextInRange(controller, game);
|
Player currentPlayer = playerList.getNextInRange(controller, game);
|
||||||
while (currentPlayer != winner) {
|
while (!Objects.equals(currentPlayer, winner)) {
|
||||||
String text = winner.getLogName() + " has bet " + highBid + " life" + (highBid > 1 ? "s" : "") + ". Top the bid?";
|
String text = winner.getLogName() + " has bet " + highBid + " life" + (highBid > 1 ? "s" : "") + ". Top the bid?";
|
||||||
if (currentPlayer.chooseUse(Outcome.Detriment, text, source, game)) {
|
if (currentPlayer.chooseUse(Outcome.Detriment, text, source, game)) {
|
||||||
int newBid = currentPlayer.getAmount(highBid + 1, Integer.MAX_VALUE, "Choose amount of life to bid", game);
|
int newBid = currentPlayer.getAmount(highBid + 1, Integer.MAX_VALUE, "Choose amount of life to bid", game);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.p;
|
package mage.cards.p;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -106,7 +107,7 @@ class PsychicPossessionTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Player opponent = game.getPlayer(enchantment.getAttachedTo());
|
Player opponent = game.getPlayer(enchantment.getAttachedTo());
|
||||||
Player player = game.getPlayer(event.getPlayerId());
|
Player player = game.getPlayer(event.getPlayerId());
|
||||||
if (opponent != null && player != null && player == opponent) {
|
if (opponent != null && player != null && Objects.equals(player, opponent)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -151,7 +152,7 @@ class ExclusionRitualReplacementEffect extends ContinuousRuleModifyingEffectImpl
|
||||||
if (spell != null && spell.isFaceDown(game)) {
|
if (spell != null && spell.isFaceDown(game)) {
|
||||||
return false; // Face Down cast spell (Morph creature) has no name
|
return false; // Face Down cast spell (Morph creature) has no name
|
||||||
}
|
}
|
||||||
return card.getName().equals(creatureName) && ownerId == card.getOwnerId();
|
return card.getName().equals(creatureName) && Objects.equals(ownerId, card.getOwnerId());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||||
|
@ -98,7 +99,7 @@ class RocketLauncherWatcher extends Watcher {
|
||||||
changedControllerOR1stTurn = false;
|
changedControllerOR1stTurn = false;
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.LOST_CONTROL &&
|
if (event.getType() == GameEvent.EventType.LOST_CONTROL &&
|
||||||
event.getSourceId()==cardId) {
|
Objects.equals(event.getSourceId(), cardId)) {
|
||||||
changedControllerOR1stTurn = true;
|
changedControllerOR1stTurn = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
|
@ -95,7 +96,7 @@ public class ScarredPuma extends CardImpl {
|
||||||
if (permanent.getId().equals(source.getSourceId())) {
|
if (permanent.getId().equals(source.getSourceId())) {
|
||||||
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
//excludes itself (http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=23067)
|
//excludes itself (http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=23067)
|
||||||
if (creature.getId() != source.getSourceId()) {
|
if (!Objects.equals(creature.getId(), source.getSourceId())) {
|
||||||
ObjectColor color = creature.getColor(game);
|
ObjectColor color = creature.getColor(game);
|
||||||
if (color.isBlack() || color.isGreen()) {
|
if (color.isBlack() || color.isGreen()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.Cost;
|
||||||
|
@ -89,7 +90,7 @@ class SharedTraumaEffect extends OneShotEffect {
|
||||||
int xSum = 0;
|
int xSum = 0;
|
||||||
xSum += playerPaysXGenericMana(controller, source, game);
|
xSum += playerPaysXGenericMana(controller, source, game);
|
||||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
if (playerId != controller.getId()) {
|
if (!Objects.equals(playerId, controller.getId())) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
xSum += playerPaysXGenericMana(player, source, game);
|
xSum += playerPaysXGenericMana(player, source, game);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -117,7 +118,7 @@ class ShattergangBrothersEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for(UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
if (playerId != source.getControllerId()) {
|
if (!Objects.equals(playerId, source.getControllerId())) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
TargetControlledPermanent target = new TargetControlledPermanent(filter);
|
TargetControlledPermanent target = new TargetControlledPermanent(filter);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -79,7 +80,7 @@ public class SkullRend extends CardImpl {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
if (playerId != source.getControllerId()) {
|
if (!Objects.equals(playerId, source.getControllerId())) {
|
||||||
Player opponent = game.getPlayer(playerId);
|
Player opponent = game.getPlayer(playerId);
|
||||||
if (opponent != null) {
|
if (opponent != null) {
|
||||||
// damage
|
// damage
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -102,7 +103,7 @@ class SpikeCannibalEffect extends OneShotEffect {
|
||||||
|
|
||||||
if (sourcePermanent != null) {
|
if (sourcePermanent != null) {
|
||||||
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (creature != sourcePermanent) {
|
if (!Objects.equals(creature, sourcePermanent)) {
|
||||||
int numberCounters = creature.getCounters(game).getCount(CounterType.P1P1);
|
int numberCounters = creature.getCounters(game).getCount(CounterType.P1P1);
|
||||||
if (numberCounters > 0) {
|
if (numberCounters > 0) {
|
||||||
creature.removeCounters(CounterType.P1P1.getName(), numberCounters, game);
|
creature.removeCounters(CounterType.P1P1.getName(), numberCounters, game);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -93,7 +94,7 @@ class SpreadingPlagueEffect extends OneShotEffect {
|
||||||
ObjectColor color = creature.getColor(game);
|
ObjectColor color = creature.getColor(game);
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(FILTER, source.getControllerId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(FILTER, source.getControllerId(), game)) {
|
||||||
if (permanent.getColor(game).shares(color)
|
if (permanent.getColor(game).shares(color)
|
||||||
&& permanent != creature) {
|
&& !Objects.equals(permanent, creature)) {
|
||||||
permanent.destroy(source.getSourceId(), game, true);
|
permanent.destroy(source.getSourceId(), game, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ class SunforgerUnattachCost extends CostImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||||
Permanent attachment = game.getPermanent(sourceId);
|
Permanent attachment = game.getPermanent(sourceId);
|
||||||
if (attachment != null & attachment.getAttachedTo() != null) {
|
if (attachment != null && attachment.getAttachedTo() != null) {
|
||||||
Permanent attachedTo = game.getPermanent(attachment.getAttachedTo());
|
Permanent attachedTo = game.getPermanent(attachment.getAttachedTo());
|
||||||
if (attachedTo != null) {
|
if (attachedTo != null) {
|
||||||
paid = attachedTo.removeAttachment(attachment.getId(), game);
|
paid = attachedTo.removeAttachment(attachment.getId(), game);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.t;
|
package mage.cards.t;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -92,7 +93,7 @@ class TerritorialGorgerTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getData().equals(CounterType.ENERGY.getName())) {
|
if (event.getData().equals(CounterType.ENERGY.getName())) {
|
||||||
return event.getTargetId() == this.getControllerId();
|
return Objects.equals(event.getTargetId(), this.getControllerId());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
package mage.cards.t;
|
package mage.cards.t;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -102,7 +103,7 @@ class TrostaniSelesnyasVoiceTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent.getCardType().contains(CardType.CREATURE)
|
if (permanent.getCardType().contains(CardType.CREATURE)
|
||||||
&& permanent.getControllerId().equals(this.controllerId)
|
&& permanent.getControllerId().equals(this.controllerId)
|
||||||
&& event.getTargetId() != this.getSourceId()) {
|
&& !Objects.equals(event.getTargetId(), this.getSourceId())) {
|
||||||
Effect effect = this.getEffects().get(0);
|
Effect effect = this.getEffects().get(0);
|
||||||
// life is determined during resolution so it has to be retrieved there (e.g. Giant Growth before resolution)
|
// life is determined during resolution so it has to be retrieved there (e.g. Giant Growth before resolution)
|
||||||
effect.setValue("lifeSource", event.getTargetId());
|
effect.setValue("lifeSource", event.getTargetId());
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.u;
|
package mage.cards.u;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -91,7 +92,7 @@ class UrborgSyphonMageEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
if (playerId != source.getControllerId()) {
|
if (!Objects.equals(playerId, source.getControllerId())) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
damage += player.damage(2, source.getSourceId(), game, false, true);
|
damage += player.damage(2, source.getSourceId(), game, false, true);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.v;
|
package mage.cards.v;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -110,13 +111,13 @@ class VenomTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo());
|
Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo());
|
||||||
if (enchantedCreature != null) {
|
if (enchantedCreature != null) {
|
||||||
if (blocker != null && blocker != enchantedCreature
|
if (blocker != null && !Objects.equals(blocker, enchantedCreature)
|
||||||
&& !blocker.getSubtype(game).contains("Wall")
|
&& !blocker.getSubtype(game).contains("Wall")
|
||||||
&& blocked == enchantedCreature) {
|
&& Objects.equals(blocked, enchantedCreature)) {
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (blocker != null && blocker == enchantedCreature
|
if (blocker != null && Objects.equals(blocker, enchantedCreature)
|
||||||
&& !blocked.getSubtype(game).contains("Wall")) {
|
&& !blocked.getSubtype(game).contains("Wall")) {
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId()));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId()));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.cards.w;
|
package mage.cards.w;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -171,7 +172,7 @@ class WeightOfConscienceTarget extends TargetControlledCreaturePermanent {
|
||||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
for (Permanent permanent1 : game.getBattlefield().getActivePermanents(filterUntapped, sourceControllerId, game)) {
|
for (Permanent permanent1 : game.getBattlefield().getActivePermanents(filterUntapped, sourceControllerId, game)) {
|
||||||
for (Permanent permanent2 : game.getBattlefield().getActivePermanents(filterUntapped, sourceControllerId, game)) {
|
for (Permanent permanent2 : game.getBattlefield().getActivePermanents(filterUntapped, sourceControllerId, game)) {
|
||||||
if (permanent1 != permanent2 && CardUtil.shareSubtypes(permanent1, permanent2, game)) {
|
if (!Objects.equals(permanent1, permanent2) && CardUtil.shareSubtypes(permanent1, permanent2, game)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.cards.w;
|
package mage.cards.w;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -125,7 +126,7 @@ class WorldslayerEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(source.getControllerId(), game);
|
List<Permanent> permanents = game.getBattlefield().getActivePermanents(source.getControllerId(), game);
|
||||||
for (Permanent permanent : permanents) {
|
for (Permanent permanent : permanents) {
|
||||||
if (permanent.getId() != source.getSourceId()) {
|
if (!Objects.equals(permanent.getId(), source.getSourceId())) {
|
||||||
permanent.destroy(source.getSourceId(), game, false);
|
permanent.destroy(source.getSourceId(), game, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.mage.test.player.TestPlayer;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -135,7 +136,7 @@ public abstract class MageTestBase {
|
||||||
try {
|
try {
|
||||||
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
|
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
|
||||||
logger.info("Loading game type: " + plugin.getClassName());
|
logger.info("Loading game type: " + plugin.getClassName());
|
||||||
return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance();
|
return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).getConstructor().newInstance();
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
logger.warn("Game type not found:" + plugin.getJar() + " - check plugin folder");
|
logger.warn("Game type not found:" + plugin.getJar() + " - check plugin folder");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -148,7 +149,7 @@ public abstract class MageTestBase {
|
||||||
try {
|
try {
|
||||||
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
|
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
|
||||||
logger.info("Loading tournament type: " + plugin.getClassName());
|
logger.info("Loading tournament type: " + plugin.getClassName());
|
||||||
return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance();
|
return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).getConstructor().newInstance();
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
logger.warn("Tournament type not found:" + plugin.getJar() + " - check plugin folder");
|
logger.warn("Tournament type not found:" + plugin.getJar() + " - check plugin folder");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.mage.test.player.TestPlayer;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -121,7 +122,7 @@ public abstract class MageTestPlayerBase {
|
||||||
try {
|
try {
|
||||||
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
|
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
|
||||||
logger.info("Loading game type: " + plugin.getClassName());
|
logger.info("Loading game type: " + plugin.getClassName());
|
||||||
return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance();
|
return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).getConstructor().newInstance();
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
logger.warn("Game type not found:" + plugin.getJar() + " - check plugin folder");
|
logger.warn("Game type not found:" + plugin.getJar() + " - check plugin folder");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -134,7 +135,7 @@ public abstract class MageTestPlayerBase {
|
||||||
try {
|
try {
|
||||||
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
|
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
|
||||||
logger.info("Loading tournament type: " + plugin.getClassName());
|
logger.info("Loading tournament type: " + plugin.getClassName());
|
||||||
return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance();
|
return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).getConstructor().newInstance();
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
logger.warn("Tournament type not found:" + plugin.getJar() + " - check plugin folder");
|
logger.warn("Tournament type not found:" + plugin.getJar() + " - check plugin folder");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
package mage;
|
package mage;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import mage.util.Copyable;
|
import mage.util.Copyable;
|
||||||
|
|
||||||
public class MageInt implements Serializable, Copyable<MageInt> {
|
public class MageInt implements Serializable, Copyable<MageInt> {
|
||||||
|
@ -75,7 +77,7 @@ public class MageInt implements Serializable, Copyable<MageInt> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MageInt copy() {
|
public MageInt copy() {
|
||||||
if (this == EmptyMageInt) {
|
if (Objects.equals(this, EmptyMageInt)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
return new MageInt(baseValue, baseValueModified, boostedValue, cardValue);
|
return new MageInt(baseValue, baseValueModified, boostedValue, cardValue);
|
||||||
|
|
|
@ -30,6 +30,8 @@ package mage;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import mage.constants.ColoredManaSymbol;
|
import mage.constants.ColoredManaSymbol;
|
||||||
import mage.util.Copyable;
|
import mage.util.Copyable;
|
||||||
|
|
||||||
|
@ -89,11 +91,11 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
|
||||||
*/
|
*/
|
||||||
public ObjectColor union(ObjectColor other) {
|
public ObjectColor union(ObjectColor other) {
|
||||||
ObjectColor newColor = new ObjectColor();
|
ObjectColor newColor = new ObjectColor();
|
||||||
newColor.white = white | other.white;
|
newColor.white = white || other.white;
|
||||||
newColor.blue = blue | other.blue;
|
newColor.blue = blue || other.blue;
|
||||||
newColor.black = black | other.black;
|
newColor.black = black || other.black;
|
||||||
newColor.red = red | other.red;
|
newColor.red = red || other.red;
|
||||||
newColor.green = green | other.green;
|
newColor.green = green || other.green;
|
||||||
return newColor;
|
return newColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,20 +170,20 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasColor() {
|
public boolean hasColor() {
|
||||||
return white | blue | black | red | green;
|
return white || blue || black || red || green;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMulticolored() {
|
public boolean isMulticolored() {
|
||||||
if (isColorless()) {
|
if (isColorless()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (white && (blue | black | red | green)) {
|
if (white && (blue || black || red || green)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (blue && (black | red | green)) {
|
if (blue && (black || red || green)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (black && (red | green)) {
|
if (black && (red || green)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return red && green;
|
return red && green;
|
||||||
|
@ -307,22 +309,22 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(ObjectColor color) {
|
public boolean contains(ObjectColor color) {
|
||||||
if (this == color) {
|
if (Objects.equals(this, color)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (color.white & this.white) {
|
if (color.white && this.white) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (color.blue & this.blue) {
|
if (color.blue && this.blue) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (color.black & this.black) {
|
if (color.black && this.black) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (color.red & this.red) {
|
if (color.red && this.red) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (color.green & this.green) {
|
if (color.green && this.green) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.abilities.common;
|
package mage.abilities.common;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
@ -65,7 +66,7 @@ public class AttacksAloneTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if(game.getActivePlayerId().equals(this.controllerId) ) {
|
if(game.getActivePlayerId().equals(this.controllerId) ) {
|
||||||
UUID creatureId = this.getSourceId();
|
UUID creatureId = this.getSourceId();
|
||||||
if(creatureId != null) {
|
if(creatureId != null) {
|
||||||
if(game.getCombat().attacksAlone() && creatureId == game.getCombat().getAttackers().get(0)) {
|
if(game.getCombat().attacksAlone() && Objects.equals(creatureId, game.getCombat().getAttackers().get(0))) {
|
||||||
UUID defender = game.getCombat().getDefenderId(creatureId);
|
UUID defender = game.getCombat().getDefenderId(creatureId);
|
||||||
if(defender != null) {
|
if(defender != null) {
|
||||||
for(Effect effect: getEffects()) {
|
for(Effect effect: getEffects()) {
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.abilities.condition.common;
|
package mage.abilities.condition.common;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
|
@ -50,7 +51,7 @@ public class SourceOnBattlefieldControlUnchangedCondition implements Condition {
|
||||||
controllerId = source.getControllerId();
|
controllerId = source.getControllerId();
|
||||||
}
|
}
|
||||||
Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId());
|
Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId());
|
||||||
return (permanent != null && controllerId == source.getControllerId());
|
return (permanent != null && Objects.equals(controllerId, source.getControllerId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
|
@ -67,7 +69,7 @@ public class CantBeRegeneratedSourceEffect extends ContinuousRuleModifyingEffect
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return source.getSourceId() == event.getTargetId();
|
return Objects.equals(source.getSourceId(), event.getTargetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,8 @@ import mage.game.stack.Spell;
|
||||||
import mage.game.stack.StackObject;
|
import mage.game.stack.StackObject;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
|
@ -112,7 +114,7 @@ class EpicReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (source.getControllerId() == event.getPlayerId()) {
|
if (Objects.equals(source.getControllerId(), event.getPlayerId())) {
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -78,4 +78,9 @@ public abstract class FilterImpl<E> implements Filter<E> {
|
||||||
public void setMessage(String message) {
|
public void setMessage(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,20 +29,9 @@ package mage.game;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.Stack;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageException;
|
import mage.MageException;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -2010,7 +1999,7 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent : worldEnchantment) {
|
for (Permanent permanent : worldEnchantment) {
|
||||||
if (newestPermanent != permanent) {
|
if (!Objects.equals(newestPermanent, permanent)) {
|
||||||
movePermanentToGraveyardWithInfo(permanent);
|
movePermanentToGraveyardWithInfo(permanent);
|
||||||
somethingHappened = true;
|
somethingHappened = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,18 +28,8 @@
|
||||||
package mage.game;
|
package mage.game;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Abilities;
|
import mage.abilities.Abilities;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -360,7 +350,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
||||||
|
|
||||||
for (Player player : players.values()) {
|
for (Player player : players.values()) {
|
||||||
sb.append("player").append(player.isPassed()).append(player.getLife()).append("hand");
|
sb.append("player").append(player.isPassed()).append(player.getLife()).append("hand");
|
||||||
if (playerId == player.getId()) {
|
if (Objects.equals(playerId, player.getId())) {
|
||||||
sb.append(player.getHand().getValue(game));
|
sb.append(player.getHand().getValue(game));
|
||||||
} else {
|
} else {
|
||||||
sb.append(player.getHand().size());
|
sb.append(player.getHand().size());
|
||||||
|
|
|
@ -184,9 +184,9 @@ public class ZonesHandler {
|
||||||
ZoneChangeInfo subInfo = itr.next();
|
ZoneChangeInfo subInfo = itr.next();
|
||||||
if (!maybeRemoveFromSourceZone(subInfo, game)) {
|
if (!maybeRemoveFromSourceZone(subInfo, game)) {
|
||||||
itr.remove();
|
itr.remove();
|
||||||
} else if (subInfo.event.getTargetId() == meld.getTopHalfCard().getId()) {
|
} else if (Objects.equals(subInfo.event.getTargetId(), meld.getTopHalfCard().getId())) {
|
||||||
meld.setTopLastZoneChangeCounter(meld.getTopHalfCard().getZoneChangeCounter(game));
|
meld.setTopLastZoneChangeCounter(meld.getTopHalfCard().getZoneChangeCounter(game));
|
||||||
} else if (subInfo.event.getTargetId() == meld.getBottomHalfCard().getId()) {
|
} else if (Objects.equals(subInfo.event.getTargetId(), meld.getBottomHalfCard().getId())) {
|
||||||
meld.setBottomLastZoneChangeCounter(meld.getBottomHalfCard().getZoneChangeCounter(game));
|
meld.setBottomLastZoneChangeCounter(meld.getBottomHalfCard().getZoneChangeCounter(game));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ package mage.game.draft;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.repository.CardCriteria;
|
import mage.cards.repository.CardCriteria;
|
||||||
|
@ -146,7 +147,7 @@ public abstract class DraftCube {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = leftCubeCards.size() - 1; i >= 0; i--) {
|
for (int i = leftCubeCards.size() - 1; i >= 0; i--) {
|
||||||
if (leftCubeCards.get(i) == cardId) {
|
if (Objects.equals(leftCubeCards.get(i), cardId)) {
|
||||||
leftCubeCards.remove(i);
|
leftCubeCards.remove(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,8 @@
|
||||||
|
|
||||||
package mage.game.draft;
|
package mage.game.draft;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.ExpansionSet;
|
import mage.cards.ExpansionSet;
|
||||||
import mage.game.draft.DraftOptions.TimingOption;
|
import mage.game.draft.DraftOptions.TimingOption;
|
||||||
|
@ -197,7 +192,7 @@ public abstract class DraftImpl implements Draft {
|
||||||
while (true) {
|
while (true) {
|
||||||
List<Card> nextBooster = next.booster;
|
List<Card> nextBooster = next.booster;
|
||||||
next.setBooster(currentBooster);
|
next.setBooster(currentBooster);
|
||||||
if (nextId == startId) {
|
if (Objects.equals(nextId, startId)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
currentBooster = nextBooster;
|
currentBooster = nextBooster;
|
||||||
|
@ -218,7 +213,7 @@ public abstract class DraftImpl implements Draft {
|
||||||
while (true) {
|
while (true) {
|
||||||
List<Card> prevBooster = prev.booster;
|
List<Card> prevBooster = prev.booster;
|
||||||
prev.setBooster(currentBooster);
|
prev.setBooster(currentBooster);
|
||||||
if (prevId == startId) {
|
if (Objects.equals(prevId, startId)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
currentBooster = prevBooster;
|
currentBooster = prevBooster;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.game.draft;
|
package mage.game.draft;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.ExpansionSet;
|
import mage.cards.ExpansionSet;
|
||||||
|
@ -69,7 +70,7 @@ public class RichManBoosterDraft extends DraftImpl {
|
||||||
while (true) {
|
while (true) {
|
||||||
List<Card> nextBooster = sets.get(cardNum % sets.size()).createBooster();
|
List<Card> nextBooster = sets.get(cardNum % sets.size()).createBooster();
|
||||||
next.setBooster(nextBooster);
|
next.setBooster(nextBooster);
|
||||||
if (nextId == startId) {
|
if (Objects.equals(nextId, startId)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nextId = table.getNext();
|
nextId = table.getNext();
|
||||||
|
|
|
@ -27,10 +27,8 @@
|
||||||
*/
|
*/
|
||||||
package mage.game.draft;
|
package mage.game.draft;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.ExpansionSet;
|
import mage.cards.ExpansionSet;
|
||||||
import mage.game.draft.DraftCube.CardIdentity;
|
import mage.game.draft.DraftCube.CardIdentity;
|
||||||
|
@ -90,7 +88,7 @@ public class RichManCubeBoosterDraft extends DraftImpl {
|
||||||
|
|
||||||
List<Card> nextBooster = draftCube.createBooster();
|
List<Card> nextBooster = draftCube.createBooster();
|
||||||
next.setBooster(nextBooster);
|
next.setBooster(nextBooster);
|
||||||
if (nextId == startId) {
|
if (Objects.equals(nextId, startId)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nextId = table.getNext();
|
nextId = table.getNext();
|
||||||
|
|
|
@ -27,14 +27,8 @@
|
||||||
*/
|
*/
|
||||||
package mage.game.permanent;
|
package mage.game.permanent;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
|
@ -667,7 +661,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attachTo(UUID permanentId, Game game) {
|
public void attachTo(UUID permanentId, Game game) {
|
||||||
if (this.attachedTo != null && this.attachedTo != permanentId) {
|
if (this.attachedTo != null && !Objects.equals(this.attachedTo, permanentId)) {
|
||||||
Permanent attachment = game.getPermanent(this.attachedTo);
|
Permanent attachment = game.getPermanent(this.attachedTo);
|
||||||
if (attachment != null) {
|
if (attachment != null) {
|
||||||
attachment.removeAttachment(this.objectId, game);
|
attachment.removeAttachment(this.objectId, game);
|
||||||
|
|
|
@ -1291,7 +1291,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (zone != Zone.BATTLEFIELD && game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this.getId(), game)) {
|
if (zone != Zone.BATTLEFIELD && game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this.getId(), game)) {
|
||||||
for (Ability ability : object.getAbilities()) {
|
for (Ability ability : object.getAbilities()) {
|
||||||
if (canUse || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
if (canUse || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
||||||
if (ability.getManaCosts().isEmpty() && ability.getCosts().isEmpty() && ability instanceof SpellAbility && !(ability.getSourceId() == getCastSourceIdWithAlternateMana())) {
|
if (ability.getManaCosts().isEmpty() && ability.getCosts().isEmpty() && ability instanceof SpellAbility && !(Objects.equals(ability.getSourceId(), getCastSourceIdWithAlternateMana()))) {
|
||||||
continue; // You can't play spells that have no costs, unless you can play them without paying their mana costs
|
continue; // You can't play spells that have no costs, unless you can play them without paying their mana costs
|
||||||
}
|
}
|
||||||
ability.setControllerId(this.getId());
|
ability.setControllerId(this.getId());
|
||||||
|
@ -1679,7 +1679,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLifeTotalCanChange() {
|
public boolean isLifeTotalCanChange() {
|
||||||
return canGainLife | canLoseLife;
|
return canGainLife || canLoseLife;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3247,7 +3247,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
// move cards to graveyard in order the owner decides
|
// move cards to graveyard in order the owner decides
|
||||||
if (!cards.isEmpty()) {
|
if (!cards.isEmpty()) {
|
||||||
Player choosingPlayer = this;
|
Player choosingPlayer = this;
|
||||||
if (ownerId != this.getId()) {
|
if (!Objects.equals(ownerId, this.getId())) {
|
||||||
choosingPlayer = game.getPlayer(ownerId);
|
choosingPlayer = game.getPlayer(ownerId);
|
||||||
}
|
}
|
||||||
if (choosingPlayer == null) {
|
if (choosingPlayer == null) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.watchers.common;
|
package mage.watchers.common;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.WatcherScope;
|
import mage.constants.WatcherScope;
|
||||||
|
@ -32,7 +33,7 @@ public class CastFromHandWatcher extends Watcher {
|
||||||
* reset if the game comes to a new step
|
* reset if the game comes to a new step
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (step != null && game.getTurn().getStep() != step) {
|
if (step != null && !Objects.equals(game.getTurn().getStep(), step)) {
|
||||||
spellsCastFromHand.clear();
|
spellsCastFromHand.clear();
|
||||||
step = null;
|
step = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom unit tests for {link Mana}.
|
* Custom unit tests for {link Mana}.
|
||||||
*
|
*
|
||||||
|
@ -525,7 +527,7 @@ public class ManaTest {
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertEquals(mana, copy); // are equal
|
assertEquals(mana, copy); // are equal
|
||||||
assertFalse(mana == copy); // are not the same object
|
assertFalse(Objects.equals(mana, copy)); // are not the same object
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -603,7 +605,7 @@ public class ManaTest {
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertEquals(mana, newMana);
|
assertEquals(mana, newMana);
|
||||||
assertFalse(mana == newMana);
|
assertFalse(Objects.equals(mana, newMana));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -4,6 +4,8 @@ import static org.junit.Assert.*;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom unit tests for {@link Counter}
|
* Custom unit tests for {@link Counter}
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +60,7 @@ public class CounterTest {
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertEquals(copy, counter);
|
assertEquals(copy, counter);
|
||||||
assertFalse(copy == counter);
|
assertFalse(Objects.equals(copy, counter));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue