From cb3411971109a7d2d86748ed96b770a0ec615f56 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Wed, 20 Jul 2022 10:13:18 -0400 Subject: [PATCH 1/3] Config for Charge raising Sp. Def. --- data/battle_scripts_1.s | 2 ++ include/constants/battle_config.h | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 4afb9c87e7..1635f7ba89 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -5544,6 +5544,7 @@ BattleScript_EffectCharge:: setcharge attackanimation waitanimation +.if B_CHARGE_SPDEF_RAISE >= GEN_5 setstatchanger STAT_SPDEF, 1, FALSE statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_EffectChargeString jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_EffectChargeString @@ -5552,6 +5553,7 @@ BattleScript_EffectCharge:: printfromtable gStatUpStringIds waitmessage B_WAIT_TIME_LONG BattleScript_EffectChargeString: +.endif printstring STRINGID_PKMNCHARGINGPOWER waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index c9b64d1a5e..91f5634a5b 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -183,14 +183,10 @@ // Move data settings #define B_UPDATED_MOVE_DATA GEN_8 // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc. #define B_PHYSICAL_SPECIAL_SPLIT GEN_7 // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this. -#define B_FELL_STINGER_STAT_RAISE GEN_7 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint. -#define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. -#define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage. #define B_RECOIL_IF_MISS_DMG GEN_7 // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing. #define B_KLUTZ_FLING_INTERACTION GEN_7 // In Gen5+, Pokémon with the Klutz ability can't use Fling. #define B_UPDATED_CONVERSION GEN_7 // In Gen6+, Conversion changes the user's type to match their first move's. Before, it would choose a move at random. #define B_PP_REDUCED_BY_SPITE GEN_7 // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5. -#define B_MINIMIZE_EVASION GEN_7 // In Gen5+, Minimize raises evasion by 2 stages instead of 1. // Move accuracy settings #define B_TOXIC_NEVER_MISS GEN_7 // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss. @@ -198,6 +194,14 @@ #define B_BLIZZARD_HAIL GEN_7 // In Gen4+, Blizzard bypasses accuracy checks if it's hailing. #define B_SHEER_COLD_ACC GEN_7 // In Gen7+, Sheer Cold's base chance of hitting is reduced to 20% if the user isn't Ice-typed. +// Move stat change settings +#define B_FELL_STINGER_STAT_RAISE GEN_7 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint. +#define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. +#define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage. +#define B_CHARGE_SPDEF_RAISE GEN_7 // In Gen5+, Charge raises the user's Special Defense by 1 stage. +#define B_MINIMIZE_EVASION GEN_7 // In Gen5+, Minimize raises evasion by 2 stages instead of 1. +#define B_GROWTH_UNDER_SUN GEN_7 // In Gen5+, Growth's effects are doubled when under the effects of the sun. + // Other move settings #define B_SOUND_SUBSTITUTE GEN_7 // In Gen6+, sound moves bypass Substitute. #define B_INCINERATE_GEMS GEN_7 // In Gen6+, Incinerate can destroy Gems. @@ -212,7 +216,6 @@ #define B_HEAL_BLOCKING GEN_7 // In Gen5+, Heal Block prevents healing by Black Sludge, Leftovers, Shell Bell. Affected Pokémon will not consume held HP-restoring Berries or Berry Juice. // Draining abilities will not heal but will prevent damage. In Gen6+, Heal Block prevents the use of most HP-draining moves. #define B_ROOTED_GROUNDING GEN_7 // In Gen4+, Ingrain causes the affected Pokémon to become grounded. -#define B_GROWTH_UNDER_SUN GEN_7 // In Gen5+, Growth's effects are doubled when under the effects of the sun. // Ability settings #define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters. From e14afd8957937921c9fba9721f2e4b767ee24269 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Wed, 20 Jul 2022 10:33:18 -0400 Subject: [PATCH 2/3] Added Growth's Atk. raise to the its configuration, as that was also introduced in Gen 5. --- data/battle_scripts_1.s | 4 ---- include/constants/battle_config.h | 2 +- src/data/battle_moves.h | 6 +++++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 1635f7ba89..145ea70049 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2154,9 +2154,7 @@ BattleScript_GrowthDoMoveAnim:: waitanimation setbyte sSTAT_ANIM_PLAYED, FALSE playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_SPATK, 0 -.if B_GROWTH_UNDER_SUN >= GEN_5 jumpifweatheraffected BS_ATTACKER, B_WEATHER_SUN, BattleScript_GrowthAtk2 -.endif setstatchanger STAT_ATK, 1, FALSE goto BattleScript_GrowthAtk BattleScript_GrowthAtk2: @@ -2167,9 +2165,7 @@ BattleScript_GrowthAtk: printfromtable gStatUpStringIds waitmessage B_WAIT_TIME_LONG BattleScript_GrowthTrySpAtk:: -.if B_GROWTH_UNDER_SUN >= GEN_5 jumpifweatheraffected BS_ATTACKER, B_WEATHER_SUN, BattleScript_GrowthSpAtk2 -.endif setstatchanger STAT_SPATK, 1, FALSE goto BattleScript_GrowthSpAtk BattleScript_GrowthSpAtk2: diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 91f5634a5b..1d1782def1 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -200,7 +200,7 @@ #define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage. #define B_CHARGE_SPDEF_RAISE GEN_7 // In Gen5+, Charge raises the user's Special Defense by 1 stage. #define B_MINIMIZE_EVASION GEN_7 // In Gen5+, Minimize raises evasion by 2 stages instead of 1. -#define B_GROWTH_UNDER_SUN GEN_7 // In Gen5+, Growth's effects are doubled when under the effects of the sun. +#define B_GROWTH_STAT_RAISE GEN_7 // In Gen5+, Growth raises Attack in addition to Special Attack by 1 stage each. Under the effects of the sun, it raises them by 2 stages each instead. // Other move settings #define B_SOUND_SUBSTITUTE GEN_7 // In Gen6+, sound moves bypass Substitute. diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 6d7ec5dfc6..b1178a5842 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -1321,7 +1321,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = #else .pp = 40, #endif - .effect = EFFECT_GROWTH, + #if B_GROWTH_STAT_RAISE >= GEN_5 + .effect = EFFECT_GROWTH, + #else + .effect = EFFECT_SPECIAL_ATTACK_UP, + #endif .power = 0, .type = TYPE_NORMAL, .accuracy = 0, From b8ea412e61e23e67aeeda206e0e6509f4748ad0d Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Wed, 20 Jul 2022 14:44:57 -0400 Subject: [PATCH 3/3] AI logic for Charge --- src/battle_ai_main.c | 5 ++++- src/battle_ai_util.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index f924728d2f..794065bece 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -985,8 +985,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 20; else if (!HasMoveWithType(battlerAtk, TYPE_ELECTRIC)) score -= 10; + #if B_CHARGE_SPDEF_RAISE >= GEN_5 else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF)) score -= 5; + #endif break; case EFFECT_QUIVER_DANCE: case EFFECT_GEOMANCY: @@ -4051,8 +4053,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_CHARGE: if (HasDamagingMoveOfType(battlerAtk, TYPE_ELECTRIC)) score += 2; - + #if B_CHARGE_SPDEF_RAISE >= GEN_5 IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPDEF, &score); + #endif break; case EFFECT_TAUNT: if (IS_MOVE_STATUS(predictedMove)) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index b8c42ed0c5..de22866ad1 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -2063,7 +2063,9 @@ bool32 IsStatRaisingEffect(u16 effect) case EFFECT_EVASION_UP_2: case EFFECT_MINIMIZE: case EFFECT_DEFENSE_CURL: + #if B_CHARGE_SPDEF_RAISE >= GEN_5 case EFFECT_CHARGE: + #endif case EFFECT_CALM_MIND: case EFFECT_COSMIC_POWER: case EFFECT_DRAGON_DANCE: