mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
- Fixed #6216
This commit is contained in:
parent
a072d8275f
commit
507658e942
1 changed files with 43 additions and 11 deletions
|
@ -1,14 +1,17 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DamageTargetControllerEffect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -17,14 +20,12 @@ import mage.target.common.TargetArtifactPermanent;
|
|||
public final class SmashToSmithereens extends CardImpl {
|
||||
|
||||
public SmashToSmithereens(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}");
|
||||
|
||||
// Destroy target artifact. Smash to Smithereens deals 3 damage to that artifact's controller.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||
Effect effect = new DamageTargetControllerEffect(3);
|
||||
effect.setText("{this} deals 3 damage to that artifact's controller");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetArtifactPermanent());
|
||||
this.getSpellAbility().addEffect(new SmashToSmithereensEffect());
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT));
|
||||
|
||||
}
|
||||
|
||||
public SmashToSmithereens(final SmashToSmithereens card) {
|
||||
|
@ -36,3 +37,34 @@ public final class SmashToSmithereens extends CardImpl {
|
|||
return new SmashToSmithereens(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SmashToSmithereensEffect extends OneShotEffect {
|
||||
|
||||
SmashToSmithereensEffect() {
|
||||
super(Outcome.Detriment);
|
||||
staticText = "Destroy target artifact. Smash to Smithereens deals 3 damage to that artifact's controller";
|
||||
}
|
||||
|
||||
private SmashToSmithereensEffect(final SmashToSmithereensEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmashToSmithereensEffect copy() {
|
||||
return new SmashToSmithereensEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent targetArtifact = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
|
||||
if (targetArtifact != null) {
|
||||
Player controllerOfArtifact = game.getPlayer(targetArtifact.getControllerId());
|
||||
targetArtifact.destroy(source.getSourceId(), game, false);
|
||||
if (controllerOfArtifact != null) {
|
||||
controllerOfArtifact.damage(3, source.getSourceId(), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue