mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-13 09:17:59 +00:00
Fix CostSacrifice paying from Effect
This commit is contained in:
committed by
Michael Kamensky
parent
33377abc9f
commit
a9f5ab8772
@@ -178,7 +178,6 @@ public final class AbilityFactory {
|
||||
return getAbility(type, type.getApiTypeOf(mapParams), mapParams, parseAbilityCost(state, mapParams, type), state, sVarHolder);
|
||||
}
|
||||
|
||||
|
||||
public static Cost parseAbilityCost(final CardState state, Map<String, String> mapParams, AbilityRecordType type) {
|
||||
Cost abCost = null;
|
||||
if (type != AbilityRecordType.SubAbility) {
|
||||
|
||||
@@ -6229,7 +6229,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (source == null){
|
||||
if (source == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -240,8 +240,7 @@ public class Cost implements Serializable {
|
||||
xCantBe0 = true;
|
||||
} else if ("Mandatory".equals(part)) {
|
||||
this.isMandatory = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
CostPart cp = parseCostPart(part, tapCost, untapCost);
|
||||
if (null != cp )
|
||||
if (cp instanceof CostPartMana ) {
|
||||
@@ -268,7 +267,6 @@ public class Cost implements Serializable {
|
||||
}
|
||||
|
||||
private static CostPart parseCostPart(String parse, boolean tapCost, boolean untapCost) {
|
||||
|
||||
if (parse.startsWith("Mana<")) {
|
||||
final String[] splitStr = TextUtil.split(abCostParse(parse, 1)[0], '\\');
|
||||
final String restriction = splitStr.length > 1 ? splitStr[1] : null;
|
||||
|
||||
@@ -3337,7 +3337,6 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
return targetPlayer == null || !targetPlayer.equals(sa.getActivatingPlayer())
|
||||
|| !hasKeyword("Spells and abilities you control can't cause you to search your library.");
|
||||
|
||||
}
|
||||
|
||||
public Card getKeywordCard() {
|
||||
|
||||
@@ -65,7 +65,7 @@ public abstract class AbilityActivated extends SpellAbility implements Cloneable
|
||||
this.setTargetRestrictions(tgt);
|
||||
}
|
||||
|
||||
public boolean isActivatedAbility() { return true; }
|
||||
public boolean isActivatedAbility() { return !isTrigger(); }
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
|
||||
@@ -579,7 +579,7 @@ public class TriggerHandler {
|
||||
sa.setOptionalTrigger(true);
|
||||
decider = AbilityUtils.getDefinedPlayers(host, regtrig.getParam("OptionalDecider"), sa).get(0);
|
||||
}
|
||||
else if (sa instanceof AbilitySub || !sa.hasParam("Cost") || sa.hasParam("CostMandatory") || sa.getParam("Cost").equals("0")) {
|
||||
else if (sa instanceof AbilitySub || !sa.hasParam("Cost") || (sa.getPayCosts() != null && sa.getPayCosts().isMandatory()) || sa.getParam("Cost").equals("0")) {
|
||||
isMandatory = true;
|
||||
} else { // triggers with a cost can't be mandatory
|
||||
sa.setOptionalTrigger(true);
|
||||
|
||||
@@ -2,6 +2,6 @@ Name:Arrogant Poet
|
||||
ManaCost:1 B
|
||||
Types:Creature Human Warlock
|
||||
PT:2/1
|
||||
T:Mode$ Attacks | ValidCard$ Card.Self | OptionalDecider$ You | Execute$ TrigPump | TriggerDescription$ Whenever CARDNAME attacks, you may pay 2 life. If you do, it gains flying until end of turn.
|
||||
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigPump | TriggerDescription$ Whenever CARDNAME attacks, you may pay 2 life. If you do, it gains flying until end of turn.
|
||||
SVar:TrigPump:AB$ Pump | Cost$ PayLife<2> | Defined$ Self | KW$ Flying
|
||||
Oracle:Whenever Arrogant Poet attacks, you may pay 2 life. If you do, it gains flying until end of turn.
|
||||
|
||||
@@ -2,7 +2,7 @@ Name:Awaken the Sky Tyrant
|
||||
ManaCost:3 R
|
||||
Types:Enchantment
|
||||
T:Mode$ DamageDone | ValidSource$ Card.OppCtrl | ValidTarget$ You | TriggerZones$ Battlefield | Execute$ TrigSac | TriggerDescription$ When a source an opponent controls deals damage to you, sacrifice CARDNAME. If you do, create a 5/5 red Dragon creature token with flying.
|
||||
SVar:TrigSac:AB$ Token | TokenAmount$ 1 | TokenScript$ r_5_5_dragon_flying | TokenOwner$ You | Cost$ Sac<1/CARDNAME> | CostMandatory$ True
|
||||
SVar:TrigSac:AB$ Token | TokenAmount$ 1 | TokenScript$ r_5_5_dragon_flying | TokenOwner$ You | Cost$ Mandatory Sac<1/CARDNAME>
|
||||
SVar:X:Remembered$Amount
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/awaken_the_sky_tyrant.jpg
|
||||
Oracle:When a source an opponent controls deals damage to you, sacrifice Awaken the Sky Tyrant. If you do, create a 5/5 red Dragon creature token with flying.
|
||||
@@ -2,7 +2,7 @@ Name:Standstill
|
||||
ManaCost:1 U
|
||||
Types:Enchantment
|
||||
T:Mode$ SpellCast | ValidActivatingPlayer$ Player | TriggerZones$ Battlefield | Execute$ TrigSac | TriggerDescription$ When a player casts a spell, sacrifice CARDNAME. If you do, each of that player's opponents draws three cards.
|
||||
SVar:TrigSac:AB$ Draw | NumCards$ 3 | Cost$ Sac<1/CARDNAME> | CostMandatory$ True | Defined$ TriggeredCardOpponent
|
||||
SVar:TrigSac:AB$ Draw | NumCards$ 3 | Cost$ Mandatory Sac<1/CARDNAME> | Defined$ TriggeredCardOpponent
|
||||
SVar:X:Remembered$Amount
|
||||
SVar:Y:Count$Valid Creature.YouCtrl
|
||||
SVar:Z:Count$Valid Creature.OppCtrl
|
||||
|
||||
@@ -567,7 +567,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
||||
}
|
||||
|
||||
// for costs declared mandatory, this is only reachable with a valid amount
|
||||
if (ability.getPayCosts().isMandatory() || (player.canPayLife(c) && player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblPayNLifeConfirm", String.valueOf(c)),ability))) {
|
||||
if (ability.getPayCosts().isMandatory() || (player.canPayLife(c) && player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblPayNLifeConfirm", String.valueOf(c)), ability))) {
|
||||
return PaymentDecision.number(c);
|
||||
}
|
||||
return null;
|
||||
@@ -1023,7 +1023,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
||||
|
||||
if (cost.payCostFromSource()) {
|
||||
if (source.getController() == ability.getActivatingPlayer() && source.isInPlay()) {
|
||||
return ability.hasParam("CostMandatory") || player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblSacrificeCardConfirm", CardTranslation.getTranslatedName(source.getName())), ability) ? PaymentDecision.card(source) : null;
|
||||
return ability.getPayCosts().isMandatory() || player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblSacrificeCardConfirm", CardTranslation.getTranslatedName(source.getName())), ability) ? PaymentDecision.card(source) : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1059,7 +1059,6 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
||||
}
|
||||
|
||||
return PaymentDecision.card(inp.getSelected());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user