Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GainAbilityTargetEffect and other must able to give EntersBattlefieldAbility for cards/permanents #13380

Open
JayDi85 opened this issue Feb 23, 2025 · 1 comment
Labels
refactoring Developers topics about code and programming

Comments

@JayDi85
Copy link
Member

JayDi85 commented Feb 23, 2025

from #13377

Looks like GainAbilityTargetEffect doesn't work for cards like [[What Must Be Done]] or [[Necromantic Summons]] (can't give EntersBattlefieldAbility).

Maybe there are some limitation for EntersBattlefieldAbility (e.g. it works for source only). Need research.

Code example for alternative implementation of What Must Be Done (from #13377):

        // * Release Juno -- Return target historic permanent card from your graveyard to the battlefield. It enters with two additional +1/+1 counters on it if it's a creature.
        Mode mode = new Mode(new ReturnFromGraveyardToBattlefieldTargetEffect());
        mode.addEffect(new GainAbilityTargetEffect(
                new EntersBattlefieldAbility(
                        new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)),
                        WhatMustBeDoneSourceIsCreatureCondition.instance,
                        null,
                        null
                ),
                Duration.EndOfTurn,
                "It enters with two additional +1/+1 counters on it if it's a creature.",
                false
        ));
        mode.addTarget(new TargetCardInYourGraveyard(filterHistoricPermanentCard));
        this.getSpellAbility().addMode(mode.withFlavorWord("Release Juno"));
enum WhatMustBeDoneSourceIsCreatureCondition implements Condition {

    instance;

    @Override
    public boolean apply(Game game, Ability source) {
        MageObject object = game.getObject(source);
        return object != null && object.isCreature(game);
    }
}
@JayDi85 JayDi85 added the refactoring Developers topics about code and programming label Feb 23, 2025
Copy link

What Must Be Done - (Gatherer) (Scryfall) (EDHREC)

{3}{W}{W}
Sorcery
Choose one —
• Let the World Burn — Destroy all artifacts and creatures.
• Release Juno — Return target historic permanent card from your graveyard to the battlefield. It enters with two additional +1/+1 counters on it if it's a creature. (Artifacts, legendaries, and Sagas are historic.)

Necromantic Summons - (Gatherer) (Scryfall) (EDHREC)

{4}{B}
Sorcery
Put target creature card from a graveyard onto the battlefield under your control.
Spell mastery — If there are two or more instant and/or sorcery cards in your graveyard, that creature enters with two additional +1/+1 counters on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Developers topics about code and programming
Projects
None yet
Development

No branches or pull requests

1 participant