forked from External/mage
Implement [JUD] Infectious Rage (#10187)
* Implement [JUD] Infectious Rage * Fix ClassCastException by using last known info * Add game log message for random choice. Still need to investigate filter. * Clarify filter and add comments * Address review comments (3/4) * Check zone change counter
This commit is contained in:
parent
d3ec7e44a3
commit
1ac9ec65cc
4 changed files with 149 additions and 23 deletions
|
|
@ -0,0 +1,35 @@
|
|||
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