implemented Crown of Fury

This commit is contained in:
Tim Schroeder 2019-10-16 04:32:52 +02:00
parent 041fb31205
commit 54552a94ad
3 changed files with 150 additions and 0 deletions

View file

@ -0,0 +1,45 @@
package mage.filter.common;
import java.util.ArrayList;
import java.util.List;
import mage.constants.SubType;
import mage.constants.SubTypeSet;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author tschroeder
*/
public class FilterOtherCreatureSharingCreatureSubtype extends FilterCreaturePermanent {
public FilterOtherCreatureSharingCreatureSubtype(Permanent creature, Game game) {
super("creature sharing a creature type with " + creature.toString());
List<SubtypePredicate> subtypePredicates = new ArrayList<>();
for (SubType subtype : creature.getSubtype(game)) {
if (subtype.getSubTypeSet() == SubTypeSet.CreatureType) {
subtypePredicates.add(new SubtypePredicate(subtype));
}
}
this.add(Predicates.and(
Predicates.or(subtypePredicates),
Predicates.not(new PermanentIdPredicate(creature.getId()))
));
}
public FilterOtherCreatureSharingCreatureSubtype(final FilterOtherCreatureSharingCreatureSubtype filter) {
super(filter);
}
@Override
public FilterOtherCreatureSharingCreatureSubtype copy() {
return new FilterOtherCreatureSharingCreatureSubtype(this);
}
}