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

PartyBattlerShouldAvoidHazards rewrite #2106

Merged

Conversation

Sneed69
Copy link

@Sneed69 Sneed69 commented May 2, 2022

In its current state, PartyBattlerShouldAvoidHazards is flawed and incomplete.

  • It checks for Levitate against Stealth Rock
  • It sets a nonsensical value to holdEffect so Heavy Duty Boots are not checked for
  • It ignores type effectiveness for SR
  • It ignores the amount of laid spikes and some spike immunities.
  • It does not account for spikes and SR overlapping.

I fixed the above issues and added more checks that make sense.
A function was added to check for SR damage against a non battler, instead passing a max HP and two type arguments.

@ghoulslash
Copy link
Collaborator

This is a good PR, but looking at ShouldPivot as a whole, I'm concerned about the call to ShouldSwitch potentially invoking BtlController_EmitTwoReturnValues mid-AI calc, overwriting potentially useful bufferA or bufferB data.

I suppose its somewhat unrelated to this PR, but if you are invested in switching logic it may be good to try and fix here as well

@Sneed69
Copy link
Author

Sneed69 commented May 7, 2022

I actually have no idea what emitting even is, sorry.
Most of battle_controllers.c is gibberish to me.
Having said that, I didn't find any references to BUFFER_A in ShouldSwitch which sounds good?

@DarkCrobat
Copy link

This is a good change that I need to implement in the switching logic checks, since we want to dissuade the AI from switching if entry hazards are present and they will be effective against us.

It looks like ShouldPivot is mostly deprecated, in lue of the ShouldSwitch function, which other battle_ai functions are calling instead. The only place that ShouldPivot is still used is in Move - Parting Shot.

The switching logic has been fleshed out to handle logic for switching for abilities that benefit from it (Regenerator, Natural Cure) I will do the same with moves that benefit from switching. (Such as Parting Shot)

@AsparagusEduardo AsparagusEduardo changed the base branch from battle_engine to master August 24, 2022 04:40
@AsparagusEduardo AsparagusEduardo changed the base branch from master to dev September 10, 2022 01:34
@AsparagusEduardo AsparagusEduardo added category: battle-mechanic Pertains to battle mechanics category: battle-ai Pertains to Battle Engine Upgrade's AI and removed category: battle-mechanic Pertains to battle mechanics labels Sep 16, 2022
@AsparagusEduardo AsparagusEduardo changed the base branch from dev to dev_1.x September 16, 2022 17:32
@AsparagusEduardo AsparagusEduardo merged commit 0e1836d into rh-hideout:upcoming Dec 30, 2022
@AsparagusEduardo AsparagusEduardo mentioned this pull request Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: battle-ai Pertains to Battle Engine Upgrade's AI category: battle-mechanic Pertains to battle mechanics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants