mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Fixed filter for "Target ANOTHER permanent" not working. Now sourceId is passed to match method. Updated sever plugins (game freezes otherwise).
This commit is contained in:
parent
cbf8f02df3
commit
a60fe86fbb
20 changed files with 72 additions and 40 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -89,7 +89,7 @@ public class CantTargetControlledEffect extends ReplacementEffectImpl<CantTarget
|
||||||
if (event.getType() == EventType.TARGET) {
|
if (event.getType() == EventType.TARGET) {
|
||||||
filterTarget.setTargetController(TargetController.YOU);
|
filterTarget.setTargetController(TargetController.YOU);
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && filterTarget.match(permanent, source.getControllerId(), game)) {
|
if (permanent != null && filterTarget.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
|
||||||
if (filterSource == null)
|
if (filterSource == null)
|
||||||
return true;
|
return true;
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -82,12 +82,12 @@ public class PreventAllDamageToEffect extends PreventionEffectImpl<PreventAllDam
|
||||||
if (super.applies(event, source, game)) {
|
if (super.applies(event, source, game)) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (filter.match(permanent, source.getControllerId(), game))
|
if (filter.match(permanent, source.getSourceId(), source.getControllerId(), game))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Player player = game.getPlayer(event.getTargetId());
|
Player player = game.getPlayer(event.getTargetId());
|
||||||
if (player != null && filter.match(player, source.getControllerId(), game))
|
if (player != null && filter.match(player, source.getSourceId(), source.getControllerId(), game))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class AddCountersAllEffect extends OneShotEffect<AddCountersAllEffect> {
|
||||||
UUID controllerId = source.getControllerId();
|
UUID controllerId = source.getControllerId();
|
||||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents();
|
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents();
|
||||||
for (Permanent permanent : permanents) {
|
for (Permanent permanent : permanents) {
|
||||||
if (filter.match(permanent, controllerId, game)) {
|
if (filter.match(permanent, source.getSourceId(), controllerId, game)) {
|
||||||
permanent.addCounters(counter.copy());
|
permanent.addCounters(counter.copy());
|
||||||
applied = true;
|
applied = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
package mage.filter;
|
package mage.filter;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +39,7 @@ import mage.game.Game;
|
||||||
*/
|
*/
|
||||||
public interface FilterInPlay<E> extends Filter<E> {
|
public interface FilterInPlay<E> extends Filter<E> {
|
||||||
|
|
||||||
public boolean match(E o, UUID playerId, Game game);
|
public boolean match(E o, UUID sourceId, UUID playerId, Game game);
|
||||||
@Override
|
@Override
|
||||||
public FilterInPlay<E> copy();
|
public FilterInPlay<E> copy();
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,11 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
|
||||||
protected UUID id;
|
protected UUID id;
|
||||||
protected boolean notId;
|
protected boolean notId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that filter shouldn't match the source.
|
||||||
|
*/
|
||||||
|
protected boolean another;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FilterObject<E, T> copy() {
|
public FilterObject<E, T> copy() {
|
||||||
return new FilterObject<E, T>(this);
|
return new FilterObject<E, T>(this);
|
||||||
|
@ -125,6 +130,7 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
|
||||||
this.toughnessComparison = filter.toughnessComparison;
|
this.toughnessComparison = filter.toughnessComparison;
|
||||||
this.id = filter.id;
|
this.id = filter.id;
|
||||||
this.notId = filter.notId;
|
this.notId = filter.notId;
|
||||||
|
this.another = filter.another;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -323,4 +329,11 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
|
||||||
this.notId = notId;
|
this.notId = notId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAnother() {
|
||||||
|
return another;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnother(boolean another) {
|
||||||
|
this.another = another;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.Constants.TargetController;
|
import mage.Constants.TargetController;
|
||||||
|
import mage.abilities.Ability;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ public class FilterPermanent<T extends FilterPermanent<T>> extends FilterObject<
|
||||||
return !notFilter;
|
return !notFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean match(Permanent permanent, UUID playerId, Game game) {
|
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
|
||||||
if (!this.match(permanent))
|
if (!this.match(permanent))
|
||||||
return notFilter;
|
return notFilter;
|
||||||
|
|
||||||
|
@ -130,6 +131,13 @@ public class FilterPermanent<T extends FilterPermanent<T>> extends FilterObject<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (another) {
|
||||||
|
// filter out itself
|
||||||
|
if (permanent.getId().equals(sourceId)) {
|
||||||
|
return notFilter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return !notFilter;
|
return !notFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.Constants.TargetController;
|
import mage.Constants.TargetController;
|
||||||
|
import mage.abilities.Ability;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ public class FilterPlayer extends FilterImpl<Player, FilterPlayer> implements Fi
|
||||||
return !notFilter;
|
return !notFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean match(Player player, UUID playerId, Game game) {
|
public boolean match(Player player, UUID sourceId, UUID playerId, Game game) {
|
||||||
if (!this.match(player))
|
if (!this.match(player))
|
||||||
return notFilter;
|
return notFilter;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
package mage.filter.common;
|
package mage.filter.common;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
import mage.filter.Filter;
|
import mage.filter.Filter;
|
||||||
import mage.filter.FilterImpl;
|
import mage.filter.FilterImpl;
|
||||||
import mage.filter.FilterInPlay;
|
import mage.filter.FilterInPlay;
|
||||||
|
@ -82,12 +84,12 @@ public class FilterCreatureOrPlayer extends FilterImpl<Object, FilterCreatureOrP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean match(Object o, UUID playerId, Game game) {
|
public boolean match(Object o, UUID sourceId, UUID playerId, Game game) {
|
||||||
if (o instanceof Player) {
|
if (o instanceof Player) {
|
||||||
return playerFilter.match((Player)o, playerId, game);
|
return playerFilter.match((Player)o, sourceId, playerId, game);
|
||||||
}
|
}
|
||||||
else if (o instanceof Permanent) {
|
else if (o instanceof Permanent) {
|
||||||
return creatureFilter.match((Permanent)o, playerId, game);
|
return creatureFilter.match((Permanent)o, sourceId, playerId, game);
|
||||||
}
|
}
|
||||||
return notFilter;
|
return notFilter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
package mage.filter.common;
|
package mage.filter.common;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
import mage.filter.FilterImpl;
|
import mage.filter.FilterImpl;
|
||||||
import mage.filter.FilterInPlay;
|
import mage.filter.FilterInPlay;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
|
@ -81,11 +82,11 @@ public class FilterPermanentOrPlayer extends FilterImpl<Object, FilterPermanentO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean match(Object o, UUID playerId, Game game) {
|
public boolean match(Object o, UUID sourceId, UUID playerId, Game game) {
|
||||||
if (o instanceof Player) {
|
if (o instanceof Player) {
|
||||||
return playerFilter.match((Player) o, playerId, game);
|
return playerFilter.match((Player) o, sourceId, playerId, game);
|
||||||
} else if (o instanceof Permanent) {
|
} else if (o instanceof Permanent) {
|
||||||
return permanentFilter.match((Permanent) o, playerId, game);
|
return permanentFilter.match((Permanent) o, sourceId, playerId, game);
|
||||||
}
|
}
|
||||||
return notFilter;
|
return notFilter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
package mage.filter.common;
|
package mage.filter.common;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
import mage.filter.FilterImpl;
|
import mage.filter.FilterImpl;
|
||||||
import mage.filter.FilterInPlay;
|
import mage.filter.FilterInPlay;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
|
@ -36,6 +37,7 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import javax.xml.transform.Source;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,11 +87,11 @@ public class FilterPermanentOrPlayerWithCounter extends FilterPermanentOrPlayer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean match(Object o, UUID playerId, Game game) {
|
public boolean match(Object o, UUID sourceId, UUID playerId, Game game) {
|
||||||
if (o instanceof Player) {
|
if (o instanceof Player) {
|
||||||
return playerFilter.match((Player) o, playerId, game);
|
return playerFilter.match((Player) o, sourceId, playerId, game);
|
||||||
} else if (o instanceof Permanent) {
|
} else if (o instanceof Permanent) {
|
||||||
return permanentFilter.match((Permanent) o, playerId, game);
|
return permanentFilter.match((Permanent) o, sourceId, playerId, game);
|
||||||
}
|
}
|
||||||
return notFilter;
|
return notFilter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class Battlefield implements Serializable {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (game.getRangeOfInfluence() == RangeOfInfluence.ALL) {
|
if (game.getRangeOfInfluence() == RangeOfInfluence.ALL) {
|
||||||
for (Permanent permanent: field.values()) {
|
for (Permanent permanent: field.values()) {
|
||||||
if (filter.match(permanent, sourcePlayerId, game)) {
|
if (filter.match(permanent, null, sourcePlayerId, game)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ public class Battlefield implements Serializable {
|
||||||
else {
|
else {
|
||||||
Set<UUID> range = game.getPlayer(sourcePlayerId).getInRange();
|
Set<UUID> range = game.getPlayer(sourcePlayerId).getInRange();
|
||||||
for (Permanent permanent: field.values()) {
|
for (Permanent permanent: field.values()) {
|
||||||
if (range.contains(permanent.getControllerId()) && filter.match(permanent, sourcePlayerId, game)) {
|
if (range.contains(permanent.getControllerId()) && filter.match(permanent, null, sourcePlayerId, game)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ public class Battlefield implements Serializable {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (game.getRangeOfInfluence() == RangeOfInfluence.ALL) {
|
if (game.getRangeOfInfluence() == RangeOfInfluence.ALL) {
|
||||||
for (Permanent permanent: field.values()) {
|
for (Permanent permanent: field.values()) {
|
||||||
if (filter.match(permanent, sourcePlayerId, game)) {
|
if (filter.match(permanent, null, sourcePlayerId, game)) {
|
||||||
count++;
|
count++;
|
||||||
if (num == count)
|
if (num == count)
|
||||||
return true;
|
return true;
|
||||||
|
@ -203,7 +203,7 @@ public class Battlefield implements Serializable {
|
||||||
else {
|
else {
|
||||||
Set<UUID> range = game.getPlayer(sourcePlayerId).getInRange();
|
Set<UUID> range = game.getPlayer(sourcePlayerId).getInRange();
|
||||||
for (Permanent permanent: field.values()) {
|
for (Permanent permanent: field.values()) {
|
||||||
if (range.contains(permanent.getControllerId()) && filter.match(permanent, sourcePlayerId, game)) {
|
if (range.contains(permanent.getControllerId()) && filter.match(permanent, null, sourcePlayerId, game)) {
|
||||||
count++;
|
count++;
|
||||||
if (num == count)
|
if (num == count)
|
||||||
return true;
|
return true;
|
||||||
|
@ -352,14 +352,14 @@ public class Battlefield implements Serializable {
|
||||||
List<Permanent> active = new ArrayList<Permanent>();
|
List<Permanent> active = new ArrayList<Permanent>();
|
||||||
if (game.getRangeOfInfluence() == RangeOfInfluence.ALL) {
|
if (game.getRangeOfInfluence() == RangeOfInfluence.ALL) {
|
||||||
for (Permanent perm: field.values()) {
|
for (Permanent perm: field.values()) {
|
||||||
if (perm.isPhasedIn() && filter.match(perm, sourcePlayerId, game))
|
if (perm.isPhasedIn() && filter.match(perm, null, sourcePlayerId, game))
|
||||||
active.add(perm);
|
active.add(perm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Set<UUID> range = game.getPlayer(sourcePlayerId).getInRange();
|
Set<UUID> range = game.getPlayer(sourcePlayerId).getInRange();
|
||||||
for (Permanent perm: field.values()) {
|
for (Permanent perm: field.values()) {
|
||||||
if (perm.isPhasedIn() && range.contains(perm.getControllerId()) && filter.match(perm, sourcePlayerId, game))
|
if (perm.isPhasedIn() && range.contains(perm.getControllerId()) && filter.match(perm, null, sourcePlayerId, game))
|
||||||
active.add(perm);
|
active.add(perm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,9 @@ public abstract class TargetImpl<T extends TargetImpl<T>> implements Target {
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
if (targetName.startsWith("another")) {
|
||||||
|
return "Select " + targetName;
|
||||||
|
}
|
||||||
return "Select a " + targetName;
|
return "Select a " + targetName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,9 +82,9 @@ public class TargetPermanent<T extends TargetPermanent<T>> extends TargetObject<
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (source != null)
|
if (source != null)
|
||||||
//TODO: check for replacement effects
|
//TODO: check for replacement effects
|
||||||
return permanent.canBeTargetedBy(game.getObject(source.getSourceId())) && filter.match(permanent, controllerId, game);
|
return permanent.canBeTargetedBy(game.getObject(source.getSourceId())) && filter.match(permanent, source.getSourceId(), controllerId, game);
|
||||||
else
|
else
|
||||||
return filter.match(permanent, controllerId, game);
|
return filter.match(permanent, null, controllerId, game);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,9 +99,9 @@ public class TargetCreatureOrPlayer extends TargetImpl<TargetCreatureOrPlayer> {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (source != null)
|
if (source != null)
|
||||||
//TODO: check for replacement effects
|
//TODO: check for replacement effects
|
||||||
return permanent.canBeTargetedBy(game.getObject(source.getSourceId())) && filter.match(permanent, controllerId, game);
|
return permanent.canBeTargetedBy(game.getObject(source.getSourceId())) && filter.match(permanent, source.getSourceId(), controllerId, game);
|
||||||
else
|
else
|
||||||
return filter.match(permanent, controllerId, game);
|
return filter.match(permanent, source.getSourceId(), controllerId, game);
|
||||||
}
|
}
|
||||||
Player player = game.getPlayer(id);
|
Player player = game.getPlayer(id);
|
||||||
if (player != null)
|
if (player != null)
|
||||||
|
@ -134,7 +134,7 @@ public class TargetCreatureOrPlayer extends TargetImpl<TargetCreatureOrPlayer> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
||||||
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceControllerId, game)) {
|
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceId, sourceControllerId, game)) {
|
||||||
count++;
|
count++;
|
||||||
if (count >= this.minNumberOfTargets)
|
if (count >= this.minNumberOfTargets)
|
||||||
return true;
|
return true;
|
||||||
|
@ -163,7 +163,7 @@ public class TargetCreatureOrPlayer extends TargetImpl<TargetCreatureOrPlayer> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
||||||
if (filter.match(permanent, sourceControllerId, game)) {
|
if (filter.match(permanent, null, sourceControllerId, game)) {
|
||||||
count++;
|
count++;
|
||||||
if (count >= this.minNumberOfTargets)
|
if (count >= this.minNumberOfTargets)
|
||||||
return true;
|
return true;
|
||||||
|
@ -183,7 +183,7 @@ public class TargetCreatureOrPlayer extends TargetImpl<TargetCreatureOrPlayer> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
||||||
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceControllerId, game)) {
|
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceId, sourceControllerId, game)) {
|
||||||
possibleTargets.add(permanent.getId());
|
possibleTargets.add(permanent.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ public class TargetCreatureOrPlayer extends TargetImpl<TargetCreatureOrPlayer> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
||||||
if (filter.match(permanent, sourceControllerId, game)) {
|
if (filter.match(permanent, null, sourceControllerId, game)) {
|
||||||
possibleTargets.add(permanent.getId());
|
possibleTargets.add(permanent.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount<TargetCreatureOrP
|
||||||
MageObject targetSource = game.getObject(source.getSourceId());
|
MageObject targetSource = game.getObject(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (source != null)
|
if (source != null)
|
||||||
return permanent.canBeTargetedBy(targetSource) && filter.match(permanent, source.getControllerId(), game);
|
return permanent.canBeTargetedBy(targetSource) && filter.match(permanent, source.getSourceId(), source.getControllerId(), game);
|
||||||
else
|
else
|
||||||
return filter.match(permanent);
|
return filter.match(permanent);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount<TargetCreatureOrP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
||||||
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceControllerId, game)) {
|
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceId, sourceControllerId, game)) {
|
||||||
count++;
|
count++;
|
||||||
if (count >= this.minNumberOfTargets)
|
if (count >= this.minNumberOfTargets)
|
||||||
return true;
|
return true;
|
||||||
|
@ -132,7 +132,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount<TargetCreatureOrP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
||||||
if (filter.match(permanent, sourceControllerId, game)) {
|
if (filter.match(permanent, null, sourceControllerId, game)) {
|
||||||
count++;
|
count++;
|
||||||
if (count >= this.minNumberOfTargets)
|
if (count >= this.minNumberOfTargets)
|
||||||
return true;
|
return true;
|
||||||
|
@ -152,7 +152,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount<TargetCreatureOrP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
||||||
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceControllerId, game)) {
|
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceId, sourceControllerId, game)) {
|
||||||
possibleTargets.add(permanent.getId());
|
possibleTargets.add(permanent.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount<TargetCreatureOrP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
||||||
if (filter.match(permanent, sourceControllerId, game)) {
|
if (filter.match(permanent, null, sourceControllerId, game)) {
|
||||||
possibleTargets.add(permanent.getId());
|
possibleTargets.add(permanent.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class TargetPermanentOrPlayer extends TargetImpl<TargetPermanentOrPlayer>
|
||||||
MageObject targetSource = game.getObject(source.getSourceId());
|
MageObject targetSource = game.getObject(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if (source != null)
|
if (source != null)
|
||||||
return permanent.canBeTargetedBy(targetSource) && filter.match(permanent, source.getControllerId(), game);
|
return permanent.canBeTargetedBy(targetSource) && filter.match(permanent, source.getSourceId(), source.getControllerId(), game);
|
||||||
else
|
else
|
||||||
return filter.match(permanent);
|
return filter.match(permanent);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ public class TargetPermanentOrPlayer extends TargetImpl<TargetPermanentOrPlayer>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
||||||
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceControllerId, game)) {
|
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceId, sourceControllerId, game)) {
|
||||||
count++;
|
count++;
|
||||||
if (count >= this.minNumberOfTargets)
|
if (count >= this.minNumberOfTargets)
|
||||||
return true;
|
return true;
|
||||||
|
@ -173,7 +173,7 @@ public class TargetPermanentOrPlayer extends TargetImpl<TargetPermanentOrPlayer>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filterPermanent, sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(filterPermanent, sourceControllerId, game)) {
|
||||||
if (filter.match(permanent, sourceControllerId, game)) {
|
if (filter.match(permanent, null, sourceControllerId, game)) {
|
||||||
count++;
|
count++;
|
||||||
if (count >= this.minNumberOfTargets)
|
if (count >= this.minNumberOfTargets)
|
||||||
return true;
|
return true;
|
||||||
|
@ -193,7 +193,7 @@ public class TargetPermanentOrPlayer extends TargetImpl<TargetPermanentOrPlayer>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
||||||
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceControllerId, game)) {
|
if (permanent.canBeTargetedBy(targetSource) && filter.match(permanent, sourceId, sourceControllerId, game)) {
|
||||||
possibleTargets.add(permanent.getId());
|
possibleTargets.add(permanent.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ public class TargetPermanentOrPlayer extends TargetImpl<TargetPermanentOrPlayer>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
for (Permanent permanent: game.getBattlefield().getActivePermanents(FilterCreaturePermanent.getDefault(), sourceControllerId, game)) {
|
||||||
if (filter.match(permanent, sourceControllerId, game)) {
|
if (filter.match(permanent, null, sourceControllerId, game)) {
|
||||||
possibleTargets.add(permanent.getId());
|
possibleTargets.add(permanent.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue