Fixed not working opponent or planeswalker filter (count all permanents instead planeswalkers);

This commit is contained in:
Oleg Agafonov 2018-04-22 04:58:24 +04:00
parent cf9ac754f0
commit 4e12b06bc7
3 changed files with 77 additions and 21 deletions

View file

@ -29,6 +29,7 @@ package mage.filter;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mage.constants.SubType;
@ -66,6 +67,13 @@ public class FilterPermanent extends FilterObject<Permanent> implements FilterIn
this.add(new SubtypePredicate(subtype));
}
public FilterPermanent(Set<SubType> subtypesList, String name) {
super(name);
for (SubType subtype: subtypesList) {
this.add(new SubtypePredicate(subtype));
}
}
@Override
public boolean checkObjectClass(Object object) {
return object instanceof Permanent;

View file

@ -5,6 +5,7 @@
*/
package mage.filter.common;
import mage.constants.SubType;
import mage.filter.FilterOpponent;
import mage.filter.FilterPermanent;
@ -19,7 +20,7 @@ public class FilterOpponentOrPlaneswalker extends FilterPermanentOrPlayer {
}
public FilterOpponentOrPlaneswalker(String name) {
super(name, new FilterPermanent(), new FilterOpponent());
super(name, new FilterPermanent(SubType.getPlaneswalkerTypes(true), "planeswalker"), new FilterOpponent());
}
public FilterOpponentOrPlaneswalker(final FilterOpponentOrPlaneswalker filter) {