Fix CostSacrifice paying from Effect

This commit is contained in:
Bug Hunter
2021-07-31 04:47:23 +00:00
committed by Michael Kamensky
parent 33377abc9f
commit a9f5ab8772
10 changed files with 9 additions and 14 deletions

View File

@@ -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) {

View File

@@ -6229,7 +6229,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
return false;
}
if (source == null){
if (source == null) {
return true;
}

View File

@@ -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;

View File

@@ -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() {

View File

@@ -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

View File

@@ -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);