Added Storm of Saruman card (#10433)

* Added Storm of Saruman card

Some classes have been added/adjusted for code reusability:
- CastSecondSpellTriggeredAbility has been modified to set a target pointer to either the caster or the spell (used here to set a target pointer to the spell for the copy effect)
- CopyTargetSpellEffect has been modified to allow specifying a copy applier (used here to apply the legenedary-stripping effect)
- RemoveTypeCopyApplier has been added as a generic copy applier for any cards which read "except it isn't <type>"

* Fixed verify failure - Remove ward hint on Storm of Saruman

* Fixed a typo - ammount -> amount

* Modified Double Major to use new CopyTargetSpellEffect

* Re-added ability text for Double Major
This commit is contained in:
Alexander Novotny 2023-06-08 13:58:28 -07:00 committed by GitHub
parent 49075d6893
commit 0b2f582d84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 217 additions and 57 deletions

View file

@ -8,8 +8,7 @@ import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.util.functions.StackObjectCopyApplier;
/**
* @author BetaSteward_at_googlemail.com
@ -20,6 +19,8 @@ public class CopyTargetSpellEffect extends OneShotEffect {
private final boolean useLKI;
private String copyThatSpellName = "that spell";
private final boolean chooseTargets;
private final int amount;
private final StackObjectCopyApplier applier;
public CopyTargetSpellEffect() {
this(false);
@ -34,10 +35,29 @@ public class CopyTargetSpellEffect extends OneShotEffect {
}
public CopyTargetSpellEffect(boolean useController, boolean useLKI, boolean chooseTargets) {
this(useController, useLKI, chooseTargets, 1);
}
public CopyTargetSpellEffect(boolean useController, boolean useLKI, boolean chooseTargets, int amount) {
this(useController, useLKI, chooseTargets, amount, null);
}
/**
*
* @param useController Whether to create the copy under the control of the original spell's controller (true) or the controller of the ability that this effect is on (false)
* @param useLKI Whether to get last-known information about the spell before resolving the effect (for instance for abilities which don't target a spell but reference it some other way)
* @param chooseTargets Whether the new copy and choose new targets
* @param amount The amount of copies to create
* @param applier An applier to apply to the newly created copies. Used to change copiable values of the copy, such as types or name
*/
public CopyTargetSpellEffect(boolean useController, boolean useLKI, boolean chooseTargets, int amount,
StackObjectCopyApplier applier) {
super(Outcome.Copy);
this.useController = useController;
this.useLKI = useLKI;
this.chooseTargets = chooseTargets;
this.amount = amount;
this.applier = applier;
}
public CopyTargetSpellEffect(final CopyTargetSpellEffect effect) {
@ -46,6 +66,8 @@ public class CopyTargetSpellEffect extends OneShotEffect {
this.useController = effect.useController;
this.copyThatSpellName = effect.copyThatSpellName;
this.chooseTargets = effect.chooseTargets;
this.amount = effect.amount;
this.applier = effect.applier;
}
public Effect withSpellName(String copyThatSpellName) {
@ -65,7 +87,8 @@ public class CopyTargetSpellEffect extends OneShotEffect {
spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK);
}
if (spell != null) {
spell.createCopyOnStack(game, source, useController ? spell.getControllerId() : source.getControllerId(), chooseTargets);
spell.createCopyOnStack(game, source, useController ? spell.getControllerId() : source.getControllerId(),
chooseTargets, amount, applier);
return true;
}
return false;