// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
Condition condition = new EquippedMatchesFilterCondition(filter);
// Enchanted creature has double strike as long as it's an enchantment. Otherwise, prevent all damage that would be dealt by enchanted creature
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(
new GainAbilityAttachedEffect(DoubleStrikeAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield),
condition, "Enchanted creature has double strike as long as it's an enchantment"));
ReplacementEffect effect = new PreventAllDamageByAttachedEffect(Duration.WhileOnBattlefield, "enchanted creature", false);
effect.setText("Otherwise, prevent all damage that would be dealt by enchanted creature");
ability.addEffect(new ConditionalReplacementEffect(effect, new InvertCondition(condition)));
this.addAbility(ability);
}