mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
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:
parent
d11269cb56
commit
e2cff095b3
4 changed files with 109 additions and 85 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue