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;

View File

@@ -1,16 +1,10 @@
Name:Bosium Strip
ManaCost:3
Types:Artifact
A:AB$ Effect | Cost$ 3 T | Triggers$ TrigBosiumStrip1,TrigBosiumStrip2 | ReplacementEffects$ REBosiumStrip | StaticAbilities$ STBosiumStrip | SVars$ RememberCastFromGrave,MoveExile,DBCleanup | RememberObjects$ TriggeredCard | SpellDescription$ Until end of turn, if the top card of your graveyard is an instant or sorcery card, you may cast that card. If a card cast this way would be put into a graveyard this turn, exile it instead.
A:AB$ Effect | Cost$ 3 T | ReplacementEffects$ REBosiumStrip | StaticAbilities$ STBosiumStrip | SVars$ MoveExile | SpellDescription$ Until end of turn, if the top card of your graveyard is an instant or sorcery card, you may cast that card. If a card cast this way would be put into a graveyard this turn, exile it instead.
SVar:STBosiumStrip:Mode$ Continuous | Affected$ Card.TopGraveyard+Instant+YouCtrl,Card.TopGraveyard+Sorcery+YouCtrl | MayPlay$ True | EffectZone$ Command | AffectedZone$ Graveyard | Description$ Until end of turn, if the top card of your graveyard is an instant or sorcery card, you may cast that card. If a card cast this way would be put into a graveyard this turn, exile it instead.
SVar:TrigBosiumStrip1:Mode$ ChangesZone | ValidCard$ Card.Instant+YouCtrl,Card.Sorcery+YouCtrl | Origin$ Graveyard | Destination$ Stack | TriggerZones$ Command | Execute$ RememberCastFromGrave | Static$ True
SVar:TrigBosiumStrip2:Mode$ ChangesZone | ValidCard$ Instant.YouCtrl+IsRemembered,Sorcery.YouCtrl+IsRemembered | Origin$ Stack | Destination$ Hand,Library,Exile | TriggerZones$ Command | Execute$ DBCleanup | Static$ True
SVar:RememberCastFromGrave:DB$ Pump | RememberObjects$ TriggeredCard
# TODO: find a better way to check "card cast this way" to interact properly with other cards that allow you to cast cards from graveyard
# but not exile them (also relevant for Kess, Dissident Mage)
SVar:REBosiumStrip:Event$ Moved | ActiveZones$ Command | ValidCard$ Instant.YouCtrl+IsRemembered,Sorcery.YouCtrl+IsRemembered | Origin$ Stack | Destination$ Graveyard | ReplaceWith$ MoveExile
SVar:MoveExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Stack | Destination$ Exile | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:REBosiumStrip:Event$ Moved | ValidCard$ Card.CastSa Spell.MayPlaySource | Origin$ Stack | Destination$ Graveyard | ReplaceWith$ MoveExile
SVar:MoveExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Stack | Destination$ Exile
SVar:NeedsOrderedGraveyard:TRUE
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/bosium_strip.jpg

View File

@@ -4,13 +4,7 @@ Types:Legendary Creature Human Wizard
PT:3/4
K:Flying
S:Mode$ Continuous | Affected$ Instant.YouCtrl,Sorcery.YouCtrl | Condition$ PlayerTurn | MayPlay$ True | MayPlayLimit$ 1 | EffectZone$ Battlefield | AffectedZone$ Graveyard | Description$ During each of your turns, you may cast an instant or sorcery card from your graveyard. If a card cast this way would be put into your graveyard this turn, exile it instead.
T:Mode$ ChangesZone | ValidCard$ Instant.YouCtrl,Sorcery.YouCtrl | Origin$ Graveyard | Destination$ Stack | TriggerZones$ Battlefield | Execute$ RememberCastFromGrave | Static$ True
T:Mode$ ChangesZone | ValidCard$ Instant.YouCtrl+IsRemembered,Sorcery.YouCtrl+IsRemembered | Origin$ Stack | Destination$ Hand,Library,Exile | TriggerZones$ Battlefield | Execute$ DBCleanup | Static$ True
SVar:RememberCastFromGrave:DB$ Pump | RememberObjects$ TriggeredCard
# TODO: find a better way to check "card cast this way" to interact properly with other cards that allow you to cast cards from graveyard
# but not exile them (also relevant for Bosium Strip)
R:Event$ Moved | ValidCard$ Instant.YouCtrl+IsRemembered,Sorcery.YouCtrl+IsRemembered | Origin$ Stack | Destination$ Graveyard | ReplaceWith$ MoveExile
SVar:MoveExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Stack | Destination$ Exile | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
R:Event$ Moved | ValidCard$ Card.CastSa Spell.MayPlaySource | Origin$ Stack | Destination$ Graveyard | ReplaceWith$ MoveExile
SVar:MoveExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Stack | Destination$ Exile
SVar:Picture:http://www.wizards.com/global/images/magic/general/kess_dissident_mage.jpg
Oracle:Flying\nDuring each of your turns, you may cast an instant or sorcery card from your graveyard. If a card cast this way would be put into your graveyard this turn, exile it instead.