mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Improved handling of the "Optional" parameter in AF Play.
This commit is contained in:
@@ -7,7 +7,7 @@ K:Islandwalk
|
|||||||
K:Swampwalk
|
K:Swampwalk
|
||||||
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigPump | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, you may cast target instant or sorcery card from that player's graveyard without paying its mana cost. If that card would be put into a graveyard this turn, exile it instead.
|
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigPump | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, you may cast target instant or sorcery card from that player's graveyard without paying its mana cost. If that card would be put into a graveyard this turn, exile it instead.
|
||||||
SVar:TrigPump:AB$ Pump | Cost$ 0 | TgtZone$ Graveyard | ValidTgts$ Instant.YouDontCtrl,Sorcery.YouDontCtrl | TgtPrompt$ Choose target instant or sorcery card from an opponent's graveyard | KW$ HIDDEN If CARDNAME would be put into a graveyard, exile it instead. | PumpZone$ Graveyard | SubAbility$ TrigPlay
|
SVar:TrigPump:AB$ Pump | Cost$ 0 | TgtZone$ Graveyard | ValidTgts$ Instant.YouDontCtrl,Sorcery.YouDontCtrl | TgtPrompt$ Choose target instant or sorcery card from an opponent's graveyard | KW$ HIDDEN If CARDNAME would be put into a graveyard, exile it instead. | PumpZone$ Graveyard | SubAbility$ TrigPlay
|
||||||
SVar:TrigPlay:DB$ Play | Defined$ Targeted | WithoutManaCost$ True
|
SVar:TrigPlay:DB$ Play | Defined$ Targeted | WithoutManaCost$ True | Optional$ True
|
||||||
SVar:Rarity:Mythic
|
SVar:Rarity:Mythic
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/wrexial_the_risen_deep.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/wrexial_the_risen_deep.jpg
|
||||||
SetInfo:COM|Mythic|http://magiccards.info/scans/en/cmd/239.jpg
|
SetInfo:COM|Mythic|http://magiccards.info/scans/en/cmd/239.jpg
|
||||||
|
|||||||
@@ -324,6 +324,7 @@ public final class AbilityFactoryPlay {
|
|||||||
final HashMap<String, String> params = af.getMapParams();
|
final HashMap<String, String> params = af.getMapParams();
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
Player activator = sa.getActivatingPlayer();
|
Player activator = sa.getActivatingPlayer();
|
||||||
|
boolean optional = params.containsKey("Optional");
|
||||||
int amount = 1;
|
int amount = 1;
|
||||||
if (params.containsKey("Amount")) {
|
if (params.containsKey("Amount")) {
|
||||||
amount = AbilityFactory.calculateAmount(source, params.get("Amount"), sa);
|
amount = AbilityFactory.calculateAmount(source, params.get("Amount"), sa);
|
||||||
@@ -386,7 +387,7 @@ public final class AbilityFactoryPlay {
|
|||||||
}
|
}
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Do you want to play " + tgtCard + "?");
|
sb.append("Do you want to play " + tgtCard + "?");
|
||||||
if (controller.isHuman() && params.containsKey("Optional")
|
if (controller.isHuman() && optional
|
||||||
&& !GameActionUtil.showYesNoDialog(source, sb.toString())) {
|
&& !GameActionUtil.showYesNoDialog(source, sb.toString())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -420,7 +421,7 @@ public final class AbilityFactoryPlay {
|
|||||||
tgtSA = sas.get(0);
|
tgtSA = sas.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tgtSA.getTarget() != null && !params.containsKey("Optional")) {
|
if (tgtSA.getTarget() != null && !optional) {
|
||||||
tgtSA.getTarget().setMandatory(true);
|
tgtSA.getTarget().setMandatory(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,8 +442,7 @@ public final class AbilityFactoryPlay {
|
|||||||
} else {
|
} else {
|
||||||
if (tgtSA instanceof Spell) {
|
if (tgtSA instanceof Spell) {
|
||||||
Spell spell = (Spell) tgtSA;
|
Spell spell = (Spell) tgtSA;
|
||||||
if (spell.canPlayFromEffectAI(false, true)) {
|
if (spell.canPlayFromEffectAI(!optional, true) || !optional) {
|
||||||
//System.out.println("canPlayFromEffectAI: " + this.getHostCard());
|
|
||||||
ComputerUtil.playSpellAbilityWithoutPayingManaCost(tgtSA);
|
ComputerUtil.playSpellAbilityWithoutPayingManaCost(tgtSA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -450,8 +450,13 @@ public final class AbilityFactoryPlay {
|
|||||||
} else {
|
} else {
|
||||||
if (controller.isHuman()) {
|
if (controller.isHuman()) {
|
||||||
Singletons.getModel().getGameAction().playSpellAbility(tgtSA);
|
Singletons.getModel().getGameAction().playSpellAbility(tgtSA);
|
||||||
} else if (tgtSA.canPlayAI()) {
|
} else {
|
||||||
ComputerUtil.playStack(tgtSA);
|
if (tgtSA instanceof Spell) {
|
||||||
|
Spell spell = (Spell) tgtSA;
|
||||||
|
if (spell.canPlayFromEffectAI(!optional, false) || !optional) {
|
||||||
|
ComputerUtil.playStack(tgtSA);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user