@Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getAttachments().contains((source.getSourceId()))) { return true; } return false; }
@Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getAttachments().contains((source.getSourceId()))) { return true; } return false; }
@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 applies(Ability abilityToModify, Ability source, Game game) { Permanent creature = game.getPermanent(abilityToModify.getSourceId()); if (creature != null && creature.getAttachments().contains(source.getSourceId())) { if (abilityToModify instanceof ActivatedAbility && !(abilityToModify instanceof SpellAbility)) { return true; } } return false; }
@Override public boolean applies(Permanent permanent, Ability source, Game game) { return game.getPermanent(source.getSourceId()) != null && permanent.getAttachments().contains(source.getSourceId()); }
@Override public boolean checkTrigger(GameEvent event, Game game) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; Permanent damageMakingCreature = game.getPermanent(event.getSourceId()); return damageEvent.isCombatDamage() && damageMakingCreature != null && damageMakingCreature.getAttachments().contains(this.getSourceId()); }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.TRANSFORMED) { if (game.getPermanent(event.getTargetId()).getAttachments().contains(this.getSourceId())) { return true; } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; Permanent p = game.getPermanent(event.getSourceId()); return damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId()); }
@Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getSourceId()); return permanent != null && game.getOpponents(this.controllerId).contains(event.getTargetId()) && permanent.getAttachments().contains(this.getSourceId()); }
@Override public boolean checkTrigger(GameEvent event, Game game) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; Permanent p = game.getPermanent(event.getSourceId()); return damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId()); }
@Override public boolean checkTrigger(GameEvent event, Game game) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; Permanent p = game.getPermanent(event.getSourceId()); return damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId()); }
@Override public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD) { Permanent enchanted = game.getPermanentOrLKIBattlefield(event.getTargetId()); if (enchanted != null && enchanted.getAttachments().contains(getSourceId()) && enchanted.isHistoric()) { return true; } } return false; }
@Override public boolean applies(Ability abilityToModify, Ability source, Game game) { Permanent artifact = game.getPermanent(abilityToModify.getSourceId()); if (artifact != null && artifact.getAttachments().contains(source.getSourceId())) { if (abilityToModify.getAbilityType() == AbilityType.ACTIVATED || (abilityToModify.getAbilityType() == AbilityType.MANA && (abilityToModify instanceof ActivatedAbility))) { 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 checkTrigger(GameEvent event, Game game) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; Permanent p = game.getPermanent(event.getSourceId()); if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } return true; } 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.getAttachments().contains(this.getSourceId())) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } return true; } 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.getAttachments().contains(this.getSourceId())) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; Permanent damageSource = game.getPermanent(event.getSourceId()); if (damageEvent.isCombatDamage() && damageSource != null && damageSource.getAttachments().contains(this.getSourceId())) { game.getState().setValue("Damage_" + getSourceId(), damageEvent.getAmount()); return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { Permanent sourcePermanet = game.getPermanent(event.getSourceId()); Permanent targetPermanet = game.getPermanent(event.getTargetId()); if (sourcePermanet != null && targetPermanet != null && sourcePermanet.getAttachments().contains(this.getSourceId()) && filter.match(targetPermanet, game)) { this.getEffects().get(0).setValue("damageAmount", event.getAmount()); this.getEffects().get(0).setValue("damagedCreatureId", targetPermanet.getId()); return true; } return false; }