Merge branch 'protection' into 'master'

Fix protection from colorless

See merge request core-developers/forge!5246
This commit is contained in:
Hans Mackowiak
2021-08-22 15:01:52 +00:00
2 changed files with 5 additions and 6 deletions

View File

@@ -27,7 +27,6 @@ public class ProtectEffect extends SpellAbilityEffect {
*/ */
@Override @Override
protected String getStackDescription(SpellAbility sa) { protected String getStackDescription(SpellAbility sa) {
final List<String> gains = getProtectionList(sa); final List<String> gains = getProtectionList(sa);
final boolean choose = sa.hasParam("Choices"); final boolean choose = sa.hasParam("Choices");
final String joiner = choose ? "or" : "and"; final String joiner = choose ? "or" : "and";
@@ -36,9 +35,7 @@ public class ProtectEffect extends SpellAbilityEffect {
List<Card> tgtCards = getTargetCards(sa); List<Card> tgtCards = getTargetCards(sa);
if (!tgtCards.isEmpty()) { if (!tgtCards.isEmpty()) {
final Iterator<Card> it = tgtCards.iterator(); final Iterator<Card> it = tgtCards.iterator();
while (it.hasNext()) { while (it.hasNext()) {
final Card tgtC = it.next(); final Card tgtC = it.next();
@@ -111,7 +108,7 @@ public class ProtectEffect extends SpellAbilityEffect {
choser = tgtCards.get(0).getController(); choser = tgtCards.get(0).getController();
} }
final String choice = choser.getController().chooseProtectionType(Localizer.getInstance().getMessage("lblChooseAProtection"), sa, choices); final String choice = choser.getController().chooseProtectionType(Localizer.getInstance().getMessage("lblChooseAProtection"), sa, choices);
if( null == choice) if (null == choice)
return; return;
gains.add(choice); gains.add(choice);
game.getAction().notifyOfValue(sa, choser, Lang.joinHomogenous(gains), choser); game.getAction().notifyOfValue(sa, choser, Lang.joinHomogenous(gains), choser);
@@ -188,7 +185,6 @@ public class ProtectEffect extends SpellAbilityEffect {
} }
} // protectResolve() } // protectResolve()
public static List<String> getProtectionList(final SpellAbility sa) { public static List<String> getProtectionList(final SpellAbility sa) {
final List<String> gains = new ArrayList<>(); final List<String> gains = new ArrayList<>();
@@ -211,5 +207,4 @@ public class ProtectEffect extends SpellAbilityEffect {
return gains; return gains;
} }
} }

View File

@@ -5693,6 +5693,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
if (!source.isColorless() && !colorlessDamage) { if (!source.isColorless() && !colorlessDamage) {
return true; return true;
} }
} else if (kw.equals("Protection from colorless")) {
if (source.isColorless() || colorlessDamage) {
return true;
}
} else if (kw.equals("Protection from everything")) { } else if (kw.equals("Protection from everything")) {
return true; return true;
} else if (kw.startsWith("Protection:")) { // uses isValid; Protection:characteristic:desc:exception } else if (kw.startsWith("Protection:")) { // uses isValid; Protection:characteristic:desc:exception