[DSK] Implement Cursed Recording

This commit is contained in:
theelk801 2024-06-28 15:27:30 -04:00
parent f0a77a8551
commit f53fb22916
3 changed files with 60 additions and 45 deletions

View file

@ -0,0 +1,59 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.common.delayed.CopyNextSpellDelayedTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.SourceHasCounterCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.DamageControllerEffect;
import mage.abilities.effects.common.RemoveAllCountersSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class CursedRecording extends CardImpl {
private static final Condition condition = new SourceHasCounterCondition(CounterType.TIME, 7);
public CursedRecording(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{R}{R}");
// Whenever you cast an instant or sorcery spell, put a time counter on Cursed Recording. Then if there are seven or more time counters on it, remove those counters and it deals 20 damage to you.
Ability ability = new SpellCastControllerTriggeredAbility(
new AddCountersSourceEffect(CounterType.TIME.createInstance()),
StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY, true
);
ability.addEffect(new ConditionalOneShotEffect(
new RemoveAllCountersSourceEffect(CounterType.TIME),
condition, "then if there are seven or more time counters on it, " +
"remove those counters and it deals 20 damage to you"
).addEffect(new DamageControllerEffect(20)));
this.addAbility(ability);
// {T}: When you next cast an instant or sorcery spell this turn, copy that spell. You may choose new targets for the copy.
this.addAbility(new SimpleActivatedAbility(
new CreateDelayedTriggeredAbilityEffect(new CopyNextSpellDelayedTriggeredAbility()), new TapSourceCost()
));
}
private CursedRecording(final CursedRecording card) {
super(card);
}
@Override
public CursedRecording copy() {
return new CursedRecording(this);
}
}

View file

@ -21,6 +21,7 @@ public final class DuskmournHouseOfHorror extends ExpansionSet {
this.hasBasicLands = true;
this.hasBoosters = false; // temporary
cards.add(new SetCardInfo("Cursed Recording", 131, Rarity.RARE, mage.cards.c.CursedRecording.class));
cards.add(new SetCardInfo("Enduring Tenacity", 95, Rarity.RARE, mage.cards.e.EnduringTenacity.class));
cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Island", 273, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));

View file

@ -1,45 +0,0 @@
package mage.abilities.effects.common.counter;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author TheElk801
*/
public class RemoveAllCountersSourceEffect extends OneShotEffect {
private final CounterType counterType;
public RemoveAllCountersSourceEffect(CounterType counterType) {
super(Outcome.Neutral);
this.counterType = counterType;
staticText = "remove all " + counterType.getName() + " counters from {this}.";
}
public RemoveAllCountersSourceEffect(RemoveAllCountersSourceEffect effect) {
super(effect);
this.counterType = effect.counterType;
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent != null) {
int count = permanent.getCounters(game).getCount(counterType);
permanent.removeCounters(counterType.getName(), count, source, game);
return true;
}
return false;
}
@Override
public RemoveAllCountersSourceEffect copy() {
return new RemoveAllCountersSourceEffect(this);
}
}