@Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.isControlledBy(source.getFirstTarget())) { return true; } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getPlayerId().equals(source.getFirstTarget())) { return true; } return false; } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { return event.getTargetId().equals(source.getFirstTarget()) && event.getSourceId().equals(targetSource.getFirstTarget()); }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { return permanent.changeControllerId(source.getFirstTarget(), game); } else { discard(); } return false; }
@Override public void init(Ability source, Game game) { super.init(source, game); if (this.affectedObjectsSet) { List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getFirstTarget(), game); for (Permanent creature : creatures) { affectedObjectList.add(new MageObjectReference(creature, game)); } } }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { return permanent.changeControllerId(source.getFirstTarget(), game); } else { discard(); } return false; } }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { Player player = game.getPlayer(sourceAbility.getFirstTarget()); if (player != null) { return player.getHand().size(); } } return 0; }
@Override public boolean canTarget(UUID id, Ability source, Game game) { UUID firstTarget = source.getFirstTarget(); Permanent permanent = game.getPermanent(id); if (firstTarget != null && permanent != null && permanent.isControlledBy(firstTarget)) { return super.canTarget(id, source, game); } return false; }
@Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getId().equals(source.getTargets().get(1).getFirstTarget())) { return permanent.canBlock(source.getFirstTarget(), game); } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (targetPointer != null) { permanent = game.getPermanent(targetPointer.getFirst(game, source)); } if (permanent != null && controller != null) { return permanent.changeControllerId(controller, game); } return false; } }
@Override public boolean canTarget(UUID id, Ability source, Game game) { if (super.canTarget(id, source, game)) { Permanent target1 = game.getPermanent(source.getFirstTarget()); Permanent opponentPermanent = game.getPermanent(id); if (target1 != null && opponentPermanent != null) { return target1.shareTypes(opponentPermanent); } } return false; }
@Override public boolean apply(Game game, Ability source) { if (!source.getTargets().isEmpty()) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { return permanent.hasSubtype(subtype, game); } } return false; } }
@Override public boolean apply(Game game, Ability source) { ContinuousEffect effect = new BoostTargetEffect(amount, amount, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); game.addEffect(effect, source); return true; } }
@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 boolean apply(Game game, Ability source) { Permanent targetCreature = game.getPermanent(source.getFirstTarget()); if (targetCreature != null) { int toughness = targetCreature.getToughness().getBaseValueModified(); game.addEffect(new SetPowerToughnessTargetEffect(0, toughness, Duration.EndOfTurn), source); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD); if (permanent != null) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.gainLife(permanent.getToughness().getValue(), game, source); } } return false; }
@Override public boolean apply(Game game, Ability source) { UUID targetId = source.getFirstTarget(); if (targetId != null) { StackObject stackObject = game.getStack().getStackObject(targetId); if (stackObject != null) { return stackObject.getStackAbility().getManaCostsToPay().getPayment().count() == 0; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null) { int amount = 2 * game.getBattlefield().countAll(filter, targetPlayer.getId(), game); targetPlayer.damage(amount, source.getSourceId(), game, false, true); return true; } return false; } }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), false); if (!game.replaceEvent(preventEvent)) { int damage = event.getAmount(); event.setAmount(0); game.informPlayers("Damage has been prevented: " + damage); game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage)); } return false; }
@Override public boolean apply(Game game, Ability source) { DynamicValue amount = new HighestConvertedManaCostValue(); Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); if (spell != null && spell.getConvertedManaCost() <= amount.calculate(game, source, this)) { return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); } return false; } }