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

Update CreatureEvaluator.java #6445

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

Conversation

Yash-2707
Copy link

@Yash-2707 Yash-2707 commented Oct 27, 2024

Break down the evaluation logic into smaller methods.
Add comments to explain the purpose of each section.
Add logging for debugging purposes.
Implement a method to print the evaluation details for better insight.

Break down the evaluation logic into smaller methods.
Add comments to explain the purpose of each section.
Add logging for debugging purposes.
Implement a method to print the evaluation details for better insight.
}

// TODO no longer a KW
Copy link
Contributor

Choose a reason for hiding this comment

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

let's not remove any unaddressed TODO or otherwise useful comments

Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like a few other ones are still being removed

}
if (c.hasKeyword(Keyword.VANISHING)) {
value -= subValue(20 / (Math.max(1, c.getCounters(CounterEnumType.TIME))), "vanishing");
value += subValue(20 / (Math.max(1, c.getCounters(CounterEnumType.TIME))), "vanishing");
Copy link
Contributor

Choose a reason for hiding this comment

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

I do believe this breaks and would just increase now...

Copy link
Contributor

Choose a reason for hiding this comment

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

can't the - be moved inside the addValue call instead so the debug output in SimulationCreatureEvaluator will be correct?

} else if (c.getSVar("SacrificeEndCombat").equals("True")) {
value -= subValue(40, "sac-end");
value += subValue(40, "sac-end");
}
if (c.hasKeyword("CARDNAME can't attack or block.")) {
value = addValue(50 + (c.getCMC() * 5), "useless"); // reset everything - useless
Copy link
Contributor

Choose a reason for hiding this comment

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

because of your splitting this reset is broken now

Copy link
Contributor

@tool4ever tool4ever 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 your ideas
However this seems to be a bit more than a simple refactor and needs more care

Retained Unaddressed TODO Comment:
Fixed the incorrect addition logic for the vanishing keyword to ensure it subtracts value correctly
Corrected the section where the reset logic for useless cards was broken due to splitting
Removed comments that only spell out the function name again, as they don't add additional information
@Yash-2707
Copy link
Author

i have made the neccessary changes please give it a look and if further changes are required you can let me know

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