mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
* Fixed a bug that cards with added abilities of continuous effects were not found always.
This commit is contained in:
parent
65401f1cbc
commit
ab4ed4f973
1 changed files with 10 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue