use of mage.filter.predicate.ObjectSourcePlayer in project mage by magefree.
the class OathOfLiegesPredicate method apply.
@Override
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
Player targetPlayer = input.getObject();
// Get active input.playerId because adjust target is used after canTarget function
UUID activePlayerId = game.getActivePlayerId();
if (targetPlayer == null || activePlayerId == null) {
return false;
}
if (!targetPlayer.hasOpponent(activePlayerId, game)) {
return false;
}
int countTargetPlayer = game.getBattlefield().countAll(StaticFilters.FILTER_LAND, targetPlayer.getId(), game);
int countActivePlayer = game.getBattlefield().countAll(StaticFilters.FILTER_LAND, activePlayerId, game);
return countTargetPlayer > countActivePlayer;
}
use of mage.filter.predicate.ObjectSourcePlayer in project mage by magefree.
the class OathOfDruidsEffect method apply.
@Override
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
Player targetPlayer = input.getObject();
// Get active input.playerId because adjust target is used after canTarget function
UUID activePlayerId = game.getActivePlayerId();
if (targetPlayer == null || activePlayerId == null) {
return false;
}
if (!targetPlayer.hasOpponent(activePlayerId, game)) {
return false;
}
int countTargetPlayer = game.getBattlefield().countAll(filter, targetPlayer.getId(), game);
int countActivePlayer = game.getBattlefield().countAll(filter, activePlayerId, game);
return countTargetPlayer > countActivePlayer;
}
use of mage.filter.predicate.ObjectSourcePlayer in project mage by magefree.
the class OathOfScholarsEffect method apply.
@Override
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
Player targetPlayer = input.getObject();
Player firstPlayer = game.getPlayer(game.getActivePlayerId());
if (targetPlayer == null || firstPlayer == null || !firstPlayer.hasOpponent(targetPlayer.getId(), game)) {
return false;
}
int countHandTargetPlayer = targetPlayer.getHand().size();
int countHandFirstPlayer = firstPlayer.getHand().size();
return countHandTargetPlayer > countHandFirstPlayer;
}
use of mage.filter.predicate.ObjectSourcePlayer in project mage by magefree.
the class BoreasChargerPredicate method apply.
@Override
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
Player targetPlayer = input.getObject();
UUID playerId = input.getPlayerId();
if (targetPlayer == null || playerId == null) {
return false;
}
if (!targetPlayer.hasOpponent(playerId, game)) {
return false;
}
int countTargetPlayer = game.getBattlefield().countAll(StaticFilters.FILTER_LANDS, targetPlayer.getId(), game);
int countController = game.getBattlefield().countAll(StaticFilters.FILTER_LANDS, playerId, game);
return countTargetPlayer > countController;
}
Aggregations