Search in sources :

Example 6 with ObjectSourcePlayer

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;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) FilterPlayer(mage.filter.FilterPlayer) ObjectSourcePlayer(mage.filter.predicate.ObjectSourcePlayer) UUID(java.util.UUID)

Example 7 with ObjectSourcePlayer

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;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) FilterPlayer(mage.filter.FilterPlayer) ObjectSourcePlayer(mage.filter.predicate.ObjectSourcePlayer) UUID(java.util.UUID)

Example 8 with ObjectSourcePlayer

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;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) FilterPlayer(mage.filter.FilterPlayer) ObjectSourcePlayer(mage.filter.predicate.ObjectSourcePlayer)

Example 9 with ObjectSourcePlayer

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;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) FilterPlayer(mage.filter.FilterPlayer) ObjectSourcePlayer(mage.filter.predicate.ObjectSourcePlayer) UUID(java.util.UUID)

Aggregations

ObjectSourcePlayer (mage.filter.predicate.ObjectSourcePlayer)9 Player (mage.players.Player)9 TargetPlayer (mage.target.TargetPlayer)9 FilterPlayer (mage.filter.FilterPlayer)7 UUID (java.util.UUID)3 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 Permanent (mage.game.permanent.Permanent)1 TargetPermanent (mage.target.TargetPermanent)1