Rework Infectious Rage (#10625)

* put custom predicate back with Aura Graft

* Rework Infectious Rage and add unit test

* cleanup Aura Graft
This commit is contained in:
xenohedron 2023-07-15 16:49:26 -04:00 committed by GitHub
parent d11269cb56
commit e2cff095b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 109 additions and 85 deletions

View file

@ -1,35 +0,0 @@
package mage.filter.predicate.permanent;
import mage.filter.Filter;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.util.TargetAddress;
/**
* @author duncant
*/
public class PermanentCanBeAttachedToPredicate implements ObjectSourcePlayerPredicate<Permanent> {
protected Permanent aura;
public PermanentCanBeAttachedToPredicate(Permanent aura) {
super();
this.aura = aura;
}
@Override
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
// TODO: Is it possible to add functionality to exclude objects the aura can't enchant (e.g. protection from)?
Permanent potentialAttachment = input.getObject();
for (TargetAddress addr : TargetAddress.walk(aura)) {
Target target = addr.getTarget(aura);
Filter filter = target.getFilter();
return filter.match(potentialAttachment, game);
}
return false;
}
}