@Override public boolean apply(Game game, Ability source) { Object tribute = game.getState().getValue("tributeValue" + source.getSourceId()); if (tribute != null) { return ((String) tribute).equals("no"); } return false; } }
@Override public void adjustTargets(Ability ability, Game game) { Card card = game.getCard(ability.getSourceId()); if (card != null) { card.adjustTargets(ability, game); } }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId()); if (sourcePermanent == null) { sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD); } if (sourcePermanent != null) { return sourcePermanent.getToughness().getValue(); } return 0; }
@Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { return "You can't cast creature spells this turn (" + mageObject.getIdName() + ")."; } return null; }
@Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject sourceObject = game.getObject(source.getSourceId()); if (sourceObject != null) { return "This spell can't be countered because mana from " + sourceObject.getName() + " was spent to cast it."; } return null; }
@Override public boolean apply(Game game, Ability source) { Card card = game.getCard(source.getSourceId()); if (card != null) { return card.getAbilities().stream() .filter(ab -> ab instanceof EvokeAbility) .anyMatch(evoke -> ((EvokeAbility) evoke).isActivated(source, game)); } return false; } }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (permanent != null) { // except only takes place if something was copied if (permanent.isCopy()) { return super.apply(game, source); } } return false; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int value = game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); if (multiplier != null) { value *= multiplier; } return value; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getType() == GameEvent.EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) { CombatDamageStepStartedWatcher watcher = game.getState().getWatcher(CombatDamageStepStartedWatcher.class); return watcher == null || watcher.conditionMet(); } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.addCounters(CounterType.CHARGE.createInstance((Integer) this.getValue("damageAmount")), source, game); } return true; } }
@Override public boolean apply(Game game, Ability source) { Permanent attachment = game.getPermanent(source.getSourceId()); if (attachment == null || attachment.getAttachedTo() == null) { return false; } Permanent attachedTo = game.getPermanent(attachment.getAttachedTo()); return (attachedTo != null); } }
@Override public boolean apply(Game game, Ability source) { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Token token = new SoldierToken(); token.putOntoBattlefield(1, game, source.getSourceId(), opponentId); } return true; } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); return creature != null && creature.isControlledBy(source.getControllerId()) && creature.isCreature() && creature.hasSubtype(SubType.WARRIOR, game) && !event.getTargetId().equals(source.getSourceId()); }
@Override public boolean apply(Game game, Ability source) { Permanent target = game.getBattlefield().getPermanent(source.getFirstTarget()); if (target != null) { if (filter.match(target, source.getSourceId(), source.getControllerId(), game)) { return true; } } return false; } }
@Override public int calculate(Game game, Ability source, Effect effect) { Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent enchanted = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); return enchanted.getToughness().getValue(); }
@Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); Permanent permanentToUntap = game.getPermanent((event.getTargetId())); if (permanentToUntap != null && mageObject != null) { return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')'; } return null; }
@Override public boolean apply(Game game, Ability source) { int damage = 0; for (UUID opponentId: game.getOpponents(source.getControllerId())) { damage += game.getPlayer(opponentId).damage(3, source.getSourceId(), game, false, true); } game.getPlayer(source.getControllerId()).gainLife(damage, game, source); return true; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, sourceAbility.getSourceId(), sourceAbility.getSourceObjectZoneChangeCounter())); if (exileZone != null) { Card exiledCard = exileZone.getRandom(game); if (exiledCard != null) { return exiledCard.getPower().getValue(); } } return 0; }
@Override public boolean apply(Game game, Ability source) { SpecialAction newAction = (SpecialAction) action.copy(); newAction.setSourceId(source.getSourceId()); newAction.setControllerId(source.getControllerId()); newAction.getTargets().addAll(source.getTargets()); game.getState().getSpecialActions().add(newAction); return true; }
@Override public boolean apply(Game game, Ability source) { FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Eldrazi Spawn"); filter.add(new SubtypePredicate(SubType.ELDRAZI)); filter.add(new SubtypePredicate(SubType.SPAWN)); EldraziSpawnToken token = new EldraziSpawnToken(); int count = game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0 ? 3 : 1; token.putOntoBattlefield(count, game, source.getSourceId(), source.getControllerId()); return true; } }