mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- Improved handling of the "Optional" parameter in AF Play.
This commit is contained in:
@@ -7,7 +7,7 @@ K:Islandwalk
|
||||
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.
|
||||
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: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
|
||||
|
||||
@@ -324,6 +324,7 @@ public final class AbilityFactoryPlay {
|
||||
final HashMap<String, String> params = af.getMapParams();
|
||||
final Card source = sa.getSourceCard();
|
||||
Player activator = sa.getActivatingPlayer();
|
||||
boolean optional = params.containsKey("Optional");
|
||||
int amount = 1;
|
||||
if (params.containsKey("Amount")) {
|
||||
amount = AbilityFactory.calculateAmount(source, params.get("Amount"), sa);
|
||||
@@ -386,7 +387,7 @@ public final class AbilityFactoryPlay {
|
||||
}
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("Do you want to play " + tgtCard + "?");
|
||||
if (controller.isHuman() && params.containsKey("Optional")
|
||||
if (controller.isHuman() && optional
|
||||
&& !GameActionUtil.showYesNoDialog(source, sb.toString())) {
|
||||
return;
|
||||
}
|
||||
@@ -420,7 +421,7 @@ public final class AbilityFactoryPlay {
|
||||
tgtSA = sas.get(0);
|
||||
}
|
||||
|
||||
if (tgtSA.getTarget() != null && !params.containsKey("Optional")) {
|
||||
if (tgtSA.getTarget() != null && !optional) {
|
||||
tgtSA.getTarget().setMandatory(true);
|
||||
}
|
||||
|
||||
@@ -441,8 +442,7 @@ public final class AbilityFactoryPlay {
|
||||
} else {
|
||||
if (tgtSA instanceof Spell) {
|
||||
Spell spell = (Spell) tgtSA;
|
||||
if (spell.canPlayFromEffectAI(false, true)) {
|
||||
//System.out.println("canPlayFromEffectAI: " + this.getHostCard());
|
||||
if (spell.canPlayFromEffectAI(!optional, true) || !optional) {
|
||||
ComputerUtil.playSpellAbilityWithoutPayingManaCost(tgtSA);
|
||||
}
|
||||
}
|
||||
@@ -450,11 +450,16 @@ public final class AbilityFactoryPlay {
|
||||
} else {
|
||||
if (controller.isHuman()) {
|
||||
Singletons.getModel().getGameAction().playSpellAbility(tgtSA);
|
||||
} else if (tgtSA.canPlayAI()) {
|
||||
} else {
|
||||
if (tgtSA instanceof Spell) {
|
||||
Spell spell = (Spell) tgtSA;
|
||||
if (spell.canPlayFromEffectAI(!optional, false) || !optional) {
|
||||
ComputerUtil.playStack(tgtSA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end resolve
|
||||
|
||||
} // end class AbilityFactory_Copy
|
||||
|
||||
Reference in New Issue
Block a user