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

@ -109,6 +109,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
protected Map<String, String> info = new LinkedHashMap<>(); // additional info for permanent's rules
protected int createOrder;
protected boolean legendRuleApplies = true;
protected boolean prototyped;
private static final List<UUID> emptyList = Collections.unmodifiableList(new ArrayList<>());
@ -179,6 +180,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.morphed = permanent.morphed;
this.manifested = permanent.manifested;
this.createOrder = permanent.createOrder;
this.prototyped = permanent.prototyped;
}
@Override
@ -1616,6 +1618,11 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
return this.monstrous;
}
@Override
public boolean isPrototyped() {
return this.prototyped;
}
@Override
public void setMonstrous(boolean value) {
this.monstrous = value;
@ -1829,6 +1836,10 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.secondSideCard = card;
}
public void setPrototyped(boolean prototyped) {
this.prototyped = prototyped;
}
@Override
public boolean isRingBearer() {
return ringBearerFlag;