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

Added B_FAST_EXP_GROW / Updated MoveBattleBar to use a more applicable denominator #4335

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

pkmnsnfrn
Copy link
Collaborator

Description

HP Fix

In MoveBattlerBar, when B_FAST_HP_DRAIN is enabled, hpFraction gets the maximum amount of the relevant mon's HP and divides it by B_HEALTHBAR_PIXELS. After some manual testing and conversations with @SonikkuA-DatH (who helped with the original implementation, 7ca07527faeb5d8f3c5aae355ecfd33a554acca6), I've realized:

  • B_HEALTHBAR_PIXELS should actually be divided by 2 here to provide a greater benefit to Pokémon of varying HP.
    • The current implementation is slightly slower for Pokémon with less HP, while the newly proposed one benefits all to a greater extent.

EXP Addition

  • Using similar logic to the aforementioned fix, when a developer enables B_FAST_EXP_GROW, GetScaledExpFraction will calculate scale by multiplying by 2 instead of 8.

Even Faster?

  • If hPFraction is calculated by divided maxValue by 8 instead 32, even greater performance jumps can be gained.
  • If GetScaledExpFraction calculates scale by multiplying by 0 instead of 8, even greater performance jumps can be gained.

In both cases, these changes extremely fast, and do not seem to be inline with Game Freak's overall design philosophy. As such, I have opted for what I believe to be more sane values.

Images

Proposed Current Fast Vanilla Emerald Even Faster
newHPnewEXP exHPexEXP vanillaHPvanillaEXP sonic

Testing

// src/data/trainer_parties.h
static const struct TrainerMon sParty_Rick[] = {
+    {
+    .lvl = 24,
+    .species = SPECIES_BLISSEY,
+    .iv = TRAINER_PARTY_IVS(31, 31, 31, 31, 31, 31),
+    .moves = {MOVE_SPLASH, MOVE_NONE, MOVE_NONE, MOVE_NONE}
+    },
+    /*
    {
    .lvl = 4,
    .species = SPECIES_WURMPLE,
    },
    {
    .lvl = 4,
    .species = SPECIES_WURMPLE,
    },
+    */
};

// data/scripts/debug.inc
Debug_EventScript_Script_1::
+	setflag FLAG_BADGE01_GET
+	setflag FLAG_BADGE02_GET
+	setflag FLAG_BADGE03_GET
+	setflag FLAG_BADGE04_GET
+	setflag FLAG_BADGE05_GET
+	setflag FLAG_BADGE06_GET
+	setflag FLAG_BADGE07_GET
+	setflag FLAG_BADGE08_GET
+    givemon species=SPECIES_MACHAMP,level=30,move1=MOVE_FISSURE,abilityNum=1,isShiny=FALSE
+    trainerbattle_single TRAINER_RICK, Debug_BoxFilledMessage_Text, Debug_BoxFilledMessage_Text
	end
  1. Enable debug mode in include/config.h.
  2. Start a new save file.
  3. Open the Debug menu using R + Start.
  4. Select Script 1.
  5. Once in battle, use Fissure. Observe faster bar movement.

People who collaborated with me in this PR

@SonikkuA-DatH

Discord contact info

I am pkmnsnfrn on Discord. I have not started a discussion thread.

Updated the denominator in MoveBattlerBar to be faster for more HP sizes
@Bassoonian Bassoonian merged commit 8f2f681 into rh-hideout:upcoming Apr 3, 2024
1 check passed
@pkmnsnfrn pkmnsnfrn deleted the battleBarSpeed branch April 20, 2024 04:12
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