* Fixed a problem that unintended allowed to cast spells with alternate cost to cast conditions (fixes #6739).

This commit is contained in:
LevelX2 2020-06-29 14:54:29 +02:00
parent 5661bb1bfe
commit d1e31140cc
3 changed files with 55 additions and 6 deletions

View file

@ -151,11 +151,11 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
for (AlternativeCost2 alternateCost : alternativeCostsToCheck) {
alternateCost.activate();
for (Iterator it = ((Costs) alternateCost).iterator(); it.hasNext(); ) {
Cost costDeailed = (Cost) it.next();
if (costDeailed instanceof ManaCost) {
ability.getManaCostsToPay().add((ManaCost) costDeailed.copy());
} else {
ability.getCosts().add(costDeailed.copy());
Cost costDetailed = (Cost) it.next();
if (costDetailed instanceof ManaCost) {
ability.getManaCostsToPay().add((ManaCost) costDetailed.copy());
} else if (costDetailed != null) {
ability.getCosts().add(costDetailed.copy());
}
}
}
@ -222,7 +222,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
sb.append("pay ");
}
String text = alternativeCost.getText(true);
sb.append(Character.toLowerCase(text.charAt(0)) + text.substring(1));
sb.append(Character.toLowerCase(text.charAt(0))).append(text.substring(1));
}
++numberCosts;
}

View file

@ -3207,6 +3207,9 @@ public abstract class PlayerImpl implements Player, Serializable {
// check "can play" condition as affected controller (BUT play from not own hand zone must be checked as original controller)
// must check all abilities, not activated only
for (Ability ability : candidateAbilities) {
if (!(ability instanceof ActivatedAbility)) {
continue;
}
boolean isPlaySpell = (ability instanceof SpellAbility);
boolean isPlayLand = (ability instanceof PlayLandAbility);