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

fix Release to the Wind, small rework/clean for edge cases #12226

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Susucre
Copy link
Contributor

@Susucre Susucre commented May 5, 2024

Fix #12224

This is part of the general work to consolidate "you may play/you may cast" effects, add unit tests and fix edge cases.

Changes are along several axes:

  • [[Release to the Wind]] is now using MayCastTargetCardEffect effect.
  • MayCastTargetCardEffect now supports:
    • Having the owner of the card be the own able to cast the card (through a TargetController argument with limited supported scope), for now only for the not-OneShot Duration.
    • Supporting the usecase of "without paying mana cost" in non-OneShot mode.
    • A new MageIdentifier.WithoutPayingManaCostAlternateCast has been introduced to support the last bullet point (and not affect other alternate ways to cast the card from exile. e.g. [[Misthollow Griffin]])
  • The AdventureSpellAbilityImpl::canActivate was not correct in edge cases. See the two TODO comments on weird choice in the Kess test and the AdventureCards test, the adventure cast was sometimes wrongly enabled to be activated, and it is now fixed.
  • Plot (resp. Foretell) are now calling the canActivate method of the SpellAbility they want to cast, using SpellAbilityCastMode.PLOT (resp. the newly added SpellAbilityCastMode.FORETELL). This allow bypassing the "from your hand" check in AdventureSpellAbilityImpl::canActivate, as this way of casting does not want to actually check if the card can be cast from hand or with an activator.

}
}
return ActivationStatus.getFalse();
}

private ActivationStatus canActivateUsingForetell(SpellAbility spellAbility, UUID playerId, Game game) {
return spellAbility.copy().setSpellAbilityCastMode(SpellAbilityCastMode.FORETELL).canActivate(playerId, game);
Copy link
Member

Choose a reason for hiding this comment

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

wtf

Copy link
Contributor Author

@Susucre Susucre May 5, 2024

Choose a reason for hiding this comment

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

Do you understand the problem this is solving?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I understand -- you introduced new workaround with injecting global identifier in abilities, it doesn't work with game engine and that's second workaround required to support it.

Copy link
Member

@JayDi85 JayDi85 left a comment

Choose a reason for hiding this comment

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

small rework/clean for edge cases

It's not small rework. There are multiple changes with many workaround/hacks all around game engine.

Most important problem: it also uses objects modifications on playable calc -- it's smells very bad and do not contains any comments about it. Must be more safer way to do same things in read only.

Please, split it by smaller steps/PRs.

  1. Fixed card/implementation;
  2. Broken use cases/tests;
  3. Migrate all old cards/abilities/code to new version -- xmage must use same code/logic for all.

Current PR can't be merged without each workaround reviewed and checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants