@Override public boolean apply(MageObject input, Game game) { return color != null && input.getColor(game).contains(color); }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (!this.used && super.applies(event, source, game)) { if (event.getTargetId().equals(source.getControllerId()) && event.getSourceId().equals(target.getFirstTarget())) { return (game.getObject(target.getFirstTarget()).getColor(game).contains(ObjectColor.BLACK) || game.getObject(target.getFirstTarget()).getColor(game).contains(ObjectColor.RED)); } } return false; } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getTargetId().equals(source.getControllerId())) { MageObject sourceObject = game.getObject(event.getSourceId()); if (sourceObject != null && sourceObject.getColor(game).contains(color)) { return super.applies(event, source, game); } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { MageObject object = game.getObject(event.getSourceId()); if (object instanceof Spell) { if (event.getTargetId().equals(this.getControllerId()) && object.getColor(game).contains(ObjectColor.WHITE) && (object.isInstant() || object.isSorcery())) { return true; } } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { ObjectColor chosenColor = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); // spell is not on the stack yet, so we have to check the card Card card = game.getCard(event.getSourceId()); if (chosenColor != null && card != null && card.getColor(game).contains(chosenColor)) { return true; } } return false; }
@Override public boolean apply(Game game, Ability source, Ability abilityToModify) { MageObject sourceObject = game.getObject(abilityToModify.getSourceId()); if (sourceObject != null) { ObjectColor color1 = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color1"); ObjectColor color2 = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color2"); int amount = 0; if (color1 != null && sourceObject.getColor(game).contains(color1)) { amount++; } if (color2 != null && sourceObject.getColor(game).contains(color2)) { amount++; } if (amount > 0) { SpellAbility spellAbility = (SpellAbility) abilityToModify; CardUtil.adjustCost(spellAbility, amount); } return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(getSourceId()); if (permanent != null) { ObjectColor color = (ObjectColor) game.getState().getValue(getSourceId() + "_color"); if (color != null) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(controllerId)) { if (perm.getColor(game).contains(color)) { return false; } } return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); if (color != null) { for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (perm.getColor(game).contains(color)) { perm.addPower(1); perm.addToughness(1); } } } return true; }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); if (you != null) { Spell spell = game.getStack().getSpell(this.getTargetPointer().getFirst(game, source)); if (spell != null) { ObjectColor color1 = new ObjectColor((String) game.getState().getValue(source.getSourceId() + "_color1")); ObjectColor color2 = new ObjectColor((String) game.getState().getValue(source.getSourceId() + "_color2")); int amount = 0; if (spell.getColor(game).contains(color1)) { ++amount; } if (spell.getColor(game).contains(color2)) { ++amount; } if (amount > 0) { you.gainLife(amount, game, source); return true; } } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color"); if (color != null) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { if (perm.getColor(game).contains(color)) { perm.addPower(1); perm.addToughness(1); } } } } return true; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if(event.getTargetId().equals(source.getControllerId())) { Spell spell = null; StackObject stackObject = game.getStack().getStackObject(event.getSourceId()); if (stackObject == null) { stackObject = (StackObject) game.getLastKnownInformation(event.getSourceId(), Zone.STACK); } if (stackObject instanceof Spell) { spell = (Spell) stackObject; } //Checks if damage is from a sorcery or instants and spell is of chosen color Permanent permanent = game.getPermanent(source.getSourceId()); ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color"); if (spell != null && instantOrSorceryFilter.match(spell.getCard(), game) && spell.getColor(game).contains(color)) { TargetPlayer target = new TargetPlayer(); target.add(spell.getControllerId(), game); redirectTarget = target; return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); ChoiceColor choice = new ChoiceColor(); if (controller == null || opponent == null || !controller.choose(outcome, choice, game)) { return false; } int cardsWithColor = 0; Cards cardsToExile = new CardsImpl(); cardsToExile.addAll(opponent.getLibrary().getTopCards(game, source.getManaCostsToPay().getX())); for (Card card : cardsToExile.getCards(game)) { if (card != null && card.getColor(game).contains(choice.getColor())) { cardsWithColor++; } } controller.moveCards(cardsToExile, Zone.EXILED, source, game); if (cardsWithColor > 0) { new CreateTokenEffect(new OonaQueenFaerieToken(), cardsWithColor).apply(game, source); } game.informPlayers("Oona: " + cardsWithColor + " Token" + (cardsWithColor != 1 ? "s" : "") + " created"); return true; } }