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

Score Minimum Value #1046

Merged
merged 13 commits into from
Nov 4, 2022
Merged

Score Minimum Value #1046

merged 13 commits into from
Nov 4, 2022

Conversation

Samuel-Roach
Copy link
Contributor

Added changes to reflect the change suggested in #1024 (comment).

Adds mercyLimitMin to ScoreConfig to store the minimum score required for a MercyRule to enforce.

Mercy Rule now calculates a mercyBaseline which will be the maximum of the mercyLimitMin and scoreBaseline + mercyLimit.

This hasn't been tested, although linting and building works. Sidenote: I could use some help with setting up a local PGM server such that I can test changes.

@KingOfSquares
Copy link
Contributor

For testing i recommend the server module which starts a server with your changes

@Pablete1234
Copy link
Member

Given that this new min may only ever have an effect if a mercy rule is defined, how about:

<score>
  <limit>10</limit>
  <mercy min="5">2</mercy>
</score>

This would make the max-score start at 5, go at most up to 10, and be always 2-higher than the runner-up

@Pablete1234 Pablete1234 added the feature New feature or request label Aug 29, 2022
@Samuel-Roach
Copy link
Contributor Author

Makes sense given the dependency on mercy rule. I'll make the change

Comment on lines 104 to 108
List<Element> mercyElements = scoreEl.getChildren("mercy");
for (Element mercyEl : mercyElements) {
config.mercyLimitMin =
XMLUtils.parseNumber(Node.fromAttr(mercyEl, "min"), Integer.class, -1);
}
Copy link
Member

Choose a reason for hiding this comment

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

I suggest using XMLUtils.getUniqueChild for this, not iterating a list

@Samuel-Roach
Copy link
Contributor Author

Sorry this took a while. Finally got around to using getUniqueChild. Tested and confirmed locally.

@Pablete1234 Pablete1234 added the ready PR is ready to merge label Nov 1, 2022
Copy link
Member

@Electroid Electroid left a comment

Choose a reason for hiding this comment

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

Thanks for bringing this over the line! 🎉

@Electroid Electroid merged commit 882b4d3 into PGMDev:dev Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request ready PR is ready to merge
Development

Successfully merging this pull request may close these issues.

5 participants