protected ObjectColor getFrameObjectColor() { // TODO: Take into account devoid, land frame colors, etc return cardView.getColor().union(cardView.getFrameColor()); }
color = commander.getColor(null); } else { color = color.union(commander.getColor(null));
@Override public boolean apply(Game game, Ability source) { StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget()); if (stackObject == null) { return false; } ObjectColor creatureColors = new ObjectColor(); for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_CREATURES, source.getControllerId(), game)) { creatureColors = creatureColors.union(creature.getColor(game)); if (!creatureColors.intersection(stackObject.getColor(game)).isColorless()) { return new CounterTargetEffect().apply(game, source); } } return false; } }
@Override public void init(Ability source, Game game) { ObjectColor colorsAmongImprinted = new ObjectColor(); Permanent sourceObject = game.getPermanent(source.getSourceId()); ExileZone exileZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source.getSourceId())); if (sourceObject == null || sourceObject.getImprinted() == null) { noneExiled = true; return; } for (UUID imprinted : sourceObject.getImprinted()){ if (imprinted != null && exileZone.contains(imprinted)){ Card card = game.getCard(imprinted); if (card != null) { colorsAmongImprinted = colorsAmongImprinted.union(card.getColor(game)); } } } FilterObject filterObject = new FilterObject("a source of your choice that shares a color with the exiled card"); filterObject.add(new SharesColorPredicate(colorsAmongImprinted)); this.target = new TargetSource(filterObject); this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game); if (target.getFirstTarget() != null) { mageObjectReference = new MageObjectReference(target.getFirstTarget(), game); } else { mageObjectReference = null; } }