From 343e685537ce297b17757ba9b32187e743048331 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Wed, 20 Jul 2022 15:13:53 -0400 Subject: [PATCH 1/2] Sky Drop fixes - Sky Drop was using lbs in the formula instead of hectograms. This has been fixed. - Sky Drop is now affected by weight modifiers like Float Stone. - Enabled AI_CheckBadMove for Sky Drop. --- src/battle_ai_main.c | 9 ++++----- src/battle_script_commands.c | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index f924728d2f..dfb7ab8670 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2491,15 +2491,14 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) //break; //case EFFECT_BEAK_BLAST: //break; - /*case EFFECT_SKY_DROP: + case EFFECT_SKY_DROP: if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)) score -= 10; - if (WillFaintFromWeather(battlerAtk) - || MoveBlockedBySubstitute(move, battlerAtk, battlerDef) - || GetSpeciesWeight(gBattleMons[battlerDef].species, AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerDef], battlerDef, TRUE) >= 2000) //200.0 kg + if (BattlerWillFaintFromWeather(battlerAtk, AI_DATA->abilities[battlerAtk]) + || DoesSubstituteBlockMove(battlerAtk, battlerDef, move) + || GetBattlerWeight(battlerDef) >= 2000) //200.0 kg score -= 10; break; - */ /*case EFFECT_NO_RETREAT: if (TrappedByNoRetreat(battlerAtk)) score -= 10; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index eb3f32269c..52c838501f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9192,7 +9192,7 @@ static void Cmd_various(void) break; case VARIOUS_JUMP_IF_UNDER_200: // If the Pokemon is less than 200 kg, or weighing less than 441 lbs, then Sky Drop will work. Otherwise, it will fail. - if (GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), 1) < 441) + if (GetBattlerWeight(gBattlerTarget) < 2000) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); else gBattlescriptCurrInstr += 7; From 76f5926743f601e2d0f574292311890b2cfc1650 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Wed, 20 Jul 2022 15:29:40 -0400 Subject: [PATCH 2/2] Sky Drop check in IsBattlerTrapped --- 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 b8c42ed0c5..afd53e1626 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -617,7 +617,7 @@ bool32 IsBattlerTrapped(u8 battler, bool8 checkSwitch) { if (gBattleMons[battler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED) || IsAbilityPreventingEscape(battler) - || gStatuses3[battler] & (STATUS3_ROOTED) // TODO: sky drop target in air + || gStatuses3[battler] & (STATUS3_ROOTED | STATUS3_SKY_DROPPED) || (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)) return TRUE; }