mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
a few changes to help with tests
This commit is contained in:
parent
dc2d8145fd
commit
e51b63aea8
2 changed files with 10 additions and 20 deletions
|
|
@ -3,21 +3,18 @@ package mage.filter.common;
|
|||
import java.util.UUID;
|
||||
|
||||
import mage.MageItem;
|
||||
import mage.filter.FilterImpl;
|
||||
import mage.filter.FilterInPlay;
|
||||
import mage.filter.FilterPlayer;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author JRHerlehy
|
||||
* Created on 4/8/18.
|
||||
* @author JRHerlehy Created on 4/8/18.
|
||||
*/
|
||||
public class FilterCreaturePlayerOrPlaneswalker extends FilterImpl<MageItem> implements FilterInPlay<MageItem> {
|
||||
public class FilterCreaturePlayerOrPlaneswalker extends FilterPermanentOrPlayer {
|
||||
|
||||
protected FilterCreaturePermanent creatureFilter;
|
||||
protected FilterPlaneswalkerPermanent planeswalkerFilter;
|
||||
protected final FilterPlayer playerFilter;
|
||||
|
||||
public FilterCreaturePlayerOrPlaneswalker() {
|
||||
this("any target");
|
||||
|
|
@ -26,29 +23,22 @@ public class FilterCreaturePlayerOrPlaneswalker extends FilterImpl<MageItem> imp
|
|||
public FilterCreaturePlayerOrPlaneswalker(String name) {
|
||||
super(name);
|
||||
creatureFilter = new FilterCreaturePermanent();
|
||||
playerFilter = new FilterPlayer();
|
||||
planeswalkerFilter = new FilterPlaneswalkerPermanent();
|
||||
}
|
||||
|
||||
public FilterCreaturePlayerOrPlaneswalker(final FilterCreaturePlayerOrPlaneswalker filter) {
|
||||
super(filter);
|
||||
this.creatureFilter = filter.creatureFilter.copy();
|
||||
this.playerFilter = filter.playerFilter.copy();
|
||||
this.planeswalkerFilter = filter.planeswalkerFilter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObjectClass(Object object) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(MageItem o, Game game) {
|
||||
if (o instanceof Player) {
|
||||
return playerFilter.match((Player) o, game);
|
||||
} else if (o instanceof Permanent) {
|
||||
return creatureFilter.match((Permanent) o, game) ||
|
||||
planeswalkerFilter.match((Permanent) o, game);
|
||||
return creatureFilter.match((Permanent) o, game)
|
||||
|| planeswalkerFilter.match((Permanent) o, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -58,8 +48,8 @@ public class FilterCreaturePlayerOrPlaneswalker extends FilterImpl<MageItem> imp
|
|||
if (o instanceof Player) {
|
||||
return playerFilter.match((Player) o, sourceId, playerId, game);
|
||||
} else if (o instanceof Permanent) {
|
||||
return creatureFilter.match((Permanent) o, sourceId, playerId, game) ||
|
||||
planeswalkerFilter.match((Permanent) o, sourceId, playerId, game);
|
||||
return creatureFilter.match((Permanent) o, sourceId, playerId, game)
|
||||
|| planeswalkerFilter.match((Permanent) o, sourceId, playerId, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue