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

Reworking goad effects (ready for review) #8034

Merged
merged 25 commits into from
Feb 15, 2022
Merged

Conversation

theelk801
Copy link
Contributor

@theelk801 theelk801 commented Jul 20, 2021

Changing goad effects so that they add a designation to the creature that is goaded. I'll build goad support directly into the game.

  • goad effects now set a permanent as having been "goaded"
  • implement Vengeful Ancestor
  • add goad support directly into combat engine (waiting on comprehensive rules update to be released)
  • write some more tests

@theelk801
Copy link
Contributor Author

still having problems with this, not sure if it's due to the changes not working or issues with the test framework or both

@theelk801
Copy link
Contributor Author

ok now when I run the test I added it attacks a random player including the goading player and also sometimes no players at all

@JayDi85
Copy link
Member

JayDi85 commented Jul 25, 2021

BTW you can use runCode command in tests -- it allows to make checks and asserts at any player's priority time. Not only at the end. Example: it can run attacks restriction or targets count (is it correct or not).

@theelk801
Copy link
Contributor Author

oh wow, that's awesome

@theelk801
Copy link
Contributor Author

@JayDi85 I think there's something wrong with TestPlayer's combat handling in multiplayer, I copied testSimpleAttackRequirementBerserkersofBloodRidge from AttackRequirementTest into GoadTest and it didn't work at all.

image

@theelk801
Copy link
Contributor Author

ok so it turns out that testRegularCombatRequirement actually passes or fails randomly

@theelk801
Copy link
Contributor Author

it seems like this is something to do with target selection

@JayDi85
Copy link
Member

JayDi85 commented Jul 26, 2021

ok so it turns out that testRegularCombatRequirement actually passes or fails randomly

Testing on current build, not PR. There are bug in getRandomOpponent call -- it selects only first opponent, all other will be miss. It's never work from 2015 and only affected in multiplayer games (with multiple opponents).
shot_210726_061032
shot_210726_060154

I don't known -- is it a real bug or it was a feature. randomOpponentId field logic in targeting -- AI use it at the end if all other targets can't be selected. So in "bugged" version AI attacks only first player in random cases (30 of 100 times in 4x players game).

count++ can fix the problem (AI will choose random player all the time):
shot_210726_061224

@JayDi85
Copy link
Member

JayDi85 commented Jul 26, 2021

Maybe related issues to that PR (wrong goad/restriction):

@theelk801
Copy link
Contributor Author

ok I just pushed that one fix, I'll take another look at the other ones

@theelk801
Copy link
Contributor Author

theelk801 commented Jul 26, 2021

ok, it looks like the issue is that the randomly chosen opponent isn't necessarily valid for TargetDefender, and in general doesn't seem to care about the targeting restrictions

image
image

I'm testing a fix right now

@theelk801
Copy link
Contributor Author

seems like it's choosing the opponent just fine but the attackers aren't getting declared anyway

@JayDi85
Copy link
Member

JayDi85 commented Jul 26, 2021

Todos in targeting code -- about choosing good or bad target. Look at target permanent code -- it selects by toughness to kill first. So player target can be same -- selects first to kill.

Btw targeting code uses for non target calls, e.g. on resolve or choices. AI selects real spell targets by game simulations and battlefield score calc.

@theelk801 theelk801 requested a review from JayDi85 July 26, 2021 22:01
@theelk801
Copy link
Contributor Author

I think the changes I made to targeting were fine since they only seem to matter when attacks are being forced. Anyway, all the tests pass now.

@JayDi85
Copy link
Member

JayDi85 commented Jul 27, 2021

Is it fix something in goad or it just a refactor?

@theelk801
Copy link
Contributor Author

what do you mean?

@JayDi85
Copy link
Member

JayDi85 commented Jul 27, 2021

  1. See old issues example above.
  2. New code example -- removed planeswalker priority as a target:
    shot_210727_055818

@JayDi85
Copy link
Member

JayDi85 commented Jul 27, 2021

Another breaking example:
shot_210727_062650

@JayDi85
Copy link
Member

JayDi85 commented Jul 27, 2021

So something changed in game logic, not only refactor.

@theelk801
Copy link
Contributor Author

I took that to mean that it shouldn't have been choosing planeswalkers at a higher priority, plus it was using a randomly chosen opponent rather than one of the defenders that the target was supposed to choose from. I'm pretty sure the only situation where that code block is even used is when the player is forced to attack.

And I removed those setNotTarget calls because I added it directly into the TargetDefender constructor.

@theelk801
Copy link
Contributor Author

oh I see what you're asking, yeah it's a fix and a refactor, but mostly because the rules for goad changed and I wanted to rework the implementation anyway because it wasn't working right

@JayDi85 JayDi85 self-assigned this Jul 27, 2021
@theelk801
Copy link
Contributor Author

just rebasing, not merging

@theelk801 theelk801 changed the title Reworking goad effects (WIP) Reworking goad effects (ready for review) Feb 13, 2022
@theelk801
Copy link
Contributor Author

I'm gonna merge this tomorrow

@theelk801 theelk801 merged commit 4591ac0 into master Feb 15, 2022
@theelk801 theelk801 deleted the refactor/update-goading branch February 15, 2022 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants