Implemented Repeated Reverberation

This commit is contained in:
Evan Kranzler 2019-06-29 15:14:04 -04:00
parent 4e9d9de99f
commit b9c9fe4178
2 changed files with 135 additions and 0 deletions

View file

@ -0,0 +1,134 @@
package mage.cards.r;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.LoyaltyAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.game.stack.StackAbility;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RepeatedReverberation extends CardImpl {
public RepeatedReverberation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}{R}");
// When you next cast an instant spell, cast a sorcery spell, or activate a loyalty ability this turn, copy that spell or ability twice. You may choose new targets for the copies.
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new ChandraTheFirebrandAbility()));
}
private RepeatedReverberation(final RepeatedReverberation card) {
super(card);
}
@Override
public RepeatedReverberation copy() {
return new RepeatedReverberation(this);
}
}
class ChandraTheFirebrandAbility extends DelayedTriggeredAbility {
ChandraTheFirebrandAbility() {
super(null, Duration.EndOfTurn);
}
private ChandraTheFirebrandAbility(final ChandraTheFirebrandAbility ability) {
super(ability);
}
@Override
public ChandraTheFirebrandAbility copy() {
return new ChandraTheFirebrandAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!event.getPlayerId().equals(this.getControllerId())) {
return false;
}
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.isInstantOrSorcery()) {
this.getEffects().clear();
this.addEffect(
new CopyTargetSpellEffect(true)
.setTargetPointer(new FixedTarget(event.getTargetId(), game))
);
this.addEffect(
new CopyTargetSpellEffect(true)
.setTargetPointer(new FixedTarget(event.getTargetId(), game))
);
return true;
}
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
if (stackAbility != null && stackAbility.getStackAbility() instanceof LoyaltyAbility) {
this.getEffects().clear();
this.addEffect(
new StrionicResonatorEffect()
.setTargetPointer(new FixedTarget(event.getTargetId(), game))
);
return true;
}
return false;
}
@Override
public String getRule() {
return "When you next cast an instant spell, cast a sorcery spell, or activate a loyalty ability this turn, " +
"copy that spell or ability twice. You may choose new targets for the copies.";
}
}
class StrionicResonatorEffect extends OneShotEffect {
StrionicResonatorEffect() {
super(Outcome.Copy);
}
private StrionicResonatorEffect(final StrionicResonatorEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(targetPointer.getFirst(game, source));
if (stackAbility == null) {
return false;
}
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (controller == null || sourcePermanent == null) {
return false;
}
stackAbility.createCopyOnStack(game, source, source.getControllerId(), true);
stackAbility.createCopyOnStack(game, source, source.getControllerId(), true);
game.informPlayers(sourcePermanent.getIdName() + ": " + controller.getLogName() + " copied loyalty ability twice");
return true;
}
@Override
public StrionicResonatorEffect copy() {
return new StrionicResonatorEffect(this);
}
}

View file

@ -256,6 +256,7 @@ public final class CoreSet2020 extends ExpansionSet {
cards.add(new SetCardInfo("Reckless Air Strike", 154, Rarity.COMMON, mage.cards.r.RecklessAirStrike.class));
cards.add(new SetCardInfo("Reduce to Ashes", 155, Rarity.COMMON, mage.cards.r.ReduceToAshes.class));
cards.add(new SetCardInfo("Renowned Weaponsmith", 72, Rarity.UNCOMMON, mage.cards.r.RenownedWeaponsmith.class));
cards.add(new SetCardInfo("Repeated Reverberation", 156, Rarity.RARE, mage.cards.r.RepeatedReverberation.class));
cards.add(new SetCardInfo("Retributive Wand", 236, Rarity.UNCOMMON, mage.cards.r.RetributiveWand.class));
cards.add(new SetCardInfo("Rienne, Angel of Rebirth", 281, Rarity.MYTHIC, mage.cards.r.RienneAngelOfRebirth.class));
cards.add(new SetCardInfo("Ripscale Predator", 157, Rarity.COMMON, mage.cards.r.RipscalePredator.class));