Search in sources :

Example 1 with ObjectSourcePlayer

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

Example 2 with ObjectSourcePlayer

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

Example 3 with ObjectSourcePlayer

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

Example 4 with ObjectSourcePlayer

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

Example 5 with ObjectSourcePlayer

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

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