CardProperty: add CastSA to card

ForgeScript: add mayPlaySource
This commit is contained in:
Hanmac
2018-03-24 18:00:09 +01:00
parent b6e80a9e3f
commit 5b159a0e64
4 changed files with 23 additions and 17 deletions

View File

@@ -7,6 +7,7 @@ import forge.game.card.Card;
import forge.game.card.CardState;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.staticability.StaticAbility;
import forge.util.Expressions;
public class ForgeScript {
@@ -179,6 +180,14 @@ public class ForgeScript {
if (!sa.hasParam("Equip")) {
return false;
}
} else if (property.equals("MayPlaySource")) {
StaticAbility m = sa.getMayPlay();
if (m == null) {
return false;
}
if (!source.equals(m.getHostCard())) {
return false;
}
} else if (property.startsWith("IsTargeting")) {
String k[] = property.split(" ", 2);
boolean found = false;

View File

@@ -1683,6 +1683,15 @@ public class CardProperty {
if (card.hasCounters()) {
return false;
}
} else if (property.startsWith("CastSa")) {
SpellAbility castSA = card.getCastSA();
if (castSA == null) {
return false;
}
String v = property.substring(7);
if (!castSA.isValid(v, sourceController, source, spellAbility)) {
return false;
}
} else if (property.equals("wasCast")) {
if (null == card.getCastFrom()) {
return false;