mirror of
https://github.com/correl/mage.git
synced 2025-04-09 17:00:09 -09:00
Can't be target/attached effects - fixed that user gets multiple warning message about prevention effect;
This commit is contained in:
parent
105062beb7
commit
8ca6fd8552
18 changed files with 91 additions and 114 deletions
Mage.Sets/src/mage/cards
b
c
g
h
n
r
s
t
v
Mage/src/main/java/mage
abilities/effects
filter/predicate/permanent
game
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
@ -15,17 +13,14 @@ import mage.abilities.keyword.DoubleStrikeAbility;
|
||||||
import mage.abilities.keyword.FirstStrikeAbility;
|
import mage.abilities.keyword.FirstStrikeAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.SuperType;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Saga
|
* @author Saga
|
||||||
*/
|
*/
|
||||||
public final class BalanWanderingKnight extends CardImpl {
|
public final class BalanWanderingKnight extends CardImpl {
|
||||||
|
@ -84,7 +79,7 @@ public final class BalanWanderingKnight extends CardImpl {
|
||||||
for (Permanent equipment : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
for (Permanent equipment : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
if (equipment != null) {
|
if (equipment != null) {
|
||||||
//If an Equipment can't equip, it isn't attached, and it doesn't become unattached (if it's attached to a creature).
|
//If an Equipment can't equip, it isn't attached, and it doesn't become unattached (if it's attached to a creature).
|
||||||
if (!balan.cantBeAttachedBy(equipment, game)) {
|
if (!balan.cantBeAttachedBy(equipment, game, false)) {
|
||||||
balan.addAttachment(equipment.getId(), game);
|
balan.addAttachment(equipment.getId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
@ -26,6 +23,8 @@ import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author spjspj
|
* @author spjspj
|
||||||
*/
|
*/
|
||||||
|
@ -106,7 +105,7 @@ class CrownOfTheAgesEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
// Check for protection
|
// Check for protection
|
||||||
MageObject auraObject = game.getObject(aura.getId());
|
MageObject auraObject = game.getObject(aura.getId());
|
||||||
if (auraObject != null && creatureToAttachAura.cantBeAttachedBy(auraObject, game)) {
|
if (auraObject != null && creatureToAttachAura.cantBeAttachedBy(auraObject, game, true)) {
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,9 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||||
import mage.abilities.effects.AsTurnedFaceUpEffect;
|
import mage.abilities.effects.AsTurnedFaceUpEffect;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.AttachEffect;
|
||||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||||
import mage.abilities.keyword.DeathtouchAbility;
|
import mage.abilities.keyword.DeathtouchAbility;
|
||||||
import mage.abilities.keyword.EnchantAbility;
|
import mage.abilities.keyword.EnchantAbility;
|
||||||
|
@ -12,26 +14,22 @@ import mage.abilities.keyword.IndestructibleAbility;
|
||||||
import mage.abilities.keyword.MorphAbility;
|
import mage.abilities.keyword.MorphAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.AttachmentType;
|
import mage.constants.*;
|
||||||
import mage.constants.CardType;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.constants.Outcome;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.constants.SubType;
|
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.effects.Effect;
|
|
||||||
import mage.abilities.effects.common.AttachEffect;
|
|
||||||
import static mage.constants.Outcome.Benefit;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
|
||||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
|
||||||
import mage.target.targetadjustment.TargetAdjuster;
|
import mage.target.targetadjustment.TargetAdjuster;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static mage.constants.Outcome.Benefit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
|
@ -132,7 +130,7 @@ class GiftOfDoomEffect extends OneShotEffect {
|
||||||
target.setNotTarget(true);
|
target.setNotTarget(true);
|
||||||
if (player.choose(outcome, target, source.getSourceId(), game)
|
if (player.choose(outcome, target, source.getSourceId(), game)
|
||||||
&& game.getPermanent(target.getFirstTarget()) != null
|
&& game.getPermanent(target.getFirstTarget()) != null
|
||||||
&& !game.getPermanent(target.getFirstTarget()).cantBeAttachedBy(giftOfDoom, game)) {
|
&& !game.getPermanent(target.getFirstTarget()).cantBeAttachedBy(giftOfDoom, game, false)) {
|
||||||
game.getState().setValue("attachTo:" + giftOfDoom.getId(), target.getFirstTarget());
|
game.getState().setValue("attachTo:" + giftOfDoom.getId(), target.getFirstTarget());
|
||||||
game.getPermanent(target.getFirstTarget()).addAttachment(giftOfDoom.getId(), game);
|
game.getPermanent(target.getFirstTarget()).addAttachment(giftOfDoom.getId(), game);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.g;
|
package mage.cards.g;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -13,8 +10,8 @@ import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||||
|
@ -25,8 +22,10 @@ import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
*/
|
*/
|
||||||
public final class GlamerSpinners extends CardImpl {
|
public final class GlamerSpinners extends CardImpl {
|
||||||
|
@ -118,7 +117,7 @@ class GlamerSpinnersEffect extends OneShotEffect {
|
||||||
// Check for protection
|
// Check for protection
|
||||||
MageObject auraObject = game.getObject(auraId);
|
MageObject auraObject = game.getObject(auraId);
|
||||||
if (auraObject != null) {
|
if (auraObject != null) {
|
||||||
if (permanentToAttachAuras.cantBeAttachedBy(auraObject, game)) {
|
if (permanentToAttachAuras.cantBeAttachedBy(auraObject, game, true)) {
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.g;
|
package mage.cards.g;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
|
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -23,8 +21,9 @@ import mage.players.Player;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
||||||
*/
|
*/
|
||||||
public final class GryffsBoon extends CardImpl {
|
public final class GryffsBoon extends CardImpl {
|
||||||
|
@ -81,7 +80,7 @@ class GryffsBoonEffect extends OneShotEffect {
|
||||||
if (aura != null && controller != null
|
if (aura != null && controller != null
|
||||||
&& game.getState().getZone(aura.getId()) == Zone.GRAVEYARD) {
|
&& game.getState().getZone(aura.getId()) == Zone.GRAVEYARD) {
|
||||||
Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (!targetPermanent.cantBeAttachedBy(aura, game)) {
|
if (!targetPermanent.cantBeAttachedBy(aura, game, false)) {
|
||||||
game.getState().setValue("attachTo:" + aura.getId(), targetPermanent);
|
game.getState().setValue("attachTo:" + aura.getId(), targetPermanent);
|
||||||
controller.moveCards(aura, Zone.BATTLEFIELD, source, game);
|
controller.moveCards(aura, Zone.BATTLEFIELD, source, game);
|
||||||
return targetPermanent.addAttachment(aura.getId(), game);
|
return targetPermanent.addAttachment(aura.getId(), game);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package mage.cards.h;
|
package mage.cards.h;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
@ -15,11 +14,7 @@ import mage.abilities.keyword.DoubleStrikeAbility;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
|
@ -30,8 +25,9 @@ import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public final class HeavenlyBlademaster extends CardImpl {
|
public final class HeavenlyBlademaster extends CardImpl {
|
||||||
|
@ -120,7 +116,7 @@ class HeavenlyBlademasterEffect extends OneShotEffect {
|
||||||
).filter(
|
).filter(
|
||||||
attachment -> attachment != null
|
attachment -> attachment != null
|
||||||
).forEachOrdered((attachment) -> {
|
).forEachOrdered((attachment) -> {
|
||||||
if (!sourcePermanent.cantBeAttachedBy(attachment, game)) {
|
if (!sourcePermanent.cantBeAttachedBy(attachment, game, true)) {
|
||||||
if (attachment.getAttachedTo() != sourcePermanent.getId()) {
|
if (attachment.getAttachedTo() != sourcePermanent.getId()) {
|
||||||
if (attachment.getAttachedTo() != null) {
|
if (attachment.getAttachedTo() != null) {
|
||||||
Permanent fromPermanent = game.getPermanent(attachment.getAttachedTo());
|
Permanent fromPermanent = game.getPermanent(attachment.getAttachedTo());
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.n;
|
package mage.cards.n;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
@ -23,8 +21,9 @@ import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInGraveyard;
|
import mage.target.common.TargetCardInGraveyard;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
*/
|
*/
|
||||||
public final class NomadMythmaker extends CardImpl {
|
public final class NomadMythmaker extends CardImpl {
|
||||||
|
@ -91,7 +90,7 @@ class NomadMythmakerEffect extends OneShotEffect {
|
||||||
if (controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) {
|
if (controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) {
|
||||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||||
if (permanent != null
|
if (permanent != null
|
||||||
&& !permanent.cantBeAttachedBy(aura, game)) {
|
&& !permanent.cantBeAttachedBy(aura, game, false)) {
|
||||||
game.getState().setValue("attachTo:" + aura.getId(), permanent);
|
game.getState().setValue("attachTo:" + aura.getId(), permanent);
|
||||||
controller.moveCards(aura, Zone.BATTLEFIELD, source, game);
|
controller.moveCards(aura, Zone.BATTLEFIELD, source, game);
|
||||||
return permanent.addAttachment(aura.getId(), game);
|
return permanent.addAttachment(aura.getId(), game);
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.DiesAttachedTriggeredAbility;
|
import mage.abilities.common.DiesAttachedTriggeredAbility;
|
||||||
|
@ -25,8 +21,11 @@ import mage.players.Player;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
*/
|
*/
|
||||||
public final class ReinsOfTheVinesteed extends CardImpl {
|
public final class ReinsOfTheVinesteed extends CardImpl {
|
||||||
|
@ -97,7 +96,7 @@ class ReinsOfTheVinesteedEffect extends OneShotEffect {
|
||||||
if (controller != null
|
if (controller != null
|
||||||
&& controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) {
|
&& controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) {
|
||||||
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
|
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
|
||||||
if (!targetPermanent.cantBeAttachedBy(aura, game)) {
|
if (!targetPermanent.cantBeAttachedBy(aura, game, false)) {
|
||||||
game.getState().setValue("attachTo:" + aura.getId(), targetPermanent);
|
game.getState().setValue("attachTo:" + aura.getId(), targetPermanent);
|
||||||
controller.moveCards(aura, Zone.BATTLEFIELD, source, game);
|
controller.moveCards(aura, Zone.BATTLEFIELD, source, game);
|
||||||
return targetPermanent.addAttachment(aura.getId(), game);
|
return targetPermanent.addAttachment(aura.getId(), game);
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -23,8 +18,12 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author L_J
|
* @author L_J
|
||||||
*/
|
*/
|
||||||
public final class Retether extends CardImpl {
|
public final class Retether extends CardImpl {
|
||||||
|
@ -105,7 +104,7 @@ class RetetherEffect extends OneShotEffect {
|
||||||
target.setTargetName("creature to enchant (" + aura.getLogName() + ')');
|
target.setTargetName("creature to enchant (" + aura.getLogName() + ')');
|
||||||
if (controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) {
|
if (controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) {
|
||||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||||
if (permanent != null && !permanent.cantBeAttachedBy(aura, game)) {
|
if (permanent != null && !permanent.cantBeAttachedBy(aura, game, true)) {
|
||||||
auraMap.put(aura, permanent);
|
auraMap.put(aura, permanent);
|
||||||
game.getState().setValue("attachTo:" + aura.getId(), permanent);
|
game.getState().setValue("attachTo:" + aura.getId(), permanent);
|
||||||
continue auraCardsInGraveyard;
|
continue auraCardsInGraveyard;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageItem;
|
import mage.MageItem;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -32,8 +30,9 @@ import mage.target.Target;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author anonymous
|
* @author anonymous
|
||||||
*/
|
*/
|
||||||
public final class SimicGuildmage extends CardImpl {
|
public final class SimicGuildmage extends CardImpl {
|
||||||
|
@ -197,7 +196,7 @@ class MoveAuraEffect extends OneShotEffect {
|
||||||
Permanent permanentToAttachAura = game.getPermanent(chosenPermanentToAttachAuras.getFirstTarget());
|
Permanent permanentToAttachAura = game.getPermanent(chosenPermanentToAttachAuras.getFirstTarget());
|
||||||
if (permanentToAttachAura != null) {
|
if (permanentToAttachAura != null) {
|
||||||
// Check for protection
|
// Check for protection
|
||||||
if (permanentToAttachAura.cantBeAttachedBy(aura, game)) {
|
if (permanentToAttachAura.cantBeAttachedBy(aura, game, true)) {
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
if (passed) {
|
if (passed) {
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -19,11 +15,7 @@ import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.Filter;
|
import mage.filter.Filter;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
|
@ -39,8 +31,12 @@ import mage.target.TargetCard;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.targetpointer.FixedTargets;
|
import mage.target.targetpointer.FixedTargets;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class StormHerald extends CardImpl {
|
public final class StormHerald extends CardImpl {
|
||||||
|
@ -113,7 +109,7 @@ class StormHeraldEffect extends OneShotEffect {
|
||||||
targetCreature.setNotTarget(true);
|
targetCreature.setNotTarget(true);
|
||||||
if (controller.choose(Outcome.PutCardInPlay, targetCreature, source.getSourceId(), game)) {
|
if (controller.choose(Outcome.PutCardInPlay, targetCreature, source.getSourceId(), game)) {
|
||||||
Permanent targetPermanent = game.getPermanent(targetCreature.getFirstTarget());
|
Permanent targetPermanent = game.getPermanent(targetCreature.getFirstTarget());
|
||||||
if (!targetPermanent.cantBeAttachedBy(auraCard, game)) {
|
if (!targetPermanent.cantBeAttachedBy(auraCard, game, true)) {
|
||||||
game.getState().setValue("attachTo:" + auraCard.getId(), targetPermanent);
|
game.getState().setValue("attachTo:" + auraCard.getId(), targetPermanent);
|
||||||
controller.moveCards(auraCard, Zone.BATTLEFIELD, source, game);
|
controller.moveCards(auraCard, Zone.BATTLEFIELD, source, game);
|
||||||
targetPermanent.addAttachment(auraCard.getId(), game);
|
targetPermanent.addAttachment(auraCard.getId(), game);
|
||||||
|
@ -175,13 +171,10 @@ class StormHeraldReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@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.ZONE_CHANGE
|
return event.getType() == GameEvent.EventType.ZONE_CHANGE
|
||||||
&& ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD
|
&& ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD
|
||||||
&& ((ZoneChangeEvent) event).getToZone() != Zone.EXILED
|
&& ((ZoneChangeEvent) event).getToZone() != Zone.EXILED
|
||||||
&& getTargetPointer().getTargets(game, source).contains(event.getTargetId())) {
|
&& getTargetPointer().getTargets(game, source).contains(event.getTargetId());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -135,7 +135,7 @@ class TravelingPlagueEffect extends OneShotEffect {
|
||||||
target.setNotTarget(true);
|
target.setNotTarget(true);
|
||||||
if (controllerOfEnchantedCreature.choose(Outcome.Detriment, target, source.getSourceId(), game)) {
|
if (controllerOfEnchantedCreature.choose(Outcome.Detriment, target, source.getSourceId(), game)) {
|
||||||
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
|
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
|
||||||
if (!targetPermanent.cantBeAttachedBy(travelingPlague, game)) {
|
if (!targetPermanent.cantBeAttachedBy(travelingPlague, game, false)) {
|
||||||
game.getState().setValue("attachTo:" + travelingPlague.getId(), targetPermanent);
|
game.getState().setValue("attachTo:" + travelingPlague.getId(), targetPermanent);
|
||||||
controllerOfEnchantedCreature.moveCards(travelingPlague, Zone.BATTLEFIELD, source, game);
|
controllerOfEnchantedCreature.moveCards(travelingPlague, Zone.BATTLEFIELD, source, game);
|
||||||
return targetPermanent.addAttachment(travelingPlague.getId(), game);
|
return targetPermanent.addAttachment(travelingPlague.getId(), game);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.v;
|
package mage.cards.v;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
@ -16,8 +14,9 @@ import mage.filter.FilterPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Derpthemeus
|
* @author Derpthemeus
|
||||||
*/
|
*/
|
||||||
public final class VulshokBattlemaster extends CardImpl {
|
public final class VulshokBattlemaster extends CardImpl {
|
||||||
|
@ -69,7 +68,7 @@ public final class VulshokBattlemaster extends CardImpl {
|
||||||
for (Permanent equipment : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
for (Permanent equipment : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||||
if (equipment != null) {
|
if (equipment != null) {
|
||||||
//If an Equipment can't equip Vulshok Battlemaster, it isn't attached to the Battlemaster, and it doesn't become unattached (if it's attached to a creature). (https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=48125)
|
//If an Equipment can't equip Vulshok Battlemaster, it isn't attached to the Battlemaster, and it doesn't become unattached (if it's attached to a creature). (https://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=48125)
|
||||||
if (!battlemaster.cantBeAttachedBy(equipment, game)) {
|
if (!battlemaster.cantBeAttachedBy(equipment, game, false)) {
|
||||||
battlemaster.addAttachment(equipment.getId(), game);
|
battlemaster.addAttachment(equipment.getId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -740,11 +740,11 @@ public class ContinuousEffects implements Serializable {
|
||||||
* @param event
|
* @param event
|
||||||
* @param targetAbility ability the event is attached to. can be null.
|
* @param targetAbility ability the event is attached to. can be null.
|
||||||
* @param game
|
* @param game
|
||||||
* @param checkPlayableMode true if the event does not really happen but
|
* @param silentMode true if the event does not really happen but
|
||||||
* it's checked if the event would be replaced
|
* it's checked if the event would be replaced
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean preventedByRuleModification(GameEvent event, Ability targetAbility, Game game, boolean checkPlayableMode) {
|
public boolean preventedByRuleModification(GameEvent event, Ability targetAbility, Game game, boolean silentMode) {
|
||||||
for (ContinuousRuleModifyingEffect effect : continuousRuleModifyingEffects) {
|
for (ContinuousRuleModifyingEffect effect : continuousRuleModifyingEffects) {
|
||||||
if (!effect.checksEventType(event, game)) {
|
if (!effect.checksEventType(event, game)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -755,7 +755,7 @@ public class ContinuousEffects implements Serializable {
|
||||||
if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) {
|
if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) {
|
||||||
effect.setValue("targetAbility", targetAbility);
|
effect.setValue("targetAbility", targetAbility);
|
||||||
if (effect.applies(event, sourceAbility, game)) {
|
if (effect.applies(event, sourceAbility, game)) {
|
||||||
if (!game.inCheckPlayableState()) {
|
if (!game.inCheckPlayableState() && !silentMode) {
|
||||||
String message = effect.getInfoMessage(sourceAbility, event, game);
|
String message = effect.getInfoMessage(sourceAbility, event, game);
|
||||||
if (message != null && !message.isEmpty()) {
|
if (message != null && !message.isEmpty()) {
|
||||||
if (effect.sendMessageToUser()) {
|
if (effect.sendMessageToUser()) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.filter.predicate.permanent;
|
package mage.filter.predicate.permanent;
|
||||||
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
|
@ -19,7 +18,7 @@ public class CanBeEnchantedByPredicate implements Predicate<Permanent> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Permanent input, Game game) {
|
public boolean apply(Permanent input, Game game) {
|
||||||
return !input.cantBeAttachedBy(auraEnchantment, game);
|
return !input.cantBeAttachedBy(auraEnchantment, game, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1971,12 +1971,12 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
Filter auraFilter = spellAbility.getTargets().get(0).getFilter();
|
Filter auraFilter = spellAbility.getTargets().get(0).getFilter();
|
||||||
if (auraFilter instanceof FilterControlledPermanent) {
|
if (auraFilter instanceof FilterControlledPermanent) {
|
||||||
if (!((FilterControlledPermanent) auraFilter).match(attachedTo, perm.getId(), perm.getControllerId(), this)
|
if (!((FilterControlledPermanent) auraFilter).match(attachedTo, perm.getId(), perm.getControllerId(), this)
|
||||||
|| attachedTo.cantBeAttachedBy(perm, this)) {
|
|| attachedTo.cantBeAttachedBy(perm, this, true)) {
|
||||||
if (movePermanentToGraveyardWithInfo(perm)) {
|
if (movePermanentToGraveyardWithInfo(perm)) {
|
||||||
somethingHappened = true;
|
somethingHappened = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!auraFilter.match(attachedTo, this) || attachedTo.cantBeAttachedBy(perm, this)) {
|
} else if (!auraFilter.match(attachedTo, this) || attachedTo.cantBeAttachedBy(perm, this, true)) {
|
||||||
// handle bestow unattachment
|
// handle bestow unattachment
|
||||||
Card card = this.getCard(perm.getId());
|
Card card = this.getCard(perm.getId());
|
||||||
if (card != null && card.isCreature()) {
|
if (card != null && card.isCreature()) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.game.permanent;
|
package mage.game.permanent;
|
||||||
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
|
@ -101,7 +100,13 @@ public interface Permanent extends Card, Controllable {
|
||||||
|
|
||||||
boolean hasProtectionFrom(MageObject source, Game game);
|
boolean hasProtectionFrom(MageObject source, Game game);
|
||||||
|
|
||||||
boolean cantBeAttachedBy(MageObject source, Game game);
|
/**
|
||||||
|
* @param source
|
||||||
|
* @param game
|
||||||
|
* @param silentMode - use it to ignore warning message for users (e.g. for checking only)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean cantBeAttachedBy(MageObject source, Game game, boolean silentMode);
|
||||||
|
|
||||||
boolean wasControlledFromStartOfControllerTurn();
|
boolean wasControlledFromStartOfControllerTurn();
|
||||||
|
|
||||||
|
@ -210,7 +215,6 @@ public interface Permanent extends Card, Controllable {
|
||||||
void setMaxBlockedBy(int maxBlockedBy);
|
void setMaxBlockedBy(int maxBlockedBy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param defenderId id of planeswalker or player to attack - can be empty
|
* @param defenderId id of planeswalker or player to attack - can be empty
|
||||||
* to check generally
|
* to check generally
|
||||||
* @param game
|
* @param game
|
||||||
|
@ -282,7 +286,7 @@ public interface Permanent extends Card, Controllable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get card that was imprinted on this one.
|
* Get card that was imprinted on this one.
|
||||||
*
|
* <p>
|
||||||
* Can be null if no card was imprinted.
|
* Can be null if no card was imprinted.
|
||||||
*
|
*
|
||||||
* @return Imprinted card UUID.
|
* @return Imprinted card UUID.
|
||||||
|
|
|
@ -1076,7 +1076,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean cantBeAttachedBy(MageObject source, Game game) {
|
public boolean cantBeAttachedBy(MageObject source, Game game, boolean silentMode) {
|
||||||
for (ProtectionAbility ability : this.getAbilities(game).getProtectionAbilities()) {
|
for (ProtectionAbility ability : this.getAbilities(game).getProtectionAbilities()) {
|
||||||
if (!(source.hasSubtype(SubType.AURA, game)
|
if (!(source.hasSubtype(SubType.AURA, game)
|
||||||
&& !ability.removesAuras())
|
&& !ability.removesAuras())
|
||||||
|
@ -1085,7 +1085,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(EventType.STAY_ATTACHED, objectId, source.getId(), null), null, game, false);
|
return game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(EventType.STAY_ATTACHED, objectId, source.getId(), null), null, game, silentMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canDamage(MageObject source, Game game) {
|
protected boolean canDamage(MageObject source, Game game) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue