@Override public boolean applies(GameEvent event, Ability source, Game game) { Permanent permanent = game.getPermanent(event.getSourceId()); return permanent != null && (permanent.hasSubtype(SubType.PLAINS, game) || permanent.hasSubtype(SubType.ISLAND, game) || permanent.hasSubtype(SubType.SWAMP, game) || permanent.hasSubtype(SubType.MOUNTAIN, game) || permanent.hasSubtype(SubType.FOREST, game)); } }
@Override public boolean apply(Permanent input, Game game) { return input.getAttachments() .stream() .map(game::getPermanent) .filter(Objects::nonNull) .anyMatch(attachment -> attachment.hasSubtype(SubType.EQUIPMENT, game)); }
private boolean hasAttachedEquipment(Game game, Permanent permanent) { for (UUID attachmentId : permanent.getAttachments()) { Permanent attachment = game.getPermanent(attachmentId); if (attachment != null && attachment.hasSubtype(SubType.EQUIPMENT, game)) { return true; } } return false; }
@Override public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { if (!permanent.hasSubtype(subtype, game)) { permanent.getSubtype(game).add(subtype); } return true; }
@Override public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) { return input.getObject().hasSubtype(SubType.ZOMBIE, game) || input.getObject().getId().equals(input.getSourceId()); } }
@Override public void adjustCosts(Ability ability, Game game) { if (ability instanceof EquipAbility) { Permanent targetCreature = game.getPermanent(ability.getTargets().getFirstTarget()); if (targetCreature != null && (targetCreature.hasSubtype(SubType.SITH, game) || targetCreature.hasSubtype(SubType.JEDI, game))) { CardUtil.increaseCost(ability, 1 - ability.getManaCostsToPay().convertedManaCost()); } } }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(this.getSourceId())) { Permanent attachment = game.getPermanent(event.getSourceId()); if (attachment != null && attachment.hasSubtype(SubType.AURA, game)) { return true; } } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && permanent.isControlledBy(source.getControllerId()) && permanent.hasSubtype(SubType.HUMAN, game)) { return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(this.getControllerId())) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null && (permanent.getId().equals(this.getSourceId()) || permanent.hasSubtype(SubType.WARRIOR, game))) { return true; } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (((ZoneChangeEvent) event).isDiesEvent()) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent.getAttachments().contains(this.getSourceId()) && permanent.hasSubtype(SubType.HUMAN, game)) { return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null && permanent.hasSubtype(SubType.DRAGON, game)) { permanent.addCounters(CounterType.P1P1.createInstance(2), source, game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { int affectedTargets = 0; for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(permanentId); if (permanent != null && permanent.hasSubtype(SubType.SPIRIT, game)) { permanent.addAbility(TrampleAbility.getInstance(), game); affectedTargets++; } } return affectedTargets > 0; }
@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 checkTrigger(GameEvent event, Game game) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; Permanent p = game.getPermanent(event.getSourceId()); if (damageEvent.isCombatDamage() && p != null && p.hasSubtype(SubType.SNAKE, game) && p.isControlledBy(controllerId)) { return true; } return false; }
@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 applies(GameEvent event, Ability source, Game game) { if (super.applies(event, source, game)) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null) { if (permanent.hasSubtype(ChooseCreatureTypeEffect.getChosenCreatureType(source.getSourceId(), game), game)) { return true; } } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(this.controllerId)) { Permanent permanent = game.getPermanent(event.getSourceId()); if (permanent != null && permanent.hasSubtype(SubType.HUMAN, game)) { this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { game.addEffect(new CantBeBlockedTargetEffect(Duration.EndOfTurn), source); if (permanent.hasSubtype(SubType.SNAKE, game)) { game.addEffect(new BoostTargetEffect(2, 2, Duration.EndOfTurn), source); } return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent.isCreature() && permanent.hasSubtype(SubType.BEAST, game) && permanent.isControlledBy(this.controllerId)) { Effect effect = this.getEffects().get(0); effect.setValue("damageSource", event.getTargetId()); return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { Permanent source = game.getPermanent(event.getSourceId()); if (source != null && source.isControlledBy(controllerId) && source.hasSubtype(SubType.TROOPER, game)) { UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(event.getSourceId(), game); this.getEffects().get(0).setTargetPointer(new FixedTarget(defendingPlayerId)); return true; } return false; }