@Override
    public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
        if (affectedControllerId.equals(source.getControllerId())) {
            Card card = game.getCard(objectId);
            MageObject sourceObject = source.getSourceObject(game);
            if (card != null && !card.isLand() && sourceObject != null) {
                UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
                if (exileId != null) {
                    ExileZone exileZone = game.getState().getExile().getExileZone(exileId);
                    if (exileZone != null && exileZone.contains(objectId)) {
                        if (game.getTurnNum() == turnNumber) {
                            if (!exileZone.contains(cardId)) {
                                // last checked card this turn is no longer exiled, so you can't cast another with this effect
                                // TODO: Handle if card was cast/removed from exile with effect from another card.
                                //       If so, this effect could prevent player from casting although they should be able to use it
                                return false;
                            }
                        }
                        this.turnNumber = game.getTurnNum();
                        this.cardId = objectId;
                        return true;
                    }
                }
            }
        }
        return false;
    }
@Override
    public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
        if (affectedControllerId.equals(source.getControllerId())) {
            Card card = game.getCard(objectId);
            MageObject sourceObject = source.getSourceObject(game);
            if (card != null && !card.isLand() && sourceObject != null) {
                UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
                if (exileId != null) {
                    ExileZone exileZone = game.getState().getExile().getExileZone(exileId);
                    if (exileZone != null && exileZone.contains(objectId)) {
                        if (game.getTurnNum() == turnNumber) {
                            if (!exileZone.contains(cardId)) {
                               
                               
                               
                                return false;
                            }
                        }
                        this.turnNumber = game.getTurnNum();
                        this.cardId = objectId;
                        return true;
                    }
                }
            }
        }
        return false;
    }
@override public boolean applies(uuid objectid, ability source, uuid affectedcontrollerid, game game) { if (affectedcontrollerid.equals(source.getcontrollerid())) { card card = game.getcard(objectid); mageobject sourceobject = source.getsourceobject(game); if (card != null && !card.island() && sourceobject != null) { uuid exileid = cardutil.getexilezoneid(game, source.getsourceid(), source.getsourceobjectzonechangecounter()); if (exileid != null) { exilezone exilezone = game.getstate().getexile().getexilezone(exileid); if (exilezone != null && exilezone.contains(objectid)) { if (game.getturnnum() == turnnumber) { if (!exilezone.contains(cardid)) { return false; } } this.turnnumber = game.getturnnum(); this.cardid = objectid; return true; } } } } return false; }