Skip to content

Refactor duplicated enchanted counter removal effect - #15913

Open
Karthikeyan010 wants to merge 2 commits into
magefree:masterfrom
Karthikeyan010:refactor-remove-all-counters-enchanted
Open

Refactor duplicated enchanted counter removal effect#15913
Karthikeyan010 wants to merge 2 commits into
magefree:masterfrom
Karthikeyan010:refactor-remove-all-counters-enchanted

Conversation

@Karthikeyan010

Copy link
Copy Markdown

Summary

Extracts the duplicated logic for removing all counters from an enchanted permanent into a reusable RemoveAllCountersEnchantedEffect.

Updates:

  • EnchantedRiversGrasp
  • HonestWork

Both cards now use the shared effect instead of maintaining separate OneShotEffect implementations.

Closes #15901

Testing

  • mvn -pl Mage.Sets -am -DskipTests clean compile
  • Build completed successfully.
  • git diff --cached --check completed without errors.

@muz muz left a comment

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.

Couple of minor changes to do, but thank you for the contribution!

// When this Aura enters, tap enchanted creature and remove all counters from it.
Ability ability = new EntersBattlefieldTriggeredAbility(new TapEnchantedEffect());
ability.addEffect(new EnchantedRiversGraspEffect());
ability.addEffect(new RemoveAllCountersEnchantedEffect().setText("and remove all counters from it"));

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.

Suggested change
ability.addEffect(new RemoveAllCountersEnchantedEffect().setText("and remove all counters from it"));
ability.addEffect(new RemoveAllCountersEnchantedEffect().concatBy("and"));

The effect has the correct rules text in it, it just needs appending with the correct string.

// When this Aura enters, tap enchanted creature and remove all counters from it.
Ability ability = new EntersBattlefieldTriggeredAbility(new TapEnchantedEffect());
ability.addEffect(new HonestWorkCountersEffect());
ability.addEffect(new RemoveAllCountersEnchantedEffect().setText("and remove all counters from it"));

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.

Same as above

public class RemoveAllCountersEnchantedEffect extends OneShotEffect {
public RemoveAllCountersEnchantedEffect() {
super(Outcome.Benefit);
staticText ="remove all counters from it";

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.

Suggested change
staticText ="remove all counters from it";
staticText = "remove all counters from it";

Nit


}

@override

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.

Suggested change
@override
@Override

Your PR doesn't successfully compile currently, and this is being caught by CI.

@Karthikeyan010

Copy link
Copy Markdown
Author

Thanks for the review! I've addressed the requested changes and pushed the updates. The project now compiles successfully locally with mvn -pl Mage.Sets -am -DskipTests clean compile.

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.

Refactor: remove all counters from it

2 participants