Implement Prototype ability (#11249)

Prototype is a SpellAbilityType, for which alternate costs are permitted. It has a continuous effect that applies on the battlefield as well as a method to modify the spell on the stack. Permanents have an isPrototyped flag that copy effects can check explicitly (same brittle method as transformed permanents use; reworking copy effects to streamline them is a separate scope).

Many test cases have been added to confirm functionality (thanks to Zerris for additional test suggestions).

---------

Co-authored-by: Susucre <34709007+Susucre@users.noreply.github.com>
Co-authored-by: Evan Kranzler <theelk801@gmail.com>
Co-authored-by: xenohedron <xenohedron@users.noreply.github.com>
This commit is contained in:
ssk97 2023-10-09 18:06:19 -07:00 committed by GitHub
parent ac20483b73
commit 5e095afdb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 946 additions and 17 deletions

View file

@ -1,9 +1,10 @@
package mage.constants;
import mage.abilities.SpellAbility;
import mage.abilities.keyword.BestowAbility;
import mage.abilities.keyword.MorphAbility;
import mage.abilities.keyword.PrototypeAbility;
import mage.cards.Card;
import mage.game.Game;
import mage.abilities.keyword.MorphAbility;
import mage.game.stack.Spell;
/**
@ -14,6 +15,7 @@ public enum SpellAbilityCastMode {
MADNESS("Madness"),
FLASHBACK("Flashback"),
BESTOW("Bestow"),
PROTOTYPE("Prototype"),
MORPH("Morph"),
TRANSFORMED("Transformed", true),
DISTURB("Disturb", true),
@ -42,7 +44,7 @@ public enum SpellAbilityCastMode {
return text;
}
public Card getTypeModifiedCardObjectCopy(Card card, Game game) {
public Card getTypeModifiedCardObjectCopy(Card card, SpellAbility spellAbility) {
Card cardCopy = card.copy();
if (this.equals(BESTOW)) {
BestowAbility.becomeAura(cardCopy);
@ -53,6 +55,9 @@ public enum SpellAbilityCastMode {
cardCopy = tmp.copy();
}
}
if (this.equals(PROTOTYPE)) {
cardCopy = ((PrototypeAbility) spellAbility).prototypeCardSpell(cardCopy);
}
if (this.equals(MORPH)) {
if (cardCopy instanceof Spell) {
//Spell doesn't support setName, so make a copy of the card (we're blowing it away anyway)