From f30a9542eebb2db4fb7245b324fea649787b8352 Mon Sep 17 00:00:00 2001 From: MissingNoL Date: Thu, 27 May 2021 22:21:55 -0700 Subject: [PATCH 01/81] Problem: Photon Geyser is calculating as Shell Side Arm?? Needs: Poison effect, contact move for Shell Side Arm --- asm/macros/battle_script.inc | 8 ++++ data/battle_scripts_1.s | 8 ++++ include/battle.h | 2 + include/constants/battle_move_effects.h | 4 +- include/constants/battle_script_commands.h | 2 + src/battle_main.c | 3 ++ src/battle_script_commands.c | 49 ++++++++++++++++++++++ src/battle_util.c | 7 +++- src/data/battle_moves.h | 10 ++--- 9 files changed, 85 insertions(+), 8 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 9fa3fe0c3..b5d21abc4 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1726,6 +1726,14 @@ .4byte \ptr .endm + .macro photongeysercheck + various BS_ATTACKER, VARIOUS_PHOTON_GEYSER_CHECK + .endm + + .macro shellsidearmcheck + various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK + .endm + .macro trysetfairylock ptr:req various BS_ATTACKER, VARIOUS_TRY_FAIRY_LOCK .4byte \ptr diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 77eddc8ab..544583961 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -367,6 +367,14 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectFairyLock .4byte BattleScript_EffectAllySwitch .4byte BattleScript_EffectSleepHit + .4byte BattleScript_EffectPhotonGeyser + .4byte BattleScript_EffectShellSideArm + +BattleScript_EffectShellSideArm: + shellsidearmcheck + +BattleScript_EffectPhotonGeyser: + photongeysercheck BattleScript_EffectSleepHit: setmoveeffect MOVE_EFFECT_SLEEP diff --git a/include/battle.h b/include/battle.h index 82a917538..2195e0a21 100644 --- a/include/battle.h +++ b/include/battle.h @@ -858,4 +858,6 @@ extern u8 gBattleControllerData[MAX_BATTLERS_COUNT]; extern bool8 gHasFetchedBall; extern u8 gLastUsedBall; +extern bool8 gSwapDamageCategory; // Photon Geyser, Shell Side Arm, Light That Burns the Sky + #endif // GUARD_BATTLE_H diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 74418d2c7..b9cf92854 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -351,7 +351,9 @@ #define EFFECT_FAIRY_LOCK 345 #define EFFECT_ALLY_SWITCH 346 #define EFFECT_SLEEP_HIT 347 // Relic Song +#define EFFECT_PHOTON_GEYSER 348 +#define EFFECT_SHELL_SIDE_ARM 349 -#define NUM_BATTLE_MOVE_EFFECTS 348 +#define NUM_BATTLE_MOVE_EFFECTS 350 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index faaf8f17e..28ba1a5d4 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -173,6 +173,8 @@ #define VARIOUS_DESTROY_ABILITY_POPUP 102 #define VARIOUS_TOTEM_BOOST 103 #define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 104 +#define VARIOUS_PHOTON_GEYSER_CHECK 105 +#define VARIOUS_SHELL_SIDE_ARM_CHECK 106 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_main.c b/src/battle_main.c index 77470246f..739d33a3e 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -229,6 +229,7 @@ EWRAM_DATA u16 gPartnerSpriteId = 0; EWRAM_DATA struct TotemBoost gTotemBoosts[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA bool8 gHasFetchedBall = FALSE; EWRAM_DATA u8 gLastUsedBall = 0; +EWRAM_DATA bool8 gSwapDamageCategory = FALSE; // Photon Geyser, Shell Side Arm, Light That Burns the Sky // IWRAM common vars void (*gPreBattleCallback1)(void); @@ -2928,6 +2929,8 @@ static void BattleStartClearSetData(void) gBattleStruct->arenaLostOpponentMons = 0; gBattleStruct->mega.triggerSpriteId = 0xFF; + + gSwapDamageCategory = FALSE; // Photon Geyser, Shell Side Arm, Light That Burns the Sky } void SwitchInClearSetData(void) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index fc0eedcbc..2a761e5c6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7126,6 +7126,55 @@ static void Cmd_various(void) switch (gBattlescriptCurrInstr[2]) { + case VARIOUS_PHOTON_GEYSER_CHECK: + { + u32 attStat = gBattleMons[gActiveBattler].attack; + u8 atkStage = gBattleMons[gActiveBattler].statStages[STAT_ATK]; + u32 spaStat = gBattleMons[gActiveBattler].spAttack; + + attStat *= gStatStageRatios[atkStage][0]; + attStat /= gStatStageRatios[atkStage][1]; + + atkStage = gBattleMons[gActiveBattler].statStages[STAT_SPATK]; + spaStat *= gStatStageRatios[atkStage][0]; + spaStat /= gStatStageRatios[atkStage][1]; + + if (attStat > spaStat) + gSwapDamageCategory = TRUE; + } + case VARIOUS_SHELL_SIDE_ARM_CHECK: // according to DaWoblefet, 0% chance GameFreak actually checks this way, but this is the only functional explanation at the moment + { + u32 attStat = gBattleMons[gBattlerAttacker].attack; + u8 atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; + u32 attStatDef = gBattleMons[gBattlerTarget].attack; + u32 physical; + + u32 spaStat = gBattleMons[gBattlerAttacker].spAttack; + u32 spaStatDef = gBattleMons[gBattlerTarget].spAttack; + u32 special; + + attStat *= gStatStageRatios[atkStage][0]; + attStat /= gStatStageRatios[atkStage][1]; + + atkStage = gBattleMons[gBattlerTarget].statStages[STAT_ATK]; + attStatDef *= gStatStageRatios[atkStage][0]; + attStatDef /= gStatStageRatios[atkStage][1]; + + physical = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * 90 * attStat) / attStatDef) / 50); + + atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_SPATK]; + spaStat *= gStatStageRatios[atkStage][0]; + spaStat /= gStatStageRatios[atkStage][1]; + + atkStage = gBattleMons[gBattlerTarget].statStages[STAT_SPATK]; + spaStatDef *= gStatStageRatios[atkStage][0]; + spaStatDef /= gStatStageRatios[atkStage][1]; + + special = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * 90 * spaStat) / spaStatDef) / 50); + + if (((physical > special) || (physical == special && (Random() % 2) == 0))) + gSwapDamageCategory = TRUE; + } // Roar will fail in a double wild battle when used by the player against one of the two alive wild mons. // Also when an opposing wild mon uses it againt its partner. case VARIOUS_JUMP_IF_ROAR_FAILS: diff --git a/src/battle_util.c b/src/battle_util.c index 07c150066..e657a4e96 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8367,8 +8367,11 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) u8 GetBattleMoveSplit(u32 moveId) { if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4) - return gBattleMoves[moveId].split; - else if (gBattleMoves[moveId].type < TYPE_MYSTERY) + if (gSwapDamageCategory == TRUE) // Photon Geyser, Shell Side Arm, Light That Burns the Sky + return SPLIT_PHYSICAL; + else + return gBattleMoves[moveId].split; + else if (gBattleMoves[moveId].type < TYPE_MYSTERY || gSwapDamageCategory == TRUE) // Photon Geyser, Shell Side Arm, Light That Burns the Sky return SPLIT_PHYSICAL; else return SPLIT_SPECIAL; diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 61050e44f..0e27bb588 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -10343,15 +10343,15 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_PHOTON_GEYSER] = { - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_PHOTON_GEYSER, .power = 100, .type = TYPE_PSYCHIC, .accuracy = 100, .pp = 5, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TARGET_ABILITY_IGNORED, .split = SPLIT_SPECIAL, }, @@ -11178,12 +11178,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_SHELL_SIDE_ARM] = { - .effect = EFFECT_PLACEHOLDER, //TODO + .effect = EFFECT_SHELL_SIDE_ARM, .power = 90, .type = TYPE_POISON, .accuracy = 100, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, From 0f09055cfea6a1faf43c7775f7ed7e19aada1536 Mon Sep 17 00:00:00 2001 From: MissingNoL Date: Fri, 28 May 2021 11:11:03 -0700 Subject: [PATCH 02/81] Fixes and added Poison chance to Shell Side Arm (needs contact on physical) --- data/battle_scripts_1.s | 3 ++ src/battle_script_commands.c | 100 ++++++++++++++++++----------------- src/battle_util.c | 9 ++-- src/data/battle_moves.h | 4 +- 4 files changed, 60 insertions(+), 56 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 544583961..795518380 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -372,9 +372,12 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 BattleScript_EffectShellSideArm: shellsidearmcheck + setmoveeffect MOVE_EFFECT_POISON + goto BattleScript_EffectHit BattleScript_EffectPhotonGeyser: photongeysercheck + goto BattleScript_EffectHit BattleScript_EffectSleepHit: setmoveeffect MOVE_EFFECT_SLEEP diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2a761e5c6..e387423bc 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7126,55 +7126,6 @@ static void Cmd_various(void) switch (gBattlescriptCurrInstr[2]) { - case VARIOUS_PHOTON_GEYSER_CHECK: - { - u32 attStat = gBattleMons[gActiveBattler].attack; - u8 atkStage = gBattleMons[gActiveBattler].statStages[STAT_ATK]; - u32 spaStat = gBattleMons[gActiveBattler].spAttack; - - attStat *= gStatStageRatios[atkStage][0]; - attStat /= gStatStageRatios[atkStage][1]; - - atkStage = gBattleMons[gActiveBattler].statStages[STAT_SPATK]; - spaStat *= gStatStageRatios[atkStage][0]; - spaStat /= gStatStageRatios[atkStage][1]; - - if (attStat > spaStat) - gSwapDamageCategory = TRUE; - } - case VARIOUS_SHELL_SIDE_ARM_CHECK: // according to DaWoblefet, 0% chance GameFreak actually checks this way, but this is the only functional explanation at the moment - { - u32 attStat = gBattleMons[gBattlerAttacker].attack; - u8 atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; - u32 attStatDef = gBattleMons[gBattlerTarget].attack; - u32 physical; - - u32 spaStat = gBattleMons[gBattlerAttacker].spAttack; - u32 spaStatDef = gBattleMons[gBattlerTarget].spAttack; - u32 special; - - attStat *= gStatStageRatios[atkStage][0]; - attStat /= gStatStageRatios[atkStage][1]; - - atkStage = gBattleMons[gBattlerTarget].statStages[STAT_ATK]; - attStatDef *= gStatStageRatios[atkStage][0]; - attStatDef /= gStatStageRatios[atkStage][1]; - - physical = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * 90 * attStat) / attStatDef) / 50); - - atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_SPATK]; - spaStat *= gStatStageRatios[atkStage][0]; - spaStat /= gStatStageRatios[atkStage][1]; - - atkStage = gBattleMons[gBattlerTarget].statStages[STAT_SPATK]; - spaStatDef *= gStatStageRatios[atkStage][0]; - spaStatDef /= gStatStageRatios[atkStage][1]; - - special = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * 90 * spaStat) / spaStatDef) / 50); - - if (((physical > special) || (physical == special && (Random() % 2) == 0))) - gSwapDamageCategory = TRUE; - } // Roar will fail in a double wild battle when used by the player against one of the two alive wild mons. // Also when an opposing wild mon uses it againt its partner. case VARIOUS_JUMP_IF_ROAR_FAILS: @@ -8429,6 +8380,57 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; // exit if loop failed (failsafe) } return; + case VARIOUS_PHOTON_GEYSER_CHECK: + { + u32 attStat = gBattleMons[gActiveBattler].attack; + u8 atkStage = gBattleMons[gActiveBattler].statStages[STAT_ATK]; + u32 spaStat = gBattleMons[gActiveBattler].spAttack; + + attStat *= gStatStageRatios[atkStage][0]; + attStat /= gStatStageRatios[atkStage][1]; + + atkStage = gBattleMons[gActiveBattler].statStages[STAT_SPATK]; + spaStat *= gStatStageRatios[atkStage][0]; + spaStat /= gStatStageRatios[atkStage][1]; + + if (attStat > spaStat) + gSwapDamageCategory = TRUE; + break; + } + case VARIOUS_SHELL_SIDE_ARM_CHECK: // 0% chance GameFreak actually checks this way according to DaWobblefet, but this is the only functional explanation at the moment + { + u32 attStat = gBattleMons[gBattlerAttacker].attack; + u8 atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; + u32 attStatDef = gBattleMons[gBattlerTarget].attack; + u32 physical; + + u32 spaStat = gBattleMons[gBattlerAttacker].spAttack; + u32 spaStatDef = gBattleMons[gBattlerTarget].spAttack; + u32 special; + + attStat *= gStatStageRatios[atkStage][0]; + attStat /= gStatStageRatios[atkStage][1]; + + atkStage = gBattleMons[gBattlerTarget].statStages[STAT_ATK]; + attStatDef *= gStatStageRatios[atkStage][0]; + attStatDef /= gStatStageRatios[atkStage][1]; + + physical = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * 90 * attStat) / attStatDef) / 50); + + atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_SPATK]; + spaStat *= gStatStageRatios[atkStage][0]; + spaStat /= gStatStageRatios[atkStage][1]; + + atkStage = gBattleMons[gBattlerTarget].statStages[STAT_SPATK]; + spaStatDef *= gStatStageRatios[atkStage][0]; + spaStatDef /= gStatStageRatios[atkStage][1]; + + special = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * 90 * spaStat) / spaStatDef) / 50); + + if (((physical > special) || (physical == special && (Random() % 2) == 0))) + gSwapDamageCategory = TRUE; + break; + } } gBattlescriptCurrInstr += 3; diff --git a/src/battle_util.c b/src/battle_util.c index e657a4e96..570377002 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8366,12 +8366,11 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) u8 GetBattleMoveSplit(u32 moveId) { + if (gSwapDamageCategory == TRUE) // Photon Geyser, Shell Side Arm, Light That Burns the Sky + return SPLIT_PHYSICAL; if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4) - if (gSwapDamageCategory == TRUE) // Photon Geyser, Shell Side Arm, Light That Burns the Sky - return SPLIT_PHYSICAL; - else - return gBattleMoves[moveId].split; - else if (gBattleMoves[moveId].type < TYPE_MYSTERY || gSwapDamageCategory == TRUE) // Photon Geyser, Shell Side Arm, Light That Burns the Sky + return gBattleMoves[moveId].split; + else if (gBattleMoves[moveId].type < TYPE_MYSTERY) return SPLIT_PHYSICAL; else return SPLIT_SPECIAL; diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 0e27bb588..89b2e29aa 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -10348,7 +10348,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_PSYCHIC, .accuracy = 100, .pp = 5, - .secondaryEffectChance = 100, + .secondaryEffectChance = 0, .target = MOVE_TARGET_FOES_AND_ALLY, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TARGET_ABILITY_IGNORED, @@ -11183,7 +11183,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_POISON, .accuracy = 100, .pp = 10, - .secondaryEffectChance = 100, + .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, From c4b700a8e7e9298610bf439380dc86383f0b0f22 Mon Sep 17 00:00:00 2001 From: MissingNoL Date: Sat, 5 Jun 2021 13:47:05 -0700 Subject: [PATCH 03/81] Only thing left is making IsMoveMakingContact work when hitting King's Shield, etc. --- src/battle_script_commands.c | 2 +- src/battle_util.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e387423bc..422738795 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4708,7 +4708,7 @@ static void Cmd_moveend(void) switch (gBattleScripting.moveendState) { case MOVEEND_PROTECT_LIKE_EFFECT: - if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT) + if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT) // needs to be IsMoveMakingContact, but this file does not reference include/battle_util.h or src/battle_util.c { if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) { diff --git a/src/battle_util.c b/src/battle_util.c index 570377002..fb4110591 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4556,7 +4556,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && IsBattlerAlive(gBattlerAttacker) && TARGET_TURN_DAMAGED - && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) + && (IsMoveMakingContact(move, gBattlerAttacker))) { switch (gBattleMons[gBattlerAttacker].ability) { @@ -4745,7 +4745,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + && (IsMoveMakingContact(move, gBattlerAttacker)) && TARGET_TURN_DAMAGED && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_FIRE) && GetBattlerAbility(gBattlerAttacker) != ABILITY_WATER_VEIL @@ -4764,7 +4764,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + && (IsMoveMakingContact(move, gBattlerAttacker)) && TARGET_TURN_DAMAGED && gBattleMons[gBattlerTarget].hp != 0 && (Random() % 3) == 0 @@ -4832,7 +4832,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED && IsBattlerAlive(battler) - && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + && (IsMoveMakingContact(move, gBattlerAttacker)) && !(gStatuses3[gBattlerAttacker] & STATUS3_PERISH_SONG)) { if (!(gStatuses3[battler] & STATUS3_PERISH_SONG)) @@ -6665,7 +6665,10 @@ u32 GetBattlerHoldEffectParam(u8 battlerId) bool32 IsMoveMakingContact(u16 move, u8 battlerAtk) { if (!(gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) - return FALSE; + if (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gSwapDamageCategory == TRUE) + return TRUE; + else + return FALSE; else if (GetBattlerAbility(battlerAtk) == ABILITY_LONG_REACH) return FALSE; else if (GetBattlerHoldEffect(battlerAtk, TRUE) == HOLD_EFFECT_PROTECTIVE_PADS) @@ -7135,7 +7138,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe MulModifier(&modifier, UQ_4_12(1.3)); break; case ABILITY_TOUGH_CLAWS: - if (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) + if (IsMoveMakingContact(move, battlerAtk)) MulModifier(&modifier, UQ_4_12(1.3)); break; case ABILITY_STRONG_JAW: From 517763bc9f31721813eb283b6fadce88e23bc825 Mon Sep 17 00:00:00 2001 From: MissingNoL <84547991+MissingNoL@users.noreply.github.com> Date: Sat, 5 Jun 2021 16:38:37 -0700 Subject: [PATCH 04/81] Update src/battle_util.c Changed an `if` to `else if` Co-authored-by: LOuroboros --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index fb4110591..0d4a7f18a 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8371,7 +8371,7 @@ u8 GetBattleMoveSplit(u32 moveId) { if (gSwapDamageCategory == TRUE) // Photon Geyser, Shell Side Arm, Light That Burns the Sky return SPLIT_PHYSICAL; - if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4) + else if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4) return gBattleMoves[moveId].split; else if (gBattleMoves[moveId].type < TYPE_MYSTERY) return SPLIT_PHYSICAL; From 921b80de7c138a0c0320187ae2a383d22a390f13 Mon Sep 17 00:00:00 2001 From: MissingNoL <84547991+MissingNoL@users.noreply.github.com> Date: Sat, 5 Jun 2021 16:40:03 -0700 Subject: [PATCH 05/81] Update battle_script_commands.h Properly aligned the list of number IDs --- include/constants/battle_script_commands.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 28ba1a5d4..3976d4375 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -173,8 +173,8 @@ #define VARIOUS_DESTROY_ABILITY_POPUP 102 #define VARIOUS_TOTEM_BOOST 103 #define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 104 -#define VARIOUS_PHOTON_GEYSER_CHECK 105 -#define VARIOUS_SHELL_SIDE_ARM_CHECK 106 +#define VARIOUS_PHOTON_GEYSER_CHECK 105 +#define VARIOUS_SHELL_SIDE_ARM_CHECK 106 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 From d69cfcff7043a1a97d0835747dd727f1a3709d34 Mon Sep 17 00:00:00 2001 From: MissingNoL <84547991+MissingNoL@users.noreply.github.com> Date: Sat, 5 Jun 2021 16:43:19 -0700 Subject: [PATCH 06/81] Update battle_script_commands.c Included src/battle_util.c to call IsMoveMakingContact --- src/battle_script_commands.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 422738795..bb81b2cbc 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -53,6 +53,7 @@ #include "constants/rgb.h" #include "data.h" #include "constants/party_menu.h" +#include "src/battle_util.c" extern struct MusicPlayerInfo gMPlayInfo_BGM; @@ -4708,7 +4709,7 @@ static void Cmd_moveend(void) switch (gBattleScripting.moveendState) { case MOVEEND_PROTECT_LIKE_EFFECT: - if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT) // needs to be IsMoveMakingContact, but this file does not reference include/battle_util.h or src/battle_util.c + if (IsMoveMakingContact(move, gBattlerAttacker)) { if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) { From caf2548830d67dd9e6de97c8b29cc1ddbe777c2a Mon Sep 17 00:00:00 2001 From: MissingNoL Date: Sun, 6 Jun 2021 21:40:38 -0700 Subject: [PATCH 07/81] Included `battle_util.h`, fixed parameter `IsMoveMakingContact` --- src/battle_script_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 1dadeadb1..bc1b48cfc 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -54,7 +54,7 @@ #include "constants/rgb.h" #include "data.h" #include "constants/party_menu.h" -#include "src/battle_util.c" +#include "battle_util.h" extern struct MusicPlayerInfo gMPlayInfo_BGM; @@ -4781,7 +4781,7 @@ static void Cmd_moveend(void) switch (gBattleScripting.moveendState) { case MOVEEND_PROTECT_LIKE_EFFECT: - if (IsMoveMakingContact(move, gBattlerAttacker)) + if (IsMoveMakingContact(gCurrentMove, gBattlerAttacker)) { if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) { From 380e1e470c2c25683b22e567cc65489faaf3c2ae Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Wed, 22 Sep 2021 23:29:00 -0300 Subject: [PATCH 08/81] Applied use of TRUE and FALSE for flags. --- src/battle_main.c | 60 +++++++++---------- src/battle_script_commands.c | 112 +++++++++++++++++------------------ src/battle_util.c | 112 +++++++++++++++++------------------ 3 files changed, 142 insertions(+), 142 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index 72d05a0fd..1b4ad5f74 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3067,31 +3067,31 @@ void FaintClearSetData(void) memset(&gDisableStructs[gActiveBattler], 0, sizeof(struct DisableStruct)); - gProtectStructs[gActiveBattler].protected = 0; - gProtectStructs[gActiveBattler].spikyShielded = 0; - gProtectStructs[gActiveBattler].kingsShielded = 0; - gProtectStructs[gActiveBattler].banefulBunkered = 0; - gProtectStructs[gActiveBattler].endured = 0; - gProtectStructs[gActiveBattler].noValidMoves = 0; - gProtectStructs[gActiveBattler].helpingHand = 0; - gProtectStructs[gActiveBattler].bounceMove = 0; - gProtectStructs[gActiveBattler].stealMove = 0; - gProtectStructs[gActiveBattler].prlzImmobility = 0; - gProtectStructs[gActiveBattler].confusionSelfDmg = 0; - gProtectStructs[gActiveBattler].targetAffected = 0; - gProtectStructs[gActiveBattler].chargingTurn = 0; + gProtectStructs[gActiveBattler].protected = FALSE; + gProtectStructs[gActiveBattler].spikyShielded = FALSE; + gProtectStructs[gActiveBattler].kingsShielded = FALSE; + gProtectStructs[gActiveBattler].banefulBunkered = FALSE; + gProtectStructs[gActiveBattler].endured = FALSE; + gProtectStructs[gActiveBattler].noValidMoves = FALSE; + gProtectStructs[gActiveBattler].helpingHand = FALSE; + gProtectStructs[gActiveBattler].bounceMove = FALSE; + gProtectStructs[gActiveBattler].stealMove = FALSE; + gProtectStructs[gActiveBattler].prlzImmobility = FALSE; + gProtectStructs[gActiveBattler].confusionSelfDmg = FALSE; + gProtectStructs[gActiveBattler].targetAffected = FALSE; + gProtectStructs[gActiveBattler].chargingTurn = FALSE; gProtectStructs[gActiveBattler].fleeFlag = 0; - gProtectStructs[gActiveBattler].usedImprisonedMove = 0; - gProtectStructs[gActiveBattler].loveImmobility = 0; - gProtectStructs[gActiveBattler].usedDisabledMove = 0; - gProtectStructs[gActiveBattler].usedTauntedMove = 0; - gProtectStructs[gActiveBattler].flag2Unknown = 0; - gProtectStructs[gActiveBattler].flinchImmobility = 0; - gProtectStructs[gActiveBattler].notFirstStrike = 0; - gProtectStructs[gActiveBattler].usedHealBlockedMove = 0; - gProtectStructs[gActiveBattler].usesBouncedMove = 0; - gProtectStructs[gActiveBattler].usedGravityPreventedMove = 0; - gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = 0; + gProtectStructs[gActiveBattler].usedImprisonedMove = FALSE; + gProtectStructs[gActiveBattler].loveImmobility = FALSE; + gProtectStructs[gActiveBattler].usedDisabledMove = FALSE; + gProtectStructs[gActiveBattler].usedTauntedMove = FALSE; + gProtectStructs[gActiveBattler].flag2Unknown = FALSE; + gProtectStructs[gActiveBattler].flinchImmobility = FALSE; + gProtectStructs[gActiveBattler].notFirstStrike = FALSE; + gProtectStructs[gActiveBattler].usedHealBlockedMove = FALSE; + gProtectStructs[gActiveBattler].usesBouncedMove = FALSE; + gProtectStructs[gActiveBattler].usedGravityPreventedMove = FALSE; + gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = FALSE; gDisableStructs[gActiveBattler].isFirstTurn = 2; @@ -4541,10 +4541,10 @@ static void TurnValuesCleanUp(bool8 var0) { if (var0) { - gProtectStructs[gActiveBattler].protected = 0; - gProtectStructs[gActiveBattler].spikyShielded = 0; - gProtectStructs[gActiveBattler].kingsShielded = 0; - gProtectStructs[gActiveBattler].banefulBunkered = 0; + gProtectStructs[gActiveBattler].protected = FALSE; + gProtectStructs[gActiveBattler].spikyShielded = FALSE; + gProtectStructs[gActiveBattler].kingsShielded = FALSE; + gProtectStructs[gActiveBattler].banefulBunkered = FALSE; } else { @@ -5032,7 +5032,7 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) gBattleStruct->dynamicMoveType = 0; gBattleStruct->ateBoost[battlerAtk] = 0; - gSpecialStatuses[battlerAtk].gemBoost = 0; + gSpecialStatuses[battlerAtk].gemBoost = FALSE; if (gBattleMoves[move].effect == EFFECT_WEATHER_BALL) { @@ -5126,7 +5126,7 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) && moveType == ItemId_GetSecondaryId(gBattleMons[battlerAtk].item)) { gSpecialStatuses[battlerAtk].gemParam = GetBattlerHoldEffectParam(battlerAtk); - gSpecialStatuses[battlerAtk].gemBoost = 1; + gSpecialStatuses[battlerAtk].gemBoost = TRUE; } } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5840e8805..9a107fac0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1402,8 +1402,8 @@ static void Cmd_attackcanceler(void) && !gProtectStructs[gBattlerAttacker].usesBouncedMove) { PressurePPLose(gBattlerAttacker, gBattlerTarget, MOVE_MAGIC_COAT); - gProtectStructs[gBattlerTarget].bounceMove = 0; - gProtectStructs[gBattlerTarget].usesBouncedMove = 1; + gProtectStructs[gBattlerTarget].bounceMove = FALSE; + gProtectStructs[gBattlerTarget].usesBouncedMove = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = 0; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MagicCoatBounce; @@ -1414,7 +1414,7 @@ static void Cmd_attackcanceler(void) && !gProtectStructs[gBattlerAttacker].usesBouncedMove) { RecordAbilityBattle(gBattlerTarget, ABILITY_MAGIC_BOUNCE); - gProtectStructs[gBattlerTarget].usesBouncedMove = 1; + gProtectStructs[gBattlerTarget].usesBouncedMove = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = 1; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MagicCoatBounce; @@ -1426,7 +1426,7 @@ static void Cmd_attackcanceler(void) if ((gProtectStructs[gBattlerByTurnOrder[i]].stealMove) && gBattleMoves[gCurrentMove].flags & FLAG_SNATCH_AFFECTED) { PressurePPLose(gBattlerAttacker, gBattlerByTurnOrder[i], MOVE_SNATCH); - gProtectStructs[gBattlerByTurnOrder[i]].stealMove = 0; + gProtectStructs[gBattlerByTurnOrder[i]].stealMove = FALSE; gBattleScripting.battler = gBattlerByTurnOrder[i]; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SnatchedMove; @@ -1436,7 +1436,7 @@ static void Cmd_attackcanceler(void) if (gSpecialStatuses[gBattlerTarget].lightningRodRedirected) { - gSpecialStatuses[gBattlerTarget].lightningRodRedirected = 0; + gSpecialStatuses[gBattlerTarget].lightningRodRedirected = FALSE; gLastUsedAbility = ABILITY_LIGHTNING_ROD; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_TookAttack; @@ -1444,7 +1444,7 @@ static void Cmd_attackcanceler(void) } else if (gSpecialStatuses[gBattlerTarget].stormDrainRedirected) { - gSpecialStatuses[gBattlerTarget].stormDrainRedirected = 0; + gSpecialStatuses[gBattlerTarget].stormDrainRedirected = FALSE; gLastUsedAbility = ABILITY_STORM_DRAIN; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_TookAttack; @@ -1456,7 +1456,7 @@ static void Cmd_attackcanceler(void) && gBattleMoves[gCurrentMove].effect != EFFECT_SUCKER_PUNCH) { if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT) - gProtectStructs[gBattlerAttacker].touchedProtectLike = 1; + gProtectStructs[gBattlerAttacker].touchedProtectLike = TRUE; CancelMultiTurnMoves(gBattlerAttacker); gMoveResultFlags |= MOVE_RESULT_MISSED; gLastLandedMoves[gBattlerTarget] = 0; @@ -1745,7 +1745,7 @@ static void Cmd_ppreduce(void) if (!(gHitMarker & (HITMARKER_NO_PPDEDUCT | HITMARKER_NO_ATTACKSTRING)) && gBattleMons[gBattlerAttacker].pp[gCurrMovePos]) { - gProtectStructs[gBattlerAttacker].notFirstStrike = 1; + gProtectStructs[gBattlerAttacker].notFirstStrike = TRUE; // For item Metronome, echoed voice if (gCurrentMove == gLastResultingMoves[gBattlerAttacker] && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) @@ -1888,17 +1888,17 @@ static void Cmd_adjustdamage(void) if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param) { RecordItemEffectBattle(gBattlerTarget, holdEffect); - gSpecialStatuses[gBattlerTarget].focusBanded = 1; + gSpecialStatuses[gBattlerTarget].focusBanded = TRUE; } else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && BATTLER_MAX_HP(gBattlerTarget)) { RecordItemEffectBattle(gBattlerTarget, holdEffect); - gSpecialStatuses[gBattlerTarget].focusSashed = 1; + gSpecialStatuses[gBattlerTarget].focusSashed = TRUE; } else if (GetBattlerAbility(gBattlerTarget) == ABILITY_STURDY && BATTLER_MAX_HP(gBattlerTarget)) { RecordAbilityBattle(gBattlerTarget, ABILITY_STURDY); - gSpecialStatuses[gBattlerTarget].sturdied = 1; + gSpecialStatuses[gBattlerTarget].sturdied = TRUE; } if (gBattleMoves[gCurrentMove].effect != EFFECT_FALSE_SWIPE @@ -1961,7 +1961,7 @@ static void Cmd_multihitresultmessage(void) if (gMoveResultFlags & MOVE_RESULT_STURDIED) { gMoveResultFlags &= ~(MOVE_RESULT_STURDIED | MOVE_RESULT_FOE_HUNG_ON); - gSpecialStatuses[gBattlerTarget].sturdied = 0; // Delete this line to make Sturdy last for the duration of the whole move turn. + gSpecialStatuses[gBattlerTarget].sturdied = FALSE; // Delete this line to make Sturdy last for the duration of the whole move turn. BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SturdiedMsg; return; @@ -1971,8 +1971,8 @@ static void Cmd_multihitresultmessage(void) gLastUsedItem = gBattleMons[gBattlerTarget].item; gPotentialItemEffectBattler = gBattlerTarget; gMoveResultFlags &= ~(MOVE_RESULT_STURDIED | MOVE_RESULT_FOE_HUNG_ON); - gSpecialStatuses[gBattlerTarget].focusBanded = 0; // Delete this line to make Focus Band last for the duration of the whole move turn. - gSpecialStatuses[gBattlerTarget].focusSashed = 0; // Delete this line to make Focus Sash last for the duration of the whole move turn. + gSpecialStatuses[gBattlerTarget].focusBanded = FALSE; // Delete this line to make Focus Band last for the duration of the whole move turn. + gSpecialStatuses[gBattlerTarget].focusSashed = FALSE; // Delete this line to make Focus Sash last for the duration of the whole move turn. BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_HangedOnMsg; return; @@ -1984,7 +1984,7 @@ static void Cmd_multihitresultmessage(void) if (gSpecialStatuses[gBattlerTarget].berryReduced && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { - gSpecialStatuses[gBattlerTarget].berryReduced = 0; + gSpecialStatuses[gBattlerTarget].berryReduced = FALSE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_PrintBerryReduceString; } @@ -2336,7 +2336,7 @@ static void Cmd_resultmessage(void) else if (gMoveResultFlags & MOVE_RESULT_STURDIED) { gMoveResultFlags &= ~(MOVE_RESULT_STURDIED | MOVE_RESULT_FOE_ENDURED | MOVE_RESULT_FOE_HUNG_ON); - gSpecialStatuses[gBattlerTarget].sturdied = 0; + gSpecialStatuses[gBattlerTarget].sturdied = FALSE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SturdiedMsg; return; @@ -2378,7 +2378,7 @@ static void Cmd_resultmessage(void) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { gLastUsedItem = gBattleMons[gBattlerTarget].item; - gSpecialStatuses[gBattlerTarget].berryReduced = 0; + gSpecialStatuses[gBattlerTarget].berryReduced = FALSE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_PrintBerryReduceString; } @@ -2888,7 +2888,7 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_CHARGING: gBattleMons[gEffectBattler].status2 |= STATUS2_MULTIPLETURNS; gLockedMoves[gEffectBattler] = gCurrentMove; - gProtectStructs[gEffectBattler].chargingTurn = 1; + gProtectStructs[gEffectBattler].chargingTurn = TRUE; gBattlescriptCurrInstr++; break; case MOVE_EFFECT_WRAP: @@ -3212,14 +3212,14 @@ void SetMoveEffect(bool32 primary, u32 certain) || gProtectStructs[gBattlerTarget].kingsShielded || gProtectStructs[gBattlerTarget].banefulBunkered) { - gProtectStructs[gBattlerTarget].protected = 0; + gProtectStructs[gBattlerTarget].protected = FALSE; gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_WIDE_GUARD); gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_QUICK_GUARD); gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_CRAFTY_SHIELD); gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_MAT_BLOCK); - gProtectStructs[gBattlerTarget].spikyShielded = 0; - gProtectStructs[gBattlerTarget].kingsShielded = 0; - gProtectStructs[gBattlerTarget].banefulBunkered = 0; + gProtectStructs[gBattlerTarget].spikyShielded = FALSE; + gProtectStructs[gBattlerTarget].kingsShielded = FALSE; + gProtectStructs[gBattlerTarget].banefulBunkered = FALSE; if (gCurrentMove == MOVE_FEINT) { BattleScriptPush(gBattlescriptCurrInstr + 1); @@ -4753,7 +4753,7 @@ static void Cmd_moveend(void) { if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) { - gProtectStructs[gBattlerAttacker].touchedProtectLike = 0; + gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -4764,7 +4764,7 @@ static void Cmd_moveend(void) } else if (gProtectStructs[gBattlerTarget].kingsShielded) { - gProtectStructs[gBattlerAttacker].touchedProtectLike = 0; + gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE; i = gBattlerAttacker; gBattlerAttacker = gBattlerTarget; gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable @@ -4775,7 +4775,7 @@ static void Cmd_moveend(void) } else if (gProtectStructs[gBattlerTarget].banefulBunkered) { - gProtectStructs[gBattlerAttacker].touchedProtectLike = 0; + gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE; gBattleScripting.moveEffect = MOVE_EFFECT_POISON | MOVE_EFFECT_AFFECTS_USER; PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_BANEFUL_BUNKER); BattleScriptPushCursor(); @@ -4924,7 +4924,7 @@ static void Cmd_moveend(void) BtlController_EmitSpriteInvisibility(0, FALSE); MarkBattlerForControllerExec(gActiveBattler); gStatuses3[gBattlerAttacker] &= ~(STATUS3_SEMI_INVULNERABLE); - gSpecialStatuses[gBattlerAttacker].restoredBattlerSprite = 1; + gSpecialStatuses[gBattlerAttacker].restoredBattlerSprite = TRUE; gBattleScripting.moveendState++; return; } @@ -5030,7 +5030,7 @@ static void Cmd_moveend(void) // Set a flag if move hits either target (for throat spray that can't check damage) if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) - gProtectStructs[gBattlerAttacker].targetAffected = 1; + gProtectStructs[gBattlerAttacker].targetAffected = TRUE; if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && gBattleTypeFlags & BATTLE_TYPE_DOUBLE @@ -5227,7 +5227,7 @@ static void Cmd_moveend(void) { gBattleScripting.savedBattler = gBattlerTarget | 0x4; gBattleScripting.savedBattler |= (gBattlerAttacker << 4); - gSpecialStatuses[gBattlerAttacker].dancerUsedMove = 1; + gSpecialStatuses[gBattlerAttacker].dancerUsedMove = TRUE; } for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++) { @@ -5275,13 +5275,13 @@ static void Cmd_moveend(void) *(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].instructedChosenTarget & 0x3; if (gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget) *(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget & 0x3; - gProtectStructs[gBattlerAttacker].usesBouncedMove = 0; - gProtectStructs[gBattlerAttacker].targetAffected = 0; + gProtectStructs[gBattlerAttacker].usesBouncedMove = FALSE; + gProtectStructs[gBattlerAttacker].targetAffected = FALSE; gBattleStruct->ateBoost[gBattlerAttacker] = 0; gStatuses3[gBattlerAttacker] &= ~(STATUS3_ME_FIRST); - gSpecialStatuses[gBattlerAttacker].gemBoost = 0; + gSpecialStatuses[gBattlerAttacker].gemBoost = FALSE; gSpecialStatuses[gBattlerAttacker].damagedMons = 0; - gSpecialStatuses[gBattlerTarget].berryReduced = 0; + gSpecialStatuses[gBattlerTarget].berryReduced = FALSE; gBattleScripting.moveEffect = 0; gBattleScripting.moveendState++; break; @@ -7538,9 +7538,9 @@ static void Cmd_various(void) gBattleCommunication[0] = FALSE; break; case VARIOUS_RESET_INTIMIDATE_TRACE_BITS: - gSpecialStatuses[gActiveBattler].intimidatedMon = 0; - gSpecialStatuses[gActiveBattler].traced = 0; - gSpecialStatuses[gActiveBattler].switchInAbilityDone = 0; + gSpecialStatuses[gActiveBattler].intimidatedMon = FALSE; + gSpecialStatuses[gActiveBattler].traced = FALSE; + gSpecialStatuses[gActiveBattler].switchInAbilityDone = FALSE; break; case VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP: if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId || gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId) @@ -8615,27 +8615,27 @@ static void Cmd_setprotectlike(void) { if (gBattleMoves[gCurrentMove].effect == EFFECT_ENDURE) { - gProtectStructs[gBattlerAttacker].endured = 1; + gProtectStructs[gBattlerAttacker].endured = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_BRACED_ITSELF; } else if (gCurrentMove == MOVE_DETECT || gCurrentMove == MOVE_PROTECT) { - gProtectStructs[gBattlerAttacker].protected = 1; + gProtectStructs[gBattlerAttacker].protected = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECTED_ITSELF; } else if (gCurrentMove == MOVE_SPIKY_SHIELD) { - gProtectStructs[gBattlerAttacker].spikyShielded = 1; + gProtectStructs[gBattlerAttacker].spikyShielded = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECTED_ITSELF; } else if (gCurrentMove == MOVE_KINGS_SHIELD) { - gProtectStructs[gBattlerAttacker].kingsShielded = 1; + gProtectStructs[gBattlerAttacker].kingsShielded = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECTED_ITSELF; } else if (gCurrentMove == MOVE_BANEFUL_BUNKER) { - gProtectStructs[gBattlerAttacker].banefulBunkered = 1; + gProtectStructs[gBattlerAttacker].banefulBunkered = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PROTECTED_ITSELF; } @@ -8800,7 +8800,7 @@ static void Cmd_trymirrormove(void) } else { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; gBattlescriptCurrInstr++; } } @@ -9168,7 +9168,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr BattleScriptPush(BS_ptr); gBattleScripting.battler = gActiveBattler; gBattlescriptCurrInstr = BattleScript_MistProtected; - gSpecialStatuses[gActiveBattler].statLowered = 1; + gSpecialStatuses[gActiveBattler].statLowered = TRUE; } } return STAT_CHANGE_DIDNT_WORK; @@ -9198,7 +9198,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr gBattlescriptCurrInstr = BattleScript_AbilityNoStatLoss; gLastUsedAbility = GetBattlerAbility(gActiveBattler); RecordAbilityBattle(gActiveBattler, gLastUsedAbility); - gSpecialStatuses[gActiveBattler].statLowered = 1; + gSpecialStatuses[gActiveBattler].statLowered = TRUE; } } return STAT_CHANGE_DIDNT_WORK; @@ -9218,7 +9218,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr gBattlerAbility = index - 1; gBattlescriptCurrInstr = BattleScript_FlowerVeilProtectsRet; gLastUsedAbility = ABILITY_FLOWER_VEIL; - gSpecialStatuses[gActiveBattler].statLowered = 1; + gSpecialStatuses[gActiveBattler].statLowered = TRUE; } } return STAT_CHANGE_DIDNT_WORK; @@ -9293,7 +9293,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr else { // Check eject pack. disableEjectPack set for edge cases (e.g. attacking weak armor'd eject pack holder with u-turn) - if (gProtectStructs[gActiveBattler].disableEjectPack == 0) + if (!gProtectStructs[gActiveBattler].disableEjectPack) gSpecialStatuses[gActiveBattler].statFell = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL } @@ -9787,12 +9787,12 @@ static void Cmd_tryKO(void) if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < GetBattlerHoldEffectParam(gBattlerTarget)) { - gSpecialStatuses[gBattlerTarget].focusBanded = 1; + gSpecialStatuses[gBattlerTarget].focusBanded = TRUE; RecordItemEffectBattle(gBattlerTarget, holdEffect); } else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && BATTLER_MAX_HP(gBattlerTarget)) { - gSpecialStatuses[gBattlerTarget].focusSashed = 1; + gSpecialStatuses[gBattlerTarget].focusSashed = TRUE; RecordItemEffectBattle(gBattlerTarget, holdEffect); } @@ -10206,7 +10206,7 @@ static void Cmd_counterdamagecalculator(void) } else { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } } @@ -10231,7 +10231,7 @@ static void Cmd_mirrorcoatdamagecalculator(void) // a copy of atkA1 with the phy } else { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } } @@ -10720,7 +10720,7 @@ static void Cmd_trysetspikes(void) if (gSideTimers[targetSide].spikesAmount == 3) { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } else @@ -11407,7 +11407,7 @@ static void Cmd_trysethelpinghand(void) && !gProtectStructs[gBattlerAttacker].helpingHand && !gProtectStructs[gBattlerTarget].helpingHand) { - gProtectStructs[gBattlerTarget].helpingHand = 1; + gProtectStructs[gBattlerTarget].helpingHand = TRUE; gBattlescriptCurrInstr += 5; } else @@ -11827,28 +11827,28 @@ static void Cmd_assistattackselect(void) static void Cmd_trysetmagiccoat(void) { gBattlerTarget = gBattlerAttacker; - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; if (gCurrentTurnActionNumber == gBattlersCount - 1) // moves last turn { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } else { - gProtectStructs[gBattlerAttacker].bounceMove = 1; + gProtectStructs[gBattlerAttacker].bounceMove = TRUE; gBattlescriptCurrInstr += 5; } } static void Cmd_trysetsnatch(void) // snatch { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; if (gCurrentTurnActionNumber == gBattlersCount - 1) // moves last turn { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } else { - gProtectStructs[gBattlerAttacker].stealMove = 1; + gProtectStructs[gBattlerAttacker].stealMove = TRUE; gBattlescriptCurrInstr += 5; } } @@ -12835,7 +12835,7 @@ static void Cmd_metalburstdamagecalculator(void) } else { - gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1; + gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } } diff --git a/src/battle_util.c b/src/battle_util.c index f0adfebb9..b012f7d49 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -255,7 +255,7 @@ void HandleAction_UseMove(void) // choose move if (gProtectStructs[gBattlerAttacker].noValidMoves) { - gProtectStructs[gBattlerAttacker].noValidMoves = 0; + gProtectStructs[gBattlerAttacker].noValidMoves = FALSE; gCurrentMove = gChosenMove = MOVE_STRUGGLE; gHitMarker |= HITMARKER_NO_PPDEDUCT; *(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(MOVE_STRUGGLE, 0); @@ -386,9 +386,9 @@ void HandleAction_UseMove(void) gActiveBattler = gBattlerByTurnOrder[var]; RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability); if (gBattleMons[gActiveBattler].ability == ABILITY_LIGHTNING_ROD) - gSpecialStatuses[gActiveBattler].lightningRodRedirected = 1; + gSpecialStatuses[gActiveBattler].lightningRodRedirected = TRUE; else if (gBattleMons[gActiveBattler].ability == ABILITY_STORM_DRAIN) - gSpecialStatuses[gActiveBattler].stormDrainRedirected = 1; + gSpecialStatuses[gActiveBattler].stormDrainRedirected = TRUE; gBattlerTarget = gActiveBattler; } } @@ -1594,7 +1594,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingDisabledMoveInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1609,7 +1609,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingTormentedMoveInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1624,7 +1624,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveTauntInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1639,7 +1639,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveThroatChopInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1654,7 +1654,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingImprisonedMoveInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1669,7 +1669,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGravityInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1684,7 +1684,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveHealBlockInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1699,7 +1699,7 @@ u8 TrySetCantSelectMoveBattleScript(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedBelchInPalace; - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1715,7 +1715,7 @@ u8 TrySetCantSelectMoveBattleScript(void) gLastUsedItem = gBattleMons[gActiveBattler].item; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1729,7 +1729,7 @@ u8 TrySetCantSelectMoveBattleScript(void) gLastUsedItem = gBattleMons[gActiveBattler].item; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1742,7 +1742,7 @@ u8 TrySetCantSelectMoveBattleScript(void) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; } else { @@ -1801,12 +1801,12 @@ bool8 AreAllMovesUnusable(void) if (unusable == 0xF) // All moves are unusable. { - gProtectStructs[gActiveBattler].noValidMoves = 1; + gProtectStructs[gActiveBattler].noValidMoves = TRUE; gSelectionBattleScripts[gActiveBattler] = BattleScript_NoMovesLeft; } else { - gProtectStructs[gActiveBattler].noValidMoves = 0; + gProtectStructs[gActiveBattler].noValidMoves = FALSE; } return (unusable == 0xF); @@ -3194,7 +3194,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_FLINCH: // flinch if (gBattleMons[gBattlerAttacker].status2 & STATUS2_FLINCHED) { - gProtectStructs[gBattlerAttacker].flinchImmobility = 1; + gProtectStructs[gBattlerAttacker].flinchImmobility = TRUE; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedFlinched; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; @@ -3205,7 +3205,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_DISABLED: // disabled move if (gDisableStructs[gBattlerAttacker].disabledMove == gCurrentMove && gDisableStructs[gBattlerAttacker].disabledMove != 0) { - gProtectStructs[gBattlerAttacker].usedDisabledMove = 1; + gProtectStructs[gBattlerAttacker].usedDisabledMove = TRUE; gBattleScripting.battler = gBattlerAttacker; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsDisabled; @@ -3217,7 +3217,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_HEAL_BLOCKED: if (gStatuses3[gBattlerAttacker] & STATUS3_HEAL_BLOCK && IsHealBlockPreventingMove(gBattlerAttacker, gCurrentMove)) { - gProtectStructs[gBattlerAttacker].usedHealBlockedMove = 1; + gProtectStructs[gBattlerAttacker].usedHealBlockedMove = TRUE; gBattleScripting.battler = gBattlerAttacker; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedHealBlockPrevents; @@ -3229,7 +3229,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_GRAVITY: if (gFieldStatuses & STATUS_FIELD_GRAVITY && IsGravityPreventingMove(gCurrentMove)) { - gProtectStructs[gBattlerAttacker].usedGravityPreventedMove = 1; + gProtectStructs[gBattlerAttacker].usedGravityPreventedMove = TRUE; gBattleScripting.battler = gBattlerAttacker; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedGravityPrevents; @@ -3241,7 +3241,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_TAUNTED: // taunt if (gDisableStructs[gBattlerAttacker].tauntTimer && gBattleMoves[gCurrentMove].power == 0) { - gProtectStructs[gBattlerAttacker].usedTauntedMove = 1; + gProtectStructs[gBattlerAttacker].usedTauntedMove = TRUE; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsTaunted; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; @@ -3252,7 +3252,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_IMPRISONED: // imprisoned if (GetImprisonedMovesCount(gBattlerAttacker, gCurrentMove)) { - gProtectStructs[gBattlerAttacker].usedImprisonedMove = 1; + gProtectStructs[gBattlerAttacker].usedImprisonedMove = TRUE; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsImprisoned; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; @@ -3271,7 +3271,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleCommunication[MULTISTRING_CHOOSER] = TRUE; gBattlerTarget = gBattlerAttacker; gBattleMoveDamage = CalculateMoveDamage(MOVE_NONE, gBattlerAttacker, gBattlerAttacker, TYPE_MYSTERY, 40, FALSE, FALSE, TRUE); - gProtectStructs[gBattlerAttacker].confusionSelfDmg = 1; + gProtectStructs[gBattlerAttacker].confusionSelfDmg = TRUE; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; } else @@ -3293,7 +3293,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_PARALYSED: // paralysis if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_PARALYSIS) && (Random() % 4) == 0) { - gProtectStructs[gBattlerAttacker].prlzImmobility = 1; + gProtectStructs[gBattlerAttacker].prlzImmobility = TRUE; // This is removed in Emerald for some reason //CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsParalyzed; @@ -3314,7 +3314,7 @@ u8 AtkCanceller_UnableToUseMove(void) { BattleScriptPush(BattleScript_MoveUsedIsInLoveCantAttack); gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; - gProtectStructs[gBattlerAttacker].loveImmobility = 1; + gProtectStructs[gBattlerAttacker].loveImmobility = TRUE; CancelMultiTurnMoves(gBattlerAttacker); } gBattlescriptCurrInstr = BattleScript_MoveUsedIsInLove; @@ -3393,7 +3393,7 @@ u8 AtkCanceller_UnableToUseMove(void) GET_MOVE_TYPE(gCurrentMove, moveType); if (moveType == TYPE_FIRE) { - gProtectStructs[gBattlerAttacker].powderSelfDmg = 1; + gProtectStructs[gBattlerAttacker].powderSelfDmg = TRUE; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; gBattlescriptCurrInstr = BattleScript_MoveUsedPowder; effect = 1; @@ -3404,7 +3404,7 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_THROAT_CHOP: if (gDisableStructs[gBattlerAttacker].throatChopTimer && gBattleMoves[gCurrentMove].flags & FLAG_SOUND) { - gProtectStructs[gBattlerAttacker].usedThroatChopPreventedMove = 1; + gProtectStructs[gBattlerAttacker].usedThroatChopPreventedMove = TRUE; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsThroatChopPrevented; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; @@ -3926,7 +3926,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_MOLDBREAKER; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -3935,7 +3935,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_TERAVOLT; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -3944,7 +3944,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_TURBOBLAZE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -3954,7 +3954,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { gDisableStructs[battler].slowStartTimer = 5; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_SLOWSTART; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -3963,7 +3963,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_UNNERVE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -3973,7 +3973,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_ASONE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_ActivateAsOne); effect++; } @@ -3985,7 +3985,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move u32 i; gEffectBattler = BATTLE_PARTNER(battler); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_CURIOUS_MEDICINE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4015,7 +4015,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (effect) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_ANTICIPATION; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); } } @@ -4023,7 +4023,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_FRISK: if (!gSpecialStatuses[battler].switchInAbilityDone) { - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_FriskActivates); // Try activate effect++; } @@ -4033,7 +4033,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move { ForewarnChooseMove(battler); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_FOREWARN; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4063,7 +4063,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move else statId = STAT_SPATK; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; if (CompareStat(battler, statId, MAX_STAT_STAGE, CMP_LESS_THAN)) { @@ -4080,7 +4080,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_PRESSURE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4089,7 +4089,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_DARKAURA; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4098,7 +4098,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_FAIRYAURA; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4107,7 +4107,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_AURABREAK; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4116,7 +4116,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_COMATOSE; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4125,7 +4125,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!gSpecialStatuses[battler].switchInAbilityDone && TryRemoveScreens(battler)) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_SCREENCLEANER; - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg); effect++; } @@ -4190,7 +4190,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gSpecialStatuses[battler].intimidatedMon)) { gBattleResources->flags->flags[battler] |= RESOURCE_FLAG_INTIMIDATED; - gSpecialStatuses[battler].intimidatedMon = 1; + gSpecialStatuses[battler].intimidatedMon = TRUE; } break; case ABILITY_FORECAST: @@ -4206,14 +4206,14 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gSpecialStatuses[battler].traced)) { gBattleResources->flags->flags[battler] |= RESOURCE_FLAG_TRACED; - gSpecialStatuses[battler].traced = 1; + gSpecialStatuses[battler].traced = TRUE; } break; case ABILITY_CLOUD_NINE: case ABILITY_AIR_LOCK: if (!gSpecialStatuses[battler].switchInAbilityDone) { - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; BattleScriptPushCursorAndCallback(BattleScript_AnnounceAirLockCloudNine); effect++; } @@ -4231,7 +4231,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_INTREPID_SWORD: if (!gSpecialStatuses[battler].switchInAbilityDone) { - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; SET_STATCHANGER(STAT_ATK, 1, FALSE); BattleScriptPushCursorAndCallback(BattleScript_BattlerAbilityStatRaiseOnSwitchIn); effect++; @@ -4240,7 +4240,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_DAUNTLESS_SHIELD: if (!gSpecialStatuses[battler].switchInAbilityDone) { - gSpecialStatuses[battler].switchInAbilityDone = 1; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; SET_STATCHANGER(STAT_DEF, 1, FALSE); BattleScriptPushCursorAndCallback(BattleScript_BattlerAbilityStatRaiseOnSwitchIn); effect++; @@ -4659,7 +4659,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move || CompareStat(battler, STAT_DEF, MIN_STAT_STAGE, CMP_GREATER_THAN))) // Don't activate if defense cannot be lowered { if (gBattleMoves[gCurrentMove].effect == EFFECT_HIT_ESCAPE && CanBattlerSwitch(gBattlerAttacker)) - gProtectStructs[battler].disableEjectPack = 1; // Set flag for target + gProtectStructs[battler].disableEjectPack = TRUE; // Set flag for target BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_WeakArmorActivates; @@ -5015,7 +5015,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && gBattlerAttacker != battler) { // Set bit and save Dancer mon's original target - gSpecialStatuses[battler].dancerUsedMove = 1; + gSpecialStatuses[battler].dancerUsedMove = TRUE; gSpecialStatuses[battler].dancerOriginalTarget = *(gBattleStruct->moveTarget + battler) | 0x4; gBattleStruct->atkCancellerTracker = 0; gBattlerAttacker = gBattlerAbility = battler; @@ -6016,7 +6016,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) if (effect) { - gSpecialStatuses[battlerId].switchInItemDone = 1; + gSpecialStatuses[battlerId].switchInItemDone = TRUE; gActiveBattler = gBattlerAttacker = gPotentialItemEffectBattler = gBattleScripting.battler = battlerId; switch (effect) { @@ -6852,7 +6852,7 @@ u8 GetMoveTarget(u16 move, u8 setTarget) { targetBattler ^= BIT_FLANK; RecordAbilityBattle(targetBattler, gBattleMons[targetBattler].ability); - gSpecialStatuses[targetBattler].lightningRodRedirected = 1; + gSpecialStatuses[targetBattler].lightningRodRedirected = TRUE; } else if (gBattleMoves[move].type == TYPE_WATER && IsAbilityOnOpposingSide(gBattlerAttacker, ABILITY_STORM_DRAIN) @@ -6860,7 +6860,7 @@ u8 GetMoveTarget(u16 move, u8 setTarget) { targetBattler ^= BIT_FLANK; RecordAbilityBattle(targetBattler, gBattleMons[targetBattler].ability); - gSpecialStatuses[targetBattler].stormDrainRedirected = 1; + gSpecialStatuses[targetBattler].stormDrainRedirected = TRUE; } } break; @@ -7387,7 +7387,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower *= 2; break; case EFFECT_ASSURANCE: - if (gProtectStructs[battlerDef].physicalDmg != 0 || gProtectStructs[battlerDef].specialDmg != 0 || gProtectStructs[battlerDef].confusionSelfDmg != 0) + if (gProtectStructs[battlerDef].physicalDmg != 0 || gProtectStructs[battlerDef].specialDmg != 0 || gProtectStructs[battlerDef].confusionSelfDmg) basePower *= 2; break; case EFFECT_TRUMP_CARD: @@ -8236,7 +8236,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move else MulModifier(&finalModifier, UQ_4_12(0.5)); if (updateFlags) - gSpecialStatuses[battlerDef].berryReduced = 1; + gSpecialStatuses[battlerDef].berryReduced = TRUE; } break; } From 075c0299a13fa1b012614eadefebd9f991f83e74 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Wed, 22 Sep 2021 23:29:26 -0300 Subject: [PATCH 09/81] Better names for Micle and Custap flags --- include/battle.h | 4 ++-- src/battle_main.c | 12 ++++++------ src/battle_script_commands.c | 4 ++-- src/battle_util.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/battle.h b/include/battle.h index 36646c9fe..200b1112d 100644 --- a/include/battle.h +++ b/include/battle.h @@ -142,8 +142,8 @@ struct ProtectStruct u32 usedGravityPreventedMove:1; u32 powderSelfDmg:1; u32 usedThroatChopPreventedMove:1; - u32 micle:1; - u32 custap:1; // also quick claw + u32 usedMicleBerry:1; + u32 usedCustapBerry:1; // also quick claw u32 touchedProtectLike:1; u32 disableEjectPack:1; u32 physicalDmg; diff --git a/src/battle_main.c b/src/battle_main.c index 1b4ad5f74..cc9fff1d3 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4360,7 +4360,7 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) || (!IsAbilityOnOpposingSide(battler1, ABILITY_UNNERVE) && holdEffectBattler1 == HOLD_EFFECT_CUSTAP_BERRY && HasEnoughHpToEatBerry(battler1, 4, gBattleMons[battler1].item))) - gProtectStructs[battler1].custap = TRUE; + gProtectStructs[battler1].usedCustapBerry = TRUE; speedBattler2 = GetBattlerTotalSpeedStat(battler2); holdEffectBattler2 = GetBattlerHoldEffect(battler2, TRUE); @@ -4368,7 +4368,7 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) || (!IsAbilityOnOpposingSide(battler2, ABILITY_UNNERVE) && holdEffectBattler2 == HOLD_EFFECT_CUSTAP_BERRY && HasEnoughHpToEatBerry(battler2, 4, gBattleMons[battler2].item))) - gProtectStructs[battler2].custap = TRUE; + gProtectStructs[battler2].usedCustapBerry = TRUE; if (!ignoreChosenMoves) { @@ -4384,9 +4384,9 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) // LAGGING TAIL - always last // STALL - always last - if (gProtectStructs[battler1].custap && !gProtectStructs[battler2].custap) + if (gProtectStructs[battler1].usedCustapBerry && !gProtectStructs[battler2].usedCustapBerry) strikesFirst = 0; - else if (gProtectStructs[battler2].custap && !gProtectStructs[battler1].custap) + else if (gProtectStructs[battler2].usedCustapBerry && !gProtectStructs[battler1].usedCustapBerry) strikesFirst = 1; else if (holdEffectBattler1 == HOLD_EFFECT_LAGGING_TAIL && holdEffectBattler2 != HOLD_EFFECT_LAGGING_TAIL) strikesFirst = 1; @@ -4639,12 +4639,12 @@ static void CheckQuickClaw_CustapBerryActivation(void) gBattleStruct->quickClawBattlerId++; if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_MOVE && gChosenMoveByBattler[gActiveBattler] != MOVE_FOCUS_PUNCH // quick claw message doesn't need to activate here - && gProtectStructs[gActiveBattler].custap + && gProtectStructs[gActiveBattler].usedCustapBerry && !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP) && !(gDisableStructs[gBattlerAttacker].truantCounter) && !(gProtectStructs[gActiveBattler].noValidMoves)) { - gProtectStructs[gActiveBattler].custap = FALSE; + gProtectStructs[gActiveBattler].usedCustapBerry = FALSE; gLastUsedItem = gBattleMons[gActiveBattler].item; if (GetBattlerHoldEffect(gActiveBattler, FALSE) == HOLD_EFFECT_CUSTAP_BERRY) { diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9a107fac0..b03da17c3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1638,9 +1638,9 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move) else if (atkHoldEffect == HOLD_EFFECT_ZOOM_LENS && GetBattlerTurnOrderNum(battlerAtk) > GetBattlerTurnOrderNum(battlerDef)); calc = (calc * (100 + atkParam)) / 100; - if (gProtectStructs[battlerAtk].micle) + if (gProtectStructs[battlerAtk].usedMicleBerry) { - gProtectStructs[battlerAtk].micle = FALSE; + gProtectStructs[battlerAtk].usedMicleBerry = FALSE; if (atkAbility == ABILITY_RIPEN) calc = (calc * 140) / 100; // ripen gives 40% acc boost else diff --git a/src/battle_util.c b/src/battle_util.c index b012f7d49..c9ecfd3d8 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5616,7 +5616,7 @@ static u8 TrySetMicleBerry(u32 battlerId, u32 itemId, bool32 end2) { if (HasEnoughHpToEatBerry(battlerId, 4, itemId)) { - gProtectStructs[battlerId].micle = TRUE; // battler's next attack has increased accuracy + gProtectStructs[battlerId].usedMicleBerry = TRUE; // battler's next attack has increased accuracy if (end2) { From 5019615be125e49de6fcc4cca8d7f5b0502debc2 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 4 Oct 2021 21:28:15 -0300 Subject: [PATCH 10/81] Refactored Secret Power move effect into a function --- include/battle_script_commands.h | 1 + src/battle_script_commands.c | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index dec1596f2..a765aafdd 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -36,6 +36,7 @@ u32 IsAbilityStatusProtected(u32 battler); bool32 TryResetBattlerStatChanges(u8 battler); bool32 CanCamouflage(u8 battlerId); u16 GetNaturePowerMove(void); +u16 GetSecretPowerMoveEffect(void); void StealTargetItem(u8 battlerStealer, u8 battlerItem); extern void (* const gBattleScriptingCommandsTable[])(void); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8d6dd5bdb..6662cb269 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -12068,37 +12068,44 @@ static void Cmd_jumpifhasnohp(void) static void Cmd_getsecretpowereffect(void) { + gBattleScripting.moveEffect = GetSecretPowerMoveEffect(); + gBattlescriptCurrInstr++; +} + +u16 GetSecretPowerMoveEffect(void) +{ + u16 moveEffect; switch (gBattleTerrain) { case BATTLE_TERRAIN_GRASS: - gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP; + moveEffect = MOVE_EFFECT_SLEEP; break; case BATTLE_TERRAIN_LONG_GRASS: - gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP; + moveEffect = MOVE_EFFECT_SLEEP; break; case BATTLE_TERRAIN_SAND: - gBattleScripting.moveEffect = MOVE_EFFECT_ACC_MINUS_1; + moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; case BATTLE_TERRAIN_UNDERWATER: - gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1; + moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; case BATTLE_TERRAIN_WATER: - gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1; + moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; case BATTLE_TERRAIN_POND: - gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1; + moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; case BATTLE_TERRAIN_MOUNTAIN: - gBattleScripting.moveEffect = MOVE_EFFECT_ACC_MINUS_1; + moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; case BATTLE_TERRAIN_CAVE: - gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH; + moveEffect = MOVE_EFFECT_FLINCH; break; default: - gBattleScripting.moveEffect = MOVE_EFFECT_PARALYSIS; + moveEffect = MOVE_EFFECT_PARALYSIS; break; } - gBattlescriptCurrInstr++; + return moveEffect; } static void Cmd_pickup(void) From 563ce8f416080d18c0807d76bde4a3dfab0f0c99 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 4 Oct 2021 21:32:08 -0300 Subject: [PATCH 11/81] Field terrain move effect --- src/battle_script_commands.c | 83 +++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 29 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6662cb269..80bb69ecc 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8709,7 +8709,7 @@ static void Cmd_various(void) else gBattlescriptCurrInstr += 7; // can heal return; - case VARIOUS_REMOVE_TERRAIN: + case VARIOUS_REMOVE_TERRAIN: switch (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) { case STATUS_FIELD_MISTY_TERRAIN: @@ -12075,35 +12075,60 @@ static void Cmd_getsecretpowereffect(void) u16 GetSecretPowerMoveEffect(void) { u16 moveEffect; - switch (gBattleTerrain) + u32 fieldTerrain = gFieldStatuses & STATUS_FIELD_TERRAIN_ANY; + if (fieldTerrain) { - case BATTLE_TERRAIN_GRASS: - moveEffect = MOVE_EFFECT_SLEEP; - break; - case BATTLE_TERRAIN_LONG_GRASS: - moveEffect = MOVE_EFFECT_SLEEP; - break; - case BATTLE_TERRAIN_SAND: - moveEffect = MOVE_EFFECT_ACC_MINUS_1; - break; - case BATTLE_TERRAIN_UNDERWATER: - moveEffect = MOVE_EFFECT_ATK_MINUS_1; - break; - case BATTLE_TERRAIN_WATER: - moveEffect = MOVE_EFFECT_ATK_MINUS_1; - break; - case BATTLE_TERRAIN_POND: - moveEffect = MOVE_EFFECT_ATK_MINUS_1; - break; - case BATTLE_TERRAIN_MOUNTAIN: - moveEffect = MOVE_EFFECT_ACC_MINUS_1; - break; - case BATTLE_TERRAIN_CAVE: - moveEffect = MOVE_EFFECT_FLINCH; - break; - default: - moveEffect = MOVE_EFFECT_PARALYSIS; - break; + switch (fieldTerrain) + { + case STATUS_FIELD_MISTY_TERRAIN: + moveEffect = MOVE_EFFECT_SP_ATK_MINUS_1; + break; + case STATUS_FIELD_GRASSY_TERRAIN: + moveEffect = MOVE_EFFECT_SLEEP; + break; + case STATUS_FIELD_ELECTRIC_TERRAIN: + moveEffect = MOVE_EFFECT_PARALYSIS; + break; + case STATUS_FIELD_PSYCHIC_TERRAIN: + moveEffect = MOVE_EFFECT_SPD_MINUS_1; + break; + default: + moveEffect = MOVE_EFFECT_PARALYSIS; + break; + } + } + else + { + switch (gBattleTerrain) + { + case BATTLE_TERRAIN_GRASS: + moveEffect = MOVE_EFFECT_SLEEP; + break; + case BATTLE_TERRAIN_LONG_GRASS: + moveEffect = MOVE_EFFECT_SLEEP; + break; + case BATTLE_TERRAIN_SAND: + moveEffect = MOVE_EFFECT_ACC_MINUS_1; + break; + case BATTLE_TERRAIN_UNDERWATER: + moveEffect = MOVE_EFFECT_ATK_MINUS_1; + break; + case BATTLE_TERRAIN_WATER: + moveEffect = MOVE_EFFECT_ATK_MINUS_1; + break; + case BATTLE_TERRAIN_POND: + moveEffect = MOVE_EFFECT_ATK_MINUS_1; + break; + case BATTLE_TERRAIN_MOUNTAIN: + moveEffect = MOVE_EFFECT_ACC_MINUS_1; + break; + case BATTLE_TERRAIN_CAVE: + moveEffect = MOVE_EFFECT_FLINCH; + break; + default: + moveEffect = MOVE_EFFECT_PARALYSIS; + break; + } } return moveEffect; } From e2bf660c97a21d1b2ed8ebc33e9f4d464c104680 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 4 Oct 2021 21:51:51 -0300 Subject: [PATCH 12/81] Secret Power field terrain animations --- data/battle_anim_scripts.s | 23 ++++++++++++++--------- src/battle_anim_utility_funcs.c | 6 ++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index d7de92096..c7b4020f3 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -23251,16 +23251,21 @@ Move_SKY_UPPERCUT: end Move_SECRET_POWER: + createvisualtask AnimTask_GetFieldTerrain, 5 + jumpargeq 0, STATUS_FIELD_MISTY_TERRAIN, Move_FAIRY_WIND + jumpargeq 0, STATUS_FIELD_GRASSY_TERRAIN, Move_NEEDLE_ARM + jumpargeq 0, STATUS_FIELD_ELECTRIC_TERRAIN, Move_THUNDER_SHOCK + jumpargeq 0, STATUS_FIELD_PSYCHIC_TERRAIN, Move_CONFUSION createvisualtask AnimTask_GetBattleTerrain, 5 - jumpargeq 0, BATTLE_TERRAIN_GRASS, Move_NEEDLE_ARM - jumpargeq 0, BATTLE_TERRAIN_LONG_GRASS, Move_MAGICAL_LEAF - jumpargeq 0, BATTLE_TERRAIN_SAND, Move_MUD_SHOT - jumpargeq 0, BATTLE_TERRAIN_UNDERWATER, Move_WATERFALL - jumpargeq 0, BATTLE_TERRAIN_WATER, Move_SURF - jumpargeq 0, BATTLE_TERRAIN_POND, Move_BUBBLE_BEAM - jumpargeq 0, BATTLE_TERRAIN_MOUNTAIN, Move_ROCK_THROW - jumpargeq 0, BATTLE_TERRAIN_CAVE, Move_BITE - jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH + jumpargeq 0, BATTLE_TERRAIN_GRASS, Move_NEEDLE_ARM + jumpargeq 0, BATTLE_TERRAIN_LONG_GRASS, Move_MAGICAL_LEAF + jumpargeq 0, BATTLE_TERRAIN_SAND, Move_MUD_SHOT + jumpargeq 0, BATTLE_TERRAIN_UNDERWATER, Move_WATERFALL + jumpargeq 0, BATTLE_TERRAIN_WATER, Move_SURF + jumpargeq 0, BATTLE_TERRAIN_POND, Move_BUBBLE_BEAM + jumpargeq 0, BATTLE_TERRAIN_MOUNTAIN, Move_ROCK_THROW + jumpargeq 0, BATTLE_TERRAIN_CAVE, Move_BITE + jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH goto Move_SLAM Move_TWISTER: diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index 6cefba92a..0f35657db 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -904,6 +904,12 @@ void AnimTask_GetBattleTerrain(u8 taskId) DestroyAnimVisualTask(taskId); } +void AnimTask_GetFieldTerrain(u8 taskId) +{ + gBattleAnimArgs[0] = gFieldStatuses & STATUS_FIELD_TERRAIN_ANY; + DestroyAnimVisualTask(taskId); +} + void AnimTask_AllocBackupPalBuffer(u8 taskId) { gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000); From aa7484bba0441ebd3e0974037610ef987953692b Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 4 Oct 2021 22:07:28 -0300 Subject: [PATCH 13/81] Camouflage with field terrains. --- src/battle_script_commands.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 80bb69ecc..1da3248d8 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -11484,13 +11484,13 @@ static void Cmd_callterrainattack(void) // nature power u16 GetNaturePowerMove(void) { if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN) - return MOVE_MOONBLAST; + return MOVE_MOONBLAST; else if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) - return MOVE_THUNDERBOLT; + return MOVE_THUNDERBOLT; else if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN) - return MOVE_ENERGY_BALL; + return MOVE_ENERGY_BALL; else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) - return MOVE_PSYCHIC; + return MOVE_PSYCHIC; return sNaturePowerMoves[gBattleTerrain]; } @@ -12358,10 +12358,30 @@ bool32 CanCamouflage(u8 battlerId) static void Cmd_settypetoterrain(void) { - if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, sTerrainToType[gBattleTerrain])) + u8 terrainType; + switch(gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) { - SET_BATTLER_TYPE(gBattlerAttacker, sTerrainToType[gBattleTerrain]); - PREPARE_TYPE_BUFFER(gBattleTextBuff1, sTerrainToType[gBattleTerrain]); + case STATUS_FIELD_ELECTRIC_TERRAIN: + terrainType = TYPE_ELECTRIC; + break; + case STATUS_FIELD_GRASSY_TERRAIN: + terrainType = TYPE_GRASS; + break; + case STATUS_FIELD_MISTY_TERRAIN: + terrainType = TYPE_FAIRY; + break; + case STATUS_FIELD_PSYCHIC_TERRAIN: + terrainType = TYPE_PSYCHIC; + break; + default: + terrainType = sTerrainToType[gBattleTerrain]; + break; + } + + if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, terrainType)) + { + SET_BATTLER_TYPE(gBattlerAttacker, terrainType); + PREPARE_TYPE_BUFFER(gBattleTextBuff1, terrainType); gBattlescriptCurrInstr += 5; } From 43d42c95cfa0c7318a0748ee6a04af2ec30aa4db Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 4 Oct 2021 22:45:37 -0300 Subject: [PATCH 14/81] Terrain Pulse effect implemented --- data/battle_anim_scripts.s | 2 +- data/battle_scripts_1.s | 1 + include/constants/battle_move_effects.h | 3 ++- src/battle_main.c | 17 +++++++++++++++++ src/battle_util.c | 5 +++++ src/data/battle_moves.h | 2 +- 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index c7b4020f3..0b630072a 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -13979,7 +13979,7 @@ Move_RISING_VOLTAGE:: end @to do: Move_TERRAIN_PULSE:: - end @to do: + goto Move_DRAGON_PULSE @Temporary, needs to setup different animations based on terrain Move_SKITTER_SMACK:: end @to do: diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5a9aec525..f018ff504 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -379,6 +379,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectDecorate @ EFFECT_DECORATE .4byte BattleScript_EffectHit @ EFFECT_SNIPE_SHOT .4byte BattleScript_EffectTripleHit @ EFFECT_TRIPLE_HIT + .4byte BattleScript_EffectHit @ EFFECT_TERRAIN_PULSE BattleScript_EffectDecorate: attackcanceler diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 440e6e76b..966d35971 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -363,7 +363,8 @@ #define EFFECT_DECORATE 357 #define EFFECT_SNIPE_SHOT 358 #define EFFECT_TRIPLE_HIT 359 +#define EFFECT_TERRAIN_PULSE 360 -#define NUM_BATTLE_MOVE_EFFECTS 360 +#define NUM_BATTLE_MOVE_EFFECTS 361 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/battle_main.c b/src/battle_main.c index 25db65f78..c7a5962ac 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -5095,6 +5095,23 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) if (ItemId_GetPocket(gBattleMons[battlerAtk].item) == POCKET_BERRIES) gBattleStruct->dynamicMoveType = gNaturalGiftTable[ITEM_TO_BERRY(gBattleMons[battlerAtk].item)].type; } + else if (gBattleMoves[move].effect == EFFECT_TERRAIN_PULSE) + { + if ((gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) + && IsBattlerGrounded(battlerAtk)) + { + if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) + gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | 0x80; + else if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN) + gBattleStruct->dynamicMoveType = TYPE_GRASS | 0x80; + else if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN) + gBattleStruct->dynamicMoveType = TYPE_FAIRY | 0x80; + else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) + gBattleStruct->dynamicMoveType = TYPE_PSYCHIC | 0x80; + else + gBattleStruct->dynamicMoveType = TYPE_NORMAL | 0x80; + } + } attackerAbility = GetBattlerAbility(battlerAtk); GET_MOVE_TYPE(move, moveType); diff --git a/src/battle_util.c b/src/battle_util.c index 462b58bd4..5ae5d80cb 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7572,6 +7572,11 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower *= 2; #endif break; + case EFFECT_TERRAIN_PULSE: + if ((gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) + && IsBattlerGrounded(gBattlerAttacker)) + basePower *= 2; + break; } // move-specific base power changes diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index a7a2752e0..542594e80 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -11332,7 +11332,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_TERRAIN_PULSE] = { - .effect = EFFECT_PLACEHOLDER, //TODO + .effect = EFFECT_TERRAIN_PULSE, .power = 50, .type = TYPE_NORMAL, .accuracy = 100, From 996301d5d33072407fe9143811d27eb31e07e201 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Tue, 12 Oct 2021 18:04:34 -0400 Subject: [PATCH 15/81] add mirror armor --- asm/macros/battle_script.inc | 4 ++ data/battle_scripts_1.s | 36 +++++++++++++++ include/battle_scripts.h | 2 + include/constants/battle_script_commands.h | 1 + src/battle_script_commands.c | 51 +++++++++++++++++----- src/battle_util.c | 7 +-- 6 files changed, 86 insertions(+), 15 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 4d8fe0365..f00e580f0 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1824,6 +1824,10 @@ .macro trytoclearprimalweather various BS_ATTACKER, VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER .endm + + .macro getrandommirrorarmortarget + various BS_TARGET, VARIOUS_GET_RANDOM_MIRROR_ARMOR_TARGET + .endm @ helpful macros .macro setstatchanger stat:req, stages:req, down:req diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index e1fb47930..5979f4c67 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2645,6 +2645,33 @@ BattleScript_StatDownPrintString:: BattleScript_StatDownEnd:: goto BattleScript_MoveEnd +BattleScript_MirrorArmorReflect:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + jumpifsubstituteblocks BattleScript_AbilityNoSpecificStatLoss +BattleScript_MirrorArmorReflectStatLoss: + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_MirrorArmorReflectWontFall + jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_MirrorArmorReflectAnim + goto BattleScript_MirrorArmorReflectWontFall +BattleScript_MirrorArmorReflectAnim: + setgraphicalstatchangevalues + playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 +BattleScript_MirrorArmorReflectPrintString: + printfromtable gStatDownStringIds + waitmessage B_WAIT_TIME_LONG +BattleScript_MirrorArmorReflectEnd: + return + +BattleScript_MirrorArmorReflectWontFall: + copybyte gBattlerTarget, gBattlerAttacker @ STRINGID_STATSWONTDECREASE uses target + goto BattleScript_MirrorArmorReflectPrintString + +BattleScript_MirrorArmorReflectStickyWeb: + call BattleScript_AbilityPopUp + getrandommirrorarmortarget + jumpifbyteequal gBattlerTarget, gBattlerAttacker, BattleScript_AbilityNoSpecificStatLossPrint + goto BattleScript_MirrorArmorReflectStatLoss + BattleScript_StatDown:: playanimation BS_EFFECT_BATTLER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 printfromtable gStatDownStringIds @@ -6099,6 +6126,7 @@ BattleScript_StickyWebOnSwitchIn:: copybyte gBattlerTarget, sBATTLER printstring STRINGID_STICKYWEBSWITCHIN waitmessage B_WAIT_TIME_LONG + jumpifability BS_TARGET, ABILITY_MIRROR_ARMOR, BattleScript_MirrorArmorReflectStickyWeb statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_StickyWebOnSwitchInEnd jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_StickyWebOnSwitchInStatAnim jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_FELL_EMPTY, BattleScript_StickyWebOnSwitchInEnd @@ -7639,6 +7667,7 @@ BattleScript_GrassyTerrainHealEnd: BattleScript_AbilityNoSpecificStatLoss:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp +BattleScript_AbilityNoSpecificStatLossPrint: printstring STRINGID_PKMNSXPREVENTSYLOSS waitmessage B_WAIT_TIME_LONG setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_FELL_EMPTY @@ -7885,6 +7914,13 @@ BattleScript_CuteCharmActivates:: call BattleScript_TryDestinyKnotTarget return +BattleScript_GooeyActivates:: + waitstate + call BattleScript_AbilityPopUp + swapattackerwithtarget @ for defiant, mirror armor + seteffectsecondary + return + BattleScript_AbilityStatusEffect:: waitstate call BattleScript_AbilityPopUp diff --git a/include/battle_scripts.h b/include/battle_scripts.h index cd4600543..4e5568c75 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -398,5 +398,7 @@ extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[]; extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; extern const u8 BattleScript_BlockedByPrimalWeatherEnd3[]; extern const u8 BattleScript_BlockedByPrimalWeatherRet[]; +extern const u8 BattleScript_MirrorArmorReflect[]; +extern const u8 BattleScript_GooeyActivates[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index d61eabbf8..bbf5714e9 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -185,6 +185,7 @@ #define VARIOUS_REMOVE_TERRAIN 113 #define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 114 #define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 115 +#define VARIOUS_GET_RANDOM_MIRROR_ARMOR_TARGET 116 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2c017b2df..9c0b4ec37 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2582,6 +2582,8 @@ void SetMoveEffect(bool32 primary, u32 certain) { s32 i, byTwo, affectsUser = 0; bool32 statusChanged = FALSE; + bool32 mirrorArmorReflected = (GetBattlerAbility(gBattlerTarget) == ABILITY_MIRROR_ARMOR); + u32 flags; switch (gBattleScripting.moveEffect) // Set move effects which happen later on { @@ -3012,11 +3014,18 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SP_DEF_MINUS_1: case MOVE_EFFECT_ACC_MINUS_1: case MOVE_EFFECT_EVS_MINUS_1: - if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(1) | STAT_BUFF_NEGATIVE, - gBattleScripting.moveEffect - MOVE_EFFECT_ATK_MINUS_1 + 1, - affectsUser, 0)) + flags = affectsUser | certain; + if (mirrorArmorReflected && !affectsUser) { - gBattlescriptCurrInstr++; + flags |= STAT_BUFF_ALLOW_PTR; + } + + if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(1) | STAT_BUFF_NEGATIVE, + gBattleScripting.moveEffect - MOVE_EFFECT_ATK_MINUS_1 + 1, + flags, gBattlescriptCurrInstr + 1)) + { + if (!mirrorArmorReflected) + gBattlescriptCurrInstr++; } else { @@ -8822,6 +8831,25 @@ static void Cmd_various(void) } break; } + case VARIOUS_GET_RANDOM_MIRROR_ARMOR_TARGET: + i = BATTLE_OPPOSITE(gActiveBattler); + gBattlerAttacker = gBattlerTarget; + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) + { + if (IsBattlerAlive(i) + && !(gBattleMons[i].status2 & STATUS2_SUBSTITUTE)) + gBattlerAttacker = i; + else if (IsBattlerAlive(BATTLE_PARTNER(i)) + && !(gBattleMons[BATTLE_PARTNER(i)].status2 & STATUS2_SUBSTITUTE)) + gBattlerAttacker = BATTLE_PARTNER(i); + } + else + { + if (IsBattlerAlive(i) && !(gBattleMons[i].status2 & STATUS2_SUBSTITUTE)) + gBattlerAttacker = i; + } + SET_STATCHANGER(STAT_SPEED, 1, TRUE); + break; } gBattlescriptCurrInstr += 3; @@ -9355,8 +9383,9 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr bool32 certain = FALSE; bool32 notProtectAffected = FALSE; u32 index; + bool32 affectsUser = flags & MOVE_EFFECT_AFFECTS_USER; - if (flags & MOVE_EFFECT_AFFECTS_USER) + if (affectsUser) gActiveBattler = gBattlerAttacker; else gActiveBattler = gBattlerTarget; @@ -9457,8 +9486,9 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr } return STAT_CHANGE_DIDNT_WORK; } - else if (GetBattlerAbility(gActiveBattler) == ABILITY_KEEN_EYE - && !certain && statId == STAT_ACC) + else if (!certain + && ((GetBattlerAbility(gActiveBattler) == ABILITY_KEEN_EYE && statId == STAT_ACC) + || (GetBattlerAbility(gActiveBattler) == ABILITY_HYPER_CUTTER && statId == STAT_ATK))) { if (flags == STAT_BUFF_ALLOW_PTR) { @@ -9471,17 +9501,14 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr } return STAT_CHANGE_DIDNT_WORK; } - else if (GetBattlerAbility(gActiveBattler) == ABILITY_HYPER_CUTTER - && !certain && statId == STAT_ATK) + else if (GetBattlerAbility(gActiveBattler) == ABILITY_MIRROR_ARMOR && !affectsUser && gBattlerAttacker != gBattlerTarget && gActiveBattler == gBattlerTarget) { if (flags == STAT_BUFF_ALLOW_PTR) { BattleScriptPush(BS_ptr); gBattleScripting.battler = gActiveBattler; gBattlerAbility = gActiveBattler; - gBattlescriptCurrInstr = BattleScript_AbilityNoSpecificStatLoss; - gLastUsedAbility = GetBattlerAbility(gActiveBattler); - RecordAbilityBattle(gActiveBattler, gLastUsedAbility); + gBattlescriptCurrInstr = BattleScript_MirrorArmorReflect; } return STAT_CHANGE_DIDNT_WORK; } diff --git a/src/battle_util.c b/src/battle_util.c index 68e787698..37cc17644 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4835,15 +4835,16 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_TANGLING_HAIR: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 - && CompareStat(gBattlerAttacker, STAT_SPEED, MIN_STAT_STAGE, CMP_GREATER_THAN) + && (CompareStat(gBattlerAttacker, STAT_SPEED, MIN_STAT_STAGE, CMP_GREATER_THAN) || GetBattlerAbility(gBattlerAttacker) == ABILITY_MIRROR_ARMOR) && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED && IsMoveMakingContact(move, gBattlerAttacker)) { - gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_SPD_MINUS_1; + SET_STATCHANGER(STAT_SPEED, 1, TRUE); + gBattleScripting.moveEffect = MOVE_EFFECT_SPD_MINUS_1; PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility); BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect; + gBattlescriptCurrInstr = BattleScript_GooeyActivates; gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; effect++; } From f9272a89fa3fade69f26a37462cc2fe93e9abc15 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Tue, 12 Oct 2021 21:09:27 -0400 Subject: [PATCH 16/81] add mirror armor check to two-stage stat decrease effects --- src/battle_script_commands.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9c0b4ec37..253f87c1c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3016,9 +3016,7 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_EVS_MINUS_1: flags = affectsUser | certain; if (mirrorArmorReflected && !affectsUser) - { flags |= STAT_BUFF_ALLOW_PTR; - } if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(1) | STAT_BUFF_NEGATIVE, gBattleScripting.moveEffect - MOVE_EFFECT_ATK_MINUS_1 + 1, @@ -3063,11 +3061,15 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SP_DEF_MINUS_2: case MOVE_EFFECT_ACC_MINUS_2: case MOVE_EFFECT_EVS_MINUS_2: + flags = affectsUser | certain; + if (mirrorArmorReflected && !affectsUser) + flags |= STAT_BUFF_ALLOW_PTR; if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(2) | STAT_BUFF_NEGATIVE, gBattleScripting.moveEffect - MOVE_EFFECT_ATK_MINUS_2 + 1, - affectsUser, 0)) + flags, gBattlescriptCurrInstr + 1)) { - gBattlescriptCurrInstr++; + if (!mirrorArmorReflected) + gBattlescriptCurrInstr++; } else { From d64dc2bbe890f210d653fede84151bd37ca1bc98 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Sun, 24 Oct 2021 17:55:37 +1300 Subject: [PATCH 17/81] Sleep moves don't check target's type Dark types aren't immune to Hypnosis, Ghost types aren't immune to Yawn or Lovely Kiss, so this check isn't needed. --- src/battle_ai_util.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index fef6e6c6f..0c3bf717a 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -2606,7 +2606,6 @@ bool32 AI_CanSleep(u8 battler, u16 ability) bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) { if (!AI_CanSleep(battlerDef, defAbility) - || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) || PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove)) // shouldn't try to sleep mon that partner is trying to make sleep return FALSE; From bbe2eccf62c210926739a324d4d001dd1e7bbcda Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Sun, 24 Oct 2021 17:57:06 +1300 Subject: [PATCH 18/81] Fix typo CanBeParayzed to CanBeParalyzed --- src/battle_ai_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 0c3bf717a..dc2be7fd5 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -2653,7 +2653,7 @@ bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 return TRUE; } -static bool32 CanBeParayzed(u8 battler, u16 ability) +static bool32 CanBeParalyzed(u8 battler, u16 ability) { if (ability == ABILITY_LIMBER || IS_BATTLER_OF_TYPE(battler, TYPE_ELECTRIC) @@ -2665,7 +2665,7 @@ static bool32 CanBeParayzed(u8 battler, u16 ability) bool32 AI_CanParalyze(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) { - if (!CanBeParayzed(battlerDef, defAbility) + if (!CanBeParalyzed(battlerDef, defAbility) || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_SAFEGUARD || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) From 4310868bee6d4ddb0f8a238ef1d003896a79b7d7 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Sun, 24 Oct 2021 18:49:17 +1300 Subject: [PATCH 19/81] AI handles multi-strike and fixed dmg moves Does not account for Parental Bond or Beat Up yet as those require some functions from #1676. --- include/battle_util.h | 5 ++- src/battle_ai_util.c | 90 +++++++++++++++++++++++++++++++++++++++---- src/battle_util.c | 26 +++++++++++++ 3 files changed, 113 insertions(+), 8 deletions(-) diff --git a/include/battle_util.h b/include/battle_util.h index ee7337ef2..5ffc901c3 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -156,7 +156,7 @@ void BufferStatChange(u8 battlerId, u8 statId, u8 stringId); void DoBurmyFormChange(u32 monId); bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget); -// ability checks +// Ability checks bool32 IsRolePlayBannedAbilityAtk(u16 ability); bool32 IsRolePlayBannedAbility(u16 ability); bool32 IsSkillSwapBannedAbility(u16 ability); @@ -173,4 +173,7 @@ bool32 CanBeFrozen(u8 battlerId); bool32 CanBeConfused(u8 battlerId); bool32 IsBattlerTerrainAffected(u8 battlerId, u32 terrainFlag); +// Move checks +bool8 IsTwoStrikesMove(u16 move); + #endif // GUARD_BATTLE_UTIL_H diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index dc2be7fd5..cf9980ee4 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -733,20 +733,85 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef) else dmg = (critDmg + normalDmg * (critChance - 1)) / critChance; - // handle dynamic move damage + // Handle dynamic move damage switch (gBattleMoves[move].effect) { case EFFECT_LEVEL_DAMAGE: case EFFECT_PSYWAVE: - //psywave's expected damage is equal to the user's level - dmg = gBattleMons[battlerAtk].level; + { + // Psywave's expected damage is equal to the user's level + if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) + dmg = 0; + else if (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND) + dmg = 2 * gBattleMons[battlerAtk].level; + else + dmg = gBattleMons[battlerAtk].level; break; + } case EFFECT_DRAGON_RAGE: - dmg = 40; + { + if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) + dmg = 0; + else if (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND) + dmg = 80; + else + dmg = 40; break; + } case EFFECT_SONICBOOM: - dmg = 20; + { + if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) + dmg = 0; + else if (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND) + dmg = 40; + else + dmg = 20; break; + } + case EFFECT_MULTI_HIT: + { + if (AI_DATA->atkAbility == ABILITY_SKILL_LINK) + dmg *= 5; + else + dmg *= 3; // Average number of hits is three + break; + } + case EFFECT_TRIPLE_KICK: + { + if (AI_DATA->atkAbility == ABILITY_SKILL_LINK) + dmg *= 6; // Skill Link ensures the 2nd and 3rd hits will connect if the first does + else + dmg *= 5; // Triple Kick/Triple Axel's average power is almost 5x its base power + break; + } + case EFFECT_ENDEAVOR: + { + if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) + dmg = 0; + else + // If target has less HP than user, Endeavor does no damage + dmg = max(0, gBattleMons[battlerDef].hp - gBattleMons[battlerAtk].hp); + break; + } + case EFFECT_SUPER_FANG: + { + if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) + dmg = 0; + // Two hits of Super Fang halves HP twice, leaving target with 25% HP + else if (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND) + dmg = gBattleMons[battlerDef].hp * 3 / 4; + else + dmg = gBattleMons[battlerDef].hp / 2; + break; + } + case EFFECT_FINAL_GAMBIT: + { + if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) + dmg = 0; + else + dmg = gBattleMons[battlerAtk].hp; + break; + } //case EFFECT_METAL_BURST: //case EFFECT_COUNTER: default: @@ -755,6 +820,17 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef) break; } + // Handle other multi-strike moves + if (IsTwoStrikesMove(move)) + { + dmg *= 2; + } + else if (move == MOVE_SURGING_STRIKES + || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH)) + { + dmg *= 3; + } + RestoreBattlerData(battlerAtk); RestoreBattlerData(battlerDef); @@ -2653,7 +2729,7 @@ bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 return TRUE; } -static bool32 CanBeParalyzed(u8 battler, u16 ability) +static bool32 AI_CanBeParalyzed(u8 battler, u16 ability) { if (ability == ABILITY_LIMBER || IS_BATTLER_OF_TYPE(battler, TYPE_ELECTRIC) @@ -2665,7 +2741,7 @@ static bool32 CanBeParalyzed(u8 battler, u16 ability) bool32 AI_CanParalyze(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) { - if (!CanBeParalyzed(battlerDef, defAbility) + if (!AI_CanBeParalyzed(battlerDef, defAbility) || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_SAFEGUARD || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) diff --git a/src/battle_util.c b/src/battle_util.c index 33dd0f5de..cc9e2fc16 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -217,6 +217,20 @@ static const u16 sEntrainmentTargetSimpleBeamBannedAbilities[] = ABILITY_GULP_MISSILE, }; +static const u16 sTwoStrikeMoves[] = +{ + MOVE_BONEMERANG, + MOVE_DOUBLE_HIT, + MOVE_DOUBLE_IRON_BASH, + MOVE_DOUBLE_KICK, + MOVE_DRAGON_DARTS, + MOVE_DUAL_CHOP, + MOVE_DUAL_WINGBEAT, + MOVE_GEAR_GRIND, + MOVE_TWINEEDLE, + 0xFFFF +}; + bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move) { u32 ability = GetBattlerAbility(battlerAtk); @@ -9509,3 +9523,15 @@ bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 chec #endif return FALSE; } + +bool8 IsTwoStrikesMove(u16 move) +{ + u32 i; + + for (i = 0; i < ARRAY_COUNT(sTwoStrikeMoves); i++) + { + if (move == sTwoStrikeMoves[i]) + return TRUE; + } + return FALSE; +} From 4faa0776415f31b371bc44311799d1b758a8585c Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Tue, 26 Oct 2021 13:41:08 +1300 Subject: [PATCH 20/81] Triple Kick, Super Fang tweaks Ignore accuracy for Triple Kick and assume all hits will connect. Super Fang always does at least 1 damage, so this should be accounted for. --- src/battle_ai_util.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index cf9980ee4..3535e800c 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -778,10 +778,7 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef) } case EFFECT_TRIPLE_KICK: { - if (AI_DATA->atkAbility == ABILITY_SKILL_LINK) - dmg *= 6; // Skill Link ensures the 2nd and 3rd hits will connect if the first does - else - dmg *= 5; // Triple Kick/Triple Axel's average power is almost 5x its base power + dmg *= 6; break; } case EFFECT_ENDEAVOR: @@ -799,9 +796,9 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef) dmg = 0; // Two hits of Super Fang halves HP twice, leaving target with 25% HP else if (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND) - dmg = gBattleMons[battlerDef].hp * 3 / 4; + dmg = max(1, gBattleMons[battlerDef].hp * 3 / 4); else - dmg = gBattleMons[battlerDef].hp / 2; + dmg = max(1, gBattleMons[battlerDef].hp / 2); break; } case EFFECT_FINAL_GAMBIT: From d5b5090d521522abe6d7d377b1475ebdee68dcc3 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 27 Oct 2021 09:36:00 -0300 Subject: [PATCH 21/81] Fixed BattleScript_EffectPhotonGeyser --- data/battle_scripts_1.s | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 447c329e0..c6ae2e848 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -399,7 +399,28 @@ BattleScript_EffectShellSideArm: goto BattleScript_EffectHit BattleScript_EffectPhotonGeyser: + attackcanceler + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + ppreduce + critcalc + damagecalc + adjustdamage photongeysercheck + attackanimation + waitanimation + effectivenesssound + hitanimation BS_TARGET + waitstate + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + critmessage + waitmessage B_WAIT_TIME_LONG + resultmessage + waitmessage B_WAIT_TIME_LONG + seteffectwithchance + tryfaintmon BS_TARGET, FALSE, NULL + goto BattleScript_MoveEnd BattleScript_EffectPlasmaFists: attackcanceler From ad95fa3d15abfe3080e00beab69225c2bc288bf7 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 27 Oct 2021 10:03:27 -0300 Subject: [PATCH 22/81] Updated Shell Side Arm's description --- src/data/text/move_descriptions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/text/move_descriptions.h b/src/data/text/move_descriptions.h index e204fb196..037261e32 100644 --- a/src/data/text/move_descriptions.h +++ b/src/data/text/move_descriptions.h @@ -2839,7 +2839,7 @@ static const u8 sMETEOR_BEAMDescription[] = _( "Sp. Attack before attacking."); static const u8 sSHELL_SIDE_ARMDescription[] = _( - "Uses higher of physical and\n" + "Deals better of physical and\n" "special damage. May poison."); static const u8 sMISTY_EXPLOSIONDescription[] = _( From de157919b060e70cb430050b176ef487c28b0753 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 27 Oct 2021 11:05:01 -0300 Subject: [PATCH 23/81] Added animations for Shell Side Arm --- data/battle_anim_scripts.s | 45 +++++++++++++++++++++++++++++++++++++- src/battle_anim_new.c | 9 ++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 994bc5cc1..30a4ccc61 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -13995,7 +13995,50 @@ Move_METEOR_BEAM:: end @to do: Move_SHELL_SIDE_ARM:: - end @to do: + launchtask AnimTask_ShellSideArm 0x5 0x0 + jumpargeq 0x0, TRUE, Move_SHELL_SIDE_ARM_PHYSICAL + jumpargeq 0x0, FALSE, Move_SHELL_SIDE_ARM_SPECIAL +Move_SHELL_SIDE_ARM_PHYSICAL: @ Modified Body Slam, placeholder + loadspritegfx ANIM_TAG_IMPACT + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_IMPACT, 0, 6, 6, RGB_MAGENTA + monbg ANIM_DEF_PARTNER + setalpha 12, 8 + playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER + createsprite gVerticalDipSpriteTemplate, ANIM_ATTACKER, 2, 6, 1, ANIM_ATTACKER + waitforvisualfinish + delay 11 + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, 26, 0, 0, 5 + delay 6 + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 4, -10, 0, ANIM_TARGET, 0 + loopsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET, 10, 2 + delay 1 + createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -28, 0, 0, 3 + waitforvisualfinish + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1 + waitforvisualfinish + delay 10 + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 6 + delay 5 + createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 6 + waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER + blendoff + end +Move_SHELL_SIDE_ARM_SPECIAL: @ Modified Snipe Shot, placeholder + loadspritegfx ANIM_TAG_IMPACT_2 + loadspritegfx ANIM_TAG_LEER + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_IMPACT_2, 0, 6, 6, RGB_MAGENTA + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_LEER, 0, 6, 6, RGB_MAGENTA + launchtemplate gLeerSpriteTemplate 0x82, 2 0x18 -12 + playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER + waitforvisualfinish + delay 0x20 + playsewithpan SE_M_GIGA_DRAIN, SOUND_PAN_TARGET + launchtemplate gSnipeShotBallTemplate 0x82, 3, 0 0 24, + waitforvisualfinish + launchtask AnimTask_ShakeMon2 2 5 1 4 0 8, 1 + waitforvisualfinish + end Move_MISTY_EXPLOSION:: end @to do: diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index d04483e6b..3bc45939f 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -5064,3 +5064,12 @@ void AnimTask_PrimalReversion(u8 taskId) gBattleAnimArgs[0] = 0; DestroyAnimVisualTask(taskId); } + +void AnimTask_ShellSideArm(u8 taskId) +{ + if (gSwapDamageCategory) + gBattleAnimArgs[0] = TRUE; + else + gBattleAnimArgs[0] = FALSE; + DestroyAnimVisualTask(taskId); +} From 8c35a6806014cede7354f0e6c47eb075223ce507 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 27 Oct 2021 11:19:39 -0300 Subject: [PATCH 24/81] Quick syntax tweaks --- asm/macros/battle_script.inc | 16 ++++++++-------- include/battle.h | 1 - src/battle_util.c | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index b838cb6d2..4a8570a1a 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1731,14 +1731,6 @@ .4byte \ptr .endm - .macro photongeysercheck - various BS_ATTACKER, VARIOUS_PHOTON_GEYSER_CHECK - .endm - - .macro shellsidearmcheck - various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK - .endm - .macro trysetfairylock ptr:req various BS_ATTACKER, VARIOUS_TRY_FAIRY_LOCK .4byte \ptr @@ -1866,6 +1858,14 @@ various BS_ATTACKER, VARIOUS_APPLY_PLASMA_FISTS .endm + .macro photongeysercheck + various BS_ATTACKER, VARIOUS_PHOTON_GEYSER_CHECK + .endm + + .macro shellsidearmcheck + various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK + .endm + @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 diff --git a/include/battle.h b/include/battle.h index 00b2c2f25..b5dabaded 100644 --- a/include/battle.h +++ b/include/battle.h @@ -918,7 +918,6 @@ extern u8 gBattleControllerData[MAX_BATTLERS_COUNT]; extern bool8 gHasFetchedBall; extern u8 gLastUsedBall; extern u16 gLastThrownBall; - extern bool8 gSwapDamageCategory; // Photon Geyser, Shell Side Arm, Light That Burns the Sky #endif // GUARD_BATTLE_H diff --git a/src/battle_util.c b/src/battle_util.c index f79ce62b2..7797b4751 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7271,7 +7271,7 @@ bool32 IsMoveMakingContact(u16 move, u8 battlerAtk) { if (!(gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) { - if (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gSwapDamageCategory == TRUE) + if (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gSwapDamageCategory) return TRUE; else return FALSE; @@ -9077,7 +9077,7 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) u8 GetBattleMoveSplit(u32 moveId) { - if (gSwapDamageCategory == TRUE) // Photon Geyser, Shell Side Arm, Light That Burns the Sky + if (gSwapDamageCategory) // Photon Geyser, Shell Side Arm, Light That Burns the Sky return SPLIT_PHYSICAL; else if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4) return gBattleMoves[moveId].split; From 52054e4bfefde6572fa19a74240a9187d4147b64 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Sat, 30 Oct 2021 21:12:18 +1300 Subject: [PATCH 25/81] Fix Corrosion, Poison Touch - CanBePoisoned now calls CanPoisonType instead of overriding it. Poison Touch now activates only if the attacker actually damaged the target. Partially implemented Pastel Veil. --- include/battle_util.h | 2 +- src/battle_ai_util.c | 2 +- src/battle_script_commands.c | 14 ++++---------- src/battle_util.c | 24 +++++++++++++----------- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/include/battle_util.h b/include/battle_util.h index d98c511e2..6caa939b9 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -167,7 +167,7 @@ bool32 IsEntrainmentBannedAbilityAttacker(u16 ability); bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability); bool32 CanSleep(u8 battlerId); -bool32 CanBePoisoned(u8 battlerId); +bool32 CanBePoisoned(u8 gBattlerAttacker, u8 battlerTarget); bool32 CanBeBurned(u8 battlerId); bool32 CanBeParalyzed(u8 battlerId); bool32 CanBeFrozen(u8 battlerId); diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index fef6e6c6f..9640df2b4 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -2616,7 +2616,7 @@ bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, bool32 AI_CanBePoisoned(u8 battler, u16 ability) { if (ability == ABILITY_IMMUNITY - || ability == ABILITY_PASTEL_VEIL + || IsAbilityOnSide(battler, ABILITY_PASTEL_VEIL) || gBattleMons[battler].status1 & STATUS1_ANY || IsAbilityStatusProtected(battler) || gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c5c922d8e..49cc8540e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2682,9 +2682,7 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUS_HAD_NO_EFFECT; RESET_RETURN } - if (!CanPoisonType(gBattleScripting.battler, gEffectBattler)) - break; - if (!CanBePoisoned(gEffectBattler)) + if (!CanBePoisoned(gBattleScripting.battler, gEffectBattler)) break; statusChanged = TRUE; @@ -2809,11 +2807,8 @@ void SetMoveEffect(bool32 primary, u32 certain) } if (gBattleMons[gEffectBattler].status1) break; - if (CanPoisonType(gBattleScripting.battler, gEffectBattler)) + if (CanBePoisoned(gBattleScripting.battler, gEffectBattler)) { - if (!CanBePoisoned(gEffectBattler)) - break; - // It's redundant, because at this point we know the status1 value is 0. gBattleMons[gEffectBattler].status1 &= ~(STATUS1_TOXIC_POISON); gBattleMons[gEffectBattler].status1 &= ~(STATUS1_POISON); @@ -7257,9 +7252,8 @@ static void HandleTerrainMove(u32 moveEffect) bool32 CanPoisonType(u8 battlerAttacker, u8 battlerTarget) { - return (GetBattlerAbility(battlerAttacker) == ABILITY_CORROSION - || !(IS_BATTLER_OF_TYPE(battlerTarget, TYPE_POISON) - || IS_BATTLER_OF_TYPE(battlerTarget, TYPE_STEEL))); + return ((GetBattlerAbility(battlerAttacker) == ABILITY_CORROSION && gBattleMoves[gCurrentMove].split == SPLIT_STATUS) + || !(IS_BATTLER_OF_TYPE(battlerTarget, TYPE_POISON) || IS_BATTLER_OF_TYPE(battlerTarget, TYPE_STEEL))); } bool32 CanParalyzeType(u8 battlerAttacker, u8 battlerTarget) diff --git a/src/battle_util.c b/src/battle_util.c index fe957e464..5dbe42227 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4961,7 +4961,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED - && CanBePoisoned(gBattlerAttacker) + && CanBePoisoned(gBattlerAttacker, gBattlerTarget) && IsMoveMakingContact(move, gBattlerAttacker) && (Random() % 3) == 0) { @@ -5148,8 +5148,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerTarget].hp != 0 && !gProtectStructs[gBattlerTarget].confusionSelfDmg - && CanBePoisoned(gBattlerTarget) + && CanBePoisoned(gBattlerAttacker, gBattlerTarget) && IsMoveMakingContact(move, gBattlerAttacker) + && TARGET_TURN_DAMAGED // Need to actually hit the target && (Random() % 3) == 0) { gBattleScripting.moveEffect = MOVE_EFFECT_POISON; @@ -5589,18 +5590,19 @@ bool32 CanSleep(u8 battlerId) return TRUE; } -bool32 CanBePoisoned(u8 battlerId) +bool32 CanBePoisoned(u8 battlerAttacker, u8 battlerTarget) { - u16 ability = GetBattlerAbility(battlerId); - if (IS_BATTLER_OF_TYPE(battlerId, TYPE_POISON) - || IS_BATTLER_OF_TYPE(battlerId, TYPE_STEEL) - || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD - || gBattleMons[battlerId].status1 & STATUS1_ANY + u16 ability = GetBattlerAbility(battlerTarget); + + if (!(CanPoisonType(battlerAttacker, battlerTarget)) + || gSideStatuses[GetBattlerSide(battlerTarget)] & SIDE_STATUS_SAFEGUARD + || gBattleMons[battlerTarget].status1 & STATUS1_ANY || ability == ABILITY_IMMUNITY || ability == ABILITY_COMATOSE - || gBattleMons[battlerId].status1 & STATUS1_ANY - || IsAbilityStatusProtected(battlerId) - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) + || IsAbilityOnSide(battlerTarget, ABILITY_PASTEL_VEIL) + || gBattleMons[battlerTarget].status1 & STATUS1_ANY + || IsAbilityStatusProtected(battlerTarget) + || IsBattlerTerrainAffected(battlerTarget, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } From c4aa2a1e924c0f1b7a517ac5a13dcfd1e01efd31 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 1 Nov 2021 21:36:08 -0300 Subject: [PATCH 26/81] Added Gen 8 contest data (minus combos), also fixed Bubble's category --- src/data/contest_moves.h | 522 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 521 insertions(+), 1 deletion(-) diff --git a/src/data/contest_moves.h b/src/data/contest_moves.h index 2e8fd8089..160a05407 100644 --- a/src/data/contest_moves.h +++ b/src/data/contest_moves.h @@ -1158,7 +1158,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = [MOVE_BUBBLE] = { .effect = CONTEST_EFFECT_STARTLE_PREV_MONS, - .contestCategory = CONTEST_CATEGORY_COOL, + .contestCategory = CONTEST_CATEGORY_CUTE, .comboStarterId = 0, .comboMoves = {COMBO_STARTER_RAIN_DANCE}, }, @@ -5398,6 +5398,526 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = .comboStarterId = 0, .comboMoves = {0} }, + + [MOVE_DYNAMAX_CANNON] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_SNIPE_SHOT] = + { + .effect = CONTEST_EFFECT_STARTLE_MONS_SAME_TYPE_APPEAL, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_JAW_LOCK] = + { + .effect = CONTEST_EFFECT_DONT_EXCITE_AUDIENCE, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_STUFF_CHEEKS] = + { + .effect = CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_NO_RETREAT] = + { + .effect = CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_TAR_SHOT] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_MAGIC_POWDER] = + { + .effect = CONTEST_EFFECT_WORSEN_CONDITION_OF_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_DRAGON_DARTS] = + { + .effect = CONTEST_EFFECT_REPETITION_NOT_BORING, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_TEATIME] = + { + .effect = CONTEST_EFFECT_MAKE_FOLLOWING_MONS_NERVOUS, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_OCTOLOCK] = + { + .effect = CONTEST_EFFECT_DONT_EXCITE_AUDIENCE, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_BOLT_BEAK] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_FISHIOUS_REND] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_COURT_CHANGE] = + { + .effect = CONTEST_EFFECT_MAKE_FOLLOWING_MONS_NERVOUS, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_CLANGOROUS_SOUL] = + { + .effect = CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_BODY_PRESS] = + { + .effect = CONTEST_EFFECT_BETTER_IF_SAME_TYPE, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_DECORATE] = + { + .effect = CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_DRUM_BEATING] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_SNAP_TRAP] = + { + .effect = CONTEST_EFFECT_DONT_EXCITE_AUDIENCE, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_PYRO_BALL] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_BEHEMOTH_BLADE] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_BEHEMOTH_BASH] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_AURA_WHEEL] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_BREAKING_SWIPE] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_BRANCH_POKE] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_OVERDRIVE] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_APPLE_ACID] = + { + .effect = CONTEST_EFFECT_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_GRAV_APPLE] = + { + .effect = CONTEST_EFFECT_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_SPIRIT_BREAK] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_STRANGE_STEAM] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_FRONT_MON, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_LIFE_DEW] = + { + .effect = CONTEST_EFFECT_QUALITY_DEPENDS_ON_TIMING, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_OBSTRUCT] = + { + .effect = CONTEST_EFFECT_AVOID_STARTLE, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_FALSE_SURRENDER] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_METEOR_ASSAULT] = + { + .effect = CONTEST_EFFECT_JAMS_OTHERS_BUT_MISS_ONE_TURN, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_ETERNABEAM] = + { + .effect = CONTEST_EFFECT_JAMS_OTHERS_BUT_MISS_ONE_TURN, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_STEEL_BEAM] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_EXPANDING_FORCE] = + { + .effect = CONTEST_EFFECT_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_VENOM_DRENCH] = + { + .effect = CONTEST_EFFECT_WORSEN_CONDITION_OF_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_SCALE_SHOT] = + { + .effect = CONTEST_EFFECT_NEXT_APPEAL_EARLIER, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_METEOR_BEAM] = + { + .effect = CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_SHELL_SIDE_ARM] = + { + .effect = CONTEST_EFFECT_BETTER_IF_SAME_TYPE, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_MISTY_EXPLOSION] = + { + .effect = CONTEST_EFFECT_GREAT_APPEAL_BUT_NO_MORE_MOVES, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_GRASSY_GLIDE] = + { + .effect = CONTEST_EFFECT_NEXT_APPEAL_EARLIER, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_RISING_VOLTAGE] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_TERRAIN_PULSE] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_SKITTER_SMACK] = + { + .effect = CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_BURNING_JEALOUSY] = + { + .effect = CONTEST_EFFECT_STARTLE_MON_WITH_JUDGES_ATTENTION, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_LASH_OUT] = + { + .effect = CONTEST_EFFECT_STARTLE_PREV_MON, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_POLTERGEIST] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_CORROSIVE_GAS] = + { + .effect = CONTEST_EFFECT_WORSEN_CONDITION_OF_PREV_MONS, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_COACHING] = + { + .effect = CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_FLIP_TURN] = + { + .effect = CONTEST_EFFECT_AVOID_STARTLE, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_TRIPLE_AXEL] = + { + .effect = CONTEST_EFFECT_BETTER_IF_SAME_TYPE, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_DUAL_WINGBEAT] = + { + .effect = CONTEST_EFFECT_REPETITION_NOT_BORING, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_SCORCHING_SANDS] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_JUNGLE_HEALING] = + { + .effect = CONTEST_EFFECT_QUALITY_DEPENDS_ON_TIMING, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_WICKED_BLOW] = + { + .effect = CONTEST_EFFECT_JAMS_OTHERS_BUT_MISS_ONE_TURN, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_SURGING_STRIKES] = + { + .effect = CONTEST_EFFECT_STARTLE_MONS_SAME_TYPE_APPEAL, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_THUNDER_CAGE] = + { + .effect = CONTEST_EFFECT_DONT_EXCITE_AUDIENCE, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_DRAGON_ENERGY] = + { + .effect = CONTEST_EFFECT_BETTER_WHEN_LATER, + .contestCategory = CONTEST_CATEGORY_COOL, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_FREEZING_GLARE] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_CUTE, + .comboStarterId = 0, + .comboMoves = {0} + }, + + [MOVE_FIERY_WRATH] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_THUNDEROUS_KICK] = + { + .effect = CONTEST_EFFECT_HIGHLY_APPEALING, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_GLACIAL_LANCE] = + { + .effect = CONTEST_EFFECT_BETTER_IF_LAST, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_ASTRAL_BARRAGE] = + { + .effect = CONTEST_EFFECT_BETTER_IF_FIRST, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0}, + }, + + [MOVE_EERIE_SPELL] = + { + .effect = CONTEST_EFFECT_BETTER_WHEN_LATER, + .contestCategory = CONTEST_CATEGORY_SMART, + .comboStarterId = 0, + .comboMoves = {0} + }, }; const struct ContestEffect gContestEffects[] = From 8332bfae4682c9b4a778386c944d01253a1a81cd Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 1 Nov 2021 21:59:34 -0300 Subject: [PATCH 27/81] Gen 8 combo moves --- include/constants/contest.h | 4 ++++ src/data/contest_moves.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/include/constants/contest.h b/include/constants/contest.h index cefcbeebd..f7b858c4a 100644 --- a/include/constants/contest.h +++ b/include/constants/contest.h @@ -238,5 +238,9 @@ #define COMBO_STARTER_THOUSAND_WAVES 82 #define COMBO_STARTER_HYPERSPACE_FURY 83 #define COMBO_STARTER_SHADOW_BONE 84 +#define COMBO_STARTER_ELECTRIC_TERRAIN 85 +#define COMBO_STARTER_MISTY_TERRAIN 86 +#define COMBO_STARTER_GRASSY_TERRAIN 87 +#define COMBO_STARTER_PSYCHIC_TERRAIN 88 #endif // GUARD_CONSTANTS_CONTEST_H diff --git a/src/data/contest_moves.h b/src/data/contest_moves.h index 160a05407..8600dcbc6 100644 --- a/src/data/contest_moves.h +++ b/src/data/contest_moves.h @@ -4633,7 +4633,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = { .effect = CONTEST_EFFECT_BETTER_WHEN_AUDIENCE_EXCITED, .contestCategory = CONTEST_CATEGORY_SMART, - .comboStarterId = 0, + .comboStarterId = COMBO_STARTER_GRASSY_TERRAIN, .comboMoves = {0} }, @@ -4641,7 +4641,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = { .effect = CONTEST_EFFECT_BETTER_WHEN_AUDIENCE_EXCITED, .contestCategory = CONTEST_CATEGORY_CUTE, - .comboStarterId = 0, + .comboStarterId = COMBO_STARTER_MISTY_TERRAIN, .comboMoves = {0} }, @@ -4825,7 +4825,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = { .effect = CONTEST_EFFECT_BETTER_WHEN_AUDIENCE_EXCITED, .contestCategory = CONTEST_CATEGORY_BEAUTY, - .comboStarterId = 0, + .comboStarterId = COMBO_STARTER_ELECTRIC_TERRAIN, .comboMoves = {0} }, @@ -5115,7 +5115,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = { .effect = CONTEST_EFFECT_BETTER_WHEN_AUDIENCE_EXCITED, .contestCategory = CONTEST_CATEGORY_SMART, - .comboStarterId = 0, + .comboStarterId = COMBO_STARTER_PSYCHIC_TERRAIN, .comboMoves = {0} }, @@ -5684,7 +5684,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = .effect = CONTEST_EFFECT_STARTLE_PREV_MONS, .contestCategory = CONTEST_CATEGORY_SMART, .comboStarterId = 0, - .comboMoves = {0} + .comboMoves = {COMBO_STARTER_PSYCHIC_TERRAIN} }, [MOVE_VENOM_DRENCH] = @@ -5724,7 +5724,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = .effect = CONTEST_EFFECT_GREAT_APPEAL_BUT_NO_MORE_MOVES, .contestCategory = CONTEST_CATEGORY_CUTE, .comboStarterId = 0, - .comboMoves = {0} + .comboMoves = {COMBO_STARTER_MISTY_TERRAIN} }, [MOVE_GRASSY_GLIDE] = @@ -5732,7 +5732,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = .effect = CONTEST_EFFECT_NEXT_APPEAL_EARLIER, .contestCategory = CONTEST_CATEGORY_SMART, .comboStarterId = 0, - .comboMoves = {0} + .comboMoves = {COMBO_STARTER_GRASSY_TERRAIN} }, [MOVE_RISING_VOLTAGE] = @@ -5740,7 +5740,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = .effect = CONTEST_EFFECT_HIGHLY_APPEALING, .contestCategory = CONTEST_CATEGORY_BEAUTY, .comboStarterId = 0, - .comboMoves = {0} + .comboMoves = {COMBO_STARTER_ELECTRIC_TERRAIN} }, [MOVE_TERRAIN_PULSE] = @@ -5748,7 +5748,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = .effect = CONTEST_EFFECT_HIGHLY_APPEALING, .contestCategory = CONTEST_CATEGORY_CUTE, .comboStarterId = 0, - .comboMoves = {0}, + .comboMoves = {COMBO_STARTER_ELECTRIC_TERRAIN, COMBO_STARTER_MISTY_TERRAIN, COMBO_STARTER_GRASSY_TERRAIN, COMBO_STARTER_PSYCHIC_TERRAIN}, }, [MOVE_SKITTER_SMACK] = From 10306d046cd4262741ca47415cc261ac3e3c7319 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 1 Nov 2021 22:07:54 -0300 Subject: [PATCH 28/81] Fixed Steam Roller's define --- src/data/contest_moves.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/contest_moves.h b/src/data/contest_moves.h index 8600dcbc6..169e55991 100644 --- a/src/data/contest_moves.h +++ b/src/data/contest_moves.h @@ -5687,7 +5687,7 @@ const struct ContestMove gContestMoves[MOVES_COUNT] = .comboMoves = {COMBO_STARTER_PSYCHIC_TERRAIN} }, - [MOVE_VENOM_DRENCH] = + [MOVE_STEEL_ROLLER] = { .effect = CONTEST_EFFECT_WORSEN_CONDITION_OF_PREV_MONS, .contestCategory = CONTEST_CATEGORY_TOUGH, From 8af882348a504d953997baa2faf5a50c12e59009 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Tue, 2 Nov 2021 16:56:12 +1300 Subject: [PATCH 29/81] Fix Parental Bond Super Fang Min damage should be 2 --- src/battle_ai_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 3535e800c..9478d7343 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -796,7 +796,7 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef) dmg = 0; // Two hits of Super Fang halves HP twice, leaving target with 25% HP else if (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND) - dmg = max(1, gBattleMons[battlerDef].hp * 3 / 4); + dmg = max(2, gBattleMons[battlerDef].hp * 3 / 4); else dmg = max(1, gBattleMons[battlerDef].hp / 2); break; From 40bced517a9a66292cea932da1360bc3e02a1161 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Tue, 2 Nov 2021 20:00:57 +1300 Subject: [PATCH 30/81] Pastel Veil blocks poison for whole side Tested vs Toxic, Toxic Thread and Sludge with 100% effect chance. --- data/battle_scripts_1.s | 15 +++++++++++++++ include/constants/battle_string_ids.h | 3 ++- src/battle_message.c | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index dd6af61e5..dc0a1900e 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2581,6 +2581,18 @@ BattleScript_AromaVeilProtects: orhalfword gMoveResultFlags, MOVE_RESULT_FAILED goto BattleScript_MoveEnd +BattleScript_PastelVeilProtectsRet:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_PASTELVEILPROTECTED + waitmessage B_WAIT_TIME_LONG + return + +BattleScript_PastelVeilProtects: + call BattleScript_PastelVeilProtectsRet + orhalfword gMoveResultFlags, MOVE_RESULT_FAILED + goto BattleScript_MoveEnd + BattleScript_LeafGuardProtectsRet:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp @@ -3053,6 +3065,7 @@ BattleScript_EffectToxic:: ppreduce jumpifability BS_TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects + jumpifability BS_TARGET_SIDE, ABILITY_PASTEL_VEIL, BattleScript_PastelVeilProtects jumpifflowerveil BattleScript_FlowerVeilProtects jumpifleafguard BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects @@ -3080,6 +3093,7 @@ BattleScript_AlreadyPoisoned:: BattleScript_ImmunityProtected:: copybyte gEffectBattler, gBattlerTarget + call BattleScript_AbilityPopUp setbyte cMULTISTRING_CHOOSER, B_MSG_ABILITY_PREVENTS_MOVE_STATUS call BattleScript_PSNPrevention goto BattleScript_MoveEnd @@ -3408,6 +3422,7 @@ BattleScript_EffectPoison:: ppreduce jumpifability BS_TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects + jumpifability BS_TARGET_SIDE, ABILITY_PASTEL_VEIL, BattleScript_PastelVeilProtects jumpifflowerveil BattleScript_FlowerVeilProtects jumpifleafguard BattleScript_LeafGuardProtects jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 1d461e2a0..a84f0ff34 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -597,8 +597,9 @@ #define STRINGID_BUTPOKEMONCANTUSETHEMOVE 594 #define STRINGID_BUTHOOPACANTUSEIT 595 #define STRINGID_BROKETHROUGHPROTECTION 596 +#define STRINGID_PASTELVEILPROTECTED 597 -#define BATTLESTRINGS_COUNT 597 +#define BATTLESTRINGS_COUNT 598 // The below IDs are all indexes into battle message tables, // used to determine which of a set of messages to print. diff --git a/src/battle_message.c b/src/battle_message.c index f26726a69..f6569f039 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -723,9 +723,11 @@ static const u8 sText_PkmnRevertedToPrimal[] = _("{B_ATK_NAME_WITH_PREFIX}'s Pri static const u8 sText_ButPokemonCantUseTheMove[] = _("But {B_ATK_NAME_WITH_PREFIX} can't\nuse the move!"); static const u8 sText_ButHoopaCantUseIt[] = _("But Hoopa can't use it\nthe way it is now!"); static const u8 sText_BrokeThroughProtection[] = _("It broke through the\n{B_DEF_NAME_WITH_PREFIX}'s protection!"); +static const u8 sText_PastelVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby a pastel veil!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_PASTELVEILPROTECTED -12] = sText_PastelVeilProtected, [STRINGID_BROKETHROUGHPROTECTION - 12] = sText_BrokeThroughProtection, [STRINGID_BUTPOKEMONCANTUSETHEMOVE - 12] = sText_ButPokemonCantUseTheMove, [STRINGID_BUTHOOPACANTUSEIT - 12] = sText_ButHoopaCantUseIt, From 95435b5f7f132da3d0d36464e8726ad132fd7008 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Tue, 2 Nov 2021 23:06:10 +1300 Subject: [PATCH 31/81] Pastel Veil switchin effect attempt Battle script isn't working for partner for some reason. --- data/battle_scripts_1.s | 8 ++++++++ include/battle_scripts.h | 1 + include/constants/battle_string_ids.h | 4 +++- src/battle_message.c | 3 +++ src/battle_util.c | 19 +++++++++++++++++++ 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index dc0a1900e..d627008da 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8926,3 +8926,11 @@ BattleScript_DarkTypePreventsPrankster:: waitmessage B_WAIT_TIME_LONG orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT goto BattleScript_MoveEnd + +BattleScript_PastelVeilActivates:: + call BattleScript_AbilityPopUp + printfromtable gSwitchInAbilityStringIds + curestatus BS_SCRIPTING + updatestatusicon BS_SCRIPTING + waitmessage B_WAIT_TIME_LONG + end3 diff --git a/include/battle_scripts.h b/include/battle_scripts.h index ec95a4549..5875eaa68 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -402,5 +402,6 @@ extern const u8 BattleScript_BlockedByPrimalWeatherEnd3[]; extern const u8 BattleScript_BlockedByPrimalWeatherRet[]; extern const u8 BattleScript_PrimalReversion[]; extern const u8 BattleScript_HyperspaceFuryRemoveProtect[]; +extern const u8 BattleScript_PastelVeilActivates[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index a84f0ff34..95a37223d 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -598,8 +598,9 @@ #define STRINGID_BUTHOOPACANTUSEIT 595 #define STRINGID_BROKETHROUGHPROTECTION 596 #define STRINGID_PASTELVEILPROTECTED 597 +#define STRINGID_PASTELVEILENTERS 598 -#define BATTLESTRINGS_COUNT 598 +#define BATTLESTRINGS_COUNT 599 // The below IDs are all indexes into battle message tables, // used to determine which of a set of messages to print. @@ -834,6 +835,7 @@ #define B_MSG_SWITCHIN_SCREENCLEANER 12 #define B_MSG_SWITCHIN_ASONE 13 #define B_MSG_SWITCHIN_CURIOUS_MEDICINE 14 +#define B_MSG_SWITCHIN_PASTEL_VEIL 15 // gMentalHerbCureStringIds #define B_MSG_MENTALHERBCURE_INFATUATION 0 diff --git a/src/battle_message.c b/src/battle_message.c index f6569f039..3a17a7240 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -724,9 +724,11 @@ static const u8 sText_ButPokemonCantUseTheMove[] = _("But {B_ATK_NAME_WITH_PREFI static const u8 sText_ButHoopaCantUseIt[] = _("But Hoopa can't use it\nthe way it is now!"); static const u8 sText_BrokeThroughProtection[] = _("It broke through the\n{B_DEF_NAME_WITH_PREFIX}'s protection!"); static const u8 sText_PastelVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby a pastel veil!"); +static const u8 sText_PastelVeilEnters[] = _("{B_EFF_NAME_WITH_PREFIX}'s poisoning\nwas cured!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_PASTELVEILENTERS - 12] = sText_PastelVeilEnters, [STRINGID_PASTELVEILPROTECTED -12] = sText_PastelVeilProtected, [STRINGID_BROKETHROUGHPROTECTION - 12] = sText_BrokeThroughProtection, [STRINGID_BUTPOKEMONCANTUSETHEMOVE - 12] = sText_ButPokemonCantUseTheMove, @@ -1373,6 +1375,7 @@ const u16 gSwitchInAbilityStringIds[] = [B_MSG_SWITCHIN_SCREENCLEANER] = STRINGID_SCREENCLEANERENTERS, [B_MSG_SWITCHIN_ASONE] = STRINGID_ASONEENTERS, [B_MSG_SWITCHIN_CURIOUS_MEDICINE] = STRINGID_CURIOUSMEDICINEENTERS, + [B_MSG_SWITCHIN_PASTEL_VEIL] = STRINGID_PASTELVEILENTERS, }; const u16 gMissStringIds[] = diff --git a/src/battle_util.c b/src/battle_util.c index 5dbe42227..0600d37e8 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4061,6 +4061,25 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_PASTEL_VEIL: + if (!gSpecialStatuses[battler].switchInAbilityDone) + { + u32 side = GetBattlerSide(battler); + + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { + if (IsBattlerAlive(i) && GetBattlerSide(i) == side + && (gBattleMons[i].status1 & STATUS1_POISON || gBattleMons[i].status1 & STATUS1_TOXIC_POISON)) + { + gActiveBattler = gBattleScripting.battler = gEffectBattler = i; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_PASTEL_VEIL; + BattleScriptPushCursorAndCallback(BattleScript_PastelVeilActivates); + effect++; + } + } + gSpecialStatuses[battler].switchInAbilityDone = 1; + } + break; case ABILITY_ANTICIPATION: if (!gSpecialStatuses[battler].switchInAbilityDone) { From 4668e11765c644e1e621275fae215c36a9fa2484 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 3 Nov 2021 00:45:24 +1300 Subject: [PATCH 32/81] Looping battlescript version 1 Would be better if it simply updated the target, cured the status and returned I think, needs testing. --- data/battle_scripts_1.s | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index d627008da..37b592365 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8927,10 +8927,30 @@ BattleScript_DarkTypePreventsPrankster:: orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT goto BattleScript_MoveEnd -BattleScript_PastelVeilActivates:: +BattleScript_PastelVeilActivatesOld:: call BattleScript_AbilityPopUp printfromtable gSwitchInAbilityStringIds curestatus BS_SCRIPTING updatestatusicon BS_SCRIPTING waitmessage B_WAIT_TIME_LONG end3 + +BattleScript_PastelVeilActivates:: + call BattleScript_AbilityPopUp + printfromtable gSwitchInAbilityStringIds + waitmessage B_WAIT_TIME_LONG + copybyte gBattlerTarget, gBattlerAttacker + setbyte gBattleCommunication, 0 +BattleScript_PastelVeil_TryCurePoison: + jumpifstatus BS_TARGET, STATUS1_POISON | STATUS1_TOXIC_POISON, BattleScript_PastelVeilCurePoison + goto BattleScript_PastelVeilEnd +BattleScript_PastelVeilCurePoison: + curestatus BS_TARGET + updatestatusicon BS_TARGET + jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_PastelVeilEnd + addbyte gBattleCommunication, 1 + jumpifnoally BS_TARGET, BattleScript_PastelVeilEnd + setallytonexttarget BattleScript_PastelVeil_TryCurePoison + goto BattleScript_MoveEnd +BattleScript_PastelVeilEnd: + end3 From 592a1dab63d3b8eb97679cbdc9161ade8f762d90 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Tue, 2 Nov 2021 12:02:58 -0400 Subject: [PATCH 33/81] fix mirror armor setstatchanger, handle reflected stat blockage --- data/battle_scripts_1.s | 2 +- src/battle_script_commands.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index b72140a11..eb80a41d5 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2894,7 +2894,7 @@ BattleScript_MirrorArmorReflect:: call BattleScript_AbilityPopUp jumpifsubstituteblocks BattleScript_AbilityNoSpecificStatLoss BattleScript_MirrorArmorReflectStatLoss: - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_MirrorArmorReflectWontFall + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_NOT_PROTECT_AFFECTED | STAT_BUFF_ALLOW_PTR, BattleScript_MirrorArmorReflectEnd jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_MirrorArmorReflectAnim goto BattleScript_MirrorArmorReflectWontFall BattleScript_MirrorArmorReflectAnim: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 28cab4af3..2ee80557f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9689,10 +9689,12 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr { if (flags == STAT_BUFF_ALLOW_PTR) { + SET_STATCHANGER(statId, GET_STAT_BUFF_VALUE(statValue) | STAT_BUFF_NEGATIVE, TRUE); BattleScriptPush(BS_ptr); gBattleScripting.battler = gActiveBattler; gBattlerAbility = gActiveBattler; gBattlescriptCurrInstr = BattleScript_MirrorArmorReflect; + RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability); } return STAT_CHANGE_DIDNT_WORK; } From 69b42de0d9b054617a946cfa37064749b43c5013 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 30 Oct 2021 20:40:05 -0300 Subject: [PATCH 34/81] Implemented Mimicry Thanks to AsparagusEduardo for helping me optimize RestoreBattlerOriginalTypes. --- asm/macros/battle_script.inc | 5 ++ data/battle_scripts_1.s | 23 ++++++++ include/battle_scripts.h | 2 + include/battle_util.h | 2 + include/constants/battle_script_commands.h | 1 + include/constants/battle_string_ids.h | 3 +- src/battle_message.c | 2 + src/battle_script_commands.c | 16 ++++++ src/battle_util.c | 62 +++++++++++++++++++++- 9 files changed, 114 insertions(+), 2 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 8fd760634..f288cfeaf 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1874,6 +1874,11 @@ .4byte \ptr .endm + .macro trytoapplymimicry battler:req, ptr:req + various \battler, VARIOUS_TRY_TO_APPLY_MIMICRY + .4byte \ptr + .endm + @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index df0048ad9..8c3e744c1 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1908,8 +1908,25 @@ BattleScript_EffectPsychicTerrain: waitmessage B_WAIT_TIME_LONG playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG, NULL call BattleScript_TerrainSeedLoop + jumpifabilitypresent ABILITY_MIMICRY, BattleScript_ApplyMimicry goto BattleScript_MoveEnd +BattleScript_ApplyMimicry:: + savetarget + setbyte gBattlerTarget, 0 +BattleScript_MimicryLoopIter: + copybyte sBATTLER, gBattlerTarget + trytoapplymimicry BS_TARGET, BattleScript_MimicryLoop_NextBattler + copybyte gBattlerAbility, sBATTLER + call BattleScript_AbilityPopUp + printstring STRINGID_BATTLERTYPECHANGEDTO + waitmessage B_WAIT_TIME_LONG +BattleScript_MimicryLoop_NextBattler: + addbyte gBattlerTarget, 0x1 + jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_MimicryLoopIter + restoretarget + end + BattleScript_EffectTopsyTurvy: attackcanceler attackstring @@ -7957,6 +7974,12 @@ BattleScript_ColorChangeActivates:: waitmessage B_WAIT_TIME_LONG return +BattleScript_MimicryActivatesEnd3:: + call BattleScript_AbilityPopUp + printstring STRINGID_BATTLERTYPECHANGEDTO + waitmessage B_WAIT_TIME_LONG + end3 + BattleScript_ProteanActivates:: call BattleScript_AbilityPopUp printstring STRINGID_PKMNCHANGEDTYPE diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 403af9515..537d9cb81 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -404,5 +404,7 @@ extern const u8 BattleScript_PrimalReversion[]; extern const u8 BattleScript_HyperspaceFuryRemoveProtect[]; extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTactics[]; extern const u8 BattleScript_WanderingSpiritActivates[]; +extern const u8 BattleScript_MimicryActivatesEnd3[]; +extern const u8 BattleScript_ApplyMimicry[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/battle_util.h b/include/battle_util.h index 7f267308d..62a7e1db6 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -157,6 +157,8 @@ void DoBurmyFormChange(u32 monId); bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget); u16 GetUsedHeldItem(u8 battler); bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags); +void TryToApplyMimicry(u8 battlerId, bool8 various); +void RestoreBattlerOriginalTypes(u8 battlerId); // ability checks bool32 IsRolePlayBannedAbilityAtk(u16 ability); diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index fb1142f48..ee6cd4c7f 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -197,6 +197,7 @@ #define VARIOUS_UPDATE_ABILITY_POPUP 124 #define VARIOUS_JUMP_IF_WEATHER_AFFECTED 125 #define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 126 +#define VARIOUS_TRY_TO_APPLY_MIMICRY 127 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 27b39475a..c4161c68f 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -599,8 +599,9 @@ #define STRINGID_BROKETHROUGHPROTECTION 596 #define STRINGID_ABILITYALLOWSONLYMOVE 597 #define STRINGID_SWAPPEDABILITIES 598 +#define STRINGID_BATTLERTYPECHANGEDTO 599 -#define BATTLESTRINGS_COUNT 599 +#define BATTLESTRINGS_COUNT 600 // The below IDs are all indexes into battle message tables, // used to determine which of a set of messages to print. diff --git a/src/battle_message.c b/src/battle_message.c index 37919ddca..30a8670ac 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -725,9 +725,11 @@ static const u8 sText_ButHoopaCantUseIt[] = _("But Hoopa can't use it\nthe way i static const u8 sText_BrokeThroughProtection[] = _("It broke through the\n{B_DEF_NAME_WITH_PREFIX}'s protection!"); static const u8 sText_AbilityAllowsOnlyMove[] = _("{B_ATK_ABILITY} allows the\nuse of only {B_CURRENT_MOVE}!\p"); static const u8 sText_SwappedAbilities[] = _("{B_DEF_NAME_WITH_PREFIX} swapped Abilities\nwith its target!"); +static const u8 sText_BattlerTypeChangedTo[] = _("{B_BUFF1}'s type\nchanged to {B_BUFF2}!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_BATTLERTYPECHANGEDTO - 12] = sText_BattlerTypeChangedTo, [STRINGID_SWAPPEDABILITIES - 12] = sText_SwappedAbilities, [STRINGID_ABILITYALLOWSONLYMOVE - 12] = sText_AbilityAllowsOnlyMove, [STRINGID_BROKETHROUGHPROTECTION - 12] = sText_BrokeThroughProtection, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9e779da1b..2f4e8c46b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -54,6 +54,7 @@ #include "constants/rgb.h" #include "data.h" #include "constants/party_menu.h" +#include "battle_util.h" extern struct MusicPlayerInfo gMPlayInfo_BGM; extern struct Evolution gEvolutionTable[][EVOS_PER_MON]; @@ -9004,6 +9005,21 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; } return; + case VARIOUS_TRY_TO_APPLY_MIMICRY: + { + bool8 isMimicryDone = FALSE; + + if (GetBattlerAbility(gActiveBattler) == ABILITY_MIMICRY) + { + TryToApplyMimicry(gActiveBattler, TRUE); + isMimicryDone = TRUE; + } + if (!isMimicryDone) + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); + else + gBattlescriptCurrInstr += 7; + return; + } } gBattlescriptCurrInstr += 3; diff --git a/src/battle_util.c b/src/battle_util.c index 224cb1af1..00e323d20 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1894,6 +1894,46 @@ u8 GetImprisonedMovesCount(u8 battlerId, u16 move) return imprisonedMoves; } +void RestoreBattlerOriginalTypes(u8 battlerId) +{ + gBattleMons[battlerId].type1 = gBaseStats[gBattleMons[battlerId].species].type1; + gBattleMons[battlerId].type2 = gBaseStats[gBattleMons[battlerId].species].type2; +} + +void TryToApplyMimicry(u8 battlerId, bool8 various) +{ + u32 moveType, move; + + GET_MOVE_TYPE(move, moveType); + switch (gFieldStatuses) + { + case STATUS_FIELD_ELECTRIC_TERRAIN: + moveType = TYPE_ELECTRIC; + break; + case STATUS_FIELD_MISTY_TERRAIN: + moveType = TYPE_FAIRY; + break; + case STATUS_FIELD_GRASSY_TERRAIN: + moveType = TYPE_GRASS; + break; + case STATUS_FIELD_PSYCHIC_TERRAIN: + moveType = TYPE_PSYCHIC; + break; + default: + moveType = 0; + break; + } + + if (moveType != 0 && !IS_BATTLER_OF_TYPE(battlerId, moveType)) + { + SET_BATTLER_TYPE(battlerId, moveType); + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, battlerId, gBattlerPartyIndexes[battlerId]) + PREPARE_TYPE_BUFFER(gBattleTextBuff2, moveType); + if (!various) + BattleScriptPushCursorAndCallback(BattleScript_MimicryActivatesEnd3); + } +} + enum { ENDTURN_ORDER, @@ -2278,6 +2318,9 @@ u8 DoFieldEndTurnEffects(void) && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.electricTerrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT); + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + if (GetBattlerAbility(i) == ABILITY_MIMICRY) + RestoreBattlerOriginalTypes(i); BattleScriptExecute(BattleScript_ElectricTerrainEnds); effect++; } @@ -2288,6 +2331,9 @@ u8 DoFieldEndTurnEffects(void) && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.mistyTerrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN); + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + if (GetBattlerAbility(i) == ABILITY_MIMICRY) + RestoreBattlerOriginalTypes(i); BattleScriptExecute(BattleScript_MistyTerrainEnds); effect++; } @@ -2298,8 +2344,12 @@ u8 DoFieldEndTurnEffects(void) { if (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && (gFieldTimers.grassyTerrainTimer == 0 || --gFieldTimers.grassyTerrainTimer == 0)) + { gFieldStatuses &= ~(STATUS_FIELD_GRASSY_TERRAIN); - + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + if (GetBattlerAbility(i) == ABILITY_MIMICRY) + RestoreBattlerOriginalTypes(i); + } BattleScriptExecute(BattleScript_GrassyTerrainHeals); effect++; } @@ -2310,6 +2360,9 @@ u8 DoFieldEndTurnEffects(void) && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.psychicTerrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_PSYCHIC_TERRAIN); + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + if (GetBattlerAbility(i) == ABILITY_MIMICRY) + RestoreBattlerOriginalTypes(i); BattleScriptExecute(BattleScript_PsychicTerrainEnds); effect++; } @@ -4380,6 +4433,13 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_MIMICRY: + if (gBattleMons[battler].hp != 0 && gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) + { + TryToApplyMimicry(battler, FALSE); + effect++; + } + break; } break; case ABILITYEFFECT_ENDTURN: // 1 From d99fd30e4d60533e46d59e872cac542786a8d929 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 3 Nov 2021 11:51:20 +1300 Subject: [PATCH 35/81] Looping battle script, correct message Testing in Sword showed that the pop up should happen once if two mons are cured, and that the correct message is "X was cured of its poisoning!" --- data/battle_scripts_1.s | 24 ++++++++++-------------- src/battle_message.c | 2 +- src/battle_util.c | 17 ++++------------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 37b592365..5bd37cf04 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8927,30 +8927,26 @@ BattleScript_DarkTypePreventsPrankster:: orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT goto BattleScript_MoveEnd -BattleScript_PastelVeilActivatesOld:: - call BattleScript_AbilityPopUp - printfromtable gSwitchInAbilityStringIds - curestatus BS_SCRIPTING - updatestatusicon BS_SCRIPTING - waitmessage B_WAIT_TIME_LONG - end3 - BattleScript_PastelVeilActivates:: - call BattleScript_AbilityPopUp - printfromtable gSwitchInAbilityStringIds - waitmessage B_WAIT_TIME_LONG - copybyte gBattlerTarget, gBattlerAttacker setbyte gBattleCommunication, 0 + setbyte gBattleCommunication + 1, 0 BattleScript_PastelVeil_TryCurePoison: jumpifstatus BS_TARGET, STATUS1_POISON | STATUS1_TOXIC_POISON, BattleScript_PastelVeilCurePoison - goto BattleScript_PastelVeilEnd + goto BattleScript_PastelVeilLoopIncrement BattleScript_PastelVeilCurePoison: + jumpifbyte CMP_NOT_EQUAL, gBattleCommunication + 1, 0x0, BattleScript_PastelVeilCurePoisonNoPopUp + call BattleScript_AbilityPopUp + setbyte gBattleCommunication + 1, 1 +BattleScript_PastelVeilCurePoisonNoPopUp: @ Only show Pastel Veil pop up once if it cures two mons + printfromtable gSwitchInAbilityStringIds + waitmessage B_WAIT_TIME_LONG curestatus BS_TARGET updatestatusicon BS_TARGET +BattleScript_PastelVeilLoopIncrement: jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_PastelVeilEnd addbyte gBattleCommunication, 1 jumpifnoally BS_TARGET, BattleScript_PastelVeilEnd setallytonexttarget BattleScript_PastelVeil_TryCurePoison - goto BattleScript_MoveEnd + goto BattleScript_PastelVeilEnd BattleScript_PastelVeilEnd: end3 diff --git a/src/battle_message.c b/src/battle_message.c index 3a17a7240..61889a2b7 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -724,7 +724,7 @@ static const u8 sText_ButPokemonCantUseTheMove[] = _("But {B_ATK_NAME_WITH_PREFI static const u8 sText_ButHoopaCantUseIt[] = _("But Hoopa can't use it\nthe way it is now!"); static const u8 sText_BrokeThroughProtection[] = _("It broke through the\n{B_DEF_NAME_WITH_PREFIX}'s protection!"); static const u8 sText_PastelVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby a pastel veil!"); -static const u8 sText_PastelVeilEnters[] = _("{B_EFF_NAME_WITH_PREFIX}'s poisoning\nwas cured!"); +static const u8 sText_PastelVeilEnters[] = _("{B_DEF_NAME_WITH_PREFIX} was cured\nof its poisoning!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { diff --git a/src/battle_util.c b/src/battle_util.c index 0600d37e8..25bfde382 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4064,19 +4064,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_PASTEL_VEIL: if (!gSpecialStatuses[battler].switchInAbilityDone) { - u32 side = GetBattlerSide(battler); - - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - { - if (IsBattlerAlive(i) && GetBattlerSide(i) == side - && (gBattleMons[i].status1 & STATUS1_POISON || gBattleMons[i].status1 & STATUS1_TOXIC_POISON)) - { - gActiveBattler = gBattleScripting.battler = gEffectBattler = i; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_PASTEL_VEIL; - BattleScriptPushCursorAndCallback(BattleScript_PastelVeilActivates); - effect++; - } - } + gBattlerTarget = battler; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_PASTEL_VEIL; + BattleScriptPushCursorAndCallback(BattleScript_PastelVeilActivates); + effect++; gSpecialStatuses[battler].switchInAbilityDone = 1; } break; From 5bfb3096adba05e14938b3c1416aa0d9ad38d4ac Mon Sep 17 00:00:00 2001 From: sbird Date: Tue, 2 Nov 2021 23:53:03 +0000 Subject: [PATCH 36/81] [battle_debug] fix charbase overflow --- src/battle_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_debug.c b/src/battle_debug.c index b34afe484..c967cfe00 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -559,7 +559,7 @@ static const struct BgTemplate sBgTemplates[] = }, { .bg = 1, - .charBaseIndex = 10, + .charBaseIndex = 2, .mapBaseIndex = 20, .screenSize = 0, .paletteMode = 0, From d33bcc335bd6e9beca0a94346098be89b6bffff6 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 3 Nov 2021 14:49:14 +1300 Subject: [PATCH 37/81] Revert Poison Touch target check This would prevent Poison Touch activating if the target hurt itself. --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 843ed16a7..7d955ee84 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5208,7 +5208,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_POISON_TOUCH: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerTarget].hp != 0 - && !gProtectStructs[gBattlerTarget].confusionSelfDmg + && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && CanBePoisoned(gBattlerAttacker, gBattlerTarget) && IsMoveMakingContact(move, gBattlerAttacker) && TARGET_TURN_DAMAGED // Need to actually hit the target From 74c85b581890f014a6031f233494fa37e96a4b3b Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 3 Nov 2021 17:23:33 +1300 Subject: [PATCH 38/81] Implement Relic Song's form change Meloetta transforms into its pirouette form after using Relic Song, unless it has Sheer Force or the move has no effect. It also has a chance to put both targets to sleep. --- data/battle_scripts_1.s | 40 ++++++++++++++++++++++--- include/battle_scripts.h | 1 + include/constants/battle.h | 3 +- include/constants/battle_config.h | 2 ++ include/constants/battle_move_effects.h | 2 +- src/battle_ai_main.c | 2 +- src/battle_script_commands.c | 10 +++++++ src/battle_util.c | 5 ++-- src/data/battle_moves.h | 3 +- 9 files changed, 58 insertions(+), 10 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index df0048ad9..5bdada7b8 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -367,7 +367,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectGeomancy @ EFFECT_GEOMANCY .4byte BattleScript_EffectFairyLock @ EFFECT_FAIRY_LOCK .4byte BattleScript_EffectAllySwitch @ EFFECT_ALLY_SWITCH - .4byte BattleScript_EffectSleepHit @ EFFECT_SLEEP_HIT + .4byte BattleScript_EffectRelicSong @ EFFECT_RELIC_SONG .4byte BattleScript_EffectAttackerDefenseDownHit @ EFFECT_ATTACKER_DEFENSE_DOWN_HIT .4byte BattleScript_EffectHit @ EFFECT_BODY_PRESS .4byte BattleScript_EffectEerieSpell @ EFFECT_EERIE_SPELL @@ -734,9 +734,30 @@ BattleScript_EffectAttackerDefenseDownHit: setmoveeffect MOVE_EFFECT_DEF_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN goto BattleScript_EffectHit -BattleScript_EffectSleepHit: - setmoveeffect MOVE_EFFECT_SLEEP - goto BattleScript_EffectHit +BattleScript_EffectRelicSong: + setmoveeffect MOVE_EFFECT_RELIC_SONG | MOVE_EFFECT_CERTAIN + attackcanceler + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + ppreduce + critcalc + damagecalc + adjustdamage + attackanimation + waitanimation + effectivenesssound + hitanimation BS_TARGET + waitstate + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + critmessage + waitmessage B_WAIT_TIME_LONG + resultmessage + waitmessage B_WAIT_TIME_LONG + seteffectwithchance + argumentstatuseffect + tryfaintmon BS_TARGET, FALSE, NULL + goto BattleScript_MoveEnd BattleScript_EffectAllySwitch: attackcanceler @@ -6939,6 +6960,17 @@ BattleScript_AttackerFormChangeEnd3:: call BattleScript_AttackerFormChange end3 +BattleScript_AttackerFormChangeMoveEffect:: + waitmessage 1 + handleformchange BS_ATTACKER, 0 + handleformchange BS_ATTACKER, 1 + playanimation BS_ATTACKER, B_ANIM_FORM_CHANGE, NULL + waitanimation + printstring STRINGID_PKMNTRANSFORMED + waitmessage B_WAIT_TIME_LONG + handleformchange BS_ATTACKER, 2 + end3 + BattleScript_BallFetch:: call BattleScript_AbilityPopUp printstring STRINGID_FETCHEDPOKEBALL diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 403af9515..753dc5127 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -404,5 +404,6 @@ extern const u8 BattleScript_PrimalReversion[]; extern const u8 BattleScript_HyperspaceFuryRemoveProtect[]; extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTactics[]; extern const u8 BattleScript_WanderingSpiritActivates[]; +extern const u8 BattleScript_AttackerFormChangeMoveEffect[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle.h b/include/constants/battle.h index 918c3e7f0..438b5660c 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -357,7 +357,8 @@ #define MOVE_EFFECT_INCINERATE 0x44 #define MOVE_EFFECT_BUG_BITE 0x45 #define MOVE_EFFECT_RECOIL_HP_25 0x46 -#define NUM_MOVE_EFFECTS 0x47 +#define MOVE_EFFECT_RELIC_SONG 0x47 +#define NUM_MOVE_EFFECTS 0x48 #define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_CERTAIN 0x8000 diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 41fee089d..0e7b75d6d 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -47,6 +47,8 @@ #define SPECIES_GRENINJA_ASH 10017 #define SPECIES_HOOPA 0 #define SPECIES_HOOPA_UNBOUND 10018 + #define SPECIES_MELOETTA 0 + #define SPECIES_MELOETTA_PIROUETTE 10019 #endif // Items with peculiar battle effects. diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 62b49a191..8d3df5ec0 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -350,7 +350,7 @@ #define EFFECT_GEOMANCY 344 #define EFFECT_FAIRY_LOCK 345 #define EFFECT_ALLY_SWITCH 346 -#define EFFECT_SLEEP_HIT 347 +#define EFFECT_RELIC_SONG 347 #define EFFECT_ATTACKER_DEFENSE_DOWN_HIT 348 #define EFFECT_BODY_PRESS 349 #define EFFECT_EERIE_SPELL 350 diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 84fa7b634..c06bb7394 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -4305,7 +4305,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (!IsBattlerGrounded(battlerDef)) score += 3; break; - case EFFECT_SLEEP_HIT: // Relic Song + case EFFECT_RELIC_SONG: #if (defined SPECIES_MELOETTA && defined SPECIES_MELOETTA_PIROUETTE) if (AI_DATA->atkSpecies == SPECIES_MELOETTA && gBattleMons[battlerDef].defense < gBattleMons[battlerDef].spDefense) score += 3; // Change to pirouette if can do more damage diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9e779da1b..d88bf9944 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3393,6 +3393,13 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr = BattleScript_MoveEffectBugBite; } break; + case MOVE_EFFECT_RELIC_SONG: + if (gBattleMons[gBattlerAttacker].species == SPECIES_MELOETTA) + { + gBattleMons[gBattlerAttacker].species = SPECIES_MELOETTA_PIROUETTE; + BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeMoveEffect); + } + break; } } } @@ -8282,6 +8289,9 @@ static void Cmd_various(void) case VARIOUS_ARGUMENT_STATUS_EFFECT: switch (gBattleMoves[gCurrentMove].argument) { + case STATUS1_SLEEP: + gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP; + break; case STATUS1_BURN: gBattleScripting.moveEffect = MOVE_EFFECT_BURN; break; diff --git a/src/battle_util.c b/src/battle_util.c index 224cb1af1..ca1021dfa 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8957,6 +8957,7 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut) { {SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU}, {SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND}, + {SPECIES_MELOETTA_PIROUETTE, SPECIES_MELOETTA}, {SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH}, {SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN}, {SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED}, @@ -8971,8 +8972,8 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut) {SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT}, }; - if (isSwitchingOut) // Don't revert Mimikyu Busted or Ash-Greninja when switching out - i = 2; + if (isSwitchingOut) // Don't revert Mimikyu, Greninja, Meloetta when switching out + i = 3; else i = 0; diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 97d61202a..0d3f23168 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -8614,7 +8614,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_RELIC_SONG] = { - .effect = EFFECT_SLEEP_HIT, + .effect = EFFECT_RELIC_SONG, .power = 75, .type = TYPE_NORMAL, .accuracy = 100, @@ -8624,6 +8624,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, + .argument = STATUS1_SLEEP, }, [MOVE_SECRET_SWORD] = From 18b87416d5f2a9b912a9ade9b932e9a25893ce68 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 3 Nov 2021 17:56:16 +1300 Subject: [PATCH 39/81] Fixes - Fix Sheer Force interaction (needed after adding | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN) - Fix "X Transformed!" target - Allow switching between both forms - Allow form change if target is KO'ed --- data/battle_scripts_1.s | 3 ++- src/battle_script_commands.c | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5bdada7b8..7e52d7d06 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -735,7 +735,7 @@ BattleScript_EffectAttackerDefenseDownHit: goto BattleScript_EffectHit BattleScript_EffectRelicSong: - setmoveeffect MOVE_EFFECT_RELIC_SONG | MOVE_EFFECT_CERTAIN + setmoveeffect MOVE_EFFECT_RELIC_SONG | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN attackcanceler accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE attackstring @@ -6966,6 +6966,7 @@ BattleScript_AttackerFormChangeMoveEffect:: handleformchange BS_ATTACKER, 1 playanimation BS_ATTACKER, B_ANIM_FORM_CHANGE, NULL waitanimation + copybyte sBATTLER, gBattlerAttacker printstring STRINGID_PKMNTRANSFORMED waitmessage B_WAIT_TIME_LONG handleformchange BS_ATTACKER, 2 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d88bf9944..d510a2746 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3394,10 +3394,18 @@ void SetMoveEffect(bool32 primary, u32 certain) } break; case MOVE_EFFECT_RELIC_SONG: - if (gBattleMons[gBattlerAttacker].species == SPECIES_MELOETTA) + if (GetBattlerAbility(gBattlerAttacker) != ABILITY_SHEER_FORCE) { - gBattleMons[gBattlerAttacker].species = SPECIES_MELOETTA_PIROUETTE; - BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeMoveEffect); + if (gBattleMons[gBattlerAttacker].species == SPECIES_MELOETTA) + { + gBattleMons[gBattlerAttacker].species = SPECIES_MELOETTA_PIROUETTE; + BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeMoveEffect); + } + else if (gBattleMons[gBattlerAttacker].species == SPECIES_MELOETTA_PIROUETTE) + { + gBattleMons[gBattlerAttacker].species = SPECIES_MELOETTA; + BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeMoveEffect); + } } break; } From 6ce1f01b8c92539659687658d1d6041841147382 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 3 Nov 2021 19:45:03 +1300 Subject: [PATCH 40/81] Hunger Switch and Aura Wheel Implement the ability Hunger Switch and the move Aura Wheel. --- data/battle_scripts_1.s | 12 ++++++++++-- include/constants/battle_config.h | 4 ++++ include/constants/battle_move_effects.h | 3 ++- src/battle_main.c | 4 ++++ src/battle_util.c | 17 +++++++++++++++++ src/data/battle_moves.h | 2 +- src/data/pokemon/base_stats.h | 4 ++-- 7 files changed, 40 insertions(+), 6 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index df0048ad9..8b2d14dc8 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -392,10 +392,18 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectSparklySwirl @ EFFECT_SPARKLY_SWIRL .4byte BattleScript_EffectPlasmaFists @ EFFECT_PLASMA_FISTS .4byte BattleScript_EffectHyperspaceFury @ EFFECT_HYPERSPACE_FURY + .4byte BattleScript_EffectAuraWheel @ EFFECT_AURA_WHEEL + +BattleScript_EffectAuraWheel: @ Aura Wheel can only be used by Morpeko + jumpifspecies BS_ATTACKER, SPECIES_MORPEKO, BattleScript_EffectSpeedUpHit + jumpifspecies BS_ATTACKER, SPECIES_MORPEKO_HANGRY, BattleScript_EffectSpeedUpHit + printstring STRINGID_BUTPOKEMONCANTUSETHEMOVE + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd BattleScript_EffectHyperspaceFury: - jumpifspecies BS_ATTACKER, SPECIES_TREECKO, BattleScript_EffectHyperspaceFuryUnbound - jumpifspecies BS_ATTACKER, SPECIES_MUDKIP, BattleScript_ButHoopaCantUseIt + jumpifspecies BS_ATTACKER, SPECIES_HOOPA_UNBOUND, BattleScript_EffectHyperspaceFuryUnbound + jumpifspecies BS_ATTACKER, SPECIES_HOOPA, BattleScript_ButHoopaCantUseIt printstring STRINGID_BUTPOKEMONCANTUSETHEMOVE waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 41fee089d..defc44226 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -47,6 +47,10 @@ #define SPECIES_GRENINJA_ASH 10017 #define SPECIES_HOOPA 0 #define SPECIES_HOOPA_UNBOUND 10018 + #define SPECIES_MELOETTA 0 + #define SPECIES_MELOETTA_PIROUETTE 10019 + #define SPECIES_MORPEKO 0 + #define SPECIES_MORPEKO_HANGRY 10020 #endif // Items with peculiar battle effects. diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 62b49a191..7acb56c93 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -375,7 +375,8 @@ #define EFFECT_SPARKLY_SWIRL 369 #define EFFECT_PLASMA_FISTS 370 #define EFFECT_HYPERSPACE_FURY 371 +#define EFFECT_AURA_WHEEL 372 -#define NUM_BATTLE_MOVE_EFFECTS 372 +#define NUM_BATTLE_MOVE_EFFECTS 373 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/battle_main.c b/src/battle_main.c index ad02854bd..12324ef96 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -5221,6 +5221,10 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) { gBattleStruct->dynamicMoveType = 0x80 | TYPE_ELECTRIC; } + else if (move == MOVE_AURA_WHEEL && gBattleMons[battlerAtk].species == SPECIES_MORPEKO_HANGRY) + { + gBattleStruct->dynamicMoveType = 0x80 | TYPE_DARK; + } // Check if a gem should activate. GET_MOVE_TYPE(move, moveType); diff --git a/src/battle_util.c b/src/battle_util.c index 224cb1af1..54a755f0e 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4562,6 +4562,22 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_HUNGER_SWITCH: + if (!(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)) + { + if (gBattleMons[battler].species == SPECIES_MORPEKO) + { + gBattleMons[battler].species = SPECIES_MORPEKO_HANGRY; + BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeEnd3); + } + else if (gBattleMons[battler].species == SPECIES_MORPEKO_HANGRY) + { + gBattleMons[battler].species = SPECIES_MORPEKO; + BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeEnd3); + } + effect++; + } + break; } } break; @@ -8969,6 +8985,7 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut) {SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI}, {SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT}, {SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT}, + {SPECIES_MORPEKO_HANGRY, SPECIES_MORPEKO} }; if (isSwitchingOut) // Don't revert Mimikyu Busted or Ash-Greninja when switching out diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 97d61202a..51c760166 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -11038,7 +11038,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_AURA_WHEEL] = { - .effect = EFFECT_SPEED_UP_HIT, + .effect = EFFECT_AURA_WHEEL, .power = 110, .type = TYPE_ELECTRIC, .accuracy = 100, diff --git a/src/data/pokemon/base_stats.h b/src/data/pokemon/base_stats.h index 141631643..0014b4437 100644 --- a/src/data/pokemon/base_stats.h +++ b/src/data/pokemon/base_stats.h @@ -6848,7 +6848,7 @@ const struct BaseStats gBaseStats[] = .growthRate = GROWTH_MEDIUM_SLOW, .eggGroup1 = EGG_GROUP_BUG, .eggGroup2 = EGG_GROUP_BUG, - .abilities = {ABILITY_STURDY, ABILITY_NONE}, + .abilities = {ABILITY_HUNGER_SWITCH, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_YELLOW, .noFlip = FALSE, @@ -7552,7 +7552,7 @@ const struct BaseStats gBaseStats[] = .growthRate = GROWTH_FAST, .eggGroup1 = EGG_GROUP_FIELD, .eggGroup2 = EGG_GROUP_FIELD, - .abilities = {ABILITY_OWN_TEMPO, ABILITY_NONE}, + .abilities = {ABILITY_HUNGER_SWITCH, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, From 5141e84296caff64a298cb46d1cb7f06cd6f35b3 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 3 Nov 2021 20:01:09 +1300 Subject: [PATCH 41/81] Fix base stats Clean up mess from testing. --- src/data/pokemon/base_stats.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/pokemon/base_stats.h b/src/data/pokemon/base_stats.h index 0014b4437..141631643 100644 --- a/src/data/pokemon/base_stats.h +++ b/src/data/pokemon/base_stats.h @@ -6848,7 +6848,7 @@ const struct BaseStats gBaseStats[] = .growthRate = GROWTH_MEDIUM_SLOW, .eggGroup1 = EGG_GROUP_BUG, .eggGroup2 = EGG_GROUP_BUG, - .abilities = {ABILITY_HUNGER_SWITCH, ABILITY_NONE}, + .abilities = {ABILITY_STURDY, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_YELLOW, .noFlip = FALSE, @@ -7552,7 +7552,7 @@ const struct BaseStats gBaseStats[] = .growthRate = GROWTH_FAST, .eggGroup1 = EGG_GROUP_FIELD, .eggGroup2 = EGG_GROUP_FIELD, - .abilities = {ABILITY_HUNGER_SWITCH, ABILITY_NONE}, + .abilities = {ABILITY_OWN_TEMPO, ABILITY_NONE}, .safariZoneFleeRate = 0, .bodyColor = BODY_COLOR_WHITE, .noFlip = FALSE, From b9c23f7c62d74570bf62987c9fc58091b27f21e7 Mon Sep 17 00:00:00 2001 From: Blackforest92 Date: Wed, 3 Nov 2021 16:29:09 +0700 Subject: [PATCH 42/81] Update waterfall, trick room, & focus blast BG --- data/battle_anim_scripts.s | 18 ++++++++++++-- .../battle_anims/backgrounds/dark_void.bin | Bin 2048 -> 0 bytes .../battle_anims/backgrounds/dark_void.pal | 19 --------------- .../battle_anims/backgrounds/dark_void.png | Bin 7041 -> 0 bytes .../backgrounds/new/dark_void.bin | Bin 2048 -> 2048 bytes .../backgrounds/new/dark_void.pal | 16 ++++++------- .../backgrounds/new/dark_void.png | Bin 7041 -> 0 bytes .../backgrounds/new/focus_blast.bin | Bin 896 -> 896 bytes .../backgrounds/new/focus_blast.png | Bin 3537 -> 984 bytes .../backgrounds/new/magic_room.pal | 12 +++++----- .../backgrounds/new/trick_room.bin | Bin 896 -> 896 bytes .../backgrounds/new/trick_room.pal | 12 +++++----- .../backgrounds/new/trick_room.png | Bin 2137 -> 1718 bytes .../backgrounds/new/waterfall.bin | Bin 2048 -> 2048 bytes .../backgrounds/new/waterfall.pal | 8 +++---- .../backgrounds/new/waterfall.png | Bin 5092 -> 814 bytes .../backgrounds/new/wonder_room.pal | 12 +++++----- .../battle_anims/backgrounds/trick_room.png | Bin 2043 -> 0 bytes .../backgrounds/trick_room_map.bin | Bin 1280 -> 0 bytes include/graphics.h | 1 - src/battle_anim.c | 2 +- src/graphics.c | 22 +++++------------- 22 files changed, 53 insertions(+), 69 deletions(-) delete mode 100644 graphics/battle_anims/backgrounds/dark_void.bin delete mode 100644 graphics/battle_anims/backgrounds/dark_void.pal delete mode 100644 graphics/battle_anims/backgrounds/dark_void.png delete mode 100644 graphics/battle_anims/backgrounds/new/dark_void.png delete mode 100644 graphics/battle_anims/backgrounds/trick_room.png delete mode 100644 graphics/battle_anims/backgrounds/trick_room_map.bin diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 03d72f3ea..cfe95371d 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1893,7 +1893,7 @@ Move_AURA_SPHERE: monbg ANIM_ATK_PARTNER monbgprio_28 ANIM_ATTACKER setalpha 12, 8 - call SetHighSpeedBg + call SetAuraSphereBG playsewithpan SE_M_SKY_UPPERCUT, 0 delay 60 createsprite gAuraSphereBlast, ANIM_TARGET, 3, 0 @@ -1908,6 +1908,10 @@ Move_AURA_SPHERE: delay 1 end +SetAuraSphereBG: + fadetobg BG_AURA_SPHERE + goto SetHighSpeedBgFade + Move_ROCK_POLISH: loadspritegfx ANIM_TAG_WHITE_STREAK loadspritegfx ANIM_TAG_SPARKLE_3 @@ -2378,7 +2382,7 @@ Move_FOCUS_BLAST: monbg ANIM_ATK_PARTNER monbgprio_28 ANIM_ATTACKER setalpha 12, 8 - call SetHighSpeedBg + call SetFocusBlastBG createsprite gSuperpowerOrbSpriteTemplate, ANIM_TARGET, 2, 0 playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER waitforvisualfinish @@ -2391,6 +2395,10 @@ Move_FOCUS_BLAST: delay 1 end +SetFocusBlastBG: + fadetobg BG_FOCUS_BLAST + goto SetHighSpeedBgFade + Move_ENERGY_BALL: loadspritegfx ANIM_TAG_ENERGY_BALL monbg ANIM_TARGET @@ -3437,6 +3445,7 @@ Move_GUNK_SHOT: monbg ANIM_DEF_PARTNER monbgprio_28 ANIM_TARGET setalpha 12, 8 + call SetGunkShotBG createvisualtask AnimTask_ShakeMon 5, 5, ANIM_ATTACKER, 0, 2, 40, 1 delay 6 panse_1B SE_M_HYDRO_PUMP, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 0 @@ -3464,6 +3473,7 @@ Move_GUNK_SHOT: call GunkShotImpact call PoisonBubblesEffect waitforvisualfinish + call UnsetHighSpeedBg clearmonbg ANIM_DEF_PARTNER blendoff end @@ -3479,6 +3489,10 @@ GunkShotImpact: createsprite gGunkShotImpactSpriteTemplate, 4, 4, 0, 15, 1, 1 createsprite gGunkShotImpactSpriteTemplate, 4, 4, 0, -15, 1, 1 return +SetGunkShotBG: + fadetobg BG_GUNK_SHOT + goto SetHighSpeedBgFade + Move_IRON_HEAD: loadspritegfx ANIM_TAG_GUST diff --git a/graphics/battle_anims/backgrounds/dark_void.bin b/graphics/battle_anims/backgrounds/dark_void.bin deleted file mode 100644 index 97b879f01ba8ebc08c92d30497c894a1a7b186c8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2048 zcmeH`W0Rg)6h-HaZF8-pgO1IPZM$RJwr!_l+qP|IY}=lBlA3=pUAJznefB-)!?{&E zL<~a2Bo?uWLtNq!p9CZ%5s3poNpO>rjO3&sC8Q3JlqG_4l&1m}sYGR}P?c&_rv^2t zMQ!R(mwMEv0S#$HW17&EW;CY-Eont-+7L-w+R>g4bfgoV=|We!(VZUjq!+#ELtpyQ zp8*VH5Q7=QP=+y_5sYLMqZz|k#xb4=Ok@(1nZi`2F`XIAWEQiT!(8Sup9L&r5sO*E zQkJot6|7_xQNhoISj`&NvMx{|*0X_)Y+^H8*c#N^*#64j!A^Fun?3AhANx7LK@M@4 zBOK)z$2q}CPH~zuoaG$nxxhs(ahWSz$y!A)*)n>*a)9`|{`Lmu&%Cp_gD&w0V? zyuq8i#oN5YyS&Hye87i%#K(NXr+miee8HD|#n*hpw|vL<{J@X=#LxV~ul&aE{K236 z#ozqHYle(rOk)|_IL0-e@l9Yt6Pef~CN-JKO<_t?nc6g_HJ$0rU`8{U*(_!iHJjND zGlx0NWp2aGV_x%_-vSo2kcBN`QHxpJ5|%VXDN9=>V2HATddZh3!g7|kLQq$^Beaj3%_?g&RZ%F&K-tm7Q-1SdMl$xd;q z)12-MXFAK-&T+2uobLh`y2!;YajDB(?h04B$|zU6#JKX6m zce}^E?sLBfJm?`0d&Hw2^SCEG=_yZp#3~?@CWcYb6c+pE<_KH`%=5=p)(_7y5 ij(5H1eINMHM?Ut6PkrWdUj%c}`H#+jbpHRZ`TrM_mOTvs diff --git a/graphics/battle_anims/backgrounds/dark_void.pal b/graphics/battle_anims/backgrounds/dark_void.pal deleted file mode 100644 index f4cf0f09d..000000000 --- a/graphics/battle_anims/backgrounds/dark_void.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -0 0 0 -131 131 131 -123 123 123 -115 115 115 -106 106 106 -98 98 98 -82 82 82 -65 65 65 -49 49 49 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/battle_anims/backgrounds/dark_void.png b/graphics/battle_anims/backgrounds/dark_void.png deleted file mode 100644 index 2922f89d3f24a6bb835fe3b53f62bedbd96029c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7041 zcmV-{8-C=8P)006)Q0{{R3aTRq$0000mP)t-s0001k zgM)i}dvkMhYHDg?Vq#KKQb9pMF)=X!0000000000000000000000000>A(T!000{d zNklBzMqy1kG@V5U84&UNd|U`m`u70$}21}xN$w$UEm45-Eua7F4Dl_ z%}U3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ZRV6j_>{*vB$YrU?s(9LhO> zn1i~-_^2l*0wh?IO-q{bFWC{a(SNGdBh(3$)j4x4h-1S=&#+<#%Z{&%g?6Hmq#x(jZ!Tv05bu4G6!=3 znzF6O!2lw?YVv+&&%qGJ*Xib8hh-oai>j$FOuZ>P4(f>-$*Sl=XWO26^7hZ%LU`Ue1pWPEcy7al?v4t>x4R=garM z4sYeG&k!}I^(iTm_4%cpj8m;m^LLsi$Nap$Pydef@)Y76r_-0DVRiCSE18k~SbzNW z`F6W(TklV4nO5hY?Zfo8ZGWd(ax6znR@zgu{_MfLaqINuqGnF^v-JW}+6)aJQ8~e4*&5gei08>zCy;%T@}2N=__hPklXf ziu4A;q~YGkW%mdtJtQmcV8+sA_3}2))*X1H7IR(#BMrx(L}*w4Ht~l3hQG}yPOf$N zR{gbKuB)vAk3%rL_@?uc7-?E&;vuqI+5v+#&%T^Y%I-b*JCS$2GmrRozg1mDQaKpD zrcRO7%d)A&_uvTiU_YF?cTmz6L)5|ml|r}m z=_pn8>vg4?>cvmJ^tGJTRnvS2qA>_$n3Z)|1Z-&U5!kMGs{e8ciXi(dTksxp1E2r7 z=Xe`U8~X9E+X}B+*)xRK_2QxKcQHh@$JgDmE$g)UQ7w7)eDbHQD_rTLAw>Gj6<-u4 z!O-3$l)l|6(YEIwjaZiVPhgu2|8`KQBE5XMg&RD<8;|{51mr(}^*xu`&v?4{7;WEl zia&yN^1Qf}PkEj)TIj3zNATgqTdwUnMTVTJZK`{kwk`gjVE?U-N&Bx3a`OKLhvt=l fY?_!zfAanZtmW~3kuXOo00000NkvXXu0mjf6ZK=N diff --git a/graphics/battle_anims/backgrounds/new/dark_void.bin b/graphics/battle_anims/backgrounds/new/dark_void.bin index 97b879f01ba8ebc08c92d30497c894a1a7b186c8..274b971db6077f17e2f02b8620be277d724c249b 100644 GIT binary patch literal 2048 zcmajcRaOE300q$_1|}sYNQl6IV-XS(``?x9;GOxrpR;%8){TFzUAc7OuXATkogDgc zANMq@`@Y%p)v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6aa0b26a6 100644 --- a/graphics/battle_anims/backgrounds/new/dark_void.pal +++ b/graphics/battle_anims/backgrounds/new/dark_void.pal @@ -2,14 +2,14 @@ JASC-PAL 0100 16 0 0 0 -131 131 131 -123 123 123 -115 115 115 -106 106 106 -98 98 98 -82 82 82 -65 65 65 -49 49 49 +48 48 48 +72 72 72 +88 88 88 +120 120 120 +0 0 0 +0 0 0 +0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/graphics/battle_anims/backgrounds/new/dark_void.png b/graphics/battle_anims/backgrounds/new/dark_void.png deleted file mode 100644 index 2922f89d3f24a6bb835fe3b53f62bedbd96029c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7041 zcmV-{8-C=8P)006)Q0{{R3aTRq$0000mP)t-s0001k zgM)i}dvkMhYHDg?Vq#KKQb9pMF)=X!0000000000000000000000000>A(T!000{d zNklBzMqy1kG@V5U84&UNd|U`m`u70$}21}xN$w$UEm45-Eua7F4Dl_ z%}U3h^CuAfBZwr=#hQfqeZuz=QVuE{M9hV|ED48$qAuTnVz0RKzKbmmnh5^CgH(Vq zMy9KEC1n2{sNF&A%J5VH zKv#eoAw#jg1rrb3lI#Mg`AC*U2|2g`P)TI`1Y)8w0MR3ex(4aMNE4uibRQ`)FClK#gz^0m$wk3<(nP ziGdW@D=`?fOekRzbRd*4(%j$<`W*C0pdA~*9C@3Ms&$EC6jr9(k3s76*IRQ{x?JQHr187nPAc1&iDVt%HMF6gPkO(kc=^>FL$H#UufJT6A z4yw5$dppb1G4?rVa?k`2;=Kc14sI;$>piGQ#mWe&9)*Ey=h#prG&fu$(EwZuFwSiN zHQ#|ivLuT#j~EDw0#5X ze(0K#g)FTDeaS7|C4O=8zx|psYq)8%5ht&O;8$m`zc+n`Wl5$pR(hAVte*G%d7bue@0=WopDH zCw62zUU-(|Q{Qr90F!`5jk}g#S34W6K0-ZD0n}vKR8e`DWu~*qQY9?qsY)?`v%&^& zZ@t#pEU#zDOm^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z6L)5|ml|r}m z=_pn8>vg4?>cvmJ^tGJTRnvS2qA>_$n3Z)|1Z-&U5!kMGs{e8ciXi(dTksxp1E2r7 z=Xe`U8~X9E+X}B+*)xRK_2QxKcQHh@$JgDmE$g)UQ7w7)eDbHQD_rTLAw>Gj6<-u4 z!O-3$l)l|6(YEIwjaZiVPhgu2|8`KQBE5XMg&RD<8;|{51mr(}^*xu`&v?4{7;WEl zia&yN^1Qf}PkEj)TIj3zNATgqTdwUnMTVTJZK`{kwk`gjVE?U-N&Bx3a`OKLhvt=l fY?_!zfAanZtmW~3kuXOo00000NkvXXu0mjf6ZK=N diff --git a/graphics/battle_anims/backgrounds/new/focus_blast.bin b/graphics/battle_anims/backgrounds/new/focus_blast.bin index 98e3e8e16b63fe73c0fb8cc7adc2cc1630bd3359..25c569a1465844e30b2dbf039894446f4cc7e984 100644 GIT binary patch literal 896 zcmWN|S35EQ00rPDlqf2DJ8^L2*dbeHWbe%EUH|{?``-IEfB-5`i7EsULN&suK`kPP zq7LaA z#ZGpxoo#Go3!B-*Mm8|PIDsVk&<|n&gBXG^j1)#-jA9Jq80Q#AX^t?(VTwZ>PSaE^nv%C_nvp1^NzQ@mB`s@3t6KGnm%ZdgFL>S=&w17}PJ7x@p7eyFr25n^YCwY;k~FN8 zMr4g@Oye5&m`81oIOSo>Lmu>i>3;V)X*jNg8q}yJHLFFfYE!#9)Tu6Yt4F=+b&tE< zBomp*LRPX7L3VPGlU(E`Pf#Rz$w&Th7oZ@8C`=KGQjFr1 z0Hh?PLPk-V=)h7YP+7`Ro(fc?5|yb!RjN^)8q}l~wZov8qknNG^PnnX-0Ee z5JN02X+>+=5Jy|u(Vh-;q!XQqrwd)_Mt6G9lV0?u4}IxJe+Dp+K@4UHLm9?!Mlh05 zjAjgDNnjk~nZQIQF_|e$Wg63&!AugF#cbvmXSEO(fD_KP{ zt69TZ*0G)qY-AIg*}_(~@i33@D37t79qeQmkMjgi@)S?=47=IGvpmQ1yue=e@ggs= zp937^5HIrzucqj=)P6ms-$=dQ4E+{|Il@tn1%8`%LLN`a6M;^0iqo9oUEbq;KHx0p z_>hnIm{0hW&p6KoJ`ehWi(KMMzT#`X;d00;T;&?qxxu%5$M^h@+CTCWH@U^n{KBvN z7IZt%9e(Ez{^T$I<{$2IkAL}(|GCdYrZKJQOm7A=n#s&&F{{~(FuOU-X)be{$4K*< z&-@m!poJ`K5sO;P;+7D#q@|3qw9$d0En`{BS>6g(w33yrVpXeI-5S=kmbI;8UF%uj z1~#;jjcsC6o7vnJ#u#f$TiMz+#@W_(wzorYM>~b=Y`k6UYB#&v!=CoCw|(quKl=v_ zaG--6>=1`K%;Ao3q@x_|7{{96ILAA|iB58|Q=IBFr#r)$COXU6&T+2uobLh`y2!;Y fajDB(?h2D!=_-@MYIRs82CZ?e>s;@K@VC(i6Oa3q diff --git a/graphics/battle_anims/backgrounds/new/focus_blast.png b/graphics/battle_anims/backgrounds/new/focus_blast.png index 8720658a784516bc636fe2156fc769109f312fda..7c8755f59a7d5666663c87dab82325fa8146d99b 100644 GIT binary patch delta 937 zcmV;a16KUe8`uXSiBL{Q4GJ0x0000DNk~Le0001h0000u1Oos70LO{#;E^Fde*g(^ zNLh0L01m_e01m_fl`9S#0009{Nkl8+!moz^9mCiv!i*wgtX?JMlzs8zU^*L!rwKCHTCV2=@AVV(Ql)G3rS7}s-Tb^fub zR)j)P6!=`%+FD!t!h=9-Giq8-)Ro)-|BwtKq5Hb7n<5zN0#=sF&%+Nu7~qOP3k+Oj zYr%G*s|=898!R&jR4xGHhERy!5n?;P5-zkCe_j;{qTYZ#<&84n ziWw*kKMeAbLoZT_5OpyE)ZfGe^i3;#9fv|`rX8UTSkT{yWv4(Fe;)&V9dx&RybD<7 zZD3O(^IY%|&Nnc9ZV(h`mf}2b9&`-t*pB51tirOgT>g}^pdbFicMt_1WdOIAa`0b( zA}g{iw#3uQbR=o3&=qAl`hQRf)eZht1PUX;h(9B)^H`4ZoIJs9vpIW$-4<|rdy8S) zZFdy;eku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r=T=ATm91P-F!l2~yZYRh^1=&MG3!SL1^pz}^T1zDEe=cC8JjYYV zi$Y`eKg`HI&;R>$su>UxomRm}fRI5cH-FzjlqZ0YbSz3f6q{*&O>>6gfKj=lO0M}j z^#}~|-)ISoB{aYx$|UIO9f00OYHlMqrZ+6XTvXbDW5x#wTu<@9ebl`W5{0> zUMw;5$B!?S(m@68SaXrG;#m~(r zfKjykRp>dMAAEAq*K|txKvIH@B!4ql45YFmT`ZLC+d1y5xG_>g!bw{~T}_iE&G-=_ z+1NdnZQDNo_dMu;L3bMSP=59S#!W=re@NVg(jQ*|3^C)@NveY|-T4cEq0zXNnV`h* zUgLikU{nUqkb1q3<&&aYaF@s#C0GMzkl)AG06$z0um$R?htg4T}%J~ N002ovPDHLkV1m*T11kUk diff --git a/graphics/battle_anims/backgrounds/new/waterfall.bin b/graphics/battle_anims/backgrounds/new/waterfall.bin index 076beeff2fe1ba44277bad014102fbcc7c3180bc..eb2085cb29530c90e242b6f08d485c95a2d228ba 100644 GIT binary patch literal 2048 zcmajc*;WAn00!YhB(gVK z<%9PwT{w5{Y{?!CQpBpr@zV5-{k3U z^7J=(`kOrcO`iTHPk)oAzsb|zn>_tZp8h6Jf0L)b$2LD%H+lM- F{2!U)2`~Tv literal 2048 zcmXw21(a1s6yxK%xG#`Ef-dgv?(XjH?(E|3&f@NFEmWZH?nUbEUOIf}nUmZkcix;g zb7mrlgpoAL$&ef=kP@koI`}k5i*!hj42TIXMi~QVLgv6(kQLdG9XXIQxCn9~ci=q8 zi&*4CeiQ&e6ht8iMqv~|Q4~XQlt3Ixq7+J_49cP$%A*1*q7o{j3aX+Ss-p&Kq84hS z4(g&F>Z1V~q7fRS37VoAnxh3;q7_=B4cej|+M@$Hq7yo!3%a5kx}yhrq8ECj5Bj1X z`eOhFVh{#n2!>)9hGPUqViZPW48~#{#$y5|ViG1}3Z`Njreg+XVism&4(4JW;*o&) zSb&9C6!y0mORyBnf?AFhfmdP`R$~p;Vjb3F12$q4HitZdE!c`}*dEp4112^#$p2jnH7SG{%ynq++5?;nDconbVb-aN$ z@fP03J9roG;eC975AhK`#x2~&9o)qy_!OVvb9{j>@fE(tH~1Fc;d}gmAMq1@#xM94 zzu|ZMfj{vV{>DG}7x$2a5hi6aCT9w!WGbd+8m47Bre_AmFe5WDGqW(953?~lBgny= z%*EWy!@P`TKIRWu0fJ;f7NY3jV_ldwOE^VSU2c;tj`8)$VP0;CTz-PY|a*J$yRL5Hf+mwY|jqt$WH9c zF6_!~?9LwS$zJTuKJ3eW?9Txl$Uz*;AsotK9L^CO$x$55F&xWr9M1`y$Vr^cDV)k_ zoX#1X$yuDuIh@ORjAsJpa{(7}5f^g_mvR}Ga|Ks&6<2c&*K!@#a|1VW6E|}Uw{jb| za|aW-le@T^d%`aE2JGX09tiay5AiUM@FpYn4`pKUtyWftP8imS}NMi?mP+G+zmd z*F4SD9L?4&&D0D{*ECJl6iwD7O$;;l1l%9HLrv5!?Nnk=JHm;^JnU@OHf`0GsN1Yf z+Ncd$uXS3hH6c6oaMpuW!Yhxi_Q0Lg2_4rl9Sw8hqw|jFuny^<4rssjX|G<<%X&#K z>IFTo=k%Iprr$8=rS^r#-uRbA0#UD8Ee(0QHHS)I{o{h;sloxasK z`dVMJeZl8_&S!nbr+q5qCj(CSxR3d$kNB_;`Cv#6c)$0B Hx;NlI69yLt diff --git a/graphics/battle_anims/backgrounds/new/waterfall.pal b/graphics/battle_anims/backgrounds/new/waterfall.pal index 1ae2f0ef9..69a25c589 100644 --- a/graphics/battle_anims/backgrounds/new/waterfall.pal +++ b/graphics/battle_anims/backgrounds/new/waterfall.pal @@ -2,10 +2,10 @@ JASC-PAL 0100 16 0 0 0 -131 205 230 -123 180 213 -115 156 205 -115 139 164 +128 200 232 +120 176 216 +112 152 200 +112 136 160 0 0 0 0 0 0 0 0 0 diff --git a/graphics/battle_anims/backgrounds/new/waterfall.png b/graphics/battle_anims/backgrounds/new/waterfall.png index 2fa27759f34a96ef3f362b934933b038629c3501..3dd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ictq?m%nRXbDmgk}eZ?pxKT zLG$tIG+HKl)AjWCaNWCF$ZYup`91G*;gkY{aCvenWnIN!>^63KP{7OHORdkU1rLhN z{e49tzGx!b)$-2MC9f4N&wClF)Z@zko-F!kn8>vkV=gjRhNaCBRu3#MwQAxrg?HHY zTjhMQM?@GK{f-1KQx9L#Ul!jylt2->wZQRhcP2WShU|omg#$$6KMCgnWk!UT6S1IaD@&dxDlMyON|85fHe3i04To!5(R z<+#SQhF)(A)42-(^o;k=925$YNldTnrqu+q2U&+kqz)%ocFbv)#0teNTh44OS3G#a>i(Fk+TLn*4w+x S`O;MX>!Y!D&bBNJ5c3m?gK+-< diff --git a/graphics/battle_anims/backgrounds/trick_room_map.bin b/graphics/battle_anims/backgrounds/trick_room_map.bin deleted file mode 100644 index 3d0041baaa897abd0ec1395b944b28a804c89c2f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1280 zcmeIuMVA#<6hPs|-Q7Q&;1b;3-GW1Kcc+11!QF#HBf+I{|7DzaCop30CQP`s_CDuU ztv#uN3MiN*IdKXp>^nt%*fZ~ce$Vtp6_YKQzPJ*yCDWHwO15PB(#pt|OkY+x6`gOb1k&gN^5Pj)lPdI{Hdc(I_sjV zZo2ECr(SyNqi@{$1^rV$z(9ixHpEcF3^&3^ql`AjSmTU0!9JPXB~= z*&W^!-*W8@a_vk0H+g^Zfz%&#$YDnu4Igvd2`8P3{j@XAI_G@y1s7xg&!zBXSHf3a zOZ{~>+;mHx+wO$#x)=W6eGg(j^eFt;lW?A=$Z`18v@_QfB V{Fwa7=QO`0e+}pSKEM1Ad;`R~qc8vf diff --git a/include/graphics.h b/include/graphics.h index 78d9f2c42..34eef131e 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4941,7 +4941,6 @@ extern const u32 gBattleAnimBgImage_SpacialRend[]; extern const u32 gBattleAnimBgPalette_SpacialRend[]; extern const u32 gBattleAnimBgTilemap_SpacialRendOpponent[]; extern const u32 gBattleAnimBgTilemap_SpacialRendPlayer[]; -extern const u32 gBattleAnimBgImage_DarkVoid[]; extern const u32 gBattleAnimBgPalette_DarkVoid[]; extern const u32 gBattleAnimBgTilemap_DarkVoid[]; extern const u32 gBattleAnimBgPalette_Dark[]; diff --git a/src/battle_anim.c b/src/battle_anim.c index 44a382296..b52ef0592 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -2059,7 +2059,7 @@ const struct BattleAnimBackground gBattleAnimBackgroundTable[] = [BG_ROCK_WRECKER] = {gBattleAnimBgImage_Hurricane, gBattleAnimBgPalette_RockWrecker, gBattleAnimBgTilemap_Hurricane}, [BG_SPACIAL_REND_ON_OPPONENT] = {gBattleAnimBgImage_SpacialRend, gBattleAnimBgPalette_SpacialRend, gBattleAnimBgTilemap_SpacialRendOpponent}, [BG_SPACIAL_REND_ON_PLAYER] = {gBattleAnimBgImage_SpacialRend, gBattleAnimBgPalette_SpacialRend, gBattleAnimBgTilemap_SpacialRendPlayer}, - [BG_DARK_VOID] = {gBattleAnimBgImage_DarkVoid, gBattleAnimBgPalette_DarkVoid, gBattleAnimBgTilemap_DarkVoid}, + [BG_DARK_VOID] = {gBattleAnimBgImage_Waterfall, gBattleAnimBgPalette_DarkVoid, gBattleAnimBgTilemap_DarkVoid}, [BG_WATER] = {gBattleAnimBgImage_HydroPump, gBattleAnimBgPalette_HydroPump, gBattleAnimBgTilemap_HydroPump}, [BG_NIGHTMARE] = {gBattleAnimBgImage_Nightmare, gBattleAnimBgPalette_Nightmare, gBattleAnimBgTilemap_Nightmare}, [BG_LEAF_STORM] = {gBattleAnimBgImage_LeafStorm, gBattleAnimBgPalette_LeafStorm, gBattleAnimBgTilemap_LeafStorm}, diff --git a/src/graphics.c b/src/graphics.c index 5ba3af42b..153d75c71 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1397,10 +1397,6 @@ const u32 gBattleAnimBgPalette_MagmaStorm[] = INCBIN_U32("graphics/battle_anims/ //new battle bgs const u32 gBattleAnimBgPalette_GigaImpact[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact.gbapal.lz"); -//const u32 gBattleAnimBgImage_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room.4bpp.lz"); -//const u32 gBattleAnimBgPalette_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room.gbapal.lz"); -//const u32 gBattleAnimBgTilemap_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/trick_room_map.bin.lz"); - const u32 gBattleAnimBgImage_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.4bpp.lz"); const u32 gBattleAnimBgPalette_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.gbapal.lz"); const u32 gBattleAnimBgTilemap_Hurricane[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/hurricane.bin.lz"); @@ -1412,11 +1408,6 @@ const u32 gBattleAnimBgPalette_SpacialRend[] = INCBIN_U32("graphics/battle_anims const u32 gBattleAnimBgTilemap_SpacialRendOpponent[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/spacial_rend_opponent.bin.lz"); const u32 gBattleAnimBgTilemap_SpacialRendPlayer[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/spacial_rend_player.bin.lz"); -const u32 gBattleAnimBgImage_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/dark_void.4bpp.lz"); -const u32 gBattleAnimBgPalette_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/dark_void.gbapal.lz"); -const u32 gBattleAnimBgTilemap_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/dark_void.bin.lz"); - - const u32 gBattleAnimBgPalette_SludgeWave[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/sludge_wave.gbapal.lz"); const u32 gBattleAnimBgImage_Aeroblast[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/aeroblast_tiles.4bpp.lz"); @@ -1441,10 +1432,6 @@ const u32 gBattleAnimBgImage_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle const u32 gBattleAnimBgPalette_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/clangorous_soulblaze.gbapal.lz"); const u32 gBattleAnimBgTilemap_ClangorousSoulblaze[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/clangorous_soulblaze.bin.lz"); -//const u32 gBattleAnimBgImage_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.4bpp.lz"); -//const u32 gBattleAnimBgPalette_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.gbapal.lz"); -//const u32 gBattleAnimBgTilemap_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.bin.lz"); - const u32 gBattleAnimBgPalette_DynamaxCannon[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dynamax_cannon.gbapal.lz"); const u32 gBattleAnimBgImage_ElectricTerrain[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/electric_terrain.4bpp.lz"); @@ -1497,8 +1484,6 @@ const u32 gBattleAnimBgImage_LeafStorm[] = INCBIN_U32("graphics/battle_anims/bac const u32 gBattleAnimBgPalette_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/leaf_storm.gbapal.lz"); const u32 gBattleAnimBgTilemap_LeafStorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/leaf_storm.bin.lz"); -const u32 gBattleAnimBgPalette_MagicRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/magic_room.gbapal.lz"); - const u32 gBattleAnimBgImage_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.4bpp.lz"); const u32 gBattleAnimBgPalette_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.gbapal.lz"); const u32 gBattleAnimBgTilemap_MaliciousMoonsault[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/malicious_moonsault.bin.lz"); @@ -1553,6 +1538,10 @@ const u32 gBattleAnimBgImage_TrickRoom[] = INCBIN_U32("graphics/battle_anims/bac const u32 gBattleAnimBgPalette_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/trick_room.gbapal.lz"); const u32 gBattleAnimBgTilemap_TrickRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/trick_room.bin.lz"); +const u32 gBattleAnimBgPalette_MagicRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/magic_room.gbapal.lz"); + +const u32 gBattleAnimBgPalette_WonderRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/wonder_room.gbapal.lz"); + const u32 gBattleAnimBgImage_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.4bpp.lz"); const u32 gBattleAnimBgPalette_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.gbapal.lz"); const u32 gBattleAnimBgTilemap_TwinkleTackle[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/twinkle_tackle.bin.lz"); @@ -1565,7 +1554,8 @@ const u32 gBattleAnimBgImage_Waterfall[] = INCBIN_U32("graphics/battle_anims/bac const u32 gBattleAnimBgPalette_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/waterfall.gbapal.lz"); const u32 gBattleAnimBgTilemap_Waterfall[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/waterfall.bin.lz"); -const u32 gBattleAnimBgPalette_WonderRoom[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/wonder_room.gbapal.lz"); +const u32 gBattleAnimBgPalette_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.gbapal.lz"); +const u32 gBattleAnimBgTilemap_DarkVoid[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/dark_void.bin.lz"); const u32 gBattleAnimBgImage_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_activate.4bpp.lz"); const u32 gBattleAnimBgPalette_ZMoveActivate[] = INCBIN_U32("graphics/battle_anims/backgrounds/new/zmove_activate.gbapal.lz"); From 7e6e23005be4bbfbffda03be99c5db0c64ae892d Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 3 Nov 2021 13:59:26 -0400 Subject: [PATCH 43/81] fix clear body --- src/battle_script_commands.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2ee80557f..500b7cab0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2586,7 +2586,7 @@ void SetMoveEffect(bool32 primary, u32 certain) s32 i, byTwo, affectsUser = 0; bool32 statusChanged = FALSE; bool32 mirrorArmorReflected = (GetBattlerAbility(gBattlerTarget) == ABILITY_MIRROR_ARMOR); - u32 flags; + u32 flags = 0; switch (gBattleScripting.moveEffect) // Set move effects which happen later on { @@ -3017,7 +3017,7 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SP_DEF_MINUS_1: case MOVE_EFFECT_ACC_MINUS_1: case MOVE_EFFECT_EVS_MINUS_1: - flags = affectsUser | certain; + flags = affectsUser; if (mirrorArmorReflected && !affectsUser) flags |= STAT_BUFF_ALLOW_PTR; @@ -3064,7 +3064,7 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SP_DEF_MINUS_2: case MOVE_EFFECT_ACC_MINUS_2: case MOVE_EFFECT_EVS_MINUS_2: - flags = affectsUser | certain; + flags = affectsUser; if (mirrorArmorReflected && !affectsUser) flags |= STAT_BUFF_ALLOW_PTR; if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(2) | STAT_BUFF_NEGATIVE, @@ -9567,7 +9567,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr bool32 certain = FALSE; bool32 notProtectAffected = FALSE; u32 index; - bool32 affectsUser = flags & MOVE_EFFECT_AFFECTS_USER; + bool32 affectsUser = (flags & MOVE_EFFECT_AFFECTS_USER); if (affectsUser) gActiveBattler = gBattlerAttacker; From 48c29a9cd823ea7d9b000c493ef52e925c467aba Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 3 Nov 2021 15:05:52 -0400 Subject: [PATCH 44/81] proper mirror armor sticky web targeting --- asm/macros/battle_script.inc | 4 ++-- data/battle_scripts_1.s | 5 +++-- include/battle.h | 1 + include/constants/battle_script_commands.h | 2 +- src/battle_main.c | 8 ++++++++ src/battle_script_commands.c | 24 +++++++--------------- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 6b2c248db..328780f53 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1839,8 +1839,8 @@ various BS_ATTACKER, VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER .endm - .macro getrandommirrorarmortarget - various BS_TARGET, VARIOUS_GET_RANDOM_MIRROR_ARMOR_TARGET + .macro setattackertostickywebuser + various BS_TARGET, VARIOUS_SET_ATTACKER_STICKY_WEB_USER .endm .macro getrototillertargets ptr:req diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index eb80a41d5..36ae4d967 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2910,10 +2910,11 @@ BattleScript_MirrorArmorReflectWontFall: copybyte gBattlerTarget, gBattlerAttacker @ STRINGID_STATSWONTDECREASE uses target goto BattleScript_MirrorArmorReflectPrintString +@ gBattlerTarget is battler with Mirror Armor BattleScript_MirrorArmorReflectStickyWeb: call BattleScript_AbilityPopUp - getrandommirrorarmortarget - jumpifbyteequal gBattlerTarget, gBattlerAttacker, BattleScript_AbilityNoSpecificStatLossPrint + setattackertostickywebuser + jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_StickyWebOnSwitchInEnd @ Sticky web user not on field -> no stat loss goto BattleScript_MirrorArmorReflectStatLoss BattleScript_StatDown:: diff --git a/include/battle.h b/include/battle.h index 5e5aa2479..770d826a5 100644 --- a/include/battle.h +++ b/include/battle.h @@ -612,6 +612,7 @@ struct BattleStruct struct StolenItem itemStolen[PARTY_SIZE]; // Player's team that had items stolen (two bytes per party member) u8 blunderPolicy:1; // should blunder policy activate u8 ballSpriteIds[2]; // item gfx, window gfx + u8 stickyWebUser; }; #define GET_MOVE_TYPE(move, typeArg) \ diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 5034c4f56..3b4495208 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -197,7 +197,7 @@ #define VARIOUS_UPDATE_ABILITY_POPUP 124 #define VARIOUS_JUMP_IF_WEATHER_AFFECTED 125 #define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 126 -#define VARIOUS_GET_RANDOM_MIRROR_ARMOR_TARGET 127 +#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 127 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_main.c b/src/battle_main.c index ad02854bd..f1adb1bfb 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -2933,6 +2933,8 @@ static void BattleStartClearSetData(void) gBattleStruct->mega.triggerSpriteId = 0xFF; + gBattleStruct->stickyWebUser = 0xFF; + for (i = 0; i < PARTY_SIZE; i++) { gBattleStruct->usedHeldItems[i][0] = 0; @@ -3030,6 +3032,9 @@ void SwitchInClearSetData(void) gBattleStruct->lastTakenMoveFrom[gActiveBattler][3] = 0; gBattleStruct->lastMoveFailed &= ~(gBitTable[gActiveBattler]); gBattleStruct->palaceFlags &= ~(gBitTable[gActiveBattler]); + + if (gActiveBattler == gBattleStruct->stickyWebUser) + gBattleStruct->stickyWebUser = 0xFF; // Switched into sticky web user slot so reset it for (i = 0; i < gBattlersCount; i++) { @@ -3127,6 +3132,9 @@ void FaintClearSetData(void) gBattleStruct->lastTakenMoveFrom[gActiveBattler][3] = 0; gBattleStruct->palaceFlags &= ~(gBitTable[gActiveBattler]); + + if (gActiveBattler == gBattleStruct->stickyWebUser) + gBattleStruct->stickyWebUser = 0xFF; // User of sticky web fainted, so reset the stored battler ID for (i = 0; i < gBattlersCount; i++) { diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 500b7cab0..3d5786b35 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9015,24 +9015,13 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; } return; - case VARIOUS_GET_RANDOM_MIRROR_ARMOR_TARGET: - i = BATTLE_OPPOSITE(gActiveBattler); - gBattlerAttacker = gBattlerTarget; - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) - { - if (IsBattlerAlive(i) - && !(gBattleMons[i].status2 & STATUS2_SUBSTITUTE)) - gBattlerAttacker = i; - else if (IsBattlerAlive(BATTLE_PARTNER(i)) - && !(gBattleMons[BATTLE_PARTNER(i)].status2 & STATUS2_SUBSTITUTE)) - gBattlerAttacker = BATTLE_PARTNER(i); - } - else - { - if (IsBattlerAlive(i) && !(gBattleMons[i].status2 & STATUS2_SUBSTITUTE)) - gBattlerAttacker = i; - } + case VARIOUS_SET_ATTACKER_STICKY_WEB_USER: + // For Mirror Armor: "If the Pokémon with this Ability is affected by Sticky Web, the effect is reflected back to the Pokémon which set it up. + // If Pokémon which set up Sticky Web is not on the field, no Pokémon have their Speed lowered." + gBattlerAttacker = gBattlerTarget; // Initialize 'fail' condition SET_STATCHANGER(STAT_SPEED, 1, TRUE); + if (gBattleStruct->stickyWebUser != 0xFF) + gBattlerAttacker = gBattleStruct->stickyWebUser; break; } @@ -11590,6 +11579,7 @@ static void Cmd_setstickyweb(void) { gSideStatuses[targetSide] |= SIDE_STATUS_STICKY_WEB; gSideTimers[targetSide].stickyWebAmount = 1; + gBattleStruct->stickyWebUser = gBattlerAttacker; // For Mirror Armor gBattlescriptCurrInstr += 5; } } From f0d7c75ec899bf3962794eb19f2be9b1f8099222 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 3 Nov 2021 17:48:04 -0300 Subject: [PATCH 45/81] Syntax corrections --- data/battle_scripts_1.s | 2 +- src/battle_util.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 8c3e744c1..aa6c10bcb 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1925,7 +1925,7 @@ BattleScript_MimicryLoop_NextBattler: addbyte gBattlerTarget, 0x1 jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_MimicryLoopIter restoretarget - end + goto BattleScript_MoveEnd BattleScript_EffectTopsyTurvy: attackcanceler diff --git a/src/battle_util.c b/src/battle_util.c index 00e323d20..45cba507b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2319,8 +2319,10 @@ u8 DoFieldEndTurnEffects(void) { gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT); for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { if (GetBattlerAbility(i) == ABILITY_MIMICRY) RestoreBattlerOriginalTypes(i); + } BattleScriptExecute(BattleScript_ElectricTerrainEnds); effect++; } @@ -2332,8 +2334,10 @@ u8 DoFieldEndTurnEffects(void) { gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN); for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { if (GetBattlerAbility(i) == ABILITY_MIMICRY) RestoreBattlerOriginalTypes(i); + } BattleScriptExecute(BattleScript_MistyTerrainEnds); effect++; } @@ -2347,8 +2351,10 @@ u8 DoFieldEndTurnEffects(void) { gFieldStatuses &= ~(STATUS_FIELD_GRASSY_TERRAIN); for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { if (GetBattlerAbility(i) == ABILITY_MIMICRY) RestoreBattlerOriginalTypes(i); + } } BattleScriptExecute(BattleScript_GrassyTerrainHeals); effect++; @@ -2361,8 +2367,10 @@ u8 DoFieldEndTurnEffects(void) { gFieldStatuses &= ~(STATUS_FIELD_PSYCHIC_TERRAIN); for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { if (GetBattlerAbility(i) == ABILITY_MIMICRY) RestoreBattlerOriginalTypes(i); + } BattleScriptExecute(BattleScript_PsychicTerrainEnds); effect++; } From 5a855db4ad97a8bebfd3c1eb7135162c2c1c3997 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Thu, 4 Nov 2021 11:08:37 +1300 Subject: [PATCH 46/81] Fix prototype of CanBePoisoned --- include/battle_util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/battle_util.h b/include/battle_util.h index 86fe789f0..d0a9d8f87 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -168,7 +168,7 @@ bool32 IsEntrainmentBannedAbilityAttacker(u16 ability); bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability); bool32 CanSleep(u8 battlerId); -bool32 CanBePoisoned(u8 gBattlerAttacker, u8 battlerTarget); +bool32 CanBePoisoned(u8 battlerAttacker, u8 battlerTarget); bool32 CanBeBurned(u8 battlerId); bool32 CanBeParalyzed(u8 battlerId); bool32 CanBeFrozen(u8 battlerId); From 05850f0f65cbdbbbd0ee466aeceff512bc25cae2 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Wed, 3 Nov 2021 22:05:02 -0300 Subject: [PATCH 47/81] Refactored UndoFormChange to make it more user friendly --- src/battle_util.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 196ce0268..f32c9875b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8954,33 +8954,29 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut) { u32 i, currSpecies; struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty; - static const u16 species[][2] = // changed form id, default form id + static const u16 species[][3] = { - {SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU}, - {SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND}, - {SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH}, - {SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN}, - {SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED}, - {SPECIES_MINIOR_METEOR_BLUE, SPECIES_MINIOR_CORE_BLUE}, - {SPECIES_MINIOR_METEOR_GREEN, SPECIES_MINIOR_CORE_GREEN}, - {SPECIES_MINIOR_METEOR_INDIGO, SPECIES_MINIOR_CORE_INDIGO}, - {SPECIES_MINIOR_METEOR_ORANGE, SPECIES_MINIOR_CORE_ORANGE}, - {SPECIES_MINIOR_METEOR_VIOLET, SPECIES_MINIOR_CORE_VIOLET}, - {SPECIES_MINIOR_METEOR_YELLOW, SPECIES_MINIOR_CORE_YELLOW}, - {SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI}, - {SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT}, - {SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT}, + // Changed Form ID Default Form ID Should change on switch + {SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU, FALSE}, + {SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND, FALSE}, + {SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH, TRUE}, + {SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN, TRUE}, + {SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED, TRUE}, + {SPECIES_MINIOR_METEOR_BLUE, SPECIES_MINIOR_CORE_BLUE, TRUE}, + {SPECIES_MINIOR_METEOR_GREEN, SPECIES_MINIOR_CORE_GREEN, TRUE}, + {SPECIES_MINIOR_METEOR_INDIGO, SPECIES_MINIOR_CORE_INDIGO, TRUE}, + {SPECIES_MINIOR_METEOR_ORANGE, SPECIES_MINIOR_CORE_ORANGE, TRUE}, + {SPECIES_MINIOR_METEOR_VIOLET, SPECIES_MINIOR_CORE_VIOLET, TRUE}, + {SPECIES_MINIOR_METEOR_YELLOW, SPECIES_MINIOR_CORE_YELLOW, TRUE}, + {SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI, TRUE}, + {SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT, TRUE}, + {SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT, TRUE}, }; - if (isSwitchingOut) // Don't revert Mimikyu Busted or Ash-Greninja when switching out - i = 2; - else - i = 0; - currSpecies = GetMonData(&party[monId], MON_DATA_SPECIES, NULL); - for (; i < ARRAY_COUNT(species); i++) + for (i = 0; i < ARRAY_COUNT(species); i++) { - if (currSpecies == species[i][0]) + if (currSpecies == species[i][0] && (!isSwitchingOut || species[i][2] == TRUE)) { SetMonData(&party[monId], MON_DATA_SPECIES, &species[i][1]); CalculateMonStats(&party[monId]); From 4466fbd930af4a7b32521936ca40220aaeb1dccc Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 3 Nov 2021 21:36:33 -0400 Subject: [PATCH 48/81] ai version of CanPoisonType, CanBePoisoned and IsAbilityOnSide --- include/battle_ai_util.h | 2 +- src/battle_ai_main.c | 2 +- src/battle_ai_util.c | 40 +++++++++++++++++++++++++++++++--------- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index b8cd53c07..304a8149d 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -54,6 +54,7 @@ bool32 IsRecycleEncouragedItem(u16 item); bool32 CanKnockOffItem(u8 battler, u16 item); bool32 IsAbilityOfRating(u16 ability, s8 rating); s8 GetAbilityRating(u16 ability); +u32 AI_IsAbilityOnSide(u32 battlerId, u32 ability); // stat stage checks bool32 AnyStatIsRaised(u8 battlerId); @@ -120,7 +121,6 @@ bool32 IsSemiInvulnerable(u8 battlerDef, u16 move); // status checks bool32 AI_CanBeBurned(u8 battler, u16 ability); -bool32 AI_CanBePoisoned(u8 battler, u16 ability); bool32 AI_CanBeConfused(u8 battler, u16 ability); bool32 AI_CanSleep(u8 battler, u16 ability); bool32 IsBattlerIncapacitated(u8 battler, u16 ability); diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 84fa7b634..526336947 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -3999,7 +3999,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 2; break; case HOLD_EFFECT_TOXIC_ORB: - if (!ShouldPoisonSelf(battlerAtk, AI_DATA->atkAbility) && AI_CanBePoisoned(battlerDef, AI_DATA->defAbility)) + if (!ShouldPoisonSelf(battlerAtk, AI_DATA->atkAbility)) score += 2; break; case HOLD_EFFECT_FLAME_ORB: diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 9640df2b4..bf10666f6 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -1065,6 +1065,16 @@ bool32 CanTargetFaintAiWithMod(u8 battlerDef, u8 battlerAtk, s32 hpMod, s32 dmgM return FALSE; } +u32 AI_IsAbilityOnSide(u32 battlerId, u32 ability) +{ + if (IsBattlerAlive(battlerId) && AI_GetAbility(battlerId) == ability) + return battlerId + 1; + else if (IsBattlerAlive(BATTLE_PARTNER(battlerId)) && AI_GetAbility(BATTLE_PARTNER(battlerId)) == ability) + return BATTLE_PARTNER(battlerId) + 1; + else + return 0; +} + // does NOT include ability suppression checks s32 AI_GetAbility(u32 battlerId) { @@ -2613,20 +2623,32 @@ bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, return TRUE; } -bool32 AI_CanBePoisoned(u8 battler, u16 ability) +static bool32 AI_CanPoisonType(u8 battlerAttacker, u8 battlerTarget) { - if (ability == ABILITY_IMMUNITY - || IsAbilityOnSide(battler, ABILITY_PASTEL_VEIL) - || gBattleMons[battler].status1 & STATUS1_ANY - || IsAbilityStatusProtected(battler) - || gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD) + return ((AI_GetAbility(battlerAttacker) == ABILITY_CORROSION && gBattleMoves[gCurrentMove].split == SPLIT_STATUS) + || !(IS_BATTLER_OF_TYPE(battlerTarget, TYPE_POISON) || IS_BATTLER_OF_TYPE(battlerTarget, TYPE_STEEL))); +} + +static bool32 AI_CanBePoisoned(u8 battlerAtk, u8 battlerDef) +{ + u16 ability = AI_GetAbility(battlerDef); + + if (!(AI_CanPoisonType(battlerAtk, battlerDef)) + || gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_SAFEGUARD + || gBattleMons[battlerDef].status1 & STATUS1_ANY + || ability == ABILITY_IMMUNITY + || ability == ABILITY_COMATOSE + || AI_IsAbilityOnSide(battlerDef, ABILITY_PASTEL_VEIL) + || gBattleMons[battlerDef].status1 & STATUS1_ANY + || IsAbilityStatusProtected(battlerDef) + || AI_IsTerrainAffected(battlerDef, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } bool32 ShouldPoisonSelf(u8 battler, u16 ability) { - if (AI_CanBePoisoned(battler, ability) && ( + if (AI_CanBePoisoned(battler, battler) && ( ability == ABILITY_MARVEL_SCALE || ability == ABILITY_POISON_HEAL || ability == ABILITY_QUICK_FEET @@ -2641,7 +2663,7 @@ bool32 ShouldPoisonSelf(u8 battler, u16 ability) bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove) { - if (!AI_CanBePoisoned(battlerDef, defAbility) + if (!AI_CanBePoisoned(battlerAtk, battlerDef) || AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0 || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) || PartnerMoveEffectIsStatusSameTarget(BATTLE_PARTNER(battlerAtk), battlerDef, partnerMove)) @@ -2744,7 +2766,7 @@ bool32 AI_CanBeInfatuated(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 atkGe || atkGender == defGender || atkGender == MON_GENDERLESS || defGender == MON_GENDERLESS - || IsAbilityOnSide(battlerDef, ABILITY_AROMA_VEIL)) + || AI_IsAbilityOnSide(battlerDef, ABILITY_AROMA_VEIL)) return FALSE; return TRUE; } From 012877bdc157d2ad04afcb9b47e03ae7eafd9434 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 3 Nov 2021 21:49:46 -0400 Subject: [PATCH 49/81] fix ai's def magic guard check --- src/battle_ai_main.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 84fa7b634..767ef4e35 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -578,6 +578,21 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { switch (AI_DATA->defAbility) { + case ABILITY_MAGIC_GUARD: + switch (moveEffect) + { + case EFFECT_POISON: + case EFFECT_WILL_O_WISP: + case EFFECT_TOXIC: + case EFFECT_LEECH_SEED: + score -= 5; + break; + case EFFECT_CURSE: + if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) + score -= 5; + break; + } + break; case ABILITY_VOLT_ABSORB: case ABILITY_MOTOR_DRIVE: case ABILITY_LIGHTNING_ROD: @@ -2949,7 +2964,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } } - // ability checks + // attacker ability checks switch (AI_DATA->atkAbility) { case ABILITY_MOXIE: @@ -2960,21 +2975,6 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 8; // prioritize killing target for stat boost } break; - case ABILITY_MAGIC_GUARD: - switch (moveEffect) - { - case EFFECT_POISON: - case EFFECT_WILL_O_WISP: - case EFFECT_TOXIC: - case EFFECT_LEECH_SEED: - score -= 5; - break; - case EFFECT_CURSE: - if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) - score -= 5; - break; - } - break; } // ability checks // move effect checks From 060ae35c7cc1c638e09b2a3ae4391fd309264080 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 3 Nov 2021 21:53:28 -0400 Subject: [PATCH 50/81] fix curse magic guard check --- src/battle_ai_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 767ef4e35..857908ef7 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -588,7 +588,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 5; break; case EFFECT_CURSE: - if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) + if (IS_BATTLER_OF_TYPE(battlerAtk, TYPE_GHOST)) // Don't use Curse if you're a ghost type vs a Magic Guard user, they'll take no damage. score -= 5; break; } From b931e341728e4b4e70c24f4a33d9d1ab4b7c07f8 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 3 Nov 2021 21:04:34 -0300 Subject: [PATCH 51/81] Handled Mimicry's interaction with Steel Roller's effect --- asm/macros/battle_script.inc | 4 ++++ data/battle_scripts_1.s | 1 + include/constants/battle_script_commands.h | 1 + src/battle_script_commands.c | 7 +++++++ 4 files changed, 13 insertions(+) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index b7a60dbbb..1625fe41c 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1883,6 +1883,10 @@ .4byte \ptr .endm + .macro trytorevertmimicry + various BS_ATTACKER, VARIOUS_TRY_TO_REVERT_MIMICRY + .endm + @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ac2d9a1a6..88d89ec3f 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -660,6 +660,7 @@ BattleScript_EffectRemoveTerrain: resultmessage waitmessage B_WAIT_TIME_LONG removeterrain + trytorevertmimicry jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 4, BattleScript_MoveEnd printfromtable gTerrainEndingStringIds waitmessage B_WAIT_TIME_LONG diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 50db28028..3d7dfbc2b 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -199,6 +199,7 @@ #define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 126 #define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 127 #define VARIOUS_TRY_TO_APPLY_MIMICRY 128 +#define VARIOUS_TRY_TO_REVERT_MIMICRY 129 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3bfa227bc..74d52dbb6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9039,6 +9039,13 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; return; } + case VARIOUS_TRY_TO_REVERT_MIMICRY: + for (i = 0; i < gBattlersCount; i++) + { + if (GetBattlerAbility(i) == ABILITY_MIMICRY) + RestoreBattlerOriginalTypes(i); + } + break; } gBattlescriptCurrInstr += 3; From e930dae278e8b3d2385956f353ca9b93d40bc4bb Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Thu, 4 Nov 2021 15:40:26 +1300 Subject: [PATCH 52/81] Remove ability pop up for Hunger Switch Morpeko should change form each turn without showing its ability. --- data/battle_scripts_1.s | 5 +++++ include/battle_scripts.h | 1 + src/battle_util.c | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a81d17f84..af4e96992 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6980,6 +6980,7 @@ BattleScript_AttackerFormChange:: call BattleScript_AbilityPopUp printstring STRINGID_EMPTYSTRING3 waitmessage 1 +BattleScript_AttackerFormChangeNoPopup:: handleformchange BS_ATTACKER, 0 handleformchange BS_ATTACKER, 1 playanimation BS_ATTACKER, B_ANIM_FORM_CHANGE, NULL @@ -6991,6 +6992,10 @@ BattleScript_AttackerFormChangeEnd3:: call BattleScript_AttackerFormChange end3 +BattleScript_AttackerFormChangeEnd3NoPopup:: + call BattleScript_AttackerFormChangeNoPopup + end3 + BattleScript_BallFetch:: call BattleScript_AbilityPopUp printstring STRINGID_FETCHEDPOKEBALL diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 12212ff94..035087fad 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -407,5 +407,6 @@ extern const u8 BattleScript_WanderingSpiritActivates[]; extern const u8 BattleScript_MirrorArmorReflect[]; extern const u8 BattleScript_GooeyActivates[]; extern const u8 BattleScript_PastelVeilActivates[]; +extern const u8 BattleScript_AttackerFormChangeEnd3NoPopup[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/src/battle_util.c b/src/battle_util.c index b17c82755..a1e39f329 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4578,12 +4578,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (gBattleMons[battler].species == SPECIES_MORPEKO) { gBattleMons[battler].species = SPECIES_MORPEKO_HANGRY; - BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeEnd3); + BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeEnd3NoPopup); } else if (gBattleMons[battler].species == SPECIES_MORPEKO_HANGRY) { gBattleMons[battler].species = SPECIES_MORPEKO; - BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeEnd3); + BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeEnd3NoPopup); } effect++; } From a2574b55cc231b4fa6b44878f0d699e17fecd5c3 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Thu, 4 Nov 2021 16:09:28 +1300 Subject: [PATCH 53/81] Fix dynamic move damage calculation Can't check effectiveness here without breaking the AI. After testing, it also appears that it doesn't need to be checked here after all. --- src/battle_ai_util.c | 80 +++++++------------------------------------- 1 file changed, 12 insertions(+), 68 deletions(-) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index ab7cc6b53..884e0fa37 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -738,95 +738,39 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef) { case EFFECT_LEVEL_DAMAGE: case EFFECT_PSYWAVE: - { - // Psywave's expected damage is equal to the user's level - if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) - dmg = 0; - else if (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND) - dmg = 2 * gBattleMons[battlerAtk].level; - else - dmg = gBattleMons[battlerAtk].level; + dmg = gBattleMons[battlerAtk].level * (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND ? 2 : 1); break; - } case EFFECT_DRAGON_RAGE: - { - if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) - dmg = 0; - else if (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND) - dmg = 80; - else - dmg = 40; + dmg = 40 * (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND ? 2 : 1); break; - } case EFFECT_SONICBOOM: - { - if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) - dmg = 0; - else if (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND) - dmg = 40; - else - dmg = 20; + dmg = 20 * (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND ? 2 : 1); break; - } case EFFECT_MULTI_HIT: - { - if (AI_DATA->atkAbility == ABILITY_SKILL_LINK) - dmg *= 5; - else - dmg *= 3; // Average number of hits is three + dmg *= (AI_DATA->atkAbility == ABILITY_SKILL_LINK ? 5 : 3); break; - } case EFFECT_TRIPLE_KICK: - { - dmg *= 6; + dmg *= (AI_DATA->atkAbility == ABILITY_SKILL_LINK ? 6 : 5); break; - } case EFFECT_ENDEAVOR: - { - if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) - dmg = 0; - else - // If target has less HP than user, Endeavor does no damage - dmg = max(0, gBattleMons[battlerDef].hp - gBattleMons[battlerAtk].hp); + // If target has less HP than user, Endeavor does no damage + dmg = max(0, gBattleMons[battlerDef].hp - gBattleMons[battlerAtk].hp); break; - } case EFFECT_SUPER_FANG: - { - if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) - dmg = 0; - // Two hits of Super Fang halves HP twice, leaving target with 25% HP - else if (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND) - dmg = max(2, gBattleMons[battlerDef].hp * 3 / 4); - else - dmg = max(1, gBattleMons[battlerDef].hp / 2); + dmg = (AI_DATA->atkAbility == ABILITY_PARENTAL_BOND + ? max(2, gBattleMons[battlerDef].hp * 3 / 4) + : max(1, gBattleMons[battlerDef].hp / 2)); break; - } case EFFECT_FINAL_GAMBIT: - { - if (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef) == AI_EFFECTIVENESS_x0) - dmg = 0; - else - dmg = gBattleMons[battlerAtk].hp; - break; - } - //case EFFECT_METAL_BURST: - //case EFFECT_COUNTER: - default: - //do not add the random factor, it's an average case analysis - //dmg *= (100 - (Random() % 10)) / 100; // add random factor + dmg = gBattleMons[battlerAtk].hp; break; } // Handle other multi-strike moves if (IsTwoStrikesMove(move)) - { dmg *= 2; - } - else if (move == MOVE_SURGING_STRIKES - || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH)) - { + else if (move == MOVE_SURGING_STRIKES || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH)) dmg *= 3; - } RestoreBattlerData(battlerAtk); RestoreBattlerData(battlerDef); From 7d1009768440b5c28a641f1700a45837af3d871c Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Thu, 4 Nov 2021 17:11:56 +1300 Subject: [PATCH 54/81] Replace IsTwoStrikesMove with FLAG_TWO_STRIKES Note that this flag does nothing until the Parental Bond PR is merged - it's just for the AI until then. --- include/battle_util.h | 3 --- include/constants/pokemon.h | 1 + src/battle_ai_util.c | 2 +- src/battle_util.c | 26 -------------------------- src/data/battle_moves.h | 20 ++++++++++---------- 5 files changed, 12 insertions(+), 40 deletions(-) diff --git a/include/battle_util.h b/include/battle_util.h index ac27461bd..aa2a3d838 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -175,7 +175,4 @@ bool32 CanBeFrozen(u8 battlerId); bool32 CanBeConfused(u8 battlerId); bool32 IsBattlerTerrainAffected(u8 battlerId, u32 terrainFlag); -// Move checks -bool8 IsTwoStrikesMove(u16 move); - #endif // GUARD_BATTLE_UTIL_H diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 4e776e592..959148e6c 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -308,6 +308,7 @@ #define FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING (1 << 24) // Makes a Ground type move do 1x damage to flying and levitating targets #define FLAG_THAW_USER (1 << 25) #define FLAG_HIT_IN_SUBSTITUTE (1 << 26) // Hyperspace Fury +#define FLAG_TWO_STRIKES (1 << 27) // A move with this flag will strike twice, and may apply its effect on each hit // Split defines. #define SPLIT_PHYSICAL 0x0 diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 884e0fa37..4fd01418c 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -767,7 +767,7 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef) } // Handle other multi-strike moves - if (IsTwoStrikesMove(move)) + if (gBattleMoves[move].flags & FLAG_TWO_STRIKES) dmg *= 2; else if (move == MOVE_SURGING_STRIKES || (move == MOVE_WATER_SHURIKEN && gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH)) dmg *= 3; diff --git a/src/battle_util.c b/src/battle_util.c index 82d6ddcbd..05c7af122 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -217,20 +217,6 @@ static const u16 sEntrainmentTargetSimpleBeamBannedAbilities[] = ABILITY_GULP_MISSILE, }; -static const u16 sTwoStrikeMoves[] = -{ - MOVE_BONEMERANG, - MOVE_DOUBLE_HIT, - MOVE_DOUBLE_IRON_BASH, - MOVE_DOUBLE_KICK, - MOVE_DRAGON_DARTS, - MOVE_DUAL_CHOP, - MOVE_DUAL_WINGBEAT, - MOVE_GEAR_GRIND, - MOVE_TWINEEDLE, - 0xFFFF -}; - bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move) { u32 ability = GetBattlerAbility(battlerAtk); @@ -9620,15 +9606,3 @@ bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags) } return FALSE; } - -bool8 IsTwoStrikesMove(u16 move) -{ - u32 i; - - for (i = 0; i < ARRAY_COUNT(sTwoStrikeMoves); i++) - { - if (move == sTwoStrikeMoves[i]) - return TRUE; - } - return FALSE; -} diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 97d61202a..f4ace3915 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -378,7 +378,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -649,7 +649,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -2460,7 +2460,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -7267,7 +7267,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -8367,7 +8367,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -8575,7 +8575,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -10726,9 +10726,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_DOUBLE_IRON_BASH] = { #if B_UPDATED_MOVE_DATA >= GEN_8 - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES, #else - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DMG_MINIMIZE | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DMG_MINIMIZE | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES, #endif .effect = EFFECT_DOUBLE_IRON_BASH, .power = 60, @@ -10850,7 +10850,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, @@ -11480,7 +11480,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_SELECTED, .priority = 0, - .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TWO_STRIKES, .split = SPLIT_PHYSICAL, }, From 2728f13eedce96ae3bd3c9cc18e2e14055749565 Mon Sep 17 00:00:00 2001 From: Jaizu Date: Thu, 4 Nov 2021 09:58:55 +0100 Subject: [PATCH 55/81] Fix comment typo --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ee9379d8d..d76dd8283 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -12817,7 +12817,7 @@ static void Cmd_handleballthrow(void) gBattleSpritesDataPtr->animationData->criticalCaptureSuccess = 0; if (CriticalCapture(odds)) { - maxShakes = 1; //critical capture doesn't gauarantee capture + maxShakes = 1; //critical capture doesn't guarantee capture gBattleSpritesDataPtr->animationData->isCriticalCapture = 1; } else From 6b10801ee8f511d5cd3ed413c8016274798c94c9 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 4 Nov 2021 10:43:33 -0400 Subject: [PATCH 56/81] convert AI_IsabilityOnSide to bool --- include/battle_ai_util.h | 2 +- src/battle_ai_util.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index 304a8149d..b6df2168e 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -54,7 +54,7 @@ bool32 IsRecycleEncouragedItem(u16 item); bool32 CanKnockOffItem(u8 battler, u16 item); bool32 IsAbilityOfRating(u16 ability, s8 rating); s8 GetAbilityRating(u16 ability); -u32 AI_IsAbilityOnSide(u32 battlerId, u32 ability); +bool32 AI_IsAbilityOnSide(u32 battlerId, u32 ability); // stat stage checks bool32 AnyStatIsRaised(u8 battlerId); diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index bf10666f6..a08034979 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -1065,14 +1065,14 @@ bool32 CanTargetFaintAiWithMod(u8 battlerDef, u8 battlerAtk, s32 hpMod, s32 dmgM return FALSE; } -u32 AI_IsAbilityOnSide(u32 battlerId, u32 ability) +bool32 AI_IsAbilityOnSide(u32 battlerId, u32 ability) { if (IsBattlerAlive(battlerId) && AI_GetAbility(battlerId) == ability) - return battlerId + 1; + return TRUE; else if (IsBattlerAlive(BATTLE_PARTNER(battlerId)) && AI_GetAbility(BATTLE_PARTNER(battlerId)) == ability) - return BATTLE_PARTNER(battlerId) + 1; + return TRUE; else - return 0; + return FALSE; } // does NOT include ability suppression checks From 4f251e6ec2b8cd4cb9339dec7a825e7c5d5f9100 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 4 Nov 2021 12:13:55 -0300 Subject: [PATCH 57/81] Moved VARIOUS_TRY_TO_REVERT_MIMICRY to VARIOUS_REMOVE_TERRAIN --- asm/macros/battle_script.inc | 4 ---- data/battle_scripts_1.s | 1 - include/constants/battle_script_commands.h | 1 - src/battle_script_commands.c | 12 +++++------- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 1625fe41c..b7a60dbbb 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1883,10 +1883,6 @@ .4byte \ptr .endm - .macro trytorevertmimicry - various BS_ATTACKER, VARIOUS_TRY_TO_REVERT_MIMICRY - .endm - @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 88d89ec3f..ac2d9a1a6 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -660,7 +660,6 @@ BattleScript_EffectRemoveTerrain: resultmessage waitmessage B_WAIT_TIME_LONG removeterrain - trytorevertmimicry jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 4, BattleScript_MoveEnd printfromtable gTerrainEndingStringIds waitmessage B_WAIT_TIME_LONG diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 3d7dfbc2b..50db28028 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -199,7 +199,6 @@ #define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 126 #define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 127 #define VARIOUS_TRY_TO_APPLY_MIMICRY 128 -#define VARIOUS_TRY_TO_REVERT_MIMICRY 129 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 74d52dbb6..d615e0b35 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8865,6 +8865,11 @@ static void Cmd_various(void) break; } gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain + for (i = 0; i < gBattlersCount; i++) // restore the types of Pokémon with Mimicry + { + if (GetBattlerAbility(i) == ABILITY_MIMICRY) + RestoreBattlerOriginalTypes(i); + } break; case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED: if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler, TRUE)) @@ -9039,13 +9044,6 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; return; } - case VARIOUS_TRY_TO_REVERT_MIMICRY: - for (i = 0; i < gBattlersCount; i++) - { - if (GetBattlerAbility(i) == ABILITY_MIMICRY) - RestoreBattlerOriginalTypes(i); - } - break; } gBattlescriptCurrInstr += 3; From b64d506809c2b84e9a6ae1e91b9d081b5b37b71e Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 4 Nov 2021 12:20:31 -0300 Subject: [PATCH 58/81] Made a function to lift Mimicry's effect --- include/battle_util.h | 1 + src/battle_script_commands.c | 6 +----- src/battle_util.c | 35 +++++++++++++++-------------------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/include/battle_util.h b/include/battle_util.h index 62a7e1db6..cb196519e 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -158,6 +158,7 @@ bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 chec u16 GetUsedHeldItem(u8 battler); bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags); void TryToApplyMimicry(u8 battlerId, bool8 various); +void TryToRevertMimicry(void); void RestoreBattlerOriginalTypes(u8 battlerId); // ability checks diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d615e0b35..d056bfa5a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8865,11 +8865,7 @@ static void Cmd_various(void) break; } gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain - for (i = 0; i < gBattlersCount; i++) // restore the types of Pokémon with Mimicry - { - if (GetBattlerAbility(i) == ABILITY_MIMICRY) - RestoreBattlerOriginalTypes(i); - } + TryToRevertMimicry(); // restore the types of Pokémon with Mimicry break; case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED: if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler, TRUE)) diff --git a/src/battle_util.c b/src/battle_util.c index a924722eb..b3cf60819 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1934,6 +1934,17 @@ void TryToApplyMimicry(u8 battlerId, bool8 various) } } +void TryToRevertMimicry(void) +{ + s32 i; + + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { + if (GetBattlerAbility(i) == ABILITY_MIMICRY) + RestoreBattlerOriginalTypes(i); + } +} + enum { ENDTURN_ORDER, @@ -2318,11 +2329,7 @@ u8 DoFieldEndTurnEffects(void) && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.electricTerrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT); - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - { - if (GetBattlerAbility(i) == ABILITY_MIMICRY) - RestoreBattlerOriginalTypes(i); - } + TryToRevertMimicry(); BattleScriptExecute(BattleScript_ElectricTerrainEnds); effect++; } @@ -2333,11 +2340,7 @@ u8 DoFieldEndTurnEffects(void) && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.mistyTerrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN); - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - { - if (GetBattlerAbility(i) == ABILITY_MIMICRY) - RestoreBattlerOriginalTypes(i); - } + TryToRevertMimicry(); BattleScriptExecute(BattleScript_MistyTerrainEnds); effect++; } @@ -2350,11 +2353,7 @@ u8 DoFieldEndTurnEffects(void) && (gFieldTimers.grassyTerrainTimer == 0 || --gFieldTimers.grassyTerrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_GRASSY_TERRAIN); - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - { - if (GetBattlerAbility(i) == ABILITY_MIMICRY) - RestoreBattlerOriginalTypes(i); - } + TryToRevertMimicry(); } BattleScriptExecute(BattleScript_GrassyTerrainHeals); effect++; @@ -2366,11 +2365,7 @@ u8 DoFieldEndTurnEffects(void) && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.psychicTerrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_PSYCHIC_TERRAIN); - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - { - if (GetBattlerAbility(i) == ABILITY_MIMICRY) - RestoreBattlerOriginalTypes(i); - } + TryToRevertMimicry(); BattleScriptExecute(BattleScript_PsychicTerrainEnds); effect++; } From 24cb5f66548656ff3d4af5f7f2014a15475e2ed2 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 4 Nov 2021 15:45:03 -0400 Subject: [PATCH 59/81] dont trigger x_up_hit effect if battle is over --- src/battle_script_commands.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6f0fec8a7..861f2b8c4 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2992,7 +2992,8 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SP_DEF_PLUS_1: case MOVE_EFFECT_ACC_PLUS_1: case MOVE_EFFECT_EVS_PLUS_1: - if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(1), + if (NoAliveMonsForEitherParty() + || ChangeStatBuffs(SET_STAT_BUFF_VALUE(1), gBattleScripting.moveEffect - MOVE_EFFECT_ATK_PLUS_1 + 1, affectsUser, 0)) { @@ -3153,8 +3154,15 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr++; break; case MOVE_EFFECT_ALL_STATS_UP: - BattleScriptPush(gBattlescriptCurrInstr + 1); - gBattlescriptCurrInstr = BattleScript_AllStatsUp; + if (NoAliveMonsForEitherParty()) + { + gBattlescriptCurrInstr++; + } + else + { + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_AllStatsUp; + } break; case MOVE_EFFECT_RAPIDSPIN: BattleScriptPush(gBattlescriptCurrInstr + 1); From 671cbabc3daa2fe217e26fa1598778f2c418ab7f Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 4 Nov 2021 17:18:26 -0300 Subject: [PATCH 60/81] Added a battle config for the Soul Dew --- include/constants/battle_config.h | 1 + src/battle_util.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 41fee089d..792d12a9b 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -166,6 +166,7 @@ #define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1. #define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Infatuation, Taunt, Encore, Torment, Heal Block, and Disable #define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items. +#define B_SOUL_DEW_BOOST GEN_7 // In Gens3-6, Soul Dew boosts the power of Lati@s' stats. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. // Flag settings // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. diff --git a/src/battle_util.c b/src/battle_util.c index 5a9d47df9..f2b186002 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8059,7 +8059,10 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_SOUL_DEW: - if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER)) + if (((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) + && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && B_SOUL_DEW_BOOST <= GEN_6) + || ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) + && (moveType == TYPE_PSYCHIC || moveType == TYPE_DRAGON) && B_SOUL_DEW_BOOST >= GEN_7)) MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_GEMS: From 9a3739d2bdc439c9189ad8d62b6ee480be09347c Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 4 Nov 2021 21:00:39 -0300 Subject: [PATCH 61/81] Review changes --- src/battle_util.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index f2b186002..c9fefe61b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8059,10 +8059,11 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_SOUL_DEW: - if (((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) - && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && B_SOUL_DEW_BOOST <= GEN_6) - || ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) - && (moveType == TYPE_PSYCHIC || moveType == TYPE_DRAGON) && B_SOUL_DEW_BOOST >= GEN_7)) + #if B_SOUL_DEW_BOOST >= GEN_7 + if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && (moveType == TYPE_PSYCHIC || moveType == TYPE_DRAGON)) + #else + if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER)) + #endif MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_GEMS: @@ -8475,6 +8476,14 @@ static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, if (!usesDefStat) MulModifier(&modifier, UQ_4_12(1.5)); break; +#if B_SOUL_DEW_BOOST <= GEN_6 + case HOLD_EFFECT_SOUL_DEW: + if ((gBattleMons[battlerDef].species == SPECIES_LATIAS || gBattleMons[battlerDef].species == SPECIES_LATIOS) + && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) + && !usesDefStat) + MulModifier(&modifier, UQ_4_12(1.5)); + break; +#endif } // sandstorm sp.def boost for rock types From bf786c6c9a8069be877aea3b5723d7a46660b7cb Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Fri, 5 Nov 2021 18:22:52 +1300 Subject: [PATCH 62/81] Fix Magma Storm Fix the strings and animation displayed when Magma Storm. Also move gTrappingMoves to battle_script_message.c as it's only sued in this file, and this allows ARRAY_COUNT(sTrappingMoves) to replace the constant in SetMoveEffect. --- data/battle_anim_scripts.s | 27 +++++++++++++++++++++++++++ include/battle_message.h | 1 - include/constants/battle_anim.h | 3 ++- include/constants/battle_string_ids.h | 2 +- src/battle_anim_throw.c | 2 ++ src/battle_message.c | 24 ++++++++++-------------- src/battle_script_commands.c | 9 +++++++-- 7 files changed, 49 insertions(+), 19 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index cfe95371d..4198f6410 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -24037,6 +24037,7 @@ General_TurnTrap: jumpargeq 0, TRAP_ANIM_WHIRLPOOL, Status_Whirlpool jumpargeq 0, TRAP_ANIM_CLAMP, Status_Clamp jumpargeq 0, TRAP_ANIM_SAND_TOMB, Status_SandTomb + jumpargeq 0, TRAP_ANIM_MAGMA_STORM, Status_MagmaStorm jumpargeq 0, TRAP_ANIM_INFESTATION, Status_Infestation goto Status_BindWrap Status_BindWrap: @@ -24063,6 +24064,32 @@ Status_FireSpin: stopsound end +Status_MagmaStorm: + loadspritegfx ANIM_TAG_SMALL_EMBER + fadetobg BG_MAGMA_STORM + waitbgfadeout + createvisualtask AnimTask_MoveSeismicTossBg, 3 + playsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_TARGET + loopsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_TARGET, 5, 8 + createvisualtask AnimTask_SeismicTossBgAccelerateDownAtEnd, 3 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 47, 1 + createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + call FireSpinEffect + call FireSpinEffect + createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + call FireSpinEffect + call FireSpinEffect + createvisualtask AnimTask_BlendColorCycle, 2, 6, 4, 2, 2, 0, 12, RGB(22, 9, 7) + call FireSpinEffect + restorebg + waitbgfadeout + setarg 7, 0xFFF + waitbgfadein + stopsound + clearmonbg ANIM_DEF_PARTNER + blendoff + end + Status_Whirlpool: loadspritegfx ANIM_TAG_WATER_ORB monbg ANIM_DEF_PARTNER diff --git a/include/battle_message.h b/include/battle_message.h index e8b362c9e..5c10f9e04 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -310,6 +310,5 @@ extern const u8 gText_BattleTourney[]; extern const u16 gMissStringIds[]; extern const u16 gStatUpStringIds[]; -extern const u16 gTrappingMoves[]; #endif // GUARD_BATTLE_MESSAGE_H diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index c7871bd15..7df75794e 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -565,7 +565,8 @@ #define TRAP_ANIM_WHIRLPOOL 2 #define TRAP_ANIM_CLAMP 3 #define TRAP_ANIM_SAND_TOMB 4 -#define TRAP_ANIM_INFESTATION 5 +#define TRAP_ANIM_MAGMA_STORM 5 +#define TRAP_ANIM_INFESTATION 6 // Weather defines for battle animation scripts. #define ANIM_WEATHER_NONE 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 74105f3bf..8fba7597c 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -410,7 +410,7 @@ #define STRINGID_PKMNTWISTEDDIMENSIONS 406 #define STRINGID_POINTEDSTONESFLOAT 407 #define STRINGID_CLOAKEDINMYSTICALMOONLIGHT 408 -#define STRINGID_TRAPPERBYSWIRLINGMAGMA 409 +#define STRINGID_TRAPPEDBYSWIRLINGMAGMA 409 #define STRINGID_VANISHEDINSTANTLY 410 #define STRINGID_PROTECTEDTEAM 411 #define STRINGID_SHAREDITSGUARD 412 diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index 207d1255d..f325cba07 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -2496,6 +2496,8 @@ void AnimTask_GetTrappedMoveAnimId(u8 taskId) gBattleAnimArgs[0] = TRAP_ANIM_CLAMP; else if (gBattleSpritesDataPtr->animationData->animArg == MOVE_SAND_TOMB) gBattleAnimArgs[0] = TRAP_ANIM_SAND_TOMB; + else if (gBattleSpritesDataPtr->animationData->animArg == MOVE_MAGMA_STORM) + gBattleAnimArgs[0] = TRAP_ANIM_MAGMA_STORM; else if (gBattleSpritesDataPtr->animationData->animArg == MOVE_INFESTATION) gBattleAnimArgs[0] = TRAP_ANIM_INFESTATION; else diff --git a/src/battle_message.c b/src/battle_message.c index 60b7f5203..f52f6be7e 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1200,7 +1200,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_PKMNTWISTEDDIMENSIONS - 12] = sText_PkmnTwistedDimensions, [STRINGID_POINTEDSTONESFLOAT - 12] = sText_PointedStonesFloat, [STRINGID_CLOAKEDINMYSTICALMOONLIGHT - 12] = sText_CloakedInMysticalMoonlight, - [STRINGID_TRAPPERBYSWIRLINGMAGMA - 12] = sText_TrappedBySwirlingMagma, + [STRINGID_TRAPPEDBYSWIRLINGMAGMA - 12] = sText_TrappedBySwirlingMagma, [STRINGID_VANISHEDINSTANTLY - 12] = sText_VanishedInstantly, [STRINGID_PROTECTEDTEAM - 12] = sText_ProtectedTeam, [STRINGID_SHAREDITSGUARD - 12] = sText_SharedItsGuard, @@ -1535,16 +1535,17 @@ const u16 gFirstTurnOfTwoStringIds[] = [B_MSG_TURN1_FREEZE_SHOCK] = STRINGID_CLOAKEDINAFREEZINGLIGHT, }; -// Index copied from move's index in gTrappingMoves +// Index copied from move's index in sTrappingMoves const u16 gWrappedStringIds[] = { - STRINGID_PKMNSQUEEZEDBYBIND, // MOVE_BIND - STRINGID_PKMNWRAPPEDBY, // MOVE_WRAP - STRINGID_PKMNTRAPPEDINVORTEX, // MOVE_FIRE_SPIN - STRINGID_PKMNCLAMPED, // MOVE_CLAMP - STRINGID_PKMNTRAPPEDINVORTEX, // MOVE_WHIRLPOOL - STRINGID_PKMNTRAPPEDBYSANDTOMB,// MOVE_SAND_TOMB - STRINGID_INFESTATION, // MOVE_INFESTATION + STRINGID_PKMNSQUEEZEDBYBIND, // MOVE_BIND + STRINGID_PKMNWRAPPEDBY, // MOVE_WRAP + STRINGID_PKMNTRAPPEDINVORTEX, // MOVE_FIRE_SPIN + STRINGID_PKMNCLAMPED, // MOVE_CLAMP + STRINGID_PKMNTRAPPEDINVORTEX, // MOVE_WHIRLPOOL + STRINGID_PKMNTRAPPEDBYSANDTOMB, // MOVE_SAND_TOMB + STRINGID_TRAPPEDBYSWIRLINGMAGMA, // MOVE_MAGMA_STORM + STRINGID_INFESTATION, // MOVE_INFESTATION }; const u16 gMistUsedStringIds[] = @@ -1755,11 +1756,6 @@ const u16 gCaughtMonStringIds[] = [B_MSG_LANETTES_BOX_FULL] = STRINGID_PKMNBOXLANETTESPCFULL, }; -const u16 gTrappingMoves[] = -{ - MOVE_BIND, MOVE_WRAP, MOVE_FIRE_SPIN, MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, MOVE_INFESTATION, 0xFFFF -}; - const u16 gRoomsStringIds[] = { STRINGID_PKMNTWISTEDDIMENSIONS, STRINGID_TRICKROOMENDS, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6f0fec8a7..dd49d0493 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -279,6 +279,11 @@ static const s32 sExperienceScalingFactors[] = 159767, }; +static const u16 sTrappingMoves[] = +{ + MOVE_BIND, MOVE_WRAP, MOVE_FIRE_SPIN, MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, MOVE_MAGMA_STORM, MOVE_INFESTATION, 0xFFFF +}; + #define STAT_CHANGE_WORKED 0 #define STAT_CHANGE_DIDNT_WORK 1 @@ -2978,9 +2983,9 @@ void SetMoveEffect(bool32 primary, u32 certain) for (gBattleCommunication[MULTISTRING_CHOOSER] = 0; ; gBattleCommunication[MULTISTRING_CHOOSER]++) { - if (gBattleCommunication[MULTISTRING_CHOOSER] > 5) + if (gBattleCommunication[MULTISTRING_CHOOSER] > ARRAY_COUNT(sTrappingMoves)) break; - if (gTrappingMoves[gBattleCommunication[MULTISTRING_CHOOSER]] == gCurrentMove) + if (sTrappingMoves[gBattleCommunication[MULTISTRING_CHOOSER]] == gCurrentMove) break; } } From 3f1ce399e640c4e43c889e11cded0a1b94a1c90d Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Fri, 5 Nov 2021 18:37:45 +1300 Subject: [PATCH 63/81] Account for terminator in sTrappingMoves --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index dd49d0493..b81639db0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2983,7 +2983,7 @@ void SetMoveEffect(bool32 primary, u32 certain) for (gBattleCommunication[MULTISTRING_CHOOSER] = 0; ; gBattleCommunication[MULTISTRING_CHOOSER]++) { - if (gBattleCommunication[MULTISTRING_CHOOSER] > ARRAY_COUNT(sTrappingMoves)) + if (gBattleCommunication[MULTISTRING_CHOOSER] > ARRAY_COUNT(sTrappingMoves) - 1) break; if (sTrappingMoves[gBattleCommunication[MULTISTRING_CHOOSER]] == gCurrentMove) break; From d15eeeb8eb7724697438e0e2269dc7d53348dbba Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 5 Nov 2021 10:37:41 -0300 Subject: [PATCH 64/81] Fixed the comment for B_SOUL_DEW_BOOST --- include/constants/battle_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 792d12a9b..faf57a40c 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -166,7 +166,7 @@ #define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1. #define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Infatuation, Taunt, Encore, Torment, Heal Block, and Disable #define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items. -#define B_SOUL_DEW_BOOST GEN_7 // In Gens3-6, Soul Dew boosts the power of Lati@s' stats. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. +#define B_SOUL_DEW_BOOST GEN_7 // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. // Flag settings // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. From 13029cd3b38049b880212e247234eb2ae2c2cfa5 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 5 Nov 2021 10:50:21 -0300 Subject: [PATCH 65/81] Tweaked VARIOUS_PHOTON_GEYSER_CHECK and VARIOUS_SHELL_SIDE_ARM_CHECK --- src/battle_script_commands.c | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 73dcca97c..a89487ce8 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8996,50 +8996,50 @@ static void Cmd_various(void) return; case VARIOUS_PHOTON_GEYSER_CHECK: { - u32 attStat = gBattleMons[gActiveBattler].attack; - u8 atkStage = gBattleMons[gActiveBattler].statStages[STAT_ATK]; - u32 spaStat = gBattleMons[gActiveBattler].spAttack; + u32 attackerAtkStat = gBattleMons[gBattlerAttacker].attack; + u8 attackerAtkStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; + u32 attackerSpAtkStat = gBattleMons[gBattlerAttacker].spAttack; - attStat *= gStatStageRatios[atkStage][0]; - attStat /= gStatStageRatios[atkStage][1]; + attackerAtkStat *= gStatStageRatios[attackerAtkStage][0]; + attackerAtkStat /= gStatStageRatios[attackerAtkStage][1]; - atkStage = gBattleMons[gActiveBattler].statStages[STAT_SPATK]; - spaStat *= gStatStageRatios[atkStage][0]; - spaStat /= gStatStageRatios[atkStage][1]; + attackerAtkStage = gBattleMons[gBattlerAttacker].statStages[STAT_SPATK]; + attackerSpAtkStat *= gStatStageRatios[attackerAtkStage][0]; + attackerSpAtkStat /= gStatStageRatios[attackerAtkStage][1]; - if (attStat > spaStat) + if (attackerAtkStat > attackerSpAtkStat) gSwapDamageCategory = TRUE; break; } case VARIOUS_SHELL_SIDE_ARM_CHECK: // 0% chance GameFreak actually checks this way according to DaWobblefet, but this is the only functional explanation at the moment { - u32 attStat = gBattleMons[gBattlerAttacker].attack; - u8 atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; - u32 attStatDef = gBattleMons[gBattlerTarget].attack; + u32 attackerAtkStat = gBattleMons[gBattlerAttacker].attack; + u32 targetDefStat = gBattleMons[gBattlerTarget].defense; + u32 attackerSpAtkStat = gBattleMons[gBattlerAttacker].spAttack; + u32 targetSpDefStat = gBattleMons[gBattlerTarget].spDefense; + u8 statStage; u32 physical; - - u32 spaStat = gBattleMons[gBattlerAttacker].spAttack; - u32 spaStatDef = gBattleMons[gBattlerTarget].spAttack; u32 special; - attStat *= gStatStageRatios[atkStage][0]; - attStat /= gStatStageRatios[atkStage][1]; + statStage = = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; + attackerAtkStat *= gStatStageRatios[statStage][0]; + attackerAtkStat /= gStatStageRatios[statStage][1]; - atkStage = gBattleMons[gBattlerTarget].statStages[STAT_ATK]; - attStatDef *= gStatStageRatios[atkStage][0]; - attStatDef /= gStatStageRatios[atkStage][1]; + statStage = gBattleMons[gBattlerTarget].statStages[STAT_ATK]; + targetDefStat *= gStatStageRatios[statStage][0]; + targetDefStat /= gStatStageRatios[statStage][1]; - physical = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * gBattleMoves[gCurrentMove].power * attStat) / attStatDef) / 50); + physical = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * gBattleMoves[gCurrentMove].power * attackerAtkStat) / targetDefStat) / 50); - atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_SPATK]; - spaStat *= gStatStageRatios[atkStage][0]; - spaStat /= gStatStageRatios[atkStage][1]; + statStage = gBattleMons[gBattlerAttacker].statStages[STAT_SPATK]; + attackerSpAtkStat *= gStatStageRatios[statStage][0]; + attackerSpAtkStat /= gStatStageRatios[statStage][1]; - atkStage = gBattleMons[gBattlerTarget].statStages[STAT_SPATK]; - spaStatDef *= gStatStageRatios[atkStage][0]; - spaStatDef /= gStatStageRatios[atkStage][1]; + statStage = gBattleMons[gBattlerTarget].statStages[STAT_SPATK]; + targetSpDefStat *= gStatStageRatios[statStage][0]; + targetSpDefStat /= gStatStageRatios[statStage][1]; - special = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * gBattleMoves[gCurrentMove].power * spaStat) / spaStatDef) / 50); + special = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * gBattleMoves[gCurrentMove].power * attackerSpAtkStat) / targetSpDefStat) / 50); if (((physical > special) || (physical == special && (Random() % 2) == 0))) gSwapDamageCategory = TRUE; From b23d5db5981b100f5d241a3cba3c0fee68b47a1d Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 5 Nov 2021 13:02:16 -0300 Subject: [PATCH 66/81] Oops --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 97a7b034f..ec7c6effa 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9032,7 +9032,7 @@ static void Cmd_various(void) u32 physical; u32 special; - statStage = = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; + statStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; attackerAtkStat *= gStatStageRatios[statStage][0]; attackerAtkStat /= gStatStageRatios[statStage][1]; From 14ebba04afd2972b2f79ca89159ff643a7f698d9 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Sat, 6 Nov 2021 12:43:57 +1300 Subject: [PATCH 67/81] Align comment with others Co-authored-by: Eduardo Quezada D'Ottone --- data/battle_scripts_1.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 30facd40d..a85b2e2a7 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -367,7 +367,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectGeomancy @ EFFECT_GEOMANCY .4byte BattleScript_EffectFairyLock @ EFFECT_FAIRY_LOCK .4byte BattleScript_EffectAllySwitch @ EFFECT_ALLY_SWITCH - .4byte BattleScript_EffectRelicSong @ EFFECT_RELIC_SONG + .4byte BattleScript_EffectRelicSong @ EFFECT_RELIC_SONG .4byte BattleScript_EffectAttackerDefenseDownHit @ EFFECT_ATTACKER_DEFENSE_DOWN_HIT .4byte BattleScript_EffectHit @ EFFECT_BODY_PRESS .4byte BattleScript_EffectEerieSpell @ EFFECT_EERIE_SPELL From 8e49e3e6530d6d738cf0167c51705833f7ef66d3 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Fri, 5 Nov 2021 21:16:13 -0300 Subject: [PATCH 68/81] Config for Synchronize's interaction with toxic poisoning --- include/constants/battle_config.h | 1 + src/battle_util.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 95ff4f4a0..1c7781980 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -162,6 +162,7 @@ #define B_MOODY_ACC_EVASION GEN_8 // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore. #define B_FLASH_FIRE_FROZEN GEN_7 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. #define B_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if the Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. +#define B_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if the Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. #define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. // Item settings diff --git a/src/battle_util.c b/src/battle_util.c index 0585bb4b6..3ddc2e9bb 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5471,8 +5471,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (!(gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY)) { gBattleStruct->synchronizeMoveEffect &= ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN); - if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC) - gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON; + #if B_SYNCHRONIZE_TOXIC < GEN_5 + if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC) + gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON; + #endif gBattleScripting.moveEffect = gBattleStruct->synchronizeMoveEffect + MOVE_EFFECT_AFFECTS_USER; gBattleScripting.battler = gBattlerAbility = gBattlerTarget; From 202827068c52df2ef10a6657ad902b9842c75cc1 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Fri, 5 Nov 2021 21:25:42 -0300 Subject: [PATCH 69/81] a Co-authored-by: LOuroboros --- include/constants/battle_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 1c7781980..df8015518 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -161,8 +161,8 @@ #define B_SHADOW_TAG_ESCAPE GEN_7 // In Gen4+, if both sides have a Pokémon with Shadow Tag, all battlers can escape. Before, neither side could escape this situation. #define B_MOODY_ACC_EVASION GEN_8 // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore. #define B_FLASH_FIRE_FROZEN GEN_7 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. -#define B_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if the Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. -#define B_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if the Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. +#define B_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. +#define B_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. #define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. // Item settings From 4bdbef9a9d25d8e547c2bd97e962df3b43d95e05 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 5 Nov 2021 22:21:50 -0300 Subject: [PATCH 70/81] Use the right defensive target stats during Shell Side Arm calculation --- src/battle_script_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ec7c6effa..938c4bf54 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9036,7 +9036,7 @@ static void Cmd_various(void) attackerAtkStat *= gStatStageRatios[statStage][0]; attackerAtkStat /= gStatStageRatios[statStage][1]; - statStage = gBattleMons[gBattlerTarget].statStages[STAT_ATK]; + statStage = gBattleMons[gBattlerTarget].statStages[STAT_DEF]; targetDefStat *= gStatStageRatios[statStage][0]; targetDefStat /= gStatStageRatios[statStage][1]; @@ -9046,7 +9046,7 @@ static void Cmd_various(void) attackerSpAtkStat *= gStatStageRatios[statStage][0]; attackerSpAtkStat /= gStatStageRatios[statStage][1]; - statStage = gBattleMons[gBattlerTarget].statStages[STAT_SPATK]; + statStage = gBattleMons[gBattlerTarget].statStages[STAT_SPDEF]; targetSpDefStat *= gStatStageRatios[statStage][0]; targetSpDefStat /= gStatStageRatios[statStage][1]; From c2e8c1058fdd73c97a9b3e112bf03962e05d5aea Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 5 Nov 2021 23:07:26 -0300 Subject: [PATCH 71/81] Force set gSwapDamageCategory's initial value in Photon Geyser's and Shell Side Arm's calculations --- src/battle_script_commands.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 938c4bf54..78872b638 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9011,6 +9011,8 @@ static void Cmd_various(void) u8 attackerAtkStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; u32 attackerSpAtkStat = gBattleMons[gBattlerAttacker].spAttack; + gSwapDamageCategory = FALSE; + attackerAtkStat *= gStatStageRatios[attackerAtkStage][0]; attackerAtkStat /= gStatStageRatios[attackerAtkStage][1]; @@ -9032,6 +9034,8 @@ static void Cmd_various(void) u32 physical; u32 special; + gSwapDamageCategory = FALSE; + statStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK]; attackerAtkStat *= gStatStageRatios[statStage][0]; attackerAtkStat /= gStatStageRatios[statStage][1]; From 03f290d937b3acb98162498302f4f6ad58d281ba Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sat, 6 Nov 2021 08:53:00 -0400 Subject: [PATCH 72/81] add check for plus_2 effects --- src/battle_script_commands.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 861f2b8c4..5a85ee6b8 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3040,7 +3040,8 @@ void SetMoveEffect(bool32 primary, u32 certain) case MOVE_EFFECT_SP_DEF_PLUS_2: case MOVE_EFFECT_ACC_PLUS_2: case MOVE_EFFECT_EVS_PLUS_2: - if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(2), + if (NoAliveMonsForEitherParty() + || ChangeStatBuffs(SET_STAT_BUFF_VALUE(2), gBattleScripting.moveEffect - MOVE_EFFECT_ATK_PLUS_2 + 1, affectsUser, 0)) { From 62b6accbcc803cd701333f41777b3c35fcee0ae6 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 6 Nov 2021 11:07:40 -0300 Subject: [PATCH 73/81] Using IsBattlerTerrainAffected --- src/battle_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index e8e27b316..63c4982f1 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -5194,8 +5194,7 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) } else if (gBattleMoves[move].effect == EFFECT_TERRAIN_PULSE) { - if ((gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) - && IsBattlerGrounded(battlerAtk)) + if (IsBattlerTerrainAffected(battlerAtk, STATUS_FIELD_TERRAIN_ANY)) { if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | 0x80; From 328976bf8174963eccff09e7eb3742ddbd39abd2 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 6 Nov 2021 17:05:13 -0300 Subject: [PATCH 74/81] Secret Power effect config --- include/constants/battle.h | 33 ++++++++++++++------ include/constants/battle_config.h | 1 + src/battle_script_commands.c | 51 ++++++++++++++++++++++++++++--- 3 files changed, 71 insertions(+), 14 deletions(-) diff --git a/include/constants/battle.h b/include/constants/battle.h index 438b5660c..3ba45e0d8 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -364,16 +364,29 @@ #define MOVE_EFFECT_CERTAIN 0x8000 // Battle terrain defines for gBattleTerrain. -#define BATTLE_TERRAIN_GRASS 0 -#define BATTLE_TERRAIN_LONG_GRASS 1 -#define BATTLE_TERRAIN_SAND 2 -#define BATTLE_TERRAIN_UNDERWATER 3 -#define BATTLE_TERRAIN_WATER 4 -#define BATTLE_TERRAIN_POND 5 -#define BATTLE_TERRAIN_MOUNTAIN 6 -#define BATTLE_TERRAIN_CAVE 7 -#define BATTLE_TERRAIN_BUILDING 8 -#define BATTLE_TERRAIN_PLAIN 9 +#define BATTLE_TERRAIN_GRASS 0 +#define BATTLE_TERRAIN_LONG_GRASS 1 +#define BATTLE_TERRAIN_SAND 2 +#define BATTLE_TERRAIN_UNDERWATER 3 +#define BATTLE_TERRAIN_WATER 4 +#define BATTLE_TERRAIN_POND 5 +#define BATTLE_TERRAIN_MOUNTAIN 6 +#define BATTLE_TERRAIN_CAVE 7 +#define BATTLE_TERRAIN_BUILDING 8 +#define BATTLE_TERRAIN_PLAIN 9 +// New battle terrains are used for Secret Power but not fully implemented. +#define BATTLE_TERRAIN_SOARING 10 +#define BATTLE_TERRAIN_SKY_PILLAR 11 +#define BATTLE_TERRAIN_BURIAL_GROUND 12 +#define BATTLE_TERRAIN_PUDDLE 13 +#define BATTLE_TERRAIN_MARSH 14 +#define BATTLE_TERRAIN_SWAMP 15 +#define BATTLE_TERRAIN_SNOW 16 +#define BATTLE_TERRAIN_ICE 17 +#define BATTLE_TERRAIN_VOLCANO 18 +#define BATTLE_TERRAIN_DISTORTION_WORLD 19 +#define BATTLE_TERRAIN_SPACE 20 +#define BATTLE_TERRAIN_ULTRA_SPACE 21 #define B_WAIT_TIME_LONG 64 #define B_WAIT_TIME_MED 48 diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 95ff4f4a0..13f2be0d8 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -153,6 +153,7 @@ #define B_MEMENTO_FAIL GEN_7 // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6. #define B_GLARE_GHOST GEN_7 // In Gen4+, Glare can hit Ghost-type Pokémon normally. #define B_SKILL_SWAP GEN_7 // In Gen4+, Skill Swap triggers switch-in abilities after use. +#define B_SECRET_POWER_EFFECT GEN_7 // Secret Power's effects change depending on the generation. See GetSecretPowerMoveEffect. // Ability settings #define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5267cfbd1..fcba67bca 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -12483,7 +12483,11 @@ u16 GetSecretPowerMoveEffect(void) switch (gBattleTerrain) { case BATTLE_TERRAIN_GRASS: - moveEffect = MOVE_EFFECT_SLEEP; + #if B_SECRET_POWER_EFFECT >= GEN_4 + moveEffect = MOVE_EFFECT_SLEEP; + #else + moveEffect = MOVE_EFFECT_POISON; + #endif break; case BATTLE_TERRAIN_LONG_GRASS: moveEffect = MOVE_EFFECT_SLEEP; @@ -12492,20 +12496,59 @@ u16 GetSecretPowerMoveEffect(void) moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; case BATTLE_TERRAIN_UNDERWATER: - moveEffect = MOVE_EFFECT_ATK_MINUS_1; + #if B_SECRET_POWER_EFFECT >= GEN_6 + moveEffect = MOVE_EFFECT_ATK_MINUS_1; + #else + moveEffect = MOVE_EFFECT_DEF_MINUS_1; + #endif break; case BATTLE_TERRAIN_WATER: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; case BATTLE_TERRAIN_POND: - moveEffect = MOVE_EFFECT_ATK_MINUS_1; + #if B_SECRET_POWER_EFFECT >= GEN_4 + moveEffect = MOVE_EFFECT_ATK_MINUS_1; + #else + moveEffect = MOVE_EFFECT_SPD_MINUS_1; + #endif break; case BATTLE_TERRAIN_MOUNTAIN: - moveEffect = MOVE_EFFECT_ACC_MINUS_1; + #if B_SECRET_POWER_EFFECT >= GEN_5 + moveEffect = MOVE_EFFECT_ACC_MINUS_1; + #elif B_SECRET_POWER_EFFECT == GEN_4 + moveEffect = MOVE_EFFECT_FLINCH; + #else + moveEffect = MOVE_EFFECT_CONFUSION; + #endif break; case BATTLE_TERRAIN_CAVE: + case BATTLE_TERRAIN_BURIAL_GROUND: + case BATTLE_TERRAIN_SPACE: moveEffect = MOVE_EFFECT_FLINCH; break; + case BATTLE_TERRAIN_SOARING: + case BATTLE_TERRAIN_SKY_PILLAR: + case BATTLE_TERRAIN_MARSH: + case BATTLE_TERRAIN_SWAMP: + moveEffect = MOVE_EFFECT_SPD_MINUS_1; + break; + case BATTLE_TERRAIN_PUDDLE: + #if B_SECRET_POWER_EFFECT >= GEN_5 + moveEffect = MOVE_EFFECT_SPD_MINUS_1; + #else + moveEffect = MOVE_EFFECT_ACC_MINUS_1; + #endif + break; + case BATTLE_TERRAIN_SNOW: + case BATTLE_TERRAIN_ICE: + moveEffect = MOVE_EFFECT_FREEZE; + break; + case BATTLE_TERRAIN_VOLCANO: + moveEffect = MOVE_EFFECT_BURN; + break; + case BATTLE_TERRAIN_ULTRA_SPACE: + moveEffect = MOVE_EFFECT_DEF_MINUS_1; + break; default: moveEffect = MOVE_EFFECT_PARALYSIS; break; From e9804a50233a26c8480ab50bc9e47c24ab2eb4db Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 6 Nov 2021 17:32:34 -0300 Subject: [PATCH 75/81] Secret Power animation config --- data/battle_anim_scripts.s | 29 +++++++++++++++++++++++++++++ include/constants/battle_config.h | 1 + 2 files changed, 30 insertions(+) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 6077a3ae4..3e7f02692 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -5,6 +5,7 @@ #include "constants/moves.h" #include "constants/pokemon.h" #include "constants/items.h" +#include "constants/battle_config.h" .include "asm/macros.inc" .include "asm/macros/battle_anim_script.inc" .include "constants/constants.inc" @@ -23367,8 +23368,36 @@ Move_SECRET_POWER: jumpargeq 0, BATTLE_TERRAIN_POND, Move_BUBBLE_BEAM jumpargeq 0, BATTLE_TERRAIN_MOUNTAIN, Move_ROCK_THROW jumpargeq 0, BATTLE_TERRAIN_CAVE, Move_BITE + jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH + jumpargeq 0, BATTLE_TERRAIN_SOARING, Move_GUST + jumpargeq 0, BATTLE_TERRAIN_SKY_PILLAR, Move_GUST + jumpargeq 0, BATTLE_TERRAIN_BURIAL_GROUND, Move_SHADOW_SNEAK + jumpargeq 0, BATTLE_TERRAIN_PUDDLE, Move_MUD_SHOT + jumpargeq 0, BATTLE_TERRAIN_MARSH, Move_MUD_SHOT + jumpargeq 0, BATTLE_TERRAIN_SWAMP, Move_MUD_SHOT +.if B_SECRET_POWER_ANIMATION >= GEN_7 + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_ICE_SHARD +.else + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE +.endif + jumpargeq 0, BATTLE_TERRAIN_ICE, Move_ICE_SHARD + jumpargeq 0, BATTLE_TERRAIN_VOLCANO, Move_INCINERATE + jumpargeq 0, BATTLE_TERRAIN_DISTORTION_WORLD, Move_POUND + jumpargeq 0, BATTLE_TERRAIN_SPACE, Move_SWIFT + jumpargeq 0, BATTLE_TERRAIN_ULTRA_SPACE, Move_PSYWAVE +.if B_SECRET_POWER_ANIMATION >= GEN_7 + jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_SPIT_UP + goto Move_SPIT_UP +.elseif B_SECRET_POWER_ANIMATION == GEN_6 + jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM + goto Move_BODY_SLAM +.elseif B_SECRET_POWER_ANIMATION == GEN_5 || B_SECRET_POWER_ANIMATION == GEN_4 + jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM + goto Move_MUD_SLAP +.else jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH goto Move_SLAM +.endif Move_TWISTER: loadspritegfx ANIM_TAG_LEAF diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 13f2be0d8..61723ced4 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -154,6 +154,7 @@ #define B_GLARE_GHOST GEN_7 // In Gen4+, Glare can hit Ghost-type Pokémon normally. #define B_SKILL_SWAP GEN_7 // In Gen4+, Skill Swap triggers switch-in abilities after use. #define B_SECRET_POWER_EFFECT GEN_7 // Secret Power's effects change depending on the generation. See GetSecretPowerMoveEffect. +#define B_SECRET_POWER_ANIMATION GEN_7 // Secret Power's animations change depending on the generation. // Ability settings #define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. From b220da1d2ad9fd9696256a39ec626029d42187fb Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 6 Nov 2021 18:50:01 -0300 Subject: [PATCH 76/81] Updated NaturePowerMoves table for new terrains + added failsafe in case the terrain isn't defined in the table --- include/constants/battle.h | 2 + include/constants/battle_config.h | 1 + src/battle_script_commands.c | 68 +++++++++++++++++++++++++++++-- 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/include/constants/battle.h b/include/constants/battle.h index 3ba45e0d8..2fb4d3401 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -388,6 +388,8 @@ #define BATTLE_TERRAIN_SPACE 20 #define BATTLE_TERRAIN_ULTRA_SPACE 21 +#define BATTLE_TERRAIN_COUNT 22 + #define B_WAIT_TIME_LONG 64 #define B_WAIT_TIME_MED 48 #define B_WAIT_TIME_SHORT 32 diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 61723ced4..9d94966dd 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -155,6 +155,7 @@ #define B_SKILL_SWAP GEN_7 // In Gen4+, Skill Swap triggers switch-in abilities after use. #define B_SECRET_POWER_EFFECT GEN_7 // Secret Power's effects change depending on the generation. See GetSecretPowerMoveEffect. #define B_SECRET_POWER_ANIMATION GEN_7 // Secret Power's animations change depending on the generation. +#define B_NATURE_POWER_MOVES GEN_8 // Nature Power calls different moves depending on the generation. // Ability settings #define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index fcba67bca..57f02e2f5 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1097,18 +1097,76 @@ static const u16 sMoveEffectsForbiddenToInstruct[] = FORBIDDEN_INSTRUCT_END }; -static const u16 sNaturePowerMoves[] = +static const u16 sNaturePowerMoves[BATTLE_TERRAIN_COUNT] = { +#if B_NATURE_POWER_MOVES >= GEN_7 [BATTLE_TERRAIN_GRASS] = MOVE_ENERGY_BALL, [BATTLE_TERRAIN_LONG_GRASS] = MOVE_ENERGY_BALL, [BATTLE_TERRAIN_SAND] = MOVE_EARTH_POWER, - [BATTLE_TERRAIN_UNDERWATER] = MOVE_HYDRO_PUMP, [BATTLE_TERRAIN_WATER] = MOVE_HYDRO_PUMP, [BATTLE_TERRAIN_POND] = MOVE_HYDRO_PUMP, [BATTLE_TERRAIN_MOUNTAIN] = MOVE_EARTH_POWER, - [BATTLE_TERRAIN_CAVE] = MOVE_POWER_GEM, + [BATTLE_TERRAIN_CAVE] = MOVE_EARTH_POWER, [BATTLE_TERRAIN_BUILDING] = MOVE_TRI_ATTACK, - [BATTLE_TERRAIN_PLAIN] = MOVE_TRI_ATTACK + [BATTLE_TERRAIN_PLAIN] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_SNOW] = MOVE_ICE_BEAM, +#elif B_NATURE_POWER_MOVES == GEN_6 + [BATTLE_TERRAIN_GRASS] = MOVE_ENERGY_BALL, + [BATTLE_TERRAIN_LONG_GRASS] = MOVE_ENERGY_BALL, + [BATTLE_TERRAIN_SAND] = MOVE_EARTH_POWER, + [BATTLE_TERRAIN_WATER] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_POND] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_MOUNTAIN] = MOVE_EARTH_POWER, + [BATTLE_TERRAIN_CAVE] = MOVE_EARTH_POWER, + [BATTLE_TERRAIN_BUILDING] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_PLAIN] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_SNOW] = MOVE_FROST_BREATH, +#elif B_NATURE_POWER_MOVES == GEN_5 + [BATTLE_TERRAIN_GRASS] = MOVE_SEED_BOMB, + [BATTLE_TERRAIN_LONG_GRASS] = MOVE_SEED_BOMB, + [BATTLE_TERRAIN_SAND] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_WATER] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_POND] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_MOUNTAIN] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_CAVE] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_BUILDING] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_PLAIN] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_SNOW] = MOVE_BLIZZARD, +#elif B_NATURE_POWER_MOVES == GEN_4 + [BATTLE_TERRAIN_GRASS] = MOVE_SEED_BOMB, + [BATTLE_TERRAIN_LONG_GRASS] = MOVE_SEED_BOMB, + [BATTLE_TERRAIN_SAND] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_WATER] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_POND] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_MOUNTAIN] = MOVE_ROCK_SLIDE, + [BATTLE_TERRAIN_CAVE] = MOVE_ROCK_SLIDE, + [BATTLE_TERRAIN_BUILDING] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_PLAIN] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_SNOW] = MOVE_BLIZZARD, +#else // Gen 1-3 + [BATTLE_TERRAIN_GRASS] = MOVE_STUN_SPORE, + [BATTLE_TERRAIN_LONG_GRASS] = MOVE_RAZOR_LEAF, + [BATTLE_TERRAIN_SAND] = MOVE_EARTHQUAKE, + [BATTLE_TERRAIN_WATER] = MOVE_SURF, + [BATTLE_TERRAIN_POND] = MOVE_BUBBLE_BEAM, + [BATTLE_TERRAIN_MOUNTAIN] = MOVE_ROCK_SLIDE, + [BATTLE_TERRAIN_CAVE] = MOVE_SHADOW_BALL, + [BATTLE_TERRAIN_BUILDING] = MOVE_SWIFT, + [BATTLE_TERRAIN_PLAIN] = MOVE_SWIFT, + [BATTLE_TERRAIN_SNOW] = MOVE_BLIZZARD, +#endif + [BATTLE_TERRAIN_UNDERWATER] = MOVE_HYDRO_PUMP, + [BATTLE_TERRAIN_SOARING] = MOVE_AIR_SLASH, + [BATTLE_TERRAIN_SKY_PILLAR] = MOVE_AIR_SLASH, + [BATTLE_TERRAIN_BURIAL_GROUND] = MOVE_SHADOW_BALL, + [BATTLE_TERRAIN_PUDDLE] = MOVE_MUD_BOMB, + [BATTLE_TERRAIN_MARSH] = MOVE_MUD_BOMB, + [BATTLE_TERRAIN_SWAMP] = MOVE_MUD_BOMB, + [BATTLE_TERRAIN_ICE] = MOVE_ICE_BEAM, + [BATTLE_TERRAIN_VOLCANO] = MOVE_LAVA_PLUME, + [BATTLE_TERRAIN_DISTORTION_WORLD] = MOVE_TRI_ATTACK, + [BATTLE_TERRAIN_SPACE] = MOVE_DRACO_METEOR, + [BATTLE_TERRAIN_ULTRA_SPACE] = MOVE_PSYSHOCK, }; static const u16 sPickupItems[] = @@ -11866,6 +11924,8 @@ u16 GetNaturePowerMove(void) return MOVE_ENERGY_BALL; else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) return MOVE_PSYCHIC; + else if (sNaturePowerMoves == MOVE_NONE) + return MOVE_TRI_ATTACK; return sNaturePowerMoves[gBattleTerrain]; } From 1c4a0c205acc405d3dff3590e1ed88e70ed4a206 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 6 Nov 2021 19:09:35 -0300 Subject: [PATCH 77/81] Camouflage types config + extra terrains --- include/constants/battle_config.h | 1 + src/battle_script_commands.c | 42 +++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 9d94966dd..be81610cc 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -156,6 +156,7 @@ #define B_SECRET_POWER_EFFECT GEN_7 // Secret Power's effects change depending on the generation. See GetSecretPowerMoveEffect. #define B_SECRET_POWER_ANIMATION GEN_7 // Secret Power's animations change depending on the generation. #define B_NATURE_POWER_MOVES GEN_8 // Nature Power calls different moves depending on the generation. +#define B_CAMOUFLAGE_TYPES GEN_7 // Camouflage changes the user to different types depending on the generation // Ability settings #define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 57f02e2f5..85ddede46 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1211,18 +1211,38 @@ static const u8 sPickupProbabilities[] = 30, 40, 50, 60, 70, 80, 90, 94, 98 }; -static const u8 sTerrainToType[] = +static const u8 sTerrainToType[BATTLE_TERRAIN_COUNT] = { - [BATTLE_TERRAIN_GRASS] = TYPE_GRASS, - [BATTLE_TERRAIN_LONG_GRASS] = TYPE_GRASS, - [BATTLE_TERRAIN_SAND] = TYPE_GROUND, - [BATTLE_TERRAIN_UNDERWATER] = TYPE_WATER, - [BATTLE_TERRAIN_WATER] = TYPE_WATER, - [BATTLE_TERRAIN_POND] = TYPE_WATER, - [BATTLE_TERRAIN_MOUNTAIN] = TYPE_GROUND, - [BATTLE_TERRAIN_CAVE] = TYPE_ROCK, - [BATTLE_TERRAIN_BUILDING] = TYPE_NORMAL, - [BATTLE_TERRAIN_PLAIN] = TYPE_NORMAL, + [BATTLE_TERRAIN_GRASS] = TYPE_GRASS, + [BATTLE_TERRAIN_LONG_GRASS] = TYPE_GRASS, + [BATTLE_TERRAIN_SAND] = TYPE_GROUND, + [BATTLE_TERRAIN_UNDERWATER] = TYPE_WATER, + [BATTLE_TERRAIN_WATER] = TYPE_WATER, + [BATTLE_TERRAIN_POND] = TYPE_WATER, + [BATTLE_TERRAIN_CAVE] = TYPE_ROCK, + [BATTLE_TERRAIN_BUILDING] = TYPE_NORMAL, + [BATTLE_TERRAIN_SOARING] = TYPE_FLYING, + [BATTLE_TERRAIN_SKY_PILLAR] = TYPE_FLYING, + [BATTLE_TERRAIN_BURIAL_GROUND] = TYPE_GHOST, + [BATTLE_TERRAIN_PUDDLE] = TYPE_GROUND, + [BATTLE_TERRAIN_MARSH] = TYPE_GROUND, + [BATTLE_TERRAIN_SWAMP] = TYPE_GROUND, + [BATTLE_TERRAIN_SNOW] = TYPE_ICE, + [BATTLE_TERRAIN_ICE] = TYPE_ICE, + [BATTLE_TERRAIN_VOLCANO] = TYPE_FIRE, + [BATTLE_TERRAIN_DISTORTION_WORLD] = TYPE_NORMAL, + [BATTLE_TERRAIN_SPACE] = TYPE_DRAGON, + [BATTLE_TERRAIN_ULTRA_SPACE] = TYPE_PSYCHIC, +#if B_CAMOUFLAGE_TYPES >= GEN_5 + [BATTLE_TERRAIN_MOUNTAIN] = TYPE_GROUND, + [BATTLE_TERRAIN_PLAIN] = TYPE_GROUND, +#elif B_CAMOUFLAGE_TYPES == GEN_4 + [BATTLE_TERRAIN_MOUNTAIN] = TYPE_ROCK, + [BATTLE_TERRAIN_PLAIN] = TYPE_GROUND, +#else + [BATTLE_TERRAIN_MOUNTAIN] = TYPE_ROCK, + [BATTLE_TERRAIN_PLAIN] = TYPE_NORMAL, +#endif }; // - ITEM_ULTRA_BALL skips Master Ball and ITEM_NONE From 8773e552ace6994a85dd728dee32f29dde984d14 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 6 Nov 2021 19:24:06 -0300 Subject: [PATCH 78/81] Organized config and added failsafe to AnimTask_SetCamouflageBlend --- include/constants/battle_config.h | 30 +++++++++++++++--------------- src/battle_anim_utility_funcs.c | 1 + 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index be81610cc..5338b304e 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -95,7 +95,6 @@ #define B_CRIT_CHANCE GEN_7 // Chances of a critical hit landing. See CalcCritChanceStage. #define B_CRIT_MULTIPLIER GEN_7 // In Gen6+, critical hits multiply damage by 1.5 instead of 2. #define B_PARALYSIS_SPEED GEN_7 // In Gen7+, Speed is decreased by 50% instead of 75%. -#define B_TERRAIN_TYPE_BOOST GEN_8 // In Gen8, damage is boosted by 30% instead of 50%. #define B_CONFUSION_SELF_DMG_CHANCE GEN_7 // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%. #define B_MULTI_HIT_CHANCE GEN_7 // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values. @@ -153,10 +152,6 @@ #define B_MEMENTO_FAIL GEN_7 // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6. #define B_GLARE_GHOST GEN_7 // In Gen4+, Glare can hit Ghost-type Pokémon normally. #define B_SKILL_SWAP GEN_7 // In Gen4+, Skill Swap triggers switch-in abilities after use. -#define B_SECRET_POWER_EFFECT GEN_7 // Secret Power's effects change depending on the generation. See GetSecretPowerMoveEffect. -#define B_SECRET_POWER_ANIMATION GEN_7 // Secret Power's animations change depending on the generation. -#define B_NATURE_POWER_MOVES GEN_8 // Nature Power calls different moves depending on the generation. -#define B_CAMOUFLAGE_TYPES GEN_7 // Camouflage changes the user to different types depending on the generation // Ability settings #define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. @@ -187,26 +182,31 @@ // Eg: Replace with VAR_UNUSED_0x40F7 so you can use VAR_TERRAIN for that feature. #define VAR_TERRAIN 0 // If this var has a value, assigning a STATUS_FIELD_xx_TERRAIN to it before battle causes the battle to start with that terrain active +// Terrain settings +#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades. +#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8. +#define B_TERRAIN_TYPE_BOOST GEN_8 // In Gen8, damage is boosted by 30% instead of 50%. +#define B_SECRET_POWER_EFFECT GEN_7 // Secret Power's effects change depending on terrain and generation. See GetSecretPowerMoveEffect. +#define B_SECRET_POWER_ANIMATION GEN_7 // Secret Power's animations change depending on terrain and generation. +#define B_NATURE_POWER_MOVES GEN_8 // Nature Power calls different moves depending on terrain and generation. See sNaturePowerMoves. +#define B_CAMOUFLAGE_TYPES GEN_7 // Camouflage changes the user to different types depending on terrain and generation. See sTerrainToType. + // Interface settings #define B_ABILITY_POP_UP TRUE // In Gen5+, the Pokémon abilities are displayed in a pop-up, when they activate in battle. #define B_FAST_INTRO TRUE // If set to TRUE, battle intro texts print at the same time as animation of a Pokémon, as opposing to waiting for the animation to end. #define B_SHOW_TARGETS TRUE // If set to TRUE, all available targets, for moves hitting 2 or 3 Pokémon, will be shown before selecting a move. #define B_SHOW_SPLIT_ICON TRUE // If set to TRUE, it will show an icon in the summary showing the move's category split. #define B_HIDE_HEALTHBOX_IN_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations. -#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades. -// Critical Capture -#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. -#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. - -// Last Used Ball -#define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented -#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. +// Catching settings +#define B_SEMI_INVULNERABLE_CATCH GEN_7 // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) +#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. +#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. +#define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented +#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. // Other #define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. -#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8. -#define B_SEMI_INVULNERABLE_CATCH GEN_7 // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) // Animation Settings #define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle. diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index 0f35657db..c85a918da 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -136,6 +136,7 @@ void AnimTask_SetCamouflageBlend(u8 taskId) gBattleAnimArgs[4] = RGB(31, 31, 31); break; case BATTLE_TERRAIN_PLAIN: + default: gBattleAnimArgs[4] = RGB(31, 31, 31); break; } From 4e6a459b1439c9e81dbcc1068b09dfba3781571b Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 6 Nov 2021 19:46:52 -0300 Subject: [PATCH 79/81] Optimized terrain timers --- include/battle.h | 5 +---- src/battle_script_commands.c | 13 +++++-------- src/battle_util.c | 16 ++++++++-------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/include/battle.h b/include/battle.h index 7602c5d09..3c4b4d220 100644 --- a/include/battle.h +++ b/include/battle.h @@ -222,10 +222,7 @@ struct FieldTimer u8 wonderRoomTimer; u8 magicRoomTimer; u8 trickRoomTimer; - u8 grassyTerrainTimer; - u8 mistyTerrainTimer; - u8 electricTerrainTimer; - u8 psychicTerrainTimer; + u8 terrainTimer; u8 gravityTimer; u8 fairyLockTimer; }; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 85ddede46..4eec84088 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7328,19 +7328,19 @@ static void HandleTerrainMove(u32 moveEffect) switch (moveEffect) { case EFFECT_MISTY_TERRAIN: - statusFlag = STATUS_FIELD_MISTY_TERRAIN, timer = &gFieldTimers.mistyTerrainTimer; + statusFlag = STATUS_FIELD_MISTY_TERRAIN, timer = &gFieldTimers.terrainTimer; gBattleCommunication[MULTISTRING_CHOOSER] = 0; break; case EFFECT_GRASSY_TERRAIN: - statusFlag = STATUS_FIELD_GRASSY_TERRAIN, timer = &gFieldTimers.grassyTerrainTimer; + statusFlag = STATUS_FIELD_GRASSY_TERRAIN, timer = &gFieldTimers.terrainTimer; gBattleCommunication[MULTISTRING_CHOOSER] = 1; break; case EFFECT_ELECTRIC_TERRAIN: - statusFlag = STATUS_FIELD_ELECTRIC_TERRAIN, timer = &gFieldTimers.electricTerrainTimer; + statusFlag = STATUS_FIELD_ELECTRIC_TERRAIN, timer = &gFieldTimers.terrainTimer; gBattleCommunication[MULTISTRING_CHOOSER] = 2; break; case EFFECT_PSYCHIC_TERRAIN: - statusFlag = STATUS_FIELD_PSYCHIC_TERRAIN, timer = &gFieldTimers.psychicTerrainTimer; + statusFlag = STATUS_FIELD_PSYCHIC_TERRAIN, timer = &gFieldTimers.terrainTimer; gBattleCommunication[MULTISTRING_CHOOSER] = 3; break; } @@ -8937,22 +8937,19 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; // can heal return; case VARIOUS_REMOVE_TERRAIN: + gFieldTimers.terrainTimer = 0; switch (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) { case STATUS_FIELD_MISTY_TERRAIN: - gFieldTimers.mistyTerrainTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 0; break; case STATUS_FIELD_GRASSY_TERRAIN: - gFieldTimers.grassyTerrainTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 1; break; case STATUS_FIELD_ELECTRIC_TERRAIN: - gFieldTimers.electricTerrainTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 2; break; case STATUS_FIELD_PSYCHIC_TERRAIN: - gFieldTimers.psychicTerrainTimer = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 3; break; default: diff --git a/src/battle_util.c b/src/battle_util.c index 15d13b85a..66247c7f6 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2326,7 +2326,7 @@ u8 DoFieldEndTurnEffects(void) break; case ENDTURN_ELECTRIC_TERRAIN: if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN - && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.electricTerrainTimer == 0)) + && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.terrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT); TryToRevertMimicry(); @@ -2337,7 +2337,7 @@ u8 DoFieldEndTurnEffects(void) break; case ENDTURN_MISTY_TERRAIN: if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN - && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.mistyTerrainTimer == 0)) + && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.terrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN); TryToRevertMimicry(); @@ -2350,7 +2350,7 @@ u8 DoFieldEndTurnEffects(void) if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN) { if (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) - && (gFieldTimers.grassyTerrainTimer == 0 || --gFieldTimers.grassyTerrainTimer == 0)) + && (gFieldTimers.terrainTimer == 0 || --gFieldTimers.terrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_GRASSY_TERRAIN); TryToRevertMimicry(); @@ -2362,7 +2362,7 @@ u8 DoFieldEndTurnEffects(void) break; case ENDTURN_PSYCHIC_TERRAIN: if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN - && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.psychicTerrainTimer == 0)) + && (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.terrainTimer == 0)) { gFieldStatuses &= ~(STATUS_FIELD_PSYCHIC_TERRAIN); TryToRevertMimicry(); @@ -4338,28 +4338,28 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_ELECTRIC_SURGE: - if (TryChangeBattleTerrain(battler, STATUS_FIELD_ELECTRIC_TERRAIN, &gFieldTimers.electricTerrainTimer)) + if (TryChangeBattleTerrain(battler, STATUS_FIELD_ELECTRIC_TERRAIN, &gFieldTimers.terrainTimer)) { BattleScriptPushCursorAndCallback(BattleScript_ElectricSurgeActivates); effect++; } break; case ABILITY_GRASSY_SURGE: - if (TryChangeBattleTerrain(battler, STATUS_FIELD_GRASSY_TERRAIN, &gFieldTimers.grassyTerrainTimer)) + if (TryChangeBattleTerrain(battler, STATUS_FIELD_GRASSY_TERRAIN, &gFieldTimers.terrainTimer)) { BattleScriptPushCursorAndCallback(BattleScript_GrassySurgeActivates); effect++; } break; case ABILITY_MISTY_SURGE: - if (TryChangeBattleTerrain(battler, STATUS_FIELD_MISTY_TERRAIN, &gFieldTimers.mistyTerrainTimer)) + if (TryChangeBattleTerrain(battler, STATUS_FIELD_MISTY_TERRAIN, &gFieldTimers.terrainTimer)) { BattleScriptPushCursorAndCallback(BattleScript_MistySurgeActivates); effect++; } break; case ABILITY_PSYCHIC_SURGE: - if (TryChangeBattleTerrain(battler, STATUS_FIELD_PSYCHIC_TERRAIN, &gFieldTimers.psychicTerrainTimer)) + if (TryChangeBattleTerrain(battler, STATUS_FIELD_PSYCHIC_TERRAIN, &gFieldTimers.terrainTimer)) { BattleScriptPushCursorAndCallback(BattleScript_PsychicSurgeActivates); effect++; From c2a17510a962b9f26fbce84399b9df23aefbd31d Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sun, 7 Nov 2021 11:25:08 -0300 Subject: [PATCH 80/81] Terrain Pulse animations --- data/battle_anim_scripts.s | 82 +++++++++++++++++++++++++++++++++++++- src/battle_anim_new.c | 22 ++++++++++ src/battle_main.c | 2 +- 3 files changed, 104 insertions(+), 2 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 3e7f02692..b10c937ae 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -14082,7 +14082,87 @@ Move_RISING_VOLTAGE:: end @to do: Move_TERRAIN_PULSE:: - goto Move_DRAGON_PULSE @Temporary, needs to setup different animations based on terrain + loadspritegfx ANIM_TAG_DRAGON_PULSE + monbg ANIM_TARGET + setalpha 12, 8 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 7, RGB_BLACK + launchtask AnimTask_TerrainPulse 0x5 0x0 + jumpargeq 0x0, TYPE_ELECTRIC, TerrainPulseElectric + jumpargeq 0x0, TYPE_GRASS, TerrainPulseGrass + jumpargeq 0x0, TYPE_FAIRY, TerrainPulseFairy + jumpargeq 0x0, TYPE_PSYCHIC, TerrainPulsePsychic +TerrainPulseNormal: + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_DRAGON_PULSE, 0, 12, 12, RGB_WHITE + waitforvisualfinish + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + call DragonPulseParticle + call DragonPulseParticle + createvisualtask AnimTask_SwayMon, 5, 0, 2, 51200, 24, ANIM_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB_WHITE + goto TerrainPulseEnd + +TerrainPulseElectric: + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_DRAGON_PULSE, 0, 12, 12, RGB(27, 27, 0) + waitforvisualfinish + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + call DragonPulseParticle + call DragonPulseParticle + createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(27, 27, 0) + goto TerrainPulseEnd + +TerrainPulseGrass: + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_DRAGON_PULSE, 0, 12, 12, RGB(11, 26, 11) + waitforvisualfinish + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + call DragonPulseParticle + call DragonPulseParticle + createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(11, 26, 11) + goto TerrainPulseEnd + +TerrainPulseFairy: + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_DRAGON_PULSE, 0, 12, 12, RGB(31, 24, 31) + waitforvisualfinish + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + call DragonPulseParticle + call DragonPulseParticle + createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(31, 24, 31) + goto TerrainPulseEnd + +TerrainPulsePsychic: + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_DRAGON_PULSE, 0, 12, 12, RGB(27, 0, 13) + waitforvisualfinish + playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER + createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_PSYBEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + call DragonPulseParticle + call DragonPulseParticle + createvisualtask AnimTask_SwayMon, 5, 0, 4, 51200, 24, ANIM_TARGET + createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(27, 0, 13) + goto TerrainPulseEnd + +TerrainPulseEnd: + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + call DragonPulseParticle + waitforvisualfinish + delay 1 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 7, 0, RGB_BLACK + waitforvisualfinish + blendoff + clearmonbg ANIM_TARGET + end Move_SKITTER_SMACK:: end @to do: diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 3bc45939f..63fed0b3d 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -5073,3 +5073,25 @@ void AnimTask_ShellSideArm(u8 taskId) gBattleAnimArgs[0] = FALSE; DestroyAnimVisualTask(taskId); } + +void AnimTask_TerrainPulse(u8 taskId) +{ + if (IsBattlerTerrainAffected(gBattleAnimAttacker, STATUS_FIELD_TERRAIN_ANY)) + { + if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) + gBattleAnimArgs[0] = TYPE_ELECTRIC; + else if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN) + gBattleAnimArgs[0] = TYPE_GRASS; + else if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN) + gBattleAnimArgs[0] = TYPE_FAIRY; + else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) + gBattleAnimArgs[0] = TYPE_PSYCHIC; + else //failsafe + gBattleAnimArgs[0] = 0; + } + else + { + gBattleAnimArgs[0] = 0; + } + DestroyAnimVisualTask(taskId); +} diff --git a/src/battle_main.c b/src/battle_main.c index 63c4982f1..84491987e 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -5204,7 +5204,7 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk) gBattleStruct->dynamicMoveType = TYPE_FAIRY | 0x80; else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) gBattleStruct->dynamicMoveType = TYPE_PSYCHIC | 0x80; - else + else //failsafe gBattleStruct->dynamicMoveType = TYPE_NORMAL | 0x80; } } From b358f774dd1f53bf10c87c345e211f80dc48822b Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sun, 7 Nov 2021 14:40:18 -0300 Subject: [PATCH 81/81] Fixed the offensive boost of the Soul Dew --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index dbc46a3ec..9c5b77cd6 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8091,7 +8091,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe #if B_SOUL_DEW_BOOST >= GEN_7 if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && (moveType == TYPE_PSYCHIC || moveType == TYPE_DRAGON)) #else - if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER)) + if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && IS_MOVE_SPECIAL(move)) #endif MulModifier(&modifier, holdEffectModifier); break;