Merge pull request #4632 from CountAndromalius/master

Corrected "Any TYPE among permanent types" handling
This commit is contained in:
LevelX2 2018-03-18 16:25:47 +01:00 committed by GitHub
commit 03ebdc17d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 9 deletions

View file

@ -84,7 +84,7 @@ public class AnyColorLandsProduceManaAbility extends ActivatedManaAbilityImpl {
class AnyColorLandsProduceManaEffect extends ManaEffect {
private final FilterPermanent filter;
private final boolean onlyColors; // false if mana types can be produced (also Colorless mana), if false only colors can be produced (no Colorless mana).
private final boolean onlyColors; // false if mana types can be produced (also Colorless mana), if true only colors can be produced (no Colorless mana).
private boolean inManaTypeCalculation = false;
@ -190,7 +190,6 @@ class AnyColorLandsProduceManaEffect extends ManaEffect {
return types;
}
inManaTypeCalculation = true;
// Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "needed to identify endless loop causing cards: {0}", source.getSourceObject(game).getName());
List<Permanent> lands = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
for (Permanent land : lands) {
Abilities<ActivatedManaAbilityImpl> mana = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD);

View file

@ -61,7 +61,7 @@ public class AnyColorPermanentTypesManaAbility extends ActivatedManaAbilityImpl
class AnyColorPermanentTypesManaEffect extends ManaEffect {
private final FilterPermanent filter;
private final boolean onlyColors; // false if mana types can be produced (also Colorless mana), if false only colors can be produced (no Colorless mana).
private final boolean onlyColors; // false if mana types can be produced (also Colorless mana), if true only colors can be produced (no Colorless mana).
private boolean inManaTypeCalculation = false;
@ -168,13 +168,19 @@ class AnyColorPermanentTypesManaEffect extends ManaEffect {
}
inManaTypeCalculation = true;
List<ObjectColor> permanentColors;
// Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "needed to identify endless loop causing cards: {0}", source.getSourceObject(game).getName());
ObjectColor permanentColor;
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
for (Permanent permanent : permanents) {
permanentColors = permanent.getColor(game).getColors();
for (ObjectColor color : permanentColors){
types.add(new Mana(color.getColoredManaSymbol()));
permanentColor = permanent.getColor(game);
if(permanentColor.isColorless())
types.add(Mana.ColorlessMana(1));
else{
List<ObjectColor> permanentColors = permanent.getColor(game).getColors();
for (ObjectColor color : permanentColors){
types.add(new Mana(color.getColoredManaSymbol()));
}
}
}
inManaTypeCalculation = false;