Merge pull request #2885 from Card-Forge/battles-should-exile-and-cast

Battles need to exile then cast. Transformed backside require SpellPe…
This commit is contained in:
Anthony Calosa
2023-04-11 13:31:19 +08:00
committed by GitHub
9 changed files with 54 additions and 15 deletions

View File

@@ -2929,10 +2929,13 @@ public class AbilityUtils {
} }
public static final List<SpellAbility> getBasicSpellsFromPlayEffect(final Card tgtCard, final Player controller) { public static final List<SpellAbility> getBasicSpellsFromPlayEffect(final Card tgtCard, final Player controller) {
return getBasicSpellsFromPlayEffect(tgtCard, controller, CardStateName.Original);
}
public static final List<SpellAbility> getBasicSpellsFromPlayEffect(final Card tgtCard, final Player controller, CardStateName state) {
List<SpellAbility> sas = new ArrayList<>(); List<SpellAbility> sas = new ArrayList<>();
List<SpellAbility> list = Lists.newArrayList(tgtCard.getBasicSpells()); List<SpellAbility> list = Lists.newArrayList(tgtCard.getBasicSpells());
CardState original = tgtCard.getState(state);
CardState original = tgtCard.getState(CardStateName.Original);
if (tgtCard.isFaceDown()) { if (tgtCard.isFaceDown()) {
list.addAll(Lists.newArrayList(tgtCard.getBasicSpells(original))); list.addAll(Lists.newArrayList(tgtCard.getBasicSpells(original)));
} else { } else {

View File

@@ -286,9 +286,20 @@ public class PlayEffect extends SpellAbilityEffect {
} }
} }
CardStateName state = CardStateName.Original;
if (sa.hasParam("CastTransformed")) {
if (!tgtCard.changeToState(CardStateName.Transformed)) {
// Failed to transform. In the future, we might need to just remove this option and continue
amount--;
continue;
}
state = CardStateName.Transformed;
}
// TODO if cost isn't replaced should include alternative ones // TODO if cost isn't replaced should include alternative ones
// get basic spells (no flashback, etc.) // get basic spells (no flashback, etc.)
List<SpellAbility> sas = AbilityUtils.getBasicSpellsFromPlayEffect(tgtCard, controller); List<SpellAbility> sas = AbilityUtils.getBasicSpellsFromPlayEffect(tgtCard, controller, state);
if (sa.hasParam("ValidSA")) { if (sa.hasParam("ValidSA")) {
final String valid[] = sa.getParam("ValidSA").split(","); final String valid[] = sa.getParam("ValidSA").split(",");
sas = Lists.newArrayList(Iterables.filter(sas, SpellAbilityPredicates.isValid(valid, controller , source, sa))); sas = Lists.newArrayList(Iterables.filter(sas, SpellAbilityPredicates.isValid(valid, controller , source, sa)));
@@ -312,14 +323,6 @@ public class PlayEffect extends SpellAbilityEffect {
// For Illusionary Mask effect // For Illusionary Mask effect
tgtSA = CardFactoryUtil.abilityMorphDown(tgtCard.getCurrentState(), false); tgtSA = CardFactoryUtil.abilityMorphDown(tgtCard.getCurrentState(), false);
} else { } else {
if (sa.hasParam("CastTransformed")) {
if (!tgtCard.changeToState(CardStateName.Transformed)) {
// Failed to transform. In the future, we might need to just remove this option and continue
amount--;
continue;
}
}
tgtSA = sa.getActivatingPlayer().getController().getAbilityToPlay(tgtCard, sas); tgtSA = sa.getActivatingPlayer().getController().getAbilityToPlay(tgtCard, sas);
} }

View File

@@ -3943,10 +3943,15 @@ public class CardFactoryUtil {
triggerDefeated.append("Mode$ CounterRemovedOnce | ValidCard$ Card.Self | Secondary$ True | CounterType$ DEFENSE | Remaining$ 0 | TriggerZones$ Battlefield | "); triggerDefeated.append("Mode$ CounterRemovedOnce | ValidCard$ Card.Self | Secondary$ True | CounterType$ DEFENSE | Remaining$ 0 | TriggerZones$ Battlefield | ");
triggerDefeated.append(" TriggerDescription$ When CARDNAME is defeated, exile it, then cast it transformed."); triggerDefeated.append(" TriggerDescription$ When CARDNAME is defeated, exile it, then cast it transformed.");
String castDefeatedBattle = "DB$ Play | Defined$ Self | WithoutManaCost$ True | CastTransformed$ True"; String castExileBattle = "DB$ ChangeZone | Defined$ Self | Origin$ Battlefield | Destination$ Exile | RememberChanged$ True";
String castDefeatedBattle = "DB$ Play | Defined$ Remembered | WithoutManaCost$ True | CastTransformed$ True";
Trigger defeatedTrigger = TriggerHandler.parseTrigger(triggerDefeated.toString(), card, true); Trigger defeatedTrigger = TriggerHandler.parseTrigger(triggerDefeated.toString(), card, true);
defeatedTrigger.setOverridingAbility(AbilityFactory.getAbility(castDefeatedBattle, card)); SpellAbility exileAbility = AbilityFactory.getAbility(castExileBattle, card);
AbilitySub castAbility = (AbilitySub)AbilityFactory.getAbility(castDefeatedBattle, card);
exileAbility.setSubAbility(castAbility);
defeatedTrigger.setOverridingAbility(exileAbility);
card.addTrigger(defeatedTrigger); card.addTrigger(defeatedTrigger);
} }

View File

@@ -3,7 +3,7 @@ ManaCost:X G G
Types:Creature Hydra Types:Creature Hydra
PT:1/1 PT:1/1
K:etbCounter:P1P1:X K:etbCounter:P1P1:X
R:Event$ AddCounter | ActiveZones$ Battlefield | ValidCard$ Creature.YouCtrl+inZoneBattlefield | ValidCounterType$ P1P1 | ReplaceWith$ AddOneMoreCounters | Description$ If one or more +1/+1 counters would be put on a creature you control, that many plus one +1/+1 counters are put on it instead. R:Event$ AddCounter | ActiveZones$ Battlefield | ValidCard$ Creature.YouCtrl+inZoneBattlefield+Other | ValidCounterType$ P1P1 | ReplaceWith$ AddOneMoreCounters | Description$ If one or more +1/+1 counters would be put on another creature you control, that many plus one +1/+1 counters are put on it instead.
SVar:AddOneMoreCounters:DB$ ReplaceCounter | ValidCounterType$ P1P1 | ChooseCounter$ True | Amount$ Y SVar:AddOneMoreCounters:DB$ ReplaceCounter | ValidCounterType$ P1P1 | ChooseCounter$ True | Amount$ Y
A:AB$ PutCounter | Cost$ T SubCounter<1/P1P1> | ValidTgts$ Creature.YouCtrl+Other | CounterType$ P1P1 | CounterNum$ 1 | SpellDescription$ Put a +1/+1 counter on another target creature you control. A:AB$ PutCounter | Cost$ T SubCounter<1/P1P1> | ValidTgts$ Creature.YouCtrl+Other | CounterType$ P1P1 | CounterNum$ 1 | SpellDescription$ Put a +1/+1 counter on another target creature you control.
SVar:X:Count$xPaid SVar:X:Count$xPaid

View File

@@ -3,7 +3,7 @@ ManaCost:2 U
Types:Creature Bird Artificer Types:Creature Bird Artificer
PT:1/1 PT:1/1
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPutCounter | TriggerDescription$ Homunculus Servant — When CARDNAME enters the battlefield, put three +1/+1 counters on up to one target noncreature artifact. That artifact becomes a 0/0 Homunculus artifact creature with flying. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPutCounter | TriggerDescription$ Homunculus Servant — When CARDNAME enters the battlefield, put three +1/+1 counters on up to one target noncreature artifact. That artifact becomes a 0/0 Homunculus artifact creature with flying.
SVar:TrigPutCounter:DB$ PutCounter | ValidTgts$ Artifact.nonCreature+YouCtrl | TgtPrompt$ Select up to one noncreature artifact | CounterType$ P1P1 | CounterNum$ 3 | MinTarget$ 0 | MaxTarget$ 1 | SubAbility$ TrigAnimate SVar:TrigPutCounter:DB$ PutCounter | ValidTgts$ Artifact.nonCreature+YouCtrl | TgtPrompt$ Select up to one noncreature artifact | CounterType$ P1P1 | CounterNum$ 3 | TargetMin$ 0 | TargetMax$ 1 | SubAbility$ TrigAnimate
SVar:TrigAnimate:DB$ Animate | Defined$ Targeted | Keywords$ Flying | Power$ 0 | Toughness$ 0 | Types$ Artifact,Creature,Homunculus | RemoveCreatureTypes$ True | Duration$ Permanent SVar:TrigAnimate:DB$ Animate | Defined$ Targeted | Keywords$ Flying | Power$ 0 | Toughness$ 0 | Types$ Artifact,Creature,Homunculus | RemoveCreatureTypes$ True | Duration$ Permanent
DeckHas:Ability$Counters & Type$Homunculus DeckHas:Ability$Counters & Type$Homunculus
DeckNeeds:Type$Artifact DeckNeeds:Type$Artifact

View File

@@ -3,7 +3,7 @@ ManaCost:2 U
Types:Creature Bird Artificer Types:Creature Bird Artificer
PT:1/3 PT:1/3
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPutCounter | TriggerDescription$ Homunculus Servant — When CARDNAME enters the battlefield, put three +1/+1 counters on up to one target noncreature artifact. That artifact becomes a 0/0 Homunculus artifact creature with flying. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPutCounter | TriggerDescription$ Homunculus Servant — When CARDNAME enters the battlefield, put three +1/+1 counters on up to one target noncreature artifact. That artifact becomes a 0/0 Homunculus artifact creature with flying.
SVar:TrigPutCounter:DB$ PutCounter | ValidTgts$ Artifact.nonCreature+YouCtrl | TgtPrompt$ Select up to one noncreature artifact | CounterType$ P1P1 | CounterNum$ 3 | MinTarget$ 0 | MaxTarget$ 1 | SubAbility$ TrigAnimate SVar:TrigPutCounter:DB$ PutCounter | ValidTgts$ Artifact.nonCreature+YouCtrl | TgtPrompt$ Select up to one noncreature artifact | CounterType$ P1P1 | CounterNum$ 3 | TargetMin$ 0 | TargetMax$ 1 | SubAbility$ TrigAnimate
SVar:TrigAnimate:DB$ Animate | Defined$ Targeted | Keywords$ Flying | Power$ 0 | Toughness$ 0 | Types$ Artifact,Creature,Homunculus | RemoveCreatureTypes$ True | Duration$ Permanent SVar:TrigAnimate:DB$ Animate | Defined$ Targeted | Keywords$ Flying | Power$ 0 | Toughness$ 0 | Types$ Artifact,Creature,Homunculus | RemoveCreatureTypes$ True | Duration$ Permanent
DeckHas:Ability$Counters & Type$Homunculus DeckHas:Ability$Counters & Type$Homunculus
DeckNeeds:Type$Artifact DeckNeeds:Type$Artifact

View File

@@ -0,0 +1,19 @@
Name:Invasion of Kylem
ManaCost:2 R W
Types:Battle Siege
Defense:5
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSearch | TriggerDescription$ When CARDNAME enters the battlefield, up to two target creatures each get +2/+0 and gain vigilance and haste until end of turn.
SVar:TrigSearch:DB$ Pump | TargetMin$ 0 | TargetMax$ 2 | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ 2 | KW$ Vigilance & Haste
Oracle:(As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) When Invasion of Kylem enters the battlefield, up to two target creatures each get +2/+0 and gain vigilance and haste until end of turn.
AlternateMode:DoubleFaced
ALTERNATE
Name:Valor's Reach Tag Team
ManaCost:no cost
Colors:red,white
Types:Sorcery
A:SP$ Token | TokenAmount$ 1 | TokenScript$ rw_3_2_warrior_symbiotic_attack | TokenAmount$ 2 | TokenOwner$ You | SpellDescription$ Create two 3/2 red and white Warrior creature tokens with “Whenever this creature and at least one other creature token attack, put a +1/+1 counter on this creature.”
DeckHas:Ability$Token & Type$Warrior
Oracle:Create two 3/2 red and white Warrior creature tokens with “Whenever this creature and at least one other creature token attack, put a +1/+1 counter on this creature.”

View File

@@ -15,6 +15,7 @@ ManaCost:no cost
Colors:green Colors:green
Types:Creature Elemental Types:Creature Elemental
PT:4/4 PT:4/4
A:SP$ PermanentCreature
K:Vigilance K:Vigilance
K:Haste K:Haste
S:Mode$ Continuous | Affected$ Card.Self | AddType$ Land | Description$ As long as Awakened Skyclave is on the battlefield, its a land in addition to its other types. S:Mode$ Continuous | Affected$ Card.Self | AddType$ Land | Description$ As long as Awakened Skyclave is on the battlefield, its a land in addition to its other types.

View File

@@ -0,0 +1,8 @@
Name:Warrior Token
ManaCost:no cost
Colors:red,white
Types:Creature Warrior
PT:3/2
T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | IsPresent$ Creature.attacking+token+Other | PresentCompare$ GE1 | Execute$ TrigPutCounter | TriggerDescription$ Whenever CARDNAME and at least one other creature token attack, put a +1/+1 counter on CARDNAME.
SVar:TrigPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1
Oracle:Whenever this creature and at least one other creature token attack, put a +1/+1 counter on this creature.