* Fixed a bug that cards with added abilities of continuous effects were not found always.

This commit is contained in:
LevelX2 2015-06-11 12:54:23 +02:00
parent 65401f1cbc
commit ab4ed4f973

View file

@ -30,6 +30,7 @@ package mage.filter.predicate.mageobject;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Abilities; import mage.abilities.Abilities;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.cards.Card;
import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicate;
import mage.game.Game; import mage.game.Game;
@ -47,9 +48,15 @@ public class AbilityPredicate implements Predicate<MageObject> {
@Override @Override
public boolean apply(MageObject input, Game game) { public boolean apply(MageObject input, Game game) {
Abilities<Ability> abilities = input.getAbilities(); Abilities<Ability> abilities;
for (int i = 0; i < abilities.size(); i++) { if (input instanceof Card){
if (abilityClass.equals(abilities.get(i).getClass())) { abilities = ((Card)input).getAbilities(game);
} else {
abilities = input.getAbilities();
}
for (Ability ability : abilities) {
if (abilityClass.equals(ability.getClass())) {
return true; return true;
} }
} }