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

Removes Crit Chance preproc #5520

Open
wants to merge 7 commits into
base: upcoming
Choose a base branch
from

Conversation

AlexOn1ine
Copy link
Collaborator

Introduces the function GetCritHitOdds to switch between generational critical hits.

Also I turned the macro BENEFITS_FROM_LEEK into an inline function for better readability and removed ASSUME(B_CRIT_CHANCE >= GEN_7); from crit_chance.c. Correct me if I'm wrong but it seems to me that it isn't needed by any current tests. If I'm wrong I can add it back to the specific tests which would need it.

@Pawkkie Pawkkie self-assigned this Oct 14, 2024
@Pawkkie Pawkkie added category: battle-mechanic Pertains to battle mechanics type: cleanup labels Oct 14, 2024
@AlexOn1ine
Copy link
Collaborator Author

added assumes back where needed

Copy link
Collaborator

@Pawkkie Pawkkie left a comment

Choose a reason for hiding this comment

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

Looks great Alex, the only comment I had on initial skim in the car this morning was on the ASSUMEs, I think a few got missed but this seems pretty much ready to go to me :)

src/battle_script_commands.c Outdated Show resolved Hide resolved
src/battle_script_commands.c Outdated Show resolved Hide resolved
test/battle/crit_chance.c Show resolved Hide resolved
@AlexOn1ine
Copy link
Collaborator Author

I'll take care of everything tomorrow. I'm not sure about the Chansey thing but wouldn't mind changing it. I only really did the change because the macro was so long (and I dislike macros) but I think it is fair to make the change for Chansey as well.

@Pawkkie
Copy link
Collaborator

Pawkkie commented Oct 14, 2024

I'll take care of everything tomorrow. I'm not sure about the Chansey thing but wouldn't mind changing it. I only really did the change because the macro was so long (and I dislike macros) but I think it is fair to make the change for Chansey as well.

Completely agree on the macro -> function front I find them much more readable and as a result much easier for users to change themselves :)

@AlexOn1ine
Copy link
Collaborator Author

Ready for review.

I've made a singular function for both leek and lucky punch. Should be easy to extend without duplicating to much code. Hope that's a fine solution.

@AlexOn1ine
Copy link
Collaborator Author

AlexOn1ine commented Oct 15, 2024

did some more refactoring but for some reason the test Crit Chance: Signature items Leek and Lucky Punch increase the critical hit ratio by 2 stages started failing for seemingly no reason.

I will continue work on this tomorrow but I wouldn't mind feedback for the current state. I personally think it is much better now since all users will have to do now is edit the GetHoldEffectCritChanceIncrease to make a new leek type affected mon

@AlexOn1ine
Copy link
Collaborator Author

force push because I made constant changes that changed one var

Copy link
Collaborator

@Pawkkie Pawkkie left a comment

Choose a reason for hiding this comment

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

I really like the GetHoldEffectCritChanceIncrease change! Just think we need to either use it for all the gen 1 items or none of them.

If you got that test sorted, I think this is the last feedback I'll have :)

return sCriticalHitOdds[critChance];
}

#define GEN_1_FARFETCHED_LEEK_SCALER 8
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we want to handle Gen 1 Leek with this function, I think we should also handle Gen 1 Lucky Punch and Scope Lens, have similar defines for them, and use this function in the Gen 1 version also.

Or we don't use this function in the gen 1 version at all, if you don't want to have 3 defines here. I don't like the idea of using this function for some gen 1 held items but not all of them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fair point! will work out a solution tomorrow

@AlexOn1ine
Copy link
Collaborator Author

If you got that test sorted, I think this is the last feedback I'll have :)

I was not able to find the problem because the recording was fine.

@Pawkkie
Copy link
Collaborator

Pawkkie commented Oct 15, 2024

I was not able to find the problem because the recording was fine.

Oh I just assumed you had it sorted because it doesn't fail with the CI. That is very strange. Would you say that's blocking in your opinion? It's odd to me that it doesn't fail here but does on your machine.

@AlexOn1ine
Copy link
Collaborator Author

I was not able to find the problem because the recording was fine.

Oh I just assumed you had it sorted because it doesn't fail with the CI. That is very strange. Would you say that's blocking in your opinion? It's odd to me that it doesn't fail here but does on your machine.

I added a KNOWN_FAILING and yes it is blocking imo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: battle-mechanic Pertains to battle mechanics type: cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants