mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
CantAttach: remove 'can't be enchanted in the future'
This commit is contained in:
@@ -374,7 +374,7 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
|
||||
|
||||
public boolean canBeAttachedBy(final Card attach, boolean checkSBA) {
|
||||
// master mode
|
||||
if (!attach.isAttachment() || attach.isCreature()) {
|
||||
if (!attach.isAttachment() || attach.isCreature() || equals(attach)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5188,9 +5188,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
}
|
||||
|
||||
return !((hasKeyword("CARDNAME can't be enchanted in the future.") && !isEnchantedBy(aura))
|
||||
|| (hasKeyword("CARDNAME can't be enchanted.") && !aura.getName().equals("Anti-Magic Aura")
|
||||
&& !(aura.getName().equals("Consecrate Land") && aura.isInZone(ZoneType.Battlefield))));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -401,11 +401,11 @@ public class CardProperty {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("AttachedBy")) {
|
||||
if (!card.isEquippedBy(source) && !card.isEnchantedBy(source) && !card.isFortifiedBy(source)) {
|
||||
if (!card.isAttachedBy(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("Attached")) {
|
||||
if (card.getEquipping() != source && !source.equals(card.getAttaching())) {
|
||||
if (!source.isAttachedBy(card)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("AttachedTo")) {
|
||||
@@ -433,8 +433,7 @@ public class CardProperty {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ((card.getAttaching() == null || !card.getAttaching().isValid(restriction, sourceController, source, spellAbility))
|
||||
&& (card.getEquipping() == null || !card.getEquipping().isValid(restriction, sourceController, source, spellAbility))) {
|
||||
if ((card.getAttaching() == null || !card.getAttaching().isValid(restriction, sourceController, source, spellAbility))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -444,7 +443,7 @@ public class CardProperty {
|
||||
return false;
|
||||
}
|
||||
} else if (property.equals("NotAttachedTo")) {
|
||||
if (card.getEquipping() == source || source.equals(card.getAttaching())) {
|
||||
if (source.isAttachedBy(card)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("EnchantedBy")) {
|
||||
@@ -546,7 +545,7 @@ public class CardProperty {
|
||||
final SpellAbility saTargeting = sa.getSATargetingCard();
|
||||
if (saTargeting != null) {
|
||||
for (final Card c : saTargeting.getTargets().getTargetCards()) {
|
||||
if (!card.isEquippedBy(c)) {
|
||||
if (!card.isAttachedBy(c)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -554,16 +553,16 @@ public class CardProperty {
|
||||
}
|
||||
} else if (property.substring(10).equals("Enchanted")) {
|
||||
if (source.getEnchantingCard() == null ||
|
||||
!card.isEquippedBy(source.getEnchantingCard())) {
|
||||
!card.isAttachedBy(source.getEnchantingCard())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!card.isEquippedBy(source)) {
|
||||
if (!card.isAttachedBy(source)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("FortifiedBy")) {
|
||||
if (!card.isFortifiedBy(source)) {
|
||||
if (!card.isAttachedBy(source)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("CanBeAttachedBy")) {
|
||||
|
||||
@@ -17,6 +17,18 @@ public class StaticAbilityCantAttach {
|
||||
&& !target.isValid(stAb.getParam("Target").split(","), hostCard.getController(), hostCard, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stAb.hasParam("ValidCardToTarget")) {
|
||||
if (!(target instanceof Card)) {
|
||||
return false;
|
||||
}
|
||||
Card tcard = (Card) target;
|
||||
|
||||
if (!card.isValid(stAb.getParam("ValidCardToTarget").split(","), tcard.getController(), tcard, null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user