[AFR] Implemented Vorpal Sword

This commit is contained in:
Evan Kranzler 2021-05-07 08:10:29 -04:00
parent c47afc8c4f
commit 071f03c491
3 changed files with 106 additions and 16 deletions

View file

@ -0,0 +1,91 @@
package mage.cards.v;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToAPlayerAttachedTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.LoseGameTargetPlayerEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class VorpalSword extends CardImpl {
public VorpalSword(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{B}");
this.subtype.add(SubType.EQUIPMENT);
// Equipped creature gets +2/+0 and has deathtouch.
Ability ability = new SimpleStaticAbility(new BoostEquippedEffect(2, 0));
ability.addEffect(new GainAbilityAttachedEffect(
DeathtouchAbility.getInstance(), AttachmentType.EQUIPMENT
).setText("and has deathtouch"));
this.addAbility(ability);
// {5}{B}{B}{B}: Until end of turn, Vorpal Sword gains "Whenever equipped creature deals combat damage to a player, that player loses the game."
this.addAbility(new SimpleActivatedAbility(new GainAbilitySourceEffect(
new DealsDamageToAPlayerAttachedTriggeredAbility(
new LoseGameTargetPlayerEffect(), "equipped creature",
false, true
), Duration.EndOfTurn
), new ManaCostsImpl<>("{5}{B}{B}{B}")));
// Equip {B}{B}
this.addAbility(new EquipAbility(Outcome.Benefit, new ManaCostsImpl<>("{B}{B}")));
}
private VorpalSword(final VorpalSword card) {
super(card);
}
@Override
public VorpalSword copy() {
return new VorpalSword(this);
}
}
// Twas brillig, and the slithy toves
// Did gyre and gimble in the wabe:
// All mimsy were the borogoves,
// And the mome raths outgrabe.
// Beware the Jabberwock, my son!
// The jaws that bite, the claws that catch!
// Beware the Jubjub bird, and shun
// The frumious Bandersnatch!
// He took his vorpal sword in hand;
// Long time the manxome foe he sought
// So rested he by the Tumtum tree
// And stood awhile in thought.
// And, as in uffish thought he stood,
// The Jabberwock, with eyes of flame,
// Came whiffling through the tulgey wood,
// And burbled as it came!
// One, two! One, two! And through and through
// The vorpal blade went snicker-snack!
// He left it dead, and with its head
// He went galumphing back.
// And hast thou slain the Jabberwock?
// Come to my arms, my beamish boy!
// O frabjous day! Callooh! Callay!
// He chortled in his joy.
// Twas brillig, and the slithy toves
// Did gyre and gimble in the wabe:
// All mimsy were the borogoves,
// And the mome raths outgrabe.

View file

@ -32,6 +32,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet {
cards.add(new SetCardInfo("Portable Hole", 33, Rarity.COMMON, mage.cards.p.PortableHole.class));
cards.add(new SetCardInfo("Power Word Kill", 114, Rarity.UNCOMMON, mage.cards.p.PowerWordKill.class));
cards.add(new SetCardInfo("Swamp", 273, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Vorpal Sword", 124, Rarity.RARE, mage.cards.v.VorpalSword.class));
}
}

View file

@ -15,10 +15,10 @@ import mage.target.targetpointer.FixedTarget;
* @author Loki
*/
public class DealsDamageToAPlayerAttachedTriggeredAbility extends TriggeredAbilityImpl {
private boolean setFixedTargetPointer;
private String attachedDescription;
private boolean onlyCombat;
private TargetController targetController;
private final boolean setFixedTargetPointer;
private final String attachedDescription;
private final boolean onlyCombat;
private final TargetController targetController;
public DealsDamageToAPlayerAttachedTriggeredAbility(Effect effect, String attachedDescription, boolean optional) {
this(effect, attachedDescription, optional, false);
@ -73,18 +73,16 @@ public class DealsDamageToAPlayerAttachedTriggeredAbility extends TriggeredAbili
}
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
Permanent p = game.getPermanent(event.getSourceId());
if ((!onlyCombat || damageEvent.isCombatDamage())
&& p != null && p.getAttachments().contains(this.getSourceId())) {
if (setFixedTargetPointer) {
for (Effect effect : this.getEffects()) {
effect.setValue("damage", event.getAmount());
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
if ((onlyCombat && !damageEvent.isCombatDamage())
|| p == null || !p.getAttachments().contains(this.getSourceId())) {
return false;
}
if (setFixedTargetPointer) {
getEffects().setValue("damage", event.getAmount());
getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
}
return false;
}
@Override
public String getRule() {
@ -94,7 +92,7 @@ public class DealsDamageToAPlayerAttachedTriggeredAbility extends TriggeredAbili
sb.append(" combat");
}
sb.append(" damage to ");
switch(targetController) {
switch (targetController) {
case OPPONENT:
sb.append("an opponent, ");
break;