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

Add B_SHOW_TYPES and cleaned up IsDoubleBattle #5131

Merged
merged 60 commits into from
Aug 11, 2024

Conversation

pkmnsnfrn
Copy link
Collaborator

@pkmnsnfrn pkmnsnfrn commented Aug 10, 2024

Description

Gif of a player opening the Fight menu and showing types in a double battle

  • Adds B_SHOW_TYPES to include/config/battle.h. When set to a non-zero value, the types of all Pokemon on the field are shown when the player is selecting a move.
  • Replaces gBattleTypeFlags & BATTLE_TYPE_DOUBLE with IsDoubleBattle().

Details

Usage

In include/config/battle.h, developers must define which setting B_SHOW_TYPES should use.

B_SHOW_TYPES == SHOW_TYPES_NEVER

libero.mp4

This feature is completely disabled.

B_SHOW_TYPES == SHOW_TYPES_ALWAYS

stellarillusion.mp4

The types of enemy Pokemon are always shown.

B_SHOW_TYPES == SHOW_TYPES_CAUGHT

caught.mp4

If the player has registered the enemy Pokemon in the Pokedex, their types are shown. Otherwise TYPE_MYSTERY is shown.

Special Cases

Unknown Types

When a Pokemon type is TYPE_NONE or TYPE_MYSTERY, the icon for TYPE_MYSTERY is shown.

Third Types

This feature does not display third types.

Type Changes

When a Pokemon's type changes, the mon's current type is shown.

Transform

If a Pokemon is transformed into another species, the types from the target species is shown.

Tera

When a Pokemon uses the Terastal phenomenon, its Tera Type is shown.

Stellar

When a Pokemon uses the Terastal phenomenon, TYPE_STELLAR as its Tera Type, the Pokemon's original typing is shown.

Illusion

If a Pokemon is casting an Illusion as another mon, the types from the target species is shown.

Illusion and Stellar

If a Pokemon is casting an Illusion as another mon, but then uses the Terastal phenomenon and has TYPE_STELLAR as its Tera Type, the types from the target species is shown.

Testing

Clean Branch

You can recreate this branch by applying a patch or pulling the repo. From a clean version of expansion's upcoming, you can either:

Patch

wget https://files.catbox.moe/nqyk6d.patch -O typeIcons.patch ; git apply typeIcons.patch ; rm typeIcons.patch

Repo

git remote add psf-expansion https://github.com/PokemonSanFran/pokeemerald-expansion/ ; git pull psf-expansion typeIcons

Manual Tests

After replicating the branch, to recreate my testing environment, you can either directly download the debug script, or manually create the changes.

Download

B_SHOW_TYPES == SHOW_TYPES_ALWAYS

wget https://files.catbox.moe/ytgdqh.h -O include/config/battle.h && wget https://files.catbox.moe/y1ydoe.inc -O data/scripts/debug.inc

B_SHOW_TYPES == SHOW_TYPES_CAUGHT

wget https://files.catbox.moe/w22acw.h -O include/config/battle.h && wget https://files.catbox.moe/y1ydoe.inc -O data/scripts/debug.inc

Manual Testing

Verified Scenarios

B_SHOW_TYPES == SHOW_TYPES_NEVER

never.mp4

B_SHOW_TYPES == SHOW_TYPES_ALWAYS

libero.mp4

B_SHOW_TYPES == SHOW_TYPES_CAUGHT

caught.mp4

Pokemon gets Third Type via Forest's Curse // Script 2

forestcurse.mp4

Pokemon loses type from Burn Up // Script 2

burnup.mp4

Pokemon changes its type via Color Change // Script 2

colorchange.mp4

Pokemon changes its type via Libero // Script 6

libero.mp4

Pokemon transforms into another Pokemon // Script 3

transform.mp4

Pokemon triggers Mega Evolution // Script 5

megaillusion.mp4

Pokemon casts an Illusion // Script 5

megaillusion.mp4

Pokemon casts an Illusion and uses the Terastal phenomenon // Script 5

megaillusion.mp4

Pokemon casts an Illusion and uses the Terastal phenomenon with Stellar Type // Script 7

stellarillusion.mp4

People who collaborated with me in this PR

This was taken from CRFU, written by @Skeli789 @fdeblasio, @ravepossum, @TeamAquasHideout all helped.

Features this PR does NOT handle:

  • This PR does NOT show a Pokemon's third type.

Discord Contact Info

I am pkmnsnfrn on Discord.

@AlexOn1ine AlexOn1ine added the new-feature Adds a feature label Aug 10, 2024
@AlexOn1ine AlexOn1ine self-assigned this Aug 10, 2024
src/type_icons.c Outdated Show resolved Hide resolved
AlexOn1ine
AlexOn1ine previously approved these changes Aug 10, 2024
src/type_icons.c Outdated Show resolved Hide resolved
src/type_icons.c Outdated Show resolved Hide resolved
src/type_icons.c Outdated Show resolved Hide resolved
@pkmnsnfrn pkmnsnfrn changed the title Add B_SHOW_TYPES and BATTLE_TYPE_IS_DOUBLE Add B_SHOW_TYPES and cleaned up IsDoubleBattle Aug 10, 2024
@Bassoonian Bassoonian added the category: battle-mechanic Pertains to battle mechanics label Aug 10, 2024
@pkmnsnfrn pkmnsnfrn marked this pull request as ready for review August 10, 2024 16:24
include/config/battle.h Outdated Show resolved Hide resolved
include/data.h Outdated Show resolved Hide resolved
src/battle_ai_main.c Outdated Show resolved Hide resolved
src/battle_ai_switch_items.c Outdated Show resolved Hide resolved
src/battle_ai_switch_items.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
src/pokemon.c Outdated Show resolved Hide resolved
Copy link
Collaborator

@AlexOn1ine AlexOn1ine left a comment

Choose a reason for hiding this comment

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

few more things and then it is done

src/type_icons.c Outdated Show resolved Hide resolved
src/type_icons.c Show resolved Hide resolved
src/type_icons.c Show resolved Hide resolved
include/data.h Outdated Show resolved Hide resolved
include/data.h Outdated Show resolved Hide resolved
@AlexOn1ine AlexOn1ine merged commit d1183f4 into rh-hideout:upcoming Aug 11, 2024
1 check passed
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 new-feature Adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants