mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
CardProperty: add CastSA to card
ForgeScript: add mayPlaySource
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user