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

Set TYPE_NONE as type 0 + other type data tweaks #4462

Merged

Conversation

AsparagusEduardo
Copy link
Collaborator

@AsparagusEduardo AsparagusEduardo commented Apr 29, 2024

Description

Unlike Natures, Types are having the issue where if it's not defined in a struct, it always defaults to TYPE_NORMAL.
This PR fixes that by changing TYPE_NONE to 0 and shifting all other Types to +1.
It duplicates TYPE_MYSTERY's icon because graphics_file_rules.mk doesn't let you do duplicates.

Also:

  • Adjusted MON_DATA_TERA_TYPE's write/read to account for shift in type IDs.
  • Moved Gen 1-3 type damage categories to gTypesInfo.
  • Moved Tera Type RGB values to gTypesInfo.
  • Moved gTypesInfo and sTypeEffectivenessTable to their own file in src/data/types_info.h
  • Fixes Hidden Power's type.

Feature(s) this PR does NOT handle:

  • I tried to take the chance to update Hidden Power such that you could customize the types allowed for it, but only got as far as adding test functions to set IVs and finishing the Hidden Power's type test.
  • Tera Type indicators aren't moved to gTypesInfo (yet).

Discord contact info

AsparagusEduardo

@mrgriffin
Copy link
Collaborator

mrgriffin commented Apr 29, 2024

Off the top of my head, the backward-compatibility concerns are:

  1. Has anybody put a type in a var or other saved value? It could come up for projects with getmondata as a script command, although even then I'm not sure if anybody is likely to permanently save the type rather than immediately compare it against something.
  2. Has anybody started using teraType, which was added to BoxPokemon in 1.8? This is fixable, we could introduce a table that maps from teraType to type, and from type to teraType, and use that in Get/SetBoxMonData (where we currently have a + 1/- 1).
    EDIT: As Jasper notes in Discord, anybody using upcoming has started using teraType... although only very recently, unless they've been using givemon's teraType parameter in preparation for it being supported.

src/battle_main.c Outdated Show resolved Hide resolved
src/battle_main.c Outdated Show resolved Hide resolved
@AsparagusEduardo AsparagusEduardo marked this pull request as draft April 29, 2024 12:09
@AsparagusEduardo
Copy link
Collaborator Author

Set to draft in the meantime while I revert this and use TYPE_NONE instead.

@AsparagusEduardo AsparagusEduardo changed the title Set TYPE_MYSTERY as type 0 Set TYPE_NONE as type 0 + other type data tweaks May 8, 2024
@AsparagusEduardo AsparagusEduardo marked this pull request as ready for review May 9, 2024 19:47
@AsparagusEduardo
Copy link
Collaborator Author

Ready for review. I updated the PR name and description to account for all the new changes.

@AsparagusEduardo
Copy link
Collaborator Author

added missing Tera Indicator stuff in the description

@Bassoonian Bassoonian added this to the 1.9.0 milestone May 19, 2024
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.

Could you please add this test (I would say the terastal.c file but up to you)?

SINGLE_BATTLE_TEST("(TERA) All types have the correct effectivness")
{
    u32 species;
    u32 type;

    PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_FLYING; }
    PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_POISON; }
    PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_FIRE; }
    PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_BUG; }
    PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_ICE; }
    PARAMETRIZE { species = SPECIES_CYNDAQUIL; type = TYPE_GROUND; }
    PARAMETRIZE { species = SPECIES_CYNDAQUIL; type = TYPE_ROCK; }
    PARAMETRIZE { species = SPECIES_CYNDAQUIL; type = TYPE_WATER; }
    PARAMETRIZE { species = SPECIES_GASTLY; type = TYPE_NORMAL; }
    PARAMETRIZE { species = SPECIES_GASTLY; type = TYPE_GHOST; }
    PARAMETRIZE { species = SPECIES_GASTLY; type = TYPE_PSYCHIC; }
    PARAMETRIZE { species = SPECIES_TOTODILE; type = TYPE_GRASS; }
    PARAMETRIZE { species = SPECIES_TOTODILE; type = TYPE_ELECTRIC; }
    PARAMETRIZE { species = SPECIES_DRATINI; type = TYPE_DRAGON; }
    PARAMETRIZE { species = SPECIES_DRATINI; type = TYPE_FAIRY; }
    PARAMETRIZE { species = SPECIES_SNEASEL; type = TYPE_FIGHTING; }
    PARAMETRIZE { species = SPECIES_SNEASEL; type = TYPE_STEEL; }
    PARAMETRIZE { species = SPECIES_ABRA; type = TYPE_DARK; }

    GIVEN {
        PLAYER(SPECIES_WOBBUFFET) { TeraType(type); }
        OPPONENT(species);
    } WHEN {
        TURN { MOVE(player, MOVE_TERA_BLAST, tera: TRUE); }
    } SCENE {
        if (species == SPECIES_GASTLY && type == TYPE_NORMAL)
            MESSAGE("It doesn't affect Foe Gastly…");
        else
            MESSAGE("It's super effective!");
    }
}

Looks good otherwise

src/data/types_info.h Show resolved Hide resolved
@AsparagusEduardo
Copy link
Collaborator Author

Could you please add this test (I would say the terastal.c file but up to you)?

This doesn't account for type changes by the user. I'll add sone assumes.

@AsparagusEduardo
Copy link
Collaborator Author

Ready for re-review

@AlexOn1ine AlexOn1ine merged commit 0be643a into rh-hideout:upcoming Jun 1, 2024
1 check passed
@AsparagusEduardo AsparagusEduardo deleted the _RHH/pr/upcoming/typeReorder branch June 2, 2024 00:05
@Pawkkie Pawkkie mentioned this pull request Jun 2, 2024
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.

5 participants