mirror of
https://github.com/correl/mage.git
synced 2025-03-29 17:00:07 -09:00
Additional fixed for #6147
This commit is contained in:
parent
b6d76a7c02
commit
854eaadcc4
2 changed files with 13 additions and 6 deletions
Mage.Tests/src/test/java/org/mage/test/cards/continuous
Mage/src/main/java/mage/filter/predicate
|
@ -34,22 +34,30 @@ public class GainAbilityDependenciesTest extends CardTestPlayerBase {
|
|||
SubType.HUMAN.getPredicate(),
|
||||
SubType.ORC.getPredicate())
|
||||
));
|
||||
FilterPermanent filterNotTree = new FilterPermanent("tree");
|
||||
filterNotTree.add(Predicates.not(
|
||||
Predicates.or(
|
||||
SubType.HUMAN.getPredicate(),
|
||||
SubType.ORC.getPredicate())
|
||||
));
|
||||
|
||||
ContinuousEffectImpl effectEmpty = new GainAbilityAllEffect(HasteAbility.getInstance(), Duration.EndOfTurn, filterEmpty);
|
||||
ContinuousEffectImpl effectSubtype = new GainAbilityAllEffect(HasteAbility.getInstance(), Duration.EndOfTurn, filterSubtype);
|
||||
ContinuousEffectImpl effectOr = new GainAbilityAllEffect(HasteAbility.getInstance(), Duration.EndOfTurn, filterOr);
|
||||
ContinuousEffectImpl effectTree = new GainAbilityAllEffect(HasteAbility.getInstance(), Duration.EndOfTurn, filterTree);
|
||||
ContinuousEffectImpl effectNotTree = new GainAbilityAllEffect(HasteAbility.getInstance(), Duration.EndOfTurn, filterNotTree);
|
||||
|
||||
Assert.assertFalse("must haven't depends with empty filter", effectEmpty.getDependedToTypes().contains(DependencyType.AddingCreatureType));
|
||||
Assert.assertTrue("must have depend from subtype predicate", effectSubtype.getDependedToTypes().contains(DependencyType.AddingCreatureType));
|
||||
Assert.assertTrue("must have depend from or predicate", effectOr.getDependedToTypes().contains(DependencyType.AddingCreatureType));
|
||||
Assert.assertTrue("must have depend from tree predicate", effectTree.getDependedToTypes().contains(DependencyType.AddingCreatureType));
|
||||
Assert.assertTrue("must have depend from not-tree predicate", effectNotTree.getDependedToTypes().contains(DependencyType.AddingCreatureType));
|
||||
}
|
||||
|
||||
/**
|
||||
* I had an elephant token equipped with Amorphous Axe attacking and a Tempered Sliver in play. The token did combat
|
||||
* damage to a player but it didnt get the +1/+1 counter it hsould be getting.
|
||||
*
|
||||
* <p>
|
||||
* More details: https://github.com/magefree/mage/issues/6147
|
||||
*/
|
||||
@Test
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.filter.predicate;
|
||||
|
||||
import mage.game.Game;
|
||||
|
@ -69,7 +68,7 @@ public final class Predicates {
|
|||
* @return
|
||||
*/
|
||||
public static <T> Predicate<T> and(Predicate<? super T> first, Predicate<? super T> second) {
|
||||
return new AndPredicate<T>(Predicates.<T>asList(checkNotNull(first), checkNotNull(second)));
|
||||
return new AndPredicate<T>(Predicates.asList(checkNotNull(first), checkNotNull(second)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +109,7 @@ public final class Predicates {
|
|||
* @return
|
||||
*/
|
||||
public static <T> Predicate<T> or(Predicate<? super T> first, Predicate<? super T> second) {
|
||||
return new OrPredicate<T>(Predicates.<T>asList(first, second));
|
||||
return new OrPredicate<T>(Predicates.asList(first, second));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -188,7 +187,7 @@ public final class Predicates {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T> List<Predicate<? super T>> asList(Predicate<? super T> first, Predicate<? super T> second) {
|
||||
return Arrays.<Predicate<? super T>>asList(first, second);
|
||||
return Arrays.asList(first, second);
|
||||
}
|
||||
|
||||
private static <T> List<T> defensiveCopy(T... array) {
|
||||
|
@ -231,7 +230,7 @@ public final class Predicates {
|
|||
*/
|
||||
public static void collectAllComponents(Predicate predicate, List<Predicate> res) {
|
||||
if (predicate instanceof NotPredicate) {
|
||||
res.add(((NotPredicate) predicate).predicate);
|
||||
collectAllComponents(((NotPredicate) predicate).predicate, res);
|
||||
} else if (predicate instanceof AndPredicate) {
|
||||
collectAllComponents(((AndPredicate) predicate).components, res);
|
||||
} else if (predicate instanceof OrPredicate) {
|
||||
|
|
Loading…
Add table
Reference in a new issue