foul-magics/Mage.Sets/src/mage/cards/b/ByForce.java
2018-09-24 11:21:56 -04:00

48 lines
No EOL
1.3 KiB
Java

package mage.cards.b;
import mage.abilities.Ability;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.Game;
import mage.target.common.TargetArtifactPermanent;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/**
* @author spjspj
*/
public final class ByForce extends CardImpl {
public ByForce(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}");
// Destroy X target artifacts.
this.getSpellAbility().addEffect(new DestroyTargetEffect("Destroy X target artifacts"));
this.getSpellAbility().addTarget(new TargetArtifactPermanent());
this.getSpellAbility().setTargetAdjuster(ByForceAdjuster.instance);
}
public ByForce(final ByForce card) {
super(card);
}
@Override
public ByForce copy() {
return new ByForce(this);
}
}
enum ByForceAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
int xValue = ability.getManaCostsToPay().getX();
ability.addTarget(new TargetArtifactPermanent(xValue, xValue));
}
}