diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/berry.c | 16 | ||||
-rw-r--r-- | src/data/pokemon/base_stats.h | 2 | ||||
-rw-r--r-- | src/pokedex.c | 298 |
3 files changed, 164 insertions, 152 deletions
diff --git a/src/berry.c b/src/berry.c index 7a8ab37fa..fe4a66af6 100644 --- a/src/berry.c +++ b/src/berry.c @@ -1200,6 +1200,15 @@ static u8 GetNumStagesWateredByBerryTreeId(u8 id) return BerryTreeGetNumStagesWatered(GetBerryTreeInfo(id)); } +// Berries can be watered at 4 stages of growth. This function is likely meant +// to divide the berry yield range equally into quartiles. If you watered the +// tree n times, your yield is a random number in the nth quartile. +// +// However, this function actually skews towards higher berry yields, because +// it rounds `extraYield` to the nearest whole number. +// +// See resulting yields: https://gist.github.com/hondew/2a099dbe54aa91414decdbfaa524327d, +// and bug fix: https://gist.github.com/hondew/0f0164e5b9dadfd72d24f30f2c049a0b. static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water) { u32 randMin; @@ -1215,10 +1224,11 @@ static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water) randMax = (max - min) * (water); rand = randMin + Random() % (randMax - randMin + 1); - if ((rand & 3) > 1) - extraYield = rand / 4 + 1; + // Round upwards + if ((rand % NUM_WATER_STAGES) >= NUM_WATER_STAGES / 2) + extraYield = rand / NUM_WATER_STAGES + 1; else - extraYield = rand / 4; + extraYield = rand / NUM_WATER_STAGES; return extraYield + min; } } diff --git a/src/data/pokemon/base_stats.h b/src/data/pokemon/base_stats.h index 2f493bc1b..4dedcfdc0 100644 --- a/src/data/pokemon/base_stats.h +++ b/src/data/pokemon/base_stats.h @@ -7,9 +7,9 @@ .baseHP = 50, \ .baseAttack = 150, \ .baseDefense = 50, \ + .baseSpeed = 150, \ .baseSpAttack = 150, \ .baseSpDefense = 50, \ - .baseSpeed = 150, \ .type1 = TYPE_NORMAL, \ .type2 = TYPE_NORMAL, \ .catchRate = 3, \ diff --git a/src/pokedex.c b/src/pokedex.c index 080548553..c3d38681c 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -666,10 +666,12 @@ static const union AnimCmd *const sSpriteAnimTable_DexListStartMenuCursor[] = sSpriteAnim_DexListStartMenuCursor }; +#define TAG_DEX_INTERFACE 4096 // Tile and pal tag used for all interface sprites. + static const struct SpriteTemplate sScrollBarSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_ScrollBar, .anims = sSpriteAnimTable_ScrollBar, .images = NULL, @@ -679,8 +681,8 @@ static const struct SpriteTemplate sScrollBarSpriteTemplate = static const struct SpriteTemplate sScrollArrowSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_ScrollArrow, .anims = sSpriteAnimTable_ScrollArrow, .images = NULL, @@ -690,8 +692,8 @@ static const struct SpriteTemplate sScrollArrowSpriteTemplate = static const struct SpriteTemplate sInterfaceTextSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_InterfaceText, .anims = sSpriteAnimTable_InterfaceText, .images = NULL, @@ -701,8 +703,8 @@ static const struct SpriteTemplate sInterfaceTextSpriteTemplate = static const struct SpriteTemplate sRotatingPokeBallSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_RotatingPokeBall, .anims = sSpriteAnimTable_RotatingPokeBall, .images = NULL, @@ -712,8 +714,8 @@ static const struct SpriteTemplate sRotatingPokeBallSpriteTemplate = static const struct SpriteTemplate sSeenOwnTextSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_SeenOwnText, .anims = sSpriteAnimTable_SeenOwnText, .images = NULL, @@ -723,8 +725,8 @@ static const struct SpriteTemplate sSeenOwnTextSpriteTemplate = static const struct SpriteTemplate sHoennNationalTextSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_InterfaceText, .anims = sSpriteAnimTable_HoennNationalText, .images = NULL, @@ -734,8 +736,8 @@ static const struct SpriteTemplate sHoennNationalTextSpriteTemplate = static const struct SpriteTemplate sHoennDexSeenOwnNumberSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_Dex8x16, .anims = sSpriteAnimTable_HoennSeenOwnNumber, .images = NULL, @@ -745,8 +747,8 @@ static const struct SpriteTemplate sHoennDexSeenOwnNumberSpriteTemplate = static const struct SpriteTemplate sNationalDexSeenOwnNumberSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_Dex8x16, .anims = sSpriteAnimTable_NationalSeenOwnNumber, .images = NULL, @@ -756,8 +758,8 @@ static const struct SpriteTemplate sNationalDexSeenOwnNumberSpriteTemplate = static const struct SpriteTemplate sDexListStartMenuCursorSpriteTemplate = { - .tileTag = 4096, - .paletteTag = 4096, + .tileTag = TAG_DEX_INTERFACE, + .paletteTag = TAG_DEX_INTERFACE, .oam = &sOamData_Dex8x16, .anims = sSpriteAnimTable_DexListStartMenuCursor, .images = NULL, @@ -767,13 +769,13 @@ static const struct SpriteTemplate sDexListStartMenuCursorSpriteTemplate = static const struct CompressedSpriteSheet sInterfaceSpriteSheet[] = { - {gPokedexInterface_Gfx, 0x2000, 4096}, + {gPokedexInterface_Gfx, 0x2000, TAG_DEX_INTERFACE}, {0} }; static const struct SpritePalette sInterfaceSpritePalette[] = { - {gPokedexBgHoenn_Pal, 4096}, + {gPokedexBgHoenn_Pal, TAG_DEX_INTERFACE}, {0} }; @@ -893,7 +895,7 @@ static const struct BgTemplate sInfoScreen_BgTemplate[] = static const struct WindowTemplate sInfoScreen_WindowTemplates[] = { - [WIN_INFO] = + [WIN_INFO] = { .bg = 2, .tilemapLeft = 0, @@ -903,7 +905,7 @@ static const struct WindowTemplate sInfoScreen_WindowTemplates[] = .paletteNum = 0, .baseBlock = 1, }, - [WIN_FOOTPRINT] = + [WIN_FOOTPRINT] = { .bg = 2, .tilemapLeft = 25, @@ -913,7 +915,7 @@ static const struct WindowTemplate sInfoScreen_WindowTemplates[] = .paletteNum = 15, .baseBlock = 641, }, - [WIN_CRY_WAVE] = + [WIN_CRY_WAVE] = { .bg = 0, .tilemapLeft = 0, @@ -923,7 +925,7 @@ static const struct WindowTemplate sInfoScreen_WindowTemplates[] = .paletteNum = 8, .baseBlock = 645, }, - [WIN_VU_METER] = + [WIN_VU_METER] = { .bg = 2, .tilemapLeft = 18, @@ -960,7 +962,7 @@ static const struct BgTemplate sNewEntryInfoScreen_BgTemplate[] = static const struct WindowTemplate sNewEntryInfoScreen_WindowTemplates[] = { - [WIN_INFO] = + [WIN_INFO] = { .bg = 2, .tilemapLeft = 0, @@ -970,7 +972,7 @@ static const struct WindowTemplate sNewEntryInfoScreen_WindowTemplates[] = .paletteNum = 0, .baseBlock = 1, }, - [WIN_FOOTPRINT] = + [WIN_FOOTPRINT] = { .bg = 2, .tilemapLeft = 25, @@ -1012,21 +1014,21 @@ static const u8 sLetterSearchRanges[][4] = static const struct SearchMenuTopBarItem sSearchMenuTopBarItems[SEARCH_TOPBAR_COUNT] = { - [SEARCH_TOPBAR_SEARCH] = + [SEARCH_TOPBAR_SEARCH] = { .description = gText_SearchForPkmnBasedOnParameters, .highlightX = 0, .highlightY = 0, .highlightWidth = 5, }, - [SEARCH_TOPBAR_SHIFT] = + [SEARCH_TOPBAR_SHIFT] = { .description = gText_SwitchPokedexListings, .highlightX = 6, .highlightY = 0, .highlightWidth = 5, }, - [SEARCH_TOPBAR_CANCEL] = + [SEARCH_TOPBAR_CANCEL] = { .description = gText_ReturnToPokedex, .highlightX = 12, @@ -1037,7 +1039,7 @@ static const struct SearchMenuTopBarItem sSearchMenuTopBarItems[SEARCH_TOPBAR_CO static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = { - [SEARCH_NAME] = + [SEARCH_NAME] = { .description = gText_ListByFirstLetter, .titleBgX = 0, @@ -1047,7 +1049,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 2, .selectionBgWidth = 12, }, - [SEARCH_COLOR] = + [SEARCH_COLOR] = { .description = gText_ListByBodyColor, .titleBgX = 0, @@ -1057,7 +1059,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 4, .selectionBgWidth = 12, }, - [SEARCH_TYPE_LEFT] = + [SEARCH_TYPE_LEFT] = { .description = gText_ListByType, .titleBgX = 0, @@ -1067,7 +1069,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 6, .selectionBgWidth = 6, }, - [SEARCH_TYPE_RIGHT] = + [SEARCH_TYPE_RIGHT] = { .description = gText_ListByType, .titleBgX = 0, @@ -1077,7 +1079,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 6, .selectionBgWidth = 6, }, - [SEARCH_ORDER] = + [SEARCH_ORDER] = { .description = gText_SelectPokedexListingMode, .titleBgX = 0, @@ -1087,7 +1089,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 8, .selectionBgWidth = 12, }, - [SEARCH_MODE] = + [SEARCH_MODE] = { .description = gText_SelectPokedexMode, .titleBgX = 0, @@ -1097,7 +1099,7 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = .selectionBgY = 10, .selectionBgWidth = 12, }, - [SEARCH_OK] = + [SEARCH_OK] = { .description = gText_ExecuteSearchSwitch, .titleBgX = 0, @@ -1112,52 +1114,52 @@ static const struct SearchMenuItem sSearchMenuItems[SEARCH_COUNT] = // Left, Right, Up, Down static const u8 sSearchMovementMap_SearchNatDex[SEARCH_COUNT][4] = { - [SEARCH_NAME] = + [SEARCH_NAME] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, SEARCH_COLOR }, - [SEARCH_COLOR] = + [SEARCH_COLOR] = { - 0xFF, - 0xFF, - SEARCH_NAME, + 0xFF, + 0xFF, + SEARCH_NAME, SEARCH_TYPE_LEFT }, - [SEARCH_TYPE_LEFT] = - { - 0xFF, - SEARCH_TYPE_RIGHT, - SEARCH_COLOR, + [SEARCH_TYPE_LEFT] = + { + 0xFF, + SEARCH_TYPE_RIGHT, + SEARCH_COLOR, SEARCH_ORDER }, - [SEARCH_TYPE_RIGHT] = - { SEARCH_TYPE_LEFT, - 0xFF, - SEARCH_COLOR, + [SEARCH_TYPE_RIGHT] = + { SEARCH_TYPE_LEFT, + 0xFF, + SEARCH_COLOR, SEARCH_ORDER }, - [SEARCH_ORDER] = + [SEARCH_ORDER] = { - 0xFF, - 0xFF, - SEARCH_TYPE_LEFT, + 0xFF, + 0xFF, + SEARCH_TYPE_LEFT, SEARCH_MODE }, - [SEARCH_MODE] = + [SEARCH_MODE] = { - 0xFF, - 0xFF, - SEARCH_ORDER, + 0xFF, + 0xFF, + SEARCH_ORDER, SEARCH_OK }, - [SEARCH_OK] = + [SEARCH_OK] = { - 0xFF, - 0xFF, - SEARCH_MODE, + 0xFF, + 0xFF, + SEARCH_MODE, 0xFF }, }; @@ -1165,53 +1167,53 @@ static const u8 sSearchMovementMap_SearchNatDex[SEARCH_COUNT][4] = // Left, Right, Up, Down static const u8 sSearchMovementMap_ShiftNatDex[SEARCH_COUNT][4] = { - [SEARCH_NAME] = + [SEARCH_NAME] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_COLOR] = + [SEARCH_COLOR] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_TYPE_LEFT] = + [SEARCH_TYPE_LEFT] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_TYPE_RIGHT] = + [SEARCH_TYPE_RIGHT] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_ORDER] = + [SEARCH_ORDER] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, SEARCH_MODE }, - [SEARCH_MODE] = + [SEARCH_MODE] = { - 0xFF, - 0xFF, - SEARCH_ORDER, + 0xFF, + 0xFF, + SEARCH_ORDER, SEARCH_OK }, - [SEARCH_OK] = + [SEARCH_OK] = { - 0xFF, - 0xFF, - SEARCH_MODE, + 0xFF, + 0xFF, + SEARCH_MODE, 0xFF }, }; @@ -1219,52 +1221,52 @@ static const u8 sSearchMovementMap_ShiftNatDex[SEARCH_COUNT][4] = // Left, Right, Up, Down static const u8 sSearchMovementMap_SearchHoennDex[SEARCH_COUNT][4] = { - [SEARCH_NAME] = + [SEARCH_NAME] = { 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, SEARCH_COLOR }, - [SEARCH_COLOR] = + [SEARCH_COLOR] = { - 0xFF, - 0xFF, - SEARCH_NAME, + 0xFF, + 0xFF, + SEARCH_NAME, SEARCH_TYPE_LEFT }, - [SEARCH_TYPE_LEFT] = + [SEARCH_TYPE_LEFT] = { - 0xFF, - SEARCH_TYPE_RIGHT, - SEARCH_COLOR, + 0xFF, + SEARCH_TYPE_RIGHT, + SEARCH_COLOR, SEARCH_ORDER }, - [SEARCH_TYPE_RIGHT] = - { SEARCH_TYPE_LEFT, - 0xFF, - SEARCH_COLOR, + [SEARCH_TYPE_RIGHT] = + { SEARCH_TYPE_LEFT, + 0xFF, + SEARCH_COLOR, SEARCH_ORDER }, [SEARCH_ORDER] = { - 0xFF, - 0xFF, - SEARCH_TYPE_LEFT, + 0xFF, + 0xFF, + SEARCH_TYPE_LEFT, SEARCH_OK }, - [SEARCH_MODE] = + [SEARCH_MODE] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_OK] = + [SEARCH_OK] = { - 0xFF, - 0xFF, - SEARCH_ORDER, + 0xFF, + 0xFF, + SEARCH_ORDER, 0xFF }, }; @@ -1272,53 +1274,53 @@ static const u8 sSearchMovementMap_SearchHoennDex[SEARCH_COUNT][4] = // Left, Right, Up, Down static const u8 sSearchMovementMap_ShiftHoennDex[SEARCH_COUNT][4] = { - [SEARCH_NAME] = + [SEARCH_NAME] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, [SEARCH_COLOR] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_TYPE_LEFT] = + [SEARCH_TYPE_LEFT] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_TYPE_RIGHT] = + [SEARCH_TYPE_RIGHT] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_ORDER] = + [SEARCH_ORDER] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, SEARCH_OK }, - [SEARCH_MODE] = + [SEARCH_MODE] = { - 0xFF, - 0xFF, - 0xFF, + 0xFF, + 0xFF, + 0xFF, 0xFF }, - [SEARCH_OK] = + [SEARCH_OK] = { - 0xFF, - 0xFF, - SEARCH_ORDER, + 0xFF, + 0xFF, + SEARCH_ORDER, 0xFF }, }; @@ -2838,7 +2840,7 @@ static void CreateInterfaceSprites(u8 page) spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 40, 48, 1); digitNum = (sPokedexView->seenCount % 100) % 10; StartSpriteAnim(&gSprites[spriteId], digitNum); - + // Owned value - 100s drawNextDigit = FALSE; spriteId = CreateSprite(&sHoennDexSeenOwnNumberSpriteTemplate, 24, 80, 1); @@ -3898,7 +3900,7 @@ static void HighlightSubmenuScreenSelectBarItem(u8 a, u16 b) u8 row = i * 7 + 1; u32 newPalette; - do + do { if (i == a || i == 3) newPalette = 0x2000; |