mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +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.abilities.Abilities;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
|
||||
|
@ -47,9 +48,15 @@ public class AbilityPredicate implements Predicate<MageObject> {
|
|||
|
||||
@Override
|
||||
public boolean apply(MageObject input, Game game) {
|
||||
Abilities<Ability> abilities = input.getAbilities();
|
||||
for (int i = 0; i < abilities.size(); i++) {
|
||||
if (abilityClass.equals(abilities.get(i).getClass())) {
|
||||
Abilities<Ability> abilities;
|
||||
if (input instanceof Card){
|
||||
abilities = ((Card)input).getAbilities(game);
|
||||
} else {
|
||||
abilities = input.getAbilities();
|
||||
}
|
||||
|
||||
for (Ability ability : abilities) {
|
||||
if (abilityClass.equals(ability.getClass())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue