mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f18e29ed9d
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