magefree / magefree/mage

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

Open
#13,380 1 comment 0 reactions 0 assignees View on GitHub
refactoring
Dominant language
Java
Stars
2.4k
Forks
940
Avg merge
2d 12h
Merged PRs (30d)
160

Description

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):

``` java
// * 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"));
```
``` java
enum WhatMustBeDoneSourceIsCreatureCondition implements Condition {

instance;

@Override
public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source);
return object != null && object.isCreature(game);
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.