Rework Cephalid Snitch. Fixes #8520

This commit is contained in:
Alex W. Jackson 2021-12-15 04:16:29 -05:00
parent 743f9e4b3b
commit f1390faf58
2 changed files with 41 additions and 41 deletions

View file

@ -15,7 +15,6 @@ import mage.game.stack.StackObject;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@ -29,6 +28,7 @@ public class ProtectionAbility extends StaticAbility {
protected boolean removeAuras;
protected boolean removeEquipment;
protected boolean doesntRemoveControlled;
protected ObjectColor fromColor;
protected UUID auraIdNotToBeRemoved; // defines an Aura objectId that will not be removed from this protection ability
public ProtectionAbility(Filter filter) {
@ -37,6 +37,7 @@ public class ProtectionAbility extends StaticAbility {
this.removeAuras = true;
this.removeEquipment = true;
this.doesntRemoveControlled = false;
this.fromColor = new ObjectColor();
this.auraIdNotToBeRemoved = null;
}
@ -46,19 +47,25 @@ public class ProtectionAbility extends StaticAbility {
this.removeAuras = ability.removeAuras;
this.removeEquipment = ability.removeEquipment;
this.doesntRemoveControlled = ability.doesntRemoveControlled;
this.fromColor = ability.fromColor;
this.auraIdNotToBeRemoved = ability.auraIdNotToBeRemoved;
}
public static ProtectionAbility from(ObjectColor color) {
FilterObject filter = new FilterObject(getFilterText(color));
filter.add(new ColorPredicate(color));
return new ProtectionAbility(filter);
ProtectionAbility ability = new ProtectionAbility(filter);
ability.getFromColor().addColor(color);
return ability;
}
public static ProtectionAbility from(ObjectColor color1, ObjectColor color2) {
FilterObject filter = new FilterObject(color1.getDescription() + " and from " + color2.getDescription());
filter.add(Predicates.or(new ColorPredicate(color1), new ColorPredicate(color2)));
return new ProtectionAbility(filter);
ProtectionAbility ability = new ProtectionAbility(filter);
ability.getFromColor().addColor(color1);
ability.getFromColor().addColor(color2);
return ability;
}
@Override
@ -167,6 +174,10 @@ public class ProtectionAbility extends StaticAbility {
return doesntRemoveControlled;
}
public ObjectColor getFromColor() {
return fromColor;
}
public UUID getAuraIdNotToBeRemoved() {
return auraIdNotToBeRemoved;
}