[VOW] Implemented Change of Fortune

This commit is contained in:
Daniel Bomar 2021-10-29 11:26:42 -05:00
parent ef2a45227d
commit 7da842a754
No known key found for this signature in database
GPG key ID: C86C8658F4023918
2 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,63 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.discard.DiscardHandControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.Game;
import mage.watchers.common.DiscardedCardWatcher;
/**
*
* @author weirddan455
*/
public final class ChangeOfFortune extends CardImpl {
public ChangeOfFortune(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}");
// Discard your hand, then draw a card for each card you've discarded this turn.
this.getSpellAbility().addEffect(new DiscardHandControllerEffect());
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(ChangeOfFortuneValue.instance));
this.getSpellAbility().addWatcher(new DiscardedCardWatcher());
}
private ChangeOfFortune(final ChangeOfFortune card) {
super(card);
}
@Override
public ChangeOfFortune copy() {
return new ChangeOfFortune(this);
}
}
enum ChangeOfFortuneValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return DiscardedCardWatcher.getDiscarded(sourceAbility.getControllerId(), game);
}
@Override
public ChangeOfFortuneValue copy() {
return instance;
}
@Override
public String getMessage() {
return "card you've discarded this turn";
}
@Override
public String toString() {
return "X";
}
}

View file

@ -34,6 +34,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
cards.add(new SetCardInfo("Anje, Maid of Dishonor", 231, Rarity.RARE, mage.cards.a.AnjeMaidOfDishonor.class));
cards.add(new SetCardInfo("Apprentice Sharpshooter", 185, Rarity.COMMON, mage.cards.a.ApprenticeSharpshooter.class));
cards.add(new SetCardInfo("By Invitation Only", 5, Rarity.RARE, mage.cards.b.ByInvitationOnly.class));
cards.add(new SetCardInfo("Change of Fortune", 150, Rarity.RARE, mage.cards.c.ChangeOfFortune.class));
cards.add(new SetCardInfo("Deathcap Glade", 261, Rarity.RARE, mage.cards.d.DeathcapGlade.class));
cards.add(new SetCardInfo("Demonic Bargain", 103, Rarity.RARE, mage.cards.d.DemonicBargain.class));
cards.add(new SetCardInfo("Dig Up", 197, Rarity.RARE, mage.cards.d.DigUp.class));