New type chart option in challenges menu

This commit is contained in:
resetes12
2025-09-03 14:16:02 +02:00
parent 36c1c64377
commit d145cddbbb
7 changed files with 60 additions and 24 deletions

View File

@@ -142,11 +142,9 @@ Debug_Script_3_SelectFrontierBanOption_Text:
.string "{COLOR RED}(YES has been always the default option)$"
Debug_Script_4::
setflag FLAG_UNUSED_0x289
end
Debug_Script_5::
clearflag FLAG_UNUSED_0x289
end
Debug_Script_6::

View File

@@ -1175,6 +1175,7 @@ struct SaveBlock1
u8 tx_Mode_Encounters:2;
u8 tx_Features_FrontierBans:1;
u8 tx_Difficulty_HardExp:1;
u8 tx_Mode_TypeEffectiveness:1;
};
extern struct SaveBlock1* gSaveBlock1Ptr;

View File

@@ -69,6 +69,7 @@
#define TX_DIFFICULTY_ESCAPE_ROPE_DIG 0
#define TX_DIFFICULTY_HARD_EXP 0
#define TX_FEATURES_FRONTIER_BANS 0
#define TX_MODE_TYPE_EFFECTIVENESS 0
// randomization types
#define TX_RANDOM_T_WILD_POKEMON 0

View File

@@ -607,7 +607,7 @@ void AI_TrySwitchOrUseItem(void)
static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8 *var)
{
s32 i = 0;
if (FlagGet(FLAG_UNUSED_0x289)) //0, Modern type effectiveness
if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 1) //Modern type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE(i)) != TYPE_ENDTABLE)
{
@@ -628,7 +628,7 @@ static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8
i += 3;
}
}
else if (!FlagGet(FLAG_UNUSED_0x289)) //1, Old type effectiveness
else if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 0) //Old type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE_OLD(i)) != TYPE_ENDTABLE)
{

View File

@@ -2968,7 +2968,7 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int mode)
}
else
{
if (FlagGet(FLAG_UNUSED_0x289)) //0, Modern type effectiveness
if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 1) //Modern type effectiveness
{
// Calculate a "type power" value to determine the benefit of using this type move against the target.
// This value will then be used to get the number of points to assign to the move.
@@ -2997,7 +2997,7 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int mode)
i += 3;
}
}
else if (!FlagGet(FLAG_UNUSED_0x289)) //1, Old type effectiveness
else if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 0) //Old type effectiveness
{
// Calculate a "type power" value to determine the benefit of using this type move against the target.
// This value will then be used to get the number of points to assign to the move.

View File

@@ -1457,7 +1457,7 @@ s32 GetTypeEffectiveness(struct Pokemon *mon, u8 moveType) {
s32 flags = 0;
if (GetMonAbility(mon) == ABILITY_LEVITATE && moveType == TYPE_GROUND)
return MOVE_RESULT_NOT_VERY_EFFECTIVE;
if (FlagGet(FLAG_UNUSED_0x289)) //0, Modern type effectiveness
if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 1) //Modern type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE(i)) != TYPE_ENDTABLE) {
if (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE(i)) == TYPE_FORESIGHT) {
@@ -1504,7 +1504,7 @@ s32 GetTypeEffectiveness(struct Pokemon *mon, u8 moveType) {
i += 3;
}
}
else if (!FlagGet(FLAG_UNUSED_0x289)) //1, Old type effectiveness
else if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 0) //Old type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE_OLD(i)) != TYPE_ENDTABLE) {
if (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE_OLD(i)) == TYPE_FORESIGHT) {
@@ -1623,7 +1623,7 @@ static void Cmd_typecalc(void)
}
else
{
if (FlagGet(FLAG_UNUSED_0x289)) //0, Modern type effectiveness
if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 1) //Modern type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE(i)) != TYPE_ENDTABLE)
{
@@ -1647,7 +1647,7 @@ static void Cmd_typecalc(void)
i += 3;
}
}
else if (!FlagGet(FLAG_UNUSED_0x289)) //1, Old type effectiveness
else if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 0) //Old type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE_OLD(i)) != TYPE_ENDTABLE)
{
@@ -1708,7 +1708,7 @@ static void CheckWonderGuardAndLevitate(void)
RecordAbilityBattle(gBattlerTarget, ABILITY_LEVITATE);
return;
}
if (FlagGet(FLAG_UNUSED_0x289)) //0, Modern type effectiveness
if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 1) //Modern type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE(i)) != TYPE_ENDTABLE)
{
@@ -1755,7 +1755,7 @@ static void CheckWonderGuardAndLevitate(void)
i += 3;
}
}
else if (!FlagGet(FLAG_UNUSED_0x289)) //1, Old type effectiveness
else if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 0) //Old type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE_OLD(i)) != TYPE_ENDTABLE)
{
@@ -1873,7 +1873,7 @@ u8 TypeCalc(u16 move, u8 attacker, u8 defender)
}
else
{
if (FlagGet(FLAG_UNUSED_0x289)) //0, Modern type effectiveness
if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 1) //Modern type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE(i)) != TYPE_ENDTABLE)
{
@@ -1898,7 +1898,7 @@ u8 TypeCalc(u16 move, u8 attacker, u8 defender)
i += 3;
}
}
else if (!FlagGet(FLAG_UNUSED_0x289)) //1, Old type effectiveness
else if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 0) //Old type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE_OLD(i)) != TYPE_ENDTABLE)
{
@@ -1957,7 +1957,7 @@ u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility)
}
else
{
if (FlagGet(FLAG_UNUSED_0x289)) //0, Modern type effectiveness
if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 1) //Modern type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE(i)) != TYPE_ENDTABLE)
{
@@ -1978,7 +1978,7 @@ u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility)
i += 3;
}
}
else if (!FlagGet(FLAG_UNUSED_0x289)) //1, Old type effectiveness
else if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 0) //Old type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE_OLD(i)) != TYPE_ENDTABLE)
{
@@ -2030,7 +2030,7 @@ u8 AI_TypeDisplay(u16 move, u16 targetSpecies, u8 targetAbility)
}
else
{
if (FlagGet(FLAG_UNUSED_0x289)) //0, Modern type effectiveness
if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 1) //Modern type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE(i)) != TYPE_ENDTABLE)
{
@@ -2051,7 +2051,7 @@ u8 AI_TypeDisplay(u16 move, u16 targetSpecies, u8 targetAbility)
i += 3;
}
}
else if (!FlagGet(FLAG_UNUSED_0x289)) //1, Old type effectiveness
else if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 0) //Old type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE_OLD(i)) != TYPE_ENDTABLE)
{
@@ -5179,7 +5179,7 @@ static void Cmd_typecalc2(void)
}
else
{
if (FlagGet(FLAG_UNUSED_0x289)) //0, Modern type effectiveness
if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 1) //Modern type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE(i)) != TYPE_ENDTABLE)
{
@@ -5241,7 +5241,7 @@ static void Cmd_typecalc2(void)
i += 3;
}
}
else if (!FlagGet(FLAG_UNUSED_0x289)) //1, Old type effectiveness
else if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 0) //Old type effectiveness
{
while (GetTypeEffectivenessRandom(TYPE_EFFECT_ATK_TYPE_OLD(i)) != TYPE_ENDTABLE)
{
@@ -8841,7 +8841,7 @@ static void Cmd_settypetorandomresistance(void)
else
{
s32 i, j, rands;
if (FlagGet(FLAG_UNUSED_0x289)) //0, Modern type effectiveness
if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 1) //Modern type effectiveness
{
for (rands = 0; rands < 1000; rands++)
{
@@ -8884,7 +8884,7 @@ static void Cmd_settypetorandomresistance(void)
}
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
}
else if (!FlagGet(FLAG_UNUSED_0x289)) //1, Old type effectiveness
else if (gSaveBlock1Ptr->tx_Mode_TypeEffectiveness == 0) //Old type effectiveness
{
for (rands = 0; rands < 1000; rands++)
{

View File

@@ -42,6 +42,7 @@ enum
MENUITEM_MODE_ALTERNATE_SPAWNS,
MENUITEM_MODE_MODERN_TYPES,
MENUITEM_MODE_FAIRY_TYPES,
MENUITEM_MODE_NEW_EFFECTIVENESS,
MENUITEM_MODE_NEW_STATS,
MENUITEM_MODE_NEW_LEGENDARIES,
MENUITEM_MODE_LEGENDARY_ABILITIES,
@@ -322,6 +323,7 @@ static void DrawChoices_Mode_Legendary_Abilities(int selection, int y);
static void DrawChoices_Mode_New_Legendaries(int selection, int y);
static void DrawChoices_Features_FrontierBans(int selection, int y);
static void DrawChoices_Difficulty_HardExp(int selection, int y);
static void DrawChoices_Mode_New_Effectiveness(int selection, int y);
static void DrawChoices_Difficulty_Escape_Rope_Dig(int selection, int y);
@@ -370,6 +372,7 @@ struct // MENU_MODE
[MENUITEM_MODE_MODERN_MOVES] = {DrawChoices_Mode_Modern_Moves, ProcessInput_Options_Two},
[MENUITEM_MODE_LEGENDARY_ABILITIES] = {DrawChoices_Mode_Legendary_Abilities, ProcessInput_Options_Two},
[MENUITEM_MODE_NEW_LEGENDARIES] = {DrawChoices_Mode_New_Legendaries, ProcessInput_Options_Two},
[MENUITEM_MODE_NEW_EFFECTIVENESS] = {DrawChoices_Mode_New_Effectiveness, ProcessInput_Options_Two},
[MENUITEM_MODE_NEXT] = {NULL, NULL},
};
@@ -475,13 +478,14 @@ static const u8 sText_Poison[] = _("SURVIVE POISON");
static const u8 sText_Synchronize[] = _("SYNCHRONIZE");
static const u8 sText_Mints[] = _("NATURE MINTS");
static const u8 sText_NewCitrus[] = _("SITRUS BERRY");
static const u8 sText_ModernTypes[] = _("{PKMN} TYPES");
static const u8 sText_ModernTypes[] = _("POKéMON TYPES");
static const u8 sText_FairyTypes[] = _("ADD FAIRY TYPE");
static const u8 sText_NewStats[] = _("{PKMN} STATS");
static const u8 sText_NewStats[] = _("POKéMON STATS");
static const u8 sText_Sturdy[] = _("STURDY");
static const u8 sText_Modern_Moves[] = _("{PKMN} MOVEPOOL");
static const u8 sText_Legendary_Abilities[] = _("LEGEN. ABILITIES");
static const u8 sText_New_Legendaries[] = _("EXTRA LEGEND.");
static const u8 sText_New_Effectiveness[] = _("TYPE CHART");
static const u8 sText_Next[] = _("NEXT");
// Menu left side option names text
static const u8 *const sOptionMenuItemsNamesMode[MENUITEM_MODE_COUNT] =
@@ -500,6 +504,7 @@ static const u8 *const sOptionMenuItemsNamesMode[MENUITEM_MODE_COUNT] =
[MENUITEM_MODE_MODERN_MOVES] = sText_Modern_Moves,
[MENUITEM_MODE_LEGENDARY_ABILITIES] = sText_Legendary_Abilities,
[MENUITEM_MODE_NEW_LEGENDARIES] = sText_New_Legendaries,
[MENUITEM_MODE_NEW_EFFECTIVENESS] = sText_New_Effectiveness,
[MENUITEM_MODE_NEXT] = sText_Next,
};
@@ -666,6 +671,7 @@ static bool8 CheckConditions(int selection)
case MENUITEM_MODE_MODERN_MOVES: return sOptions->sel_mode[MENUITEM_MODE_CLASSIC_MODERN] == 2;
case MENUITEM_MODE_LEGENDARY_ABILITIES: return sOptions->sel_mode[MENUITEM_MODE_CLASSIC_MODERN] == 2;
case MENUITEM_MODE_NEW_LEGENDARIES: return sOptions->sel_mode[MENUITEM_MODE_CLASSIC_MODERN] == 2;
case MENUITEM_MODE_NEW_EFFECTIVENESS: return sOptions->sel_mode[MENUITEM_MODE_CLASSIC_MODERN] == 2;
default: return FALSE;
}
case MENU_FEATURES:
@@ -769,6 +775,8 @@ static const u8 sText_Description_Mode_Leg_Abilities_Off[] = _("PRESSURE
static const u8 sText_Description_Mode_Leg_Abilities_On[] = _("Legendaries have PRESSURE changed\nfor a better ability.");
static const u8 sText_Description_Mode_New_Legendaries_Off[] = _("No extra legendaries are added.");
static const u8 sText_Description_Mode_New_Legendaries_On[] = _("Extra legendaries from GEN I and II\nare added via ingame events.");
static const u8 sText_Description_Mode_New_Effectiveness_Original[] = _("Original type effectiveness\nfor all types.");
static const u8 sText_Description_Mode_New_Effectiveness_Modern[] = _("New and balanced type effectiveness\nfor certain types.");
static const u8 sText_Description_Mode_Next[] = _("Continue to Features options.");
static const u8 *const sOptionMenuItemDescriptionsMode[MENUITEM_MODE_COUNT][5] =
@@ -787,6 +795,7 @@ static const u8 *const sOptionMenuItemDescriptionsMode[MENUITEM_MODE_COUNT][5] =
[MENUITEM_MODE_MODERN_MOVES] = {sText_Description_Mode_Modern_Moves_Off, sText_Description_Mode_Modern_Moves_On, sText_Empty, sText_Empty, sText_Empty},
[MENUITEM_MODE_LEGENDARY_ABILITIES] = {sText_Description_Mode_Leg_Abilities_Off, sText_Description_Mode_Leg_Abilities_On, sText_Empty, sText_Empty, sText_Empty},
[MENUITEM_MODE_NEW_LEGENDARIES] = {sText_Description_Mode_New_Legendaries_Off, sText_Description_Mode_New_Legendaries_On, sText_Empty, sText_Empty, sText_Empty},
[MENUITEM_MODE_NEW_EFFECTIVENESS] = {sText_Description_Mode_New_Effectiveness_Original, sText_Description_Mode_New_Effectiveness_Modern, sText_Empty, sText_Empty, sText_Empty},
[MENUITEM_MODE_NEXT] = {sText_Description_Mode_Next, sText_Empty, sText_Empty, sText_Empty, sText_Empty},
};
@@ -998,6 +1007,7 @@ static const u8 *const sOptionMenuItemDescriptionsDisabledMode[MENUITEM_MODE_COU
[MENUITEM_MODE_NEXT] = sText_Empty,
[MENUITEM_MODE_LEGENDARY_ABILITIES] = sText_Empty,
[MENUITEM_MODE_NEW_LEGENDARIES] = sText_Empty,
[MENUITEM_MODE_NEW_EFFECTIVENESS] = sText_Empty,
};
// Disabled descriptions
@@ -1412,6 +1422,7 @@ void CB2_InitTxRandomizerChallengesMenu(void)
gSaveBlock1Ptr->tx_Mode_Modern_Moves = TX_MODE_MODERN_MOVES;
gSaveBlock1Ptr->tx_Mode_Legendary_Abilities = TX_MODE_LEGENDARY_ABILITIES;
gSaveBlock1Ptr->tx_Mode_New_Legendaries = TX_MODE_NEW_LEGENDARIES;
gSaveBlock1Ptr->tx_Mode_TypeEffectiveness = TX_MODE_TYPE_EFFECTIVENESS;
gSaveBlock1Ptr->tx_Features_RTCType = TX_FEATURES_RTC_TYPE;
gSaveBlock1Ptr->tx_Features_ShinyChance = TX_FEATURES_SHINY_CHANCE;
@@ -1484,6 +1495,7 @@ void CB2_InitTxRandomizerChallengesMenu(void)
sOptions->sel_mode[MENUITEM_MODE_MODERN_MOVES] = gSaveBlock1Ptr->tx_Mode_Modern_Moves;
sOptions->sel_mode[MENUITEM_MODE_LEGENDARY_ABILITIES] = gSaveBlock1Ptr->tx_Mode_Legendary_Abilities;
sOptions->sel_mode[MENUITEM_MODE_NEW_LEGENDARIES] = gSaveBlock1Ptr->tx_Mode_New_Legendaries;
sOptions->sel_mode[MENUITEM_MODE_NEW_EFFECTIVENESS] = gSaveBlock1Ptr->tx_Mode_TypeEffectiveness;
//MENU FEATURES
sOptions->sel_features[MENUITEM_FEATURES_RTC_TYPE] = gSaveBlock1Ptr->tx_Features_RTCType;
sOptions->sel_features[MENUITEM_FEATURES_SHINY_CHANCE] = gSaveBlock1Ptr->tx_Features_ShinyChance;
@@ -1835,6 +1847,7 @@ void SaveData_TxRandomizerAndChallenges(void)
gSaveBlock1Ptr->tx_Mode_Modern_Moves = sOptions->sel_mode[MENUITEM_MODE_MODERN_MOVES];
gSaveBlock1Ptr->tx_Mode_Legendary_Abilities = sOptions->sel_mode[MENUITEM_MODE_LEGENDARY_ABILITIES];
gSaveBlock1Ptr->tx_Mode_New_Legendaries = sOptions->sel_mode[MENUITEM_MODE_NEW_LEGENDARIES];
gSaveBlock1Ptr->tx_Mode_TypeEffectiveness = sOptions->sel_mode[MENUITEM_MODE_NEW_EFFECTIVENESS];
//MENU FEAUTRES
gSaveBlock1Ptr->tx_Features_RTCType = sOptions->sel_features[MENUITEM_FEATURES_RTC_TYPE];
gSaveBlock1Ptr->tx_Features_ShinyChance = sOptions->sel_features[MENUITEM_FEATURES_SHINY_CHANCE];
@@ -2255,6 +2268,8 @@ static void DrawChoices_Mode_Classic_Modern_Selector(int selection, int y)
gSaveBlock1Ptr->tx_Mode_Legendary_Abilities = 0;
sOptions->sel_mode[MENUITEM_MODE_NEW_LEGENDARIES] = TX_MODE_NEW_LEGENDARIES;
gSaveBlock1Ptr->tx_Mode_New_Legendaries = 0;
sOptions->sel_mode[MENUITEM_MODE_NEW_EFFECTIVENESS] = TX_MODE_TYPE_EFFECTIVENESS;
gSaveBlock1Ptr->tx_Mode_TypeEffectiveness = 0;
}
else if (selection == 1)
{
@@ -2286,6 +2301,8 @@ static void DrawChoices_Mode_Classic_Modern_Selector(int selection, int y)
gSaveBlock1Ptr->tx_Mode_Legendary_Abilities = 1;
sOptions->sel_mode[MENUITEM_MODE_NEW_LEGENDARIES] = !TX_MODE_NEW_LEGENDARIES;
gSaveBlock1Ptr->tx_Mode_New_Legendaries = 1;
sOptions->sel_mode[MENUITEM_MODE_NEW_EFFECTIVENESS] = !TX_MODE_TYPE_EFFECTIVENESS;
gSaveBlock1Ptr->tx_Mode_TypeEffectiveness = 1;
}
}
@@ -3036,6 +3053,25 @@ static void DrawChoices_Mode_Modern_Moves(int selection, int y)
DrawOptionMenuChoice(sText_Encounters_Modern_Long, GetStringRightAlignXOffset(1, sText_Encounters_Modern_Long, 198), y, styles[1], active);
}
static void DrawChoices_Mode_New_Effectiveness(int selection, int y)
{
bool8 active = CheckConditions(MENUITEM_MODE_NEW_EFFECTIVENESS);
u8 styles[2] = {0};
styles[selection] = 1;
if (selection == 0)
{
gSaveBlock1Ptr->tx_Mode_TypeEffectiveness = 0; //Old type chart
}
else
{
gSaveBlock1Ptr->tx_Mode_TypeEffectiveness = 1; //New type chart
}
DrawOptionMenuChoice(sText_Encounters_Vanilla_Long, 104, y, styles[0], active);
DrawOptionMenuChoice(sText_Encounters_Modern_Long, GetStringRightAlignXOffset(1, sText_Encounters_Modern_Long, 198), y, styles[1], active);
}
static void DrawChoices_Mode_Legendary_Abilities(int selection, int y)
{
bool8 active = CheckConditions(MENUITEM_MODE_LEGENDARY_ABILITIES);