[MID] Implemented Silver Bolt

This commit is contained in:
Evan Kranzler 2021-09-12 08:58:52 -04:00
parent 1a5f15751d
commit e9d78fc5ac
4 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,74 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SilverBolt extends CardImpl {
public SilverBolt(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
// {3}, {T}, Sacrifice Silver Bolt: It deals 3 damage to target creature. If a Werewolf is dealt damage this way, destroy it.
Ability ability = new SimpleActivatedAbility(new SilverBoltEffect(), new GenericManaCost(3));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
private SilverBolt(final SilverBolt card) {
super(card);
}
@Override
public SilverBolt copy() {
return new SilverBolt(this);
}
}
class SilverBoltEffect extends OneShotEffect {
SilverBoltEffect() {
super(Outcome.Benefit);
staticText = "it deals 3 damage to target creature. If a Werewolf is dealt damage this way, destroy it";
}
private SilverBoltEffect(final SilverBoltEffect effect) {
super(effect);
}
@Override
public SilverBoltEffect copy() {
return new SilverBoltEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
if (permanent.damage(3, source, game) > 0
&& permanent.hasSubtype(SubType.WEREWOLF, game)) {
permanent.destroy(source, game, false);
}
return true;
}
}

View file

@ -246,6 +246,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
cards.add(new SetCardInfo("Shipwreck Marsh", 267, Rarity.RARE, mage.cards.s.ShipwreckMarsh.class));
cards.add(new SetCardInfo("Siege Zombie", 121, Rarity.COMMON, mage.cards.s.SiegeZombie.class));
cards.add(new SetCardInfo("Sigarda, Champion of Light", 240, Rarity.MYTHIC, mage.cards.s.SigardaChampionOfLight.class));
cards.add(new SetCardInfo("Silver Bolt", 258, Rarity.COMMON, mage.cards.s.SilverBolt.class));
cards.add(new SetCardInfo("Skaab Wrangler", 75, Rarity.UNCOMMON, mage.cards.s.SkaabWrangler.class));
cards.add(new SetCardInfo("Slaughter Specialist", 122, Rarity.RARE, mage.cards.s.SlaughterSpecialist.class));
cards.add(new SetCardInfo("Snarling Wolf", 199, Rarity.COMMON, mage.cards.s.SnarlingWolf.class));

View file

@ -125,6 +125,8 @@ public interface Permanent extends Card, Controllable {
int getDamage();
int damage(int damage, Ability source, Game game);
int damage(int damage, UUID attackerId, Ability source, Game game);
int damage(int damage, UUID attackerId, Ability source, Game game, boolean combat, boolean preventable);
@ -168,6 +170,8 @@ public interface Permanent extends Card, Controllable {
MageObject getBasicMageObject(Game game);
boolean destroy(Ability source, Game game);
boolean destroy(Ability source, Game game, boolean noRegen);
/**

View file

@ -840,6 +840,11 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
return this.damage;
}
@Override
public int damage(int damage, Ability source, Game game) {
return damage(damage, source.getSourceId(), source, game);
}
@Override
public int damage(int damage, UUID attackerId, Ability source, Game game) {
return doDamage(damage, attackerId, source, game, true, false, false, null);
@ -1165,6 +1170,11 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
return true;
}
@Override
public boolean destroy(Ability source, Game game) {
return destroy(source, game, false);
}
@Override
public boolean destroy(Ability source, Game game, boolean noRegen) {
// Only permanets on the battlefield can be destroyed