// Whenever an artifact is put into a graveyard from the battlefield, you may have target opponent lose 1 life.
Effect effect = new LoseLifeTargetEffect(1);
effect.setText("you may have target opponent lose 1 life");
Ability ability = new ZoneChangeAllTriggeredAbility(Zone.BATTLEFIELD, Zone.BATTLEFIELD, Zone.GRAVEYARD,
effect, new FilterArtifactPermanent(),
"Whenever an artifact is put into a graveyard from the battlefield, ", true);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}