mirror of
https://github.com/correl/mage.git
synced 2025-04-05 09:12:29 -09:00
removed ObjectPlayer and ObjectPlayerPredicate
This commit is contained in:
parent
c6feab68da
commit
658ae06e6f
41 changed files with 172 additions and 237 deletions
Mage.Sets/src/mage/cards
a
c
d
f
h
m
o
p
r
s
t
v
Mage/src/main/java/mage/filter
|
@ -14,8 +14,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterEquipmentPermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DefenderAttackedEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
|
@ -103,11 +103,11 @@ class AkiriFearlessVoyagerTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
class AkiriFearlessVoyagerEffect extends OneShotEffect {
|
||||
|
||||
private static enum AkiriFearlessVoyagerPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
private static enum AkiriFearlessVoyagerPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
return game.getPermanent(input.getObject().getAttachedTo()) != null
|
||||
&& game.getControllerId(input.getObject().getAttachedTo()).equals(input.getPlayerId());
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ import mage.constants.Outcome;
|
|||
import mage.constants.SubType;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -54,19 +54,19 @@ public final class AuraGraft extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class AttachedToPermanentPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
class AttachedToPermanentPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
|
||||
public AttachedToPermanentPredicate() {
|
||||
super();
|
||||
}
|
||||
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent attached = input.getObject();
|
||||
return attached != null && game.getPermanent(attached.getAttachedTo()) != null;
|
||||
}
|
||||
}
|
||||
|
||||
class PermanentCanBeAttachedToPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
class PermanentCanBeAttachedToPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
|
||||
protected Permanent aura;
|
||||
|
||||
|
@ -76,7 +76,7 @@ class PermanentCanBeAttachedToPredicate implements ObjectPlayerPredicate<ObjectP
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent potentialAttachment = input.getObject();
|
||||
for (TargetAddress addr : TargetAddress.walk(aura)) {
|
||||
Target target = addr.getTarget(aura);
|
||||
|
|
|
@ -13,8 +13,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.target.TargetSpell;
|
||||
|
@ -61,11 +61,11 @@ public final class CeruleanDrake extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum CeruleanDrakePredicate implements ObjectPlayerPredicate<ObjectPlayer<StackObject>> {
|
||||
enum CeruleanDrakePredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<StackObject>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<StackObject> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<StackObject> input, Game game) {
|
||||
if (input.getPlayerId() == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ import mage.constants.ComparisonType;
|
|||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.mageobject.ColorlessPredicate;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.game.Controllable;
|
||||
|
@ -100,10 +100,10 @@ class ConduitOfRuinWatcher extends Watcher {
|
|||
}
|
||||
}
|
||||
|
||||
class FirstCastCreatureSpellPredicate implements ObjectPlayerPredicate<ObjectPlayer<Controllable>> {
|
||||
class FirstCastCreatureSpellPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Controllable>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Controllable> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Controllable> input, Game game) {
|
||||
if (input.getObject() instanceof Card
|
||||
&& ((Card) input.getObject()).isCreature(game)) {
|
||||
ConduitOfRuinWatcher watcher = game.getState().getWatcher(ConduitOfRuinWatcher.class);
|
||||
|
|
|
@ -11,8 +11,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.target.Target;
|
||||
|
@ -59,10 +59,10 @@ public final class DawnCharm extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class DawnCharmPredicate implements ObjectPlayerPredicate<ObjectPlayer<StackObject>> {
|
||||
class DawnCharmPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<StackObject>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<StackObject> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<StackObject> input, Game game) {
|
||||
UUID controllerId = input.getPlayerId();
|
||||
if (controllerId == null) {
|
||||
return false;
|
||||
|
|
|
@ -13,8 +13,8 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterEnchantmentPermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
@ -56,9 +56,9 @@ public final class DevoutHarpist extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
class DevoutHarpistPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
class DevoutHarpistPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent attachment = input.getObject();
|
||||
if (attachment != null) {
|
||||
Permanent permanent = game.getPermanent(attachment.getAttachedTo());
|
||||
|
|
|
@ -13,8 +13,8 @@ import mage.constants.Outcome;
|
|||
import mage.constants.PhaseStep;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterAttackingCreature;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.permanent.PermanentInListPredicate;
|
||||
import mage.game.Controllable;
|
||||
import mage.game.Game;
|
||||
|
@ -64,11 +64,11 @@ public final class FalseOrders extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
enum FalseOrdersDefendingPlayerControlsPredicate implements ObjectPlayerPredicate<ObjectPlayer<Controllable>> {
|
||||
enum FalseOrdersDefendingPlayerControlsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Controllable>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Controllable> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Controllable> input, Game game) {
|
||||
return game.getCombat().getPlayerDefenders(game).contains(input.getObject().getControllerId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -43,11 +43,11 @@ public final class FlameSweep extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum FlameSweepPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
enum FlameSweepPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent object = input.getObject();
|
||||
UUID playerId = input.getPlayerId();
|
||||
return !(object.isControlledBy(playerId)
|
||||
|
|
|
@ -20,8 +20,8 @@ import mage.filter.FilterCard;
|
|||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.common.FilterInstantOrSorceryCard;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -79,11 +79,11 @@ public final class FrostpyreArcanist extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum FrostpyreArcanistPredicate implements ObjectPlayerPredicate<ObjectPlayer<Card>> {
|
||||
enum FrostpyreArcanistPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Card> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
Player player = game.getPlayer(input.getPlayerId());
|
||||
if (player == null || player.getGraveyard().isEmpty()) {
|
||||
return false;
|
||||
|
|
|
@ -9,8 +9,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackObject;
|
||||
|
@ -49,10 +49,10 @@ public final class HinderingLight extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class HinderingLightPredicate implements ObjectPlayerPredicate<ObjectPlayer<StackObject>> {
|
||||
class HinderingLightPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<StackObject>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<StackObject> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<StackObject> input, Game game) {
|
||||
UUID controllerId = input.getPlayerId();
|
||||
if (controllerId == null) {
|
||||
return false;
|
||||
|
|
|
@ -26,7 +26,8 @@ public final class MaceWindu extends CardImpl {
|
|||
private static final FilterSpellOrPermanent filter = new FilterSpellOrPermanent("spell or creature you don't control");
|
||||
|
||||
static {
|
||||
filter.add(TargetController.NOT_YOU.getControllerPredicate());
|
||||
filter.getPermanentFilter().add(TargetController.NOT_YOU.getControllerPredicate());
|
||||
filter.getSpellFilter().add(TargetController.NOT_YOU.getControllerPredicate());
|
||||
}
|
||||
|
||||
public MaceWindu(UUID ownerId, CardSetInfo setInfo) {
|
||||
|
|
|
@ -11,8 +11,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackObject;
|
||||
|
@ -53,10 +53,10 @@ public final class MirrorSheen extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class TargetYouPredicate implements ObjectPlayerPredicate<ObjectPlayer<StackObject>> {
|
||||
class TargetYouPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<StackObject>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<StackObject> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<StackObject> input, Game game) {
|
||||
UUID controllerId = input.getPlayerId();
|
||||
if (controllerId == null) {
|
||||
return false;
|
||||
|
|
|
@ -16,8 +16,8 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.mageobject.TargetsPermanentPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
|
@ -69,10 +69,10 @@ public final class MuckDrubb extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class SpellWithOnlySingleTargetPredicate implements ObjectPlayerPredicate<ObjectPlayer<Spell>> {
|
||||
class SpellWithOnlySingleTargetPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Spell>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Spell> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Spell> input, Game game) {
|
||||
Spell spell = input.getObject();
|
||||
if (spell == null) {
|
||||
return false;
|
||||
|
|
|
@ -21,8 +21,8 @@ import mage.constants.SubType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -148,7 +148,7 @@ class SourcePowerGreaterEqualTargetCondition implements Condition {
|
|||
}
|
||||
}
|
||||
|
||||
class PowerLowerEqualSourcePredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
class PowerLowerEqualSourcePredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
|
||||
UUID sourceId;
|
||||
|
||||
|
@ -157,7 +157,7 @@ class PowerLowerEqualSourcePredicate implements ObjectPlayerPredicate<ObjectPlay
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanent(sourceId);
|
||||
Permanent permanent = input.getObject();
|
||||
if (permanent != null && sourcePermanent != null) {
|
||||
|
|
|
@ -8,8 +8,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackObject;
|
||||
|
@ -46,10 +46,10 @@ public final class PersonalEnergyShield extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class PersonalEnergyFieldPredicate implements ObjectPlayerPredicate<ObjectPlayer<StackObject>> {
|
||||
class PersonalEnergyFieldPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<StackObject>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<StackObject> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<StackObject> input, Game game) {
|
||||
UUID controllerId = input.getPlayerId();
|
||||
if (controllerId == null) {
|
||||
return false;
|
||||
|
|
|
@ -10,8 +10,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
|
@ -91,10 +91,10 @@ class PsychicRebuttalEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
class PsychicRebuttalPredicate implements ObjectPlayerPredicate<ObjectPlayer<StackObject>> {
|
||||
class PsychicRebuttalPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<StackObject>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<StackObject> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<StackObject> input, Game game) {
|
||||
UUID controllerId = input.getPlayerId();
|
||||
if (controllerId == null) {
|
||||
return false;
|
||||
|
|
|
@ -16,8 +16,8 @@ import mage.constants.Duration;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterEnchantmentPermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
@ -60,9 +60,9 @@ public final class Pyramids extends CardImpl {
|
|||
return new Pyramids(this);
|
||||
}
|
||||
}
|
||||
class PyramidsPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
class PyramidsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent attachment = input.getObject();
|
||||
if (attachment != null) {
|
||||
Permanent permanent = game.getPermanent(attachment.getAttachedTo());
|
||||
|
|
|
@ -10,8 +10,8 @@ import mage.constants.CardType;
|
|||
import mage.filter.FilterSpell;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterInstantOrSorcerySpell;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.mageobject.MageObjectReferencePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
|
@ -55,11 +55,11 @@ public final class Radiate extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum SpellWithOnlySingleTargetPredicate implements ObjectPlayerPredicate<ObjectPlayer<Spell>> {
|
||||
enum SpellWithOnlySingleTargetPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Spell>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Spell> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Spell> input, Game game) {
|
||||
Spell spell = input.getObject();
|
||||
if (spell == null) {
|
||||
return false;
|
||||
|
@ -79,11 +79,11 @@ enum SpellWithOnlySingleTargetPredicate implements ObjectPlayerPredicate<ObjectP
|
|||
}
|
||||
}
|
||||
|
||||
enum SpellWithOnlyPermanentOrPlayerTargetsPredicate implements ObjectPlayerPredicate<ObjectPlayer<Spell>> {
|
||||
enum SpellWithOnlyPermanentOrPlayerTargetsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Spell>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Spell> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Spell> input, Game game) {
|
||||
Spell spell = input.getObject();
|
||||
if (spell == null) {
|
||||
return false;
|
||||
|
|
|
@ -11,8 +11,8 @@ import mage.constants.SubType;
|
|||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledEnchantmentPermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.permanent.AttachedToControlledPermanentPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -74,10 +74,10 @@ public final class RemoveEnchantments extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class AttachedToOpponentControlledAttackingCreaturePredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
class AttachedToOpponentControlledAttackingCreaturePredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent attachement = input.getObject();
|
||||
if (attachement != null) {
|
||||
Permanent permanent = game.getPermanent(attachement.getAttachedTo());
|
||||
|
|
|
@ -17,8 +17,8 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.other.NumberOfTargetsPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
|
@ -57,10 +57,10 @@ public final class Ricochet extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class SpellWithOnlyPlayerTargetsPredicate implements ObjectPlayerPredicate<ObjectPlayer<Spell>> {
|
||||
class SpellWithOnlyPlayerTargetsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Spell>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Spell> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Spell> input, Game game) {
|
||||
Spell spell = input.getObject();
|
||||
if (spell == null) {
|
||||
return false;
|
||||
|
|
|
@ -12,8 +12,8 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
|
@ -59,7 +59,7 @@ public final class SageOfTheBeyond extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum SageOfTheBeyondPredicate implements ObjectPlayerPredicate<ObjectSourcePlayer<Card>> {
|
||||
enum SageOfTheBeyondPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,8 +15,8 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterEnchantmentPermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
@ -59,9 +59,9 @@ public final class SavaenElves extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class SavaenElvesPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
class SavaenElvesPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent attachment = input.getObject();
|
||||
if (attachment != null) {
|
||||
Permanent permanent = game.getPermanent(attachment.getAttachedTo());
|
||||
|
|
|
@ -17,8 +17,8 @@ import mage.constants.SuperType;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -156,10 +156,10 @@ class ShellOfTheLastKappaCastEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
class TargetYouPredicate implements ObjectPlayerPredicate<ObjectPlayer<StackObject>> {
|
||||
class TargetYouPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<StackObject>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<StackObject> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<StackObject> input, Game game) {
|
||||
UUID controllerId = input.getPlayerId();
|
||||
if (controllerId == null) {
|
||||
return false;
|
||||
|
|
|
@ -8,8 +8,8 @@ import mage.constants.CardType;
|
|||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -47,7 +47,7 @@ public final class SoulShatter extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum SoulShatterPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
enum SoulShatterPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
instance;
|
||||
|
||||
private static final FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent();
|
||||
|
@ -57,7 +57,7 @@ enum SoulShatterPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanen
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
int cmc = game.getBattlefield()
|
||||
.getActivePermanents(filter, input.getPlayerId(), game)
|
||||
.stream()
|
||||
|
|
|
@ -10,8 +10,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
@ -49,13 +49,13 @@ public final class TelimTorsEdict extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class TelimTorsEdictPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
class TelimTorsEdictPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
|
||||
public TelimTorsEdictPredicate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent permanent = input.getObject();
|
||||
UUID playerId = input.getPlayerId();
|
||||
if (permanent.isControlledBy(playerId) || permanent.isOwnedBy(playerId)) {
|
||||
|
|
|
@ -18,8 +18,8 @@ import mage.constants.SubType;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
@ -62,7 +62,7 @@ public final class VedalkenShackles extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class PowerIslandPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
class PowerIslandPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
|
||||
static final FilterLandPermanent filter = new FilterLandPermanent("Island");
|
||||
static {
|
||||
|
@ -70,7 +70,7 @@ class PowerIslandPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permane
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent permanent = input.getObject();
|
||||
if (permanent != null) {
|
||||
int islands = game.getBattlefield().countAll(filter, input.getPlayerId(), game);
|
||||
|
|
|
@ -16,8 +16,8 @@ import mage.constants.WatcherScope;
|
|||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
|
@ -67,11 +67,11 @@ public final class VineGecko extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum VineGeckoPredicate implements ObjectPlayerPredicate<ObjectPlayer<Card>> {
|
||||
enum VineGeckoPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Card> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
VineGeckoWatcher watcher = game.getState().getWatcher(VineGeckoWatcher.class);
|
||||
if (watcher == null || watcher.checkPlayer(input.getPlayerId())) {
|
||||
return false;
|
||||
|
|
|
@ -2,7 +2,10 @@ package mage.filter;
|
|||
|
||||
import mage.cards.Card;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.predicate.*;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -20,7 +23,7 @@ import java.util.stream.Collectors;
|
|||
public class FilterCard extends FilterObject<Card> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected List<ObjectPlayerPredicate<ObjectPlayer<Card>>> extraPredicates = new ArrayList<>();
|
||||
protected List<ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>>> extraPredicates = new ArrayList<>();
|
||||
|
||||
public FilterCard() {
|
||||
super("card");
|
||||
|
@ -53,21 +56,17 @@ public class FilterCard extends FilterObject<Card> {
|
|||
}
|
||||
|
||||
public boolean match(Card card, UUID playerId, Game game) {
|
||||
if (!this.match(card, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Predicates.and(extraPredicates).apply(new ObjectPlayer(card, playerId), game);
|
||||
return match(card, null, playerId, game);
|
||||
}
|
||||
|
||||
public boolean match(Card card, UUID sourceId, UUID playerId, Game game) {
|
||||
if (!this.match(card, game)) {
|
||||
return false;
|
||||
}
|
||||
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(card, sourceId, playerId), game);
|
||||
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer<Card>(card, sourceId, playerId), game);
|
||||
}
|
||||
|
||||
public final void add(ObjectPlayerPredicate predicate) {
|
||||
public final void add(ObjectSourcePlayerPredicate predicate) {
|
||||
if (isLockedFilter()) {
|
||||
throw new UnsupportedOperationException("You may not modify a locked filter");
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package mage.filter;
|
||||
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
|
@ -18,7 +18,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public class FilterPermanent extends FilterObject<Permanent> implements FilterInPlay<Permanent> {
|
||||
|
||||
protected List<ObjectPlayerPredicate<ObjectPlayer<Permanent>>> extraPredicates = new ArrayList<>();
|
||||
protected List<ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>>> extraPredicates = new ArrayList<>();
|
||||
|
||||
public FilterPermanent() {
|
||||
super("permanent");
|
||||
|
@ -56,10 +56,10 @@ public class FilterPermanent extends FilterObject<Permanent> implements FilterIn
|
|||
return false;
|
||||
}
|
||||
|
||||
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(permanent, sourceId, playerId), game);
|
||||
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer<Permanent>(permanent, sourceId, playerId), game);
|
||||
}
|
||||
|
||||
public final void add(ObjectPlayerPredicate predicate) {
|
||||
public final void add(ObjectSourcePlayerPredicate predicate) {
|
||||
if (isLockedFilter()) {
|
||||
throw new UnsupportedOperationException("You may not modify a locked filter");
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package mage.filter;
|
||||
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -17,7 +16,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public class FilterPlayer extends FilterImpl<Player> {
|
||||
|
||||
protected List<ObjectPlayerPredicate<ObjectPlayer<Player>>> extraPredicates = new ArrayList<>();
|
||||
protected List<ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>>> extraPredicates = new ArrayList<>();
|
||||
|
||||
public FilterPlayer() {
|
||||
this("player");
|
||||
|
@ -32,7 +31,7 @@ public class FilterPlayer extends FilterImpl<Player> {
|
|||
this.extraPredicates = new ArrayList<>(filter.extraPredicates);
|
||||
}
|
||||
|
||||
public void add(ObjectPlayerPredicate predicate) {
|
||||
public void add(ObjectSourcePlayerPredicate predicate) {
|
||||
if (isLockedFilter()) {
|
||||
throw new UnsupportedOperationException("You may not modify a locked filter");
|
||||
}
|
||||
|
@ -49,7 +48,7 @@ public class FilterPlayer extends FilterImpl<Player> {
|
|||
return false;
|
||||
}
|
||||
|
||||
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(checkPlayer, sourceId, sourceControllerId), game);
|
||||
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer<Player>(checkPlayer, sourceId, sourceControllerId), game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mage.filter;
|
||||
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
|
@ -17,7 +17,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public class FilterStackObject extends FilterObject<StackObject> {
|
||||
|
||||
protected List<ObjectPlayerPredicate<ObjectPlayer<Permanent>>> extraPredicates = new ArrayList<>();
|
||||
protected List<ObjectSourcePlayerPredicate<ObjectSourcePlayer<StackObject>>> extraPredicates = new ArrayList<>();
|
||||
|
||||
public FilterStackObject() {
|
||||
this("spell or ability");
|
||||
|
@ -37,10 +37,10 @@ public class FilterStackObject extends FilterObject<StackObject> {
|
|||
return false;
|
||||
}
|
||||
|
||||
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(stackObject, sourceId, playerId), game);
|
||||
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer<StackObject>(stackObject, sourceId, playerId), game);
|
||||
}
|
||||
|
||||
public final void add(ObjectPlayerPredicate predicate) {
|
||||
public final void add(ObjectSourcePlayerPredicate predicate) {
|
||||
if (isLockedFilter()) {
|
||||
throw new UnsupportedOperationException("You may not modify a locked filter");
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@ import mage.filter.FilterImpl;
|
|||
import mage.filter.FilterInPlay;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.FilterPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -46,7 +47,7 @@ public class FilterPermanentOrPlayer extends FilterImpl<MageItem> implements Fil
|
|||
return true;
|
||||
}
|
||||
|
||||
public void add(ObjectPlayerPredicate predicate) {
|
||||
public void add(ObjectSourcePlayerPredicate predicate) {
|
||||
playerFilter.add((Predicate<? super Player>) predicate);
|
||||
permanentFilter.add((Predicate<? super Permanent>) predicate);
|
||||
}
|
||||
|
|
|
@ -1,49 +1,17 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*
|
||||
*/
|
||||
package mage.filter.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.filter.FilterImpl;
|
||||
import mage.filter.FilterInPlay;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX
|
||||
*/
|
||||
public class FilterSpellOrPermanent extends FilterImpl<MageObject> implements FilterInPlay<MageObject> {
|
||||
|
@ -92,12 +60,11 @@ public class FilterSpellOrPermanent extends FilterImpl<MageObject> implements Fi
|
|||
return false;
|
||||
}
|
||||
|
||||
public final void add(ObjectPlayerPredicate<? extends ObjectPlayer> predicate) {
|
||||
if (isLockedFilter()) {
|
||||
throw new UnsupportedOperationException("You may not modify a locked filter");
|
||||
}
|
||||
spellFilter.add(predicate);
|
||||
permanentFilter.add(predicate);
|
||||
@Override
|
||||
public void setLockedFilter(boolean lockedFilter) {
|
||||
super.setLockedFilter(lockedFilter);
|
||||
spellFilter.setLockedFilter(lockedFilter);
|
||||
permanentFilter.setLockedFilter(lockedFilter);
|
||||
}
|
||||
|
||||
public FilterPermanent getPermanentFilter() {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
|
||||
package mage.filter.predicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
* @param <T>
|
||||
*/
|
||||
public class ObjectPlayer<T> {
|
||||
|
||||
protected final T object;
|
||||
protected final UUID playerId;
|
||||
|
||||
public ObjectPlayer(T object, UUID playerId) {
|
||||
this.object = object;
|
||||
this.playerId = playerId;
|
||||
}
|
||||
|
||||
public T getObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
public UUID getPlayerId() {
|
||||
return playerId;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
|
||||
package mage.filter.predicate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
* @param <T>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ObjectPlayerPredicate<T extends ObjectPlayer> extends Predicate<T> {
|
||||
}
|
|
@ -1,22 +1,31 @@
|
|||
|
||||
package mage.filter.predicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
* @param <T>
|
||||
* @author North
|
||||
*/
|
||||
public class ObjectSourcePlayer<T> extends ObjectPlayer<T> {
|
||||
public class ObjectSourcePlayer<T> {
|
||||
|
||||
protected final T object;
|
||||
protected final UUID playerId;
|
||||
protected final UUID sourceId;
|
||||
|
||||
public ObjectSourcePlayer(T object, UUID sourceId, UUID sourceControllerId) {
|
||||
super(object, sourceControllerId);
|
||||
this.object = object;
|
||||
this.playerId = sourceControllerId;
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
|
||||
public T getObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
public UUID getPlayerId() {
|
||||
return playerId;
|
||||
}
|
||||
|
||||
public UUID getSourceId() {
|
||||
return sourceId;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
|
||||
package mage.filter.predicate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
* @param <T>
|
||||
* @author North
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ObjectSourcePlayerPredicate<T extends ObjectSourcePlayer> extends ObjectPlayerPredicate<T> {
|
||||
public interface ObjectSourcePlayerPredicate<T extends ObjectSourcePlayer<?>> extends Predicate<T> {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package mage.filter.predicate.card;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
|
@ -10,12 +10,12 @@ import mage.players.Player;
|
|||
* @author JayDi85
|
||||
*/
|
||||
|
||||
public enum CardOnTopOfLibraryPredicate implements ObjectPlayerPredicate<ObjectPlayer<Card>> {
|
||||
public enum CardOnTopOfLibraryPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>> {
|
||||
YOUR,
|
||||
ANY;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Card> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
|
||||
Player player;
|
||||
switch (this) {
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package mage.filter.predicate.card;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum DefendingPlayerOwnsCardPredicate implements ObjectPlayerPredicate<ObjectPlayer<Card>> {
|
||||
public enum DefendingPlayerOwnsCardPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Card> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
return game.getCombat().getPlayerDefenders(game, false).contains(input.getObject().getOwnerId());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package mage.filter.predicate.other;
|
||||
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Controllable;
|
||||
import mage.game.Game;
|
||||
import mage.watchers.common.PlayerDamagedBySourceWatcher;
|
||||
|
@ -12,7 +12,7 @@ import java.util.UUID;
|
|||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class DamagedPlayerThisTurnPredicate implements ObjectPlayerPredicate<ObjectPlayer<Controllable>> {
|
||||
public class DamagedPlayerThisTurnPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Controllable>> {
|
||||
|
||||
private final TargetController controller;
|
||||
|
||||
|
@ -21,7 +21,7 @@ public class DamagedPlayerThisTurnPredicate implements ObjectPlayerPredicate<Obj
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Controllable> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Controllable> input, Game game) {
|
||||
Controllable object = input.getObject();
|
||||
UUID playerId = input.getPlayerId();
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
package mage.filter.predicate.permanent;
|
||||
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -10,10 +10,10 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author North & L_J
|
||||
*/
|
||||
public class AttachedToControlledPermanentPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
|
||||
public class AttachedToControlledPermanentPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
Permanent attachement = input.getObject();
|
||||
if (attachement != null) {
|
||||
Permanent permanent = game.getPermanent(attachement.getAttachedTo());
|
||||
|
|
Loading…
Add table
Reference in a new issue