Skip to content

Potential overload rework#14015

Open
ssk97 wants to merge 16 commits intomagefree:masterfrom
ssk97:OverloadRework
Open

Potential overload rework#14015
ssk97 wants to merge 16 commits intomagefree:masterfrom
ssk97:OverloadRework

Conversation

@ssk97
Copy link
Copy Markdown
Contributor

@ssk97 ssk97 commented Oct 13, 2025

Casting a spell with Overload converts all "target" text to "each". Currently this is done by having entirely separate effects. Instead, we can apply the effects after setting up a FixedTargets.

I have not yet finished converting all Overload cards, once I do I will remove the old OverloadAbility constructor. Currently only A-D cards have been modified. Several of the more complex Overload cards will require merging the target and overload effect implementations as the target version uses getFirstTarget.

I was wondering if this seemed worth finishing. I don't expect it to fix any bugs, just remove a lot of repetitive code.

card.getSpellAbility().addEffect(effect.copy());
OverloadedEffect overloadEffect = new OverloadedEffect(effect, target.copy());
overloadEffect.setText(effect.getText(card.getSpellAbility().getModes().getMode())
.replace("target", "each"));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you don’t use conditional style effect and target (one pair for single and one pair for all)? Auto-replace looks overdeveloped and potentially buggy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "all" version of the spell needs to have no target when cast. It sounds to me like you're recommending not continuing this rework and keeping the existing code with its fully separate effects.

The whole point of this rework is to remove the duplicated code by auto-replacing the targets.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, it’s looks strange in current implementation — one shot effect but it can be continues effect inside — thats can broke some effects/targets lifecycle in theory. Not critical and maybe workable.

Also inner effects must support work with target pointers (e.g. each inner effect must have special code to check and use the pointers). Must be carefully replaced and checked.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not call it "special code" as all effects ought to use target pointers as the default, but I agree need to verify each effect properly uses them.

protected OverloadedEffect(final OverloadedEffect effect) {
super(effect);
this.innerEffect = effect.innerEffect;
this.target = effect.target;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Miss copies

@xenohedron
Copy link
Copy Markdown
Contributor

xenohedron commented Oct 14, 2025

I endorse this direction

(just make sure there's adequate test coverage)

@ssk97
Copy link
Copy Markdown
Contributor Author

ssk97 commented Mar 19, 2026

I want to add more tests, I'll un-draft this once I do. Aside from that, there are two separate PRs I'll likely be making at some point in the nearish future:

  1. [[Mizzix's Mastery]] is complex enough that I'm going to make it its own PR, and also make several other cards with multiple "exile copy cast" cards that require ordering). This will also allow the deletion of the previous Overload constructor

  2. Fangs of Kalonia and Spectacular Showdown work, but probably need to be changed. Right now the permanent.addCounters function returned if it put any counters on instead of "was this a legal action" which breaks the [[Vizier of Remedies]]+[[Devoted Druid]] combo. Since messing with the counter code is entirely unrelated to Overload, I'm not touching it here.

@github-actions
Copy link
Copy Markdown

Mizzix's Mastery - (Gatherer) (Scryfall) (EDHREC)

{3}{R}
Sorcery
Exile target card that's an instant or sorcery from your graveyard. For each card exiled this way, copy it, and you may cast the copy without paying its mana cost. Exile Mizzix's Mastery.
Overload {5}{R}{R}{R} (You may cast this spell for its overload cost. If you do, change "target" in its text to "each.")

Vizier of Remedies - (Gatherer) (Scryfall) (EDHREC)

{1}{W}
Creature — Human Cleric
2/1
If one or more -1/-1 counters would be put on a creature you control, that many -1/-1 counters minus one are put on it instead.

Devoted Druid - (Gatherer) (Scryfall) (EDHREC)

{1}{G}
Creature — Elf Druid
0/2
{T}: Add {G}.
Put a -1/-1 counter on this creature: Untap this creature.

@ssk97 ssk97 marked this pull request as ready for review April 14, 2026 20:59
@github-actions github-actions bot added the tests label Apr 14, 2026
@ssk97
Copy link
Copy Markdown
Contributor Author

ssk97 commented Apr 14, 2026

Only added one more test, but it's an important one that actually fails under the current master. I couldn't see any other tests that would be worth adding, instead I just checked over most of the effects to make sure they properly iterated through the target pointer instead of just grabbing the first.

On a side note, I think most of the X-SourceEffect classes could maybe be replaced with a special source-pointing TargetPointer. That would remove a lot of highly redundant code.

@xenohedron
Copy link
Copy Markdown
Contributor

On a side note, I think most of the X-SourceEffect classes could maybe be replaced with a special source-pointing TargetPointer. That would remove a lot of highly redundant code.

I've thought about this too! Feel free to open an issue to discuss scope seeing as I still haven't gotten around to doing so yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants