use of mage.filter.predicate.ObjectSourcePlayer in project mage by magefree.
the class OathOfGhoulsEffect 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 countGraveyardTargetPlayer = targetPlayer.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game).size();
int countGraveyardFirstPlayer = firstPlayer.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game).size();
return countGraveyardTargetPlayer < countGraveyardFirstPlayer;
}
use of mage.filter.predicate.ObjectSourcePlayer in project mage by magefree.
the class HopeOfGhirapurCombatDamageWatcher method apply.
@Override
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
Player targetPlayer = input.getObject();
if (targetPlayer == null) {
return false;
}
HopeOfGhirapurCombatDamageWatcher watcher = game.getState().getWatcher(HopeOfGhirapurCombatDamageWatcher.class);
if (watcher != null) {
return watcher.playerGotCombatDamage(input.getSourceId(), input.getObject().getId(), game);
}
return false;
}
use of mage.filter.predicate.ObjectSourcePlayer in project mage by magefree.
the class KeeperOfTheDeadEffect method apply.
@Override
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
Player targetPlayer = input.getObject();
Permanent sourceObject = game.getPermanent(input.getSourceId());
Player controller = null;
if (sourceObject != null) {
controller = game.getPlayer(sourceObject.getControllerId());
}
if (targetPlayer == null || controller == null || !controller.hasOpponent(targetPlayer.getId(), game)) {
return false;
}
int countGraveyardTargetPlayer = targetPlayer.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURES, game).size();
int countGraveyardController = controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURES, game).size();
return countGraveyardController >= countGraveyardTargetPlayer + 2;
}
use of mage.filter.predicate.ObjectSourcePlayer in project mage by magefree.
the class KeeperOfTheMindPredicate 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 - 2 >= countHandFirstPlayer;
}
use of mage.filter.predicate.ObjectSourcePlayer in project mage by magefree.
the class KeeperOfTheFlamePredicate method apply.
@Override
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
Player targetOpponent = input.getObject();
Player controller = game.getPlayer(input.getPlayerId());
if (targetOpponent == null || controller == null || !controller.hasOpponent(targetOpponent.getId(), game)) {
return false;
}
return targetOpponent.getLife() > controller.getLife();
}
Aggregations