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

[40K] Implement Seeker of Slaanesh, added new must attack option #12712

Merged
merged 4 commits into from
Aug 24, 2024

Conversation

jimga150
Copy link
Contributor

#8954

Added a player-based "must attack" check in HumanPlayer to satisfy this effect. Unfortunately, this seems to have added to the backlog of issues related to must-attack requirements that the AI isn't checking for:

#6911

I threw in an ignored test with a similar TODO to make note of this.

@JayDi85 JayDi85 changed the title [40K] Implement Seeker of Slaanesh [40K] Implement Seeker of Slaanesh, added new must attack option Aug 23, 2024
@JayDi85
Copy link
Member

JayDi85 commented Aug 23, 2024

“Must attack” effects are old, many cards uses it. Are there was a miss implementation and current PR fixed it (for human only and AI players still buggy)?

@jimga150
Copy link
Contributor Author

I was not able to find any cards that do exactly what this card does--requiring all opponents to attack /anyone/ with at least one creature, irrespective of who they attack.

Yes, AI does not respect this requirement at all right now. I looked into adding it and fixing the linked issue, but it looks like there's a lot of history in the ComputerPlayer code and its children that makes this out of scope for this PR.

@@ -1916,13 +1916,17 @@ private boolean checkIfAttackersValid(Game game) {
// check if enough attackers are declared
// check if players have to be attacked
Set<UUID> playersToAttackIfAble = new HashSet<>();
boolean mustAttackAPlayer = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

misleading name - effect says "must attack" so could be a planeswalker or battle

make sure to check your code for this possibility

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. My code isn't only checking for creatures attacking players (only that at least one creature is attacking at all), but I will modify the "can any creatures attack" check to check for any defenders at all, not just players

Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't like the variable name "mustAttackAPlayer"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah i see, i misread.


@Override
public boolean mustAttack(Game game) {
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

are you sure this works the way you want it to? seems like this would require all creatures to attack.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does, since playerRelated is set to true. all other calls to getApplicableRequirementEffects pass in false for this flag, so they will not see this requirement when checking creatures.

@xenohedron xenohedron merged commit 4259b7f into magefree:master Aug 24, 2024
3 checks passed
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