From c2f718d3d35255552fdbe42f237a909a78a821cb Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 12 Jan 2021 14:58:24 -0300 Subject: [PATCH 01/79] Implemented Cramorant's Gulp Missile form change --- data/battle_anim_scripts.s | 17 +++++++++++ data/battle_scripts_1.s | 36 +++++++++++++++++++++++ include/battle_scripts.h | 2 ++ include/constants/battle_anim.h | 1 + include/constants/battle_config.h | 3 ++ src/battle_interface.c | 1 + src/battle_util.c | 47 +++++++++++++++++++++++++++++++ 7 files changed, 107 insertions(+) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 4bfef447b..c3ab5b150 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -826,6 +826,7 @@ gBattleAnims_General:: .4byte General_SlideOffScreen .4byte General_RestoreBg .4byte General_TotemFlare + .4byte General_GulpMissile .align 2 gBattleAnims_Special:: @@ -24420,6 +24421,22 @@ General_TotemFlare:: clearmonbg ANIM_ATTACKER end +General_GulpMissile: @ Modified Tackle anim (placeholder) + loadspritegfx ANIM_TAG_IMPACT + monbg ANIM_ATTACKER + setalpha 12, 8 + createsprite gHorizontalLungeSpriteTemplate, ANIM_TARGET, 2, 4, 4 + delay 6 + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, 0, 0, ANIM_ATTACKER, 2 + createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 3, 0, 6, 1 + playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_ATTACKER + waitforvisualfinish + delay 10 + playse SE_EFFECTIVE + clearmonbg ANIM_ATTACKER + blendoff + end + RainbowEndureEffect: launchtemplate gBlueEndureEnergySpriteTemplate 0x2 0x4 0x0 0xffe8 0x1a 0x2 delay 0x3 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f4b2ab7a7..76eda8472 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -5761,6 +5761,42 @@ BattleScript_PerishBodyActivates:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 return +BattleScript_GulpMissileGorging:: + call BattleScript_AbilityPopUp + playanimation BS_ATTACKER, B_ANIM_GULP_MISSILE, NULL + waitanimation + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 + healthbarupdate BS_ATTACKER + datahpupdate BS_ATTACKER + tryfaintmon BS_ATTACKER, FALSE, NULL + handleformchange BS_TARGET, 0 + playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL + waitanimation + swapattackerwithtarget + setmoveeffect MOVE_EFFECT_PARALYSIS + seteffectprimary + swapattackerwithtarget + return + +BattleScript_GulpMissileGulping:: + call BattleScript_AbilityPopUp + playanimation BS_ATTACKER, B_ANIM_GULP_MISSILE, NULL + waitanimation + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 + healthbarupdate BS_ATTACKER + datahpupdate BS_ATTACKER + tryfaintmon BS_ATTACKER, FALSE, NULL + handleformchange BS_TARGET, 0 + playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL + waitanimation + statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL + setgraphicalstatchangevalues + playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 + waitanimation + printstring STRINGID_PKMNSSTATCHANGED + waitmessage 0x40 + return + BattleScript_PerishSongCountGoesDown:: printstring STRINGID_PKMNPERISHCOUNTFELL waitmessage 0x40 diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 009590f3a..bf8700a25 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -357,5 +357,7 @@ extern const u8 BattleScript_CottonDownActivates[]; extern const u8 BattleScript_BallFetch[]; extern const u8 BattleScript_SandSpitActivates[]; extern const u8 BattleScript_PerishBodyActivates[]; +extern const u8 BattleScript_GulpMissileGorging[]; +extern const u8 BattleScript_GulpMissileGulping[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index 90766f9d5..525366df8 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -527,6 +527,7 @@ #define B_ANIM_SLIDE_OFFSCREEN 0x1E // for Emergency Exit #define B_ANIM_RESTORE_BG 0x1F // for Terrain Endings #define B_ANIM_TOTEM_FLARE 0x20 // Totem boosts aura flare +#define B_ANIM_GULP_MISSILE 0x21 // special animations table #define B_ANIM_LVL_UP 0x0 diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 6c34197ca..69a142f23 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -35,6 +35,9 @@ #define SPECIES_ZYGARDE 0 // 50% #define SPECIES_ZYGARDE_10 10011 // 10 % #define SPECIES_ZYGARDE_COMPLETE 10012 // 100 % + #define SPECIES_CRAMORANT 0 + #define SPECIES_CRAMORANT_GORGING 10013 + #define SPECIES_CRAMORANT_GULPING 10014 #endif // Items with peculiar battle effects. diff --git a/src/battle_interface.c b/src/battle_interface.c index 267b06ece..0f17a79ed 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -969,6 +969,7 @@ static void TryToggleHealboxVisibility(u8 priority, u8 healthboxLeftSpriteId, u8 case B_ANIM_TERRAIN_GRASSY: case B_ANIM_TERRAIN_ELECTRIC: case B_ANIM_TERRAIN_PSYCHIC: + case B_ANIM_GULP_MISSILE: break; } return; //all other special anims dont hide diff --git a/src/battle_util.c b/src/battle_util.c index 210f00b27..ba3874f51 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3488,6 +3488,8 @@ static bool32 ShouldChangeFormHpBased(u32 battler) {ABILITY_SHIELDS_DOWN, SPECIES_MINIOR_METEOR_VIOLET, SPECIES_MINIOR_CORE_VIOLET, 2}, {ABILITY_SHIELDS_DOWN, SPECIES_MINIOR_METEOR_YELLOW, SPECIES_MINIOR_CORE_YELLOW, 2}, {ABILITY_SCHOOLING, SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI, 4}, + {ABILITY_GULP_MISSILE, SPECIES_CRAMORANT, SPECIES_CRAMORANT_GORGING, 2}, + {ABILITY_GULP_MISSILE, SPECIES_CRAMORANT, SPECIES_CRAMORANT_GULPING, 1}, }; u32 i; @@ -4689,6 +4691,39 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_GULP_MISSILE: + if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) + && !gProtectStructs[gBattlerAttacker].confusionSelfDmg + && TARGET_TURN_DAMAGED + && IsBattlerAlive(battler) + && gBattleMons[battler].species == SPECIES_CRAMORANT_GORGING) + { + gBattleStruct->changedSpecies[gBattlerPartyIndexes[battler]] = gBattleMons[battler].species; + gBattleMons[battler].species = SPECIES_CRAMORANT; + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_GulpMissileGorging; + effect++; + } + else if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) + && !gProtectStructs[gBattlerAttacker].confusionSelfDmg + && TARGET_TURN_DAMAGED + && IsBattlerAlive(battler) + && gBattleMons[battler].species == SPECIES_CRAMORANT_GULPING) + { + gBattleStruct->changedSpecies[gBattlerPartyIndexes[battler]] = gBattleMons[battler].species; + gBattleMons[battler].species = SPECIES_CRAMORANT; + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + SET_STATCHANGER(STAT_DEF, 1, TRUE); + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_GulpMissileGulping; + effect++; + } + break; } break; case ABILITYEFFECT_MOVE_END_ATTACKER: // Same as above, but for attacker @@ -4714,6 +4749,16 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_GULP_MISSILE: + if ((effect = ShouldChangeFormHpBased(battler)) + && (gCurrentMove == MOVE_SURF + || gStatuses3[battler] & STATUS3_UNDERWATER)) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_AttackerFormChange; + effect++; + } + break; } break; case ABILITYEFFECT_MOVE_END_OTHER: // Abilities that activate on *another* battler's moveend: Dancer, Soul-Heart, Receiver, Symbiosis @@ -7798,6 +7843,8 @@ void UndoFormChange(u32 monId, u32 side) {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}, }; currSpecies = GetMonData(&party[monId], MON_DATA_SPECIES, NULL); From a49b5d1ad0aaebeceb5a7411ce725e99153a6054 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 16 Jan 2021 16:14:36 -0700 Subject: [PATCH 02/79] prankster updated to gen 7 --- data/battle_scripts_1.s | 9 +++++++++ include/battle_scripts.h | 1 + include/constants/battle_config.h | 1 + src/battle_script_commands.c | 1 + src/battle_util.c | 18 ++++++++++++++++++ 5 files changed, 30 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index bff609d59..ee5467a36 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7792,3 +7792,12 @@ BattleScript_AnnounceAirLockCloudNine:: waitmessage 0x40 call BattleScript_WeatherFormChanges end3 + +BattleScript_DarkTypePreventsPrankster:: + attackstring + ppreduce + pause 0x20 + printstring STRINGID_ITDOESNTAFFECT + waitmessage 0x40 + orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT + goto BattleScript_MoveEnd diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 009590f3a..243467195 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -357,5 +357,6 @@ extern const u8 BattleScript_CottonDownActivates[]; extern const u8 BattleScript_BallFetch[]; extern const u8 BattleScript_SandSpitActivates[]; extern const u8 BattleScript_PerishBodyActivates[]; +extern const u8 BattleScript_DarkTypePreventsPrankster[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index f7b38000c..f5129a479 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -122,6 +122,7 @@ #define B_FLASH_FIRE_FROZEN GEN_6 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. #define B_SYNCHRONIZE_NATURE GEN_6 // 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_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. +#define B_PRANKSTER GEN_7 // In Gen7, Prankster-elevated status moves do not affect Dark type Pokemon // Item settings #define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6c5f37a7d..b52f65e3e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4994,6 +4994,7 @@ static void Cmd_moveend(void) MoveValuesCleanUp(); gBattleScripting.moveEffect = gBattleScripting.savedMoveEffect; BattleScriptPush(gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]); + gBattleStruct->atkCancellerTracker = 0; // run all cancellers on next target gBattlescriptCurrInstr = BattleScript_FlushMessageBox; return; } diff --git a/src/battle_util.c b/src/battle_util.c index 210f00b27..83b53ff8a 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2849,6 +2849,7 @@ enum CANCELLER_POWDER_MOVE, CANCELLER_POWDER_STATUS, CANCELLER_THROAT_CHOP, + CANCELLER_PRANKSTER, CANCELLER_END, CANCELLER_PSYCHIC_TERRAIN, CANCELLER_END2, @@ -3185,6 +3186,23 @@ u8 AtkCanceller_UnableToUseMove(void) } gBattleStruct->atkCancellerTracker++; break; + case CANCELLER_PRANKSTER: + #if B_PRANKSTER >= GEN_7 + if (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER + && IS_MOVE_STATUS(gCurrentMove) + && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_OPPONENTS_FIELD) + && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) + && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE)) + { + if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) + CancelMultiTurnMoves(gBattlerAttacker); // don't cancel moves that can hit two targets bc one target might not be protected + gBattleScripting.battler = gBattlerAbility = gBattlerTarget; + gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster; + effect = 1; + } + #endif + gBattleStruct->atkCancellerTracker++; + break; case CANCELLER_END: break; } From 60f3ad77fe79e0b2bb62dc6215609b4ae9e91ab8 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 23 Jan 2021 12:40:17 -0700 Subject: [PATCH 03/79] fix prankster blocking self-targeting moves --- src/battle_util.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/battle_util.c b/src/battle_util.c index 83b53ff8a..18a5c128c 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3190,6 +3190,7 @@ u8 AtkCanceller_UnableToUseMove(void) #if B_PRANKSTER >= GEN_7 if (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_MOVE_STATUS(gCurrentMove) + && gBattlerAttacker != gBattlerTarget && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_OPPONENTS_FIELD) && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE)) From d5004638a933ed9394be4b2409ef8b7aa8c701e6 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Tue, 9 Mar 2021 16:35:47 -0700 Subject: [PATCH 04/79] Update include/constants/battle_config.h Co-authored-by: Eduardo Quezada D'Ottone --- 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 f5129a479..125088d78 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -122,7 +122,7 @@ #define B_FLASH_FIRE_FROZEN GEN_6 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. #define B_SYNCHRONIZE_NATURE GEN_6 // 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_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. -#define B_PRANKSTER GEN_7 // In Gen7, Prankster-elevated status moves do not affect Dark type Pokemon +#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7, Prankster-elevated status moves do not affect Dark type Pokémon. // Item settings #define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn. From 208b964a5682789b3bb9df04faf12ba47ebc7319 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Tue, 9 Mar 2021 16:35:56 -0700 Subject: [PATCH 05/79] Update src/battle_util.c Co-authored-by: Eduardo Quezada D'Ottone --- 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 18a5c128c..e5d13283b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3187,7 +3187,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case CANCELLER_PRANKSTER: - #if B_PRANKSTER >= GEN_7 + #if B_PRANKSTER_DARK_TYPES >= GEN_7 if (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_MOVE_STATUS(gCurrentMove) && gBattlerAttacker != gBattlerTarget From 1f3983cb05fc91945004c5dd75507def95e01c05 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Sat, 7 Aug 2021 20:38:35 +1200 Subject: [PATCH 06/79] Shields Down protects all meteor form Minior This was only working with red core minior. --- 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 de7105a27..104c528b8 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7138,7 +7138,7 @@ u32 IsLeafGuardProtected(u32 battler) bool32 IsShieldsDownProtected(u32 battler) { return (gBattleMons[battler].ability == ABILITY_SHIELDS_DOWN - && gBattleMons[battler].species == SPECIES_MINIOR); + && GetFormIdFromFormSpeciesId(gBattleMons[battler].species) < 6); // Minior is not in core form } u32 IsAbilityStatusProtected(u32 battler) From bc298d242f487437d797879889eca2a153f9b444 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 25 Aug 2021 23:15:30 +1200 Subject: [PATCH 07/79] Move mega indicator for lv 100 mons Indicator sprite overlaps the "100" without this. --- src/battle_interface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/battle_interface.c b/src/battle_interface.c index c4fcfe331..1a6a933a1 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1519,11 +1519,15 @@ u32 CreateMegaIndicatorSprite(u32 battlerId, u32 which) { x += sIndicatorPosDoubles[position][0]; y += sIndicatorPosDoubles[position][1]; + if (gBattleMons[battlerId].level >= 100) + x -= 4; } else { x += sIndicatorPosSingles[position][0]; y += sIndicatorPosSingles[position][1]; + if (gBattleMons[battlerId].level >= 100) + x -= 4; } spriteId = CreateSpriteAtEnd(&sSpriteTemplate_MegaIndicator, x, y, 0); gSprites[gSprites[gHealthboxSpriteIds[battlerId]].oam.affineParam].hOther_IndicatorSpriteId = spriteId; From 1d1546c7b22c59afb0dd1b6ec519ab8f5623e6ca Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Thu, 26 Aug 2021 19:00:43 +1200 Subject: [PATCH 08/79] Suggested changes --- src/battle_interface.c | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index 1a6a933a1..26d6fb27f 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1037,6 +1037,7 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl) if (gBattleStruct->mega.evolvedPartyIds[GetBattlerSide(battler)] & gBitTable[gBattlerPartyIndexes[battler]]) { objVram = ConvertIntToDecimalStringN(text, lvl, STR_CONV_MODE_LEFT_ALIGN, 3); + xPos = 5 * (3 - (objVram - (text + 2))) - 1; } else { @@ -1044,6 +1045,7 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl) text[1] = CHAR_LV_2; objVram = ConvertIntToDecimalStringN(text + 2, lvl, STR_CONV_MODE_LEFT_ALIGN, 3); + xPos = 5 * (3 - (objVram - (text + 2))); } xPos = 5 * (3 - (objVram - (text + 2))); @@ -1491,18 +1493,12 @@ void DestroyMegaTriggerSprite(void) gBattleStruct->mega.triggerSpriteId = 0xFF; } -static const s8 sIndicatorPosSingles[][2] = +static const s8 sIndicatorPositions[][2] = { - [B_POSITION_PLAYER_LEFT] = {53, -8}, - [B_POSITION_OPPONENT_LEFT] = {45, -8}, -}; - -static const s8 sIndicatorPosDoubles[][2] = -{ - [B_POSITION_PLAYER_LEFT] = {53, -8}, - [B_POSITION_OPPONENT_LEFT] = {45, -8}, - [B_POSITION_PLAYER_RIGHT] = {53, -8}, - [B_POSITION_OPPONENT_RIGHT] = {45, -8}, + [B_POSITION_PLAYER_LEFT] = {52, -9}, + [B_POSITION_OPPONENT_LEFT] = {44, -9}, + [B_POSITION_PLAYER_RIGHT] = {52, -9}, + [B_POSITION_OPPONENT_RIGHT] = {44, -9}, }; u32 CreateMegaIndicatorSprite(u32 battlerId, u32 which) @@ -1515,20 +1511,15 @@ u32 CreateMegaIndicatorSprite(u32 battlerId, u32 which) position = GetBattlerPosition(battlerId); GetBattlerHealthboxCoords(battlerId, &x, &y); - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) - { - x += sIndicatorPosDoubles[position][0]; - y += sIndicatorPosDoubles[position][1]; - if (gBattleMons[battlerId].level >= 100) - x -= 4; - } - else - { - x += sIndicatorPosSingles[position][0]; - y += sIndicatorPosSingles[position][1]; - if (gBattleMons[battlerId].level >= 100) - x -= 4; - } + + x += sIndicatorPositions[position][0]; + y += sIndicatorPositions[position][1]; + + if (gBattleMons[battlerId].level >= 100) + x -= 4; + else if (gBattleMons[battlerId].level < 10) + x += 5; + spriteId = CreateSpriteAtEnd(&sSpriteTemplate_MegaIndicator, x, y, 0); gSprites[gSprites[gHealthboxSpriteIds[battlerId]].oam.affineParam].hOther_IndicatorSpriteId = spriteId; From 9e4f33d09eefca193668718d84411105257f412d Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 26 Aug 2021 16:14:05 -0300 Subject: [PATCH 09/79] Implemented Desolate Land, Primordial Sea and Delta Stream --- asm/macros/battle_script.inc | 4 + data/battle_scripts_1.s | 85 ++ include/battle_scripts.h | 7 + include/constants/battle.h | 35 +- include/constants/battle_script_commands.h | 1 + include/constants/battle_string_ids.h | 1130 ++++++++++---------- src/battle_message.c | 24 + src/battle_script_commands.c | 44 + src/battle_util.c | 54 +- 9 files changed, 807 insertions(+), 577 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 9fa3fe0c3..78938293e 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1769,6 +1769,10 @@ various \battler, VARIOUS_TRY_ACTIVATE_GRIM_NEIGH .endm + .macro trytoclearprimalweather + various BS_ATTACKER, VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER + .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 eef725903..63c300a74 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3664,6 +3664,9 @@ BattleScript_EffectSandstorm:: attackcanceler attackstring ppreduce + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn setsandstorm goto BattleScript_MoveWeatherChange @@ -3866,6 +3869,9 @@ BattleScript_EffectRainDance:: attackcanceler attackstring ppreduce + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn setrain BattleScript_MoveWeatherChange:: attackanimation @@ -3879,9 +3885,30 @@ BattleScript_EffectSunnyDay:: attackcanceler attackstring ppreduce + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn setsunny goto BattleScript_MoveWeatherChange +BattleScript_ExtremelyHarshSunlightWasNotLessened: + pause B_WAIT_TIME_SHORT + printstring STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_NoReliefFromHeavyRain: + pause B_WAIT_TIME_SHORT + printstring STRINGID_NORELIEFROMHEAVYRAIN + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_MysteriousAirCurrentBlowsOn: + pause B_WAIT_TIME_SHORT + printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + BattleScript_EffectDefenseUpHit:: setmoveeffect MOVE_EFFECT_DEF_PLUS_1 | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -4239,6 +4266,9 @@ BattleScript_EffectHail:: attackcanceler attackstring ppreduce + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessened + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRain + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOn sethail goto BattleScript_MoveWeatherChange @@ -5240,6 +5270,9 @@ BattleScript_DoSwitchOut:: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON hidepartystatussummary BS_ATTACKER switchinanim BS_ATTACKER, FALSE @@ -6860,6 +6893,58 @@ BattleScript_DroughtActivates:: call BattleScript_WeatherFormChanges end3 +BattleScript_DesolateLandActivates:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_EXTREMELYHARSHSUNLIGHT + waitstate + playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL + call BattleScript_WeatherFormChanges + end3 + +BattleScript_DesolateLandEvaporatesWaterTypeMoves:: + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + pause B_WAIT_TIME_SHORT + ppreduce + printstring STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_PrimordialSeaActivates:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_HEAVYRAIN + waitstate + playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL + call BattleScript_WeatherFormChanges + end3 + +BattleScript_PrimordialSeaFizzlesOutFireTypeMoves:: + accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + attackstring + pause B_WAIT_TIME_SHORT + ppreduce + printstring STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_DeltaStreamActivates:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_MYSTERIOUSAIRCURRENT + waitmessage B_WAIT_TIME_LONG + end3 + +BattleScript_AttackWeakenedByStrongWinds:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS + waitmessage B_WAIT_TIME_LONG + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 + goto BattleScript_HitFromAtkAnimation + BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp diff --git a/include/battle_scripts.h b/include/battle_scripts.h index f0712fc43..f3470776a 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -369,5 +369,12 @@ extern const u8 BattleScript_JabocaRowapBerryActivates[]; extern const u8 BattleScript_NotAffectedAbilityPopUp[]; extern const u8 BattleScript_BattlerShookOffTaunt[]; extern const u8 BattleScript_BattlerGotOverItsInfatuation[]; +extern const u8 BattleScript_DesolateLandActivates[]; +extern const u8 BattleScript_DesolateLandEvaporatesWaterTypeMoves[]; +extern const u8 BattleScript_PrimordialSeaActivates[]; +extern const u8 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves[]; +extern const u8 BattleScript_DeltaStreamActivates[]; +extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[]; +extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle.h b/include/constants/battle.h index b158076bd..cb3e2c7be 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -256,24 +256,31 @@ #define WEATHER_RAIN_TEMPORARY (1 << 0) #define WEATHER_RAIN_DOWNPOUR (1 << 1) // unused #define WEATHER_RAIN_PERMANENT (1 << 2) -#define WEATHER_RAIN_ANY (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT) -#define WEATHER_SANDSTORM_TEMPORARY (1 << 3) -#define WEATHER_SANDSTORM_PERMANENT (1 << 4) +#define WEATHER_RAIN_PRIMAL (1 << 3) +#define WEATHER_RAIN_ANY (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT | WEATHER_RAIN_PRIMAL) +#define WEATHER_SANDSTORM_TEMPORARY (1 << 4) +#define WEATHER_SANDSTORM_PERMANENT (1 << 5) #define WEATHER_SANDSTORM_ANY (WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT) -#define WEATHER_SUN_TEMPORARY (1 << 5) -#define WEATHER_SUN_PERMANENT (1 << 6) -#define WEATHER_SUN_ANY (WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT) -#define WEATHER_HAIL_TEMPORARY (1 << 7) -#define WEATHER_HAIL_PERMANENT (1 << 8) +#define WEATHER_SUN_TEMPORARY (1 << 6) +#define WEATHER_SUN_PERMANENT (1 << 7) +#define WEATHER_SUN_PRIMAL (1 << 8) +#define WEATHER_SUN_ANY (WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT | WEATHER_SUN_PRIMAL) +#define WEATHER_HAIL_TEMPORARY (1 << 9) +#define WEATHER_HAIL_PERMANENT (1 << 10) #define WEATHER_HAIL_ANY (WEATHER_HAIL_TEMPORARY | WEATHER_HAIL_PERMANENT) -#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY) +#define WEATHER_STRONG_WINDS (1 << 11) +#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY | WEATHER_STRONG_WINDS) +#define WEATHER_PRIMAL_ANY (WEATHER_RAIN_PRIMAL | WEATHER_SUN_PRIMAL | WEATHER_STRONG_WINDS) // Battle Weather as enum -#define ENUM_WEATHER_NONE 0 -#define ENUM_WEATHER_RAIN 1 -#define ENUM_WEATHER_SUN 2 -#define ENUM_WEATHER_SANDSTORM 3 -#define ENUM_WEATHER_HAIL 4 +#define ENUM_WEATHER_NONE 0 +#define ENUM_WEATHER_RAIN 1 +#define ENUM_WEATHER_SUN 2 +#define ENUM_WEATHER_SANDSTORM 3 +#define ENUM_WEATHER_HAIL 4 +#define ENUM_WEATHER_SUN_PRIMAL 5 +#define ENUM_WEATHER_RAIN_PRIMAL 6 +#define ENUM_WEATHER_STRONG_WINDS 7 // Move Effects #define MOVE_EFFECT_SLEEP 0x1 diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index faaf8f17e..5b94cb145 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -173,6 +173,7 @@ #define VARIOUS_DESTROY_ABILITY_POPUP 102 #define VARIOUS_TOTEM_BOOST 103 #define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 104 +#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 105 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index cda885694..04abb280b 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -12,566 +12,578 @@ #define STRINGID_TRAINERSLIDE 6 // todo: make some of those names less vague: attacker/target vs pkmn, etc. -#define STRINGID_TRAINER1LOSETEXT 12 -#define STRINGID_PKMNGAINEDEXP 13 -#define STRINGID_PKMNGREWTOLV 14 -#define STRINGID_PKMNLEARNEDMOVE 15 -#define STRINGID_TRYTOLEARNMOVE1 16 -#define STRINGID_TRYTOLEARNMOVE2 17 -#define STRINGID_TRYTOLEARNMOVE3 18 -#define STRINGID_PKMNFORGOTMOVE 19 -#define STRINGID_STOPLEARNINGMOVE 20 -#define STRINGID_DIDNOTLEARNMOVE 21 -#define STRINGID_PKMNLEARNEDMOVE2 22 -#define STRINGID_ATTACKMISSED 23 -#define STRINGID_PKMNPROTECTEDITSELF 24 -#define STRINGID_STATSWONTINCREASE2 25 -#define STRINGID_AVOIDEDDAMAGE 26 -#define STRINGID_ITDOESNTAFFECT 27 -#define STRINGID_ATTACKERFAINTED 28 -#define STRINGID_TARGETFAINTED 29 -#define STRINGID_PLAYERGOTMONEY 30 -#define STRINGID_PLAYERWHITEOUT 31 -#define STRINGID_PLAYERWHITEOUT2 32 -#define STRINGID_PREVENTSESCAPE 33 -#define STRINGID_HITXTIMES 34 -#define STRINGID_PKMNFELLASLEEP 35 -#define STRINGID_PKMNMADESLEEP 36 -#define STRINGID_PKMNALREADYASLEEP 37 -#define STRINGID_PKMNALREADYASLEEP2 38 -#define STRINGID_PKMNWASNTAFFECTED 39 -#define STRINGID_PKMNWASPOISONED 40 -#define STRINGID_PKMNPOISONEDBY 41 -#define STRINGID_PKMNHURTBYPOISON 42 -#define STRINGID_PKMNALREADYPOISONED 43 -#define STRINGID_PKMNBADLYPOISONED 44 -#define STRINGID_PKMNENERGYDRAINED 45 -#define STRINGID_PKMNWASBURNED 46 -#define STRINGID_PKMNBURNEDBY 47 -#define STRINGID_PKMNHURTBYBURN 48 -#define STRINGID_PKMNWASFROZEN 49 -#define STRINGID_PKMNFROZENBY 50 -#define STRINGID_PKMNISFROZEN 51 -#define STRINGID_PKMNWASDEFROSTED 52 -#define STRINGID_PKMNWASDEFROSTED2 53 -#define STRINGID_PKMNWASDEFROSTEDBY 54 -#define STRINGID_PKMNWASPARALYZED 55 -#define STRINGID_PKMNWASPARALYZEDBY 56 -#define STRINGID_PKMNISPARALYZED 57 -#define STRINGID_PKMNISALREADYPARALYZED 58 -#define STRINGID_PKMNHEALEDPARALYSIS 59 -#define STRINGID_PKMNDREAMEATEN 60 -#define STRINGID_STATSWONTINCREASE 61 -#define STRINGID_STATSWONTDECREASE 62 -#define STRINGID_TEAMSTOPPEDWORKING 63 -#define STRINGID_FOESTOPPEDWORKING 64 -#define STRINGID_PKMNISCONFUSED 65 -#define STRINGID_PKMNHEALEDCONFUSION 66 -#define STRINGID_PKMNWASCONFUSED 67 -#define STRINGID_PKMNALREADYCONFUSED 68 -#define STRINGID_PKMNFELLINLOVE 69 -#define STRINGID_PKMNINLOVE 70 -#define STRINGID_PKMNIMMOBILIZEDBYLOVE 71 -#define STRINGID_PKMNBLOWNAWAY 72 -#define STRINGID_PKMNCHANGEDTYPE 73 -#define STRINGID_PKMNFLINCHED 74 -#define STRINGID_PKMNREGAINEDHEALTH 75 -#define STRINGID_PKMNHPFULL 76 -#define STRINGID_PKMNRAISEDSPDEF 77 -#define STRINGID_PKMNRAISEDDEF 78 -#define STRINGID_PKMNCOVEREDBYVEIL 79 -#define STRINGID_PKMNUSEDSAFEGUARD 80 -#define STRINGID_PKMNSAFEGUARDEXPIRED 81 -#define STRINGID_PKMNWENTTOSLEEP 82 -#define STRINGID_PKMNSLEPTHEALTHY 83 -#define STRINGID_PKMNWHIPPEDWHIRLWIND 84 -#define STRINGID_PKMNTOOKSUNLIGHT 85 -#define STRINGID_PKMNLOWEREDHEAD 86 -#define STRINGID_PKMNISGLOWING 87 -#define STRINGID_PKMNFLEWHIGH 88 -#define STRINGID_PKMNDUGHOLE 89 -#define STRINGID_PKMNSQUEEZEDBYBIND 90 -#define STRINGID_PKMNTRAPPEDINVORTEX 91 -#define STRINGID_PKMNWRAPPEDBY 92 -#define STRINGID_PKMNCLAMPED 93 -#define STRINGID_PKMNHURTBY 94 -#define STRINGID_PKMNFREEDFROM 95 -#define STRINGID_PKMNCRASHED 96 -#define STRINGID_PKMNSHROUDEDINMIST 97 -#define STRINGID_PKMNPROTECTEDBYMIST 98 -#define STRINGID_PKMNGETTINGPUMPED 99 -#define STRINGID_PKMNHITWITHRECOIL 100 -#define STRINGID_PKMNPROTECTEDITSELF2 101 -#define STRINGID_PKMNBUFFETEDBYSANDSTORM 102 -#define STRINGID_PKMNPELTEDBYHAIL 103 -#define STRINGID_PKMNSEEDED 104 -#define STRINGID_PKMNEVADEDATTACK 105 -#define STRINGID_PKMNSAPPEDBYLEECHSEED 106 -#define STRINGID_PKMNFASTASLEEP 107 -#define STRINGID_PKMNWOKEUP 108 -#define STRINGID_PKMNUPROARKEPTAWAKE 109 -#define STRINGID_PKMNWOKEUPINUPROAR 110 -#define STRINGID_PKMNCAUSEDUPROAR 111 -#define STRINGID_PKMNMAKINGUPROAR 112 -#define STRINGID_PKMNCALMEDDOWN 113 -#define STRINGID_PKMNCANTSLEEPINUPROAR 114 -#define STRINGID_PKMNSTOCKPILED 115 -#define STRINGID_PKMNCANTSTOCKPILE 116 -#define STRINGID_PKMNCANTSLEEPINUPROAR2 117 -#define STRINGID_UPROARKEPTPKMNAWAKE 118 -#define STRINGID_PKMNSTAYEDAWAKEUSING 119 -#define STRINGID_PKMNSTORINGENERGY 120 -#define STRINGID_PKMNUNLEASHEDENERGY 121 -#define STRINGID_PKMNFATIGUECONFUSION 122 -#define STRINGID_PLAYERPICKEDUPMONEY 123 -#define STRINGID_PKMNUNAFFECTED 124 -#define STRINGID_PKMNTRANSFORMEDINTO 125 -#define STRINGID_PKMNMADESUBSTITUTE 126 -#define STRINGID_PKMNHASSUBSTITUTE 127 -#define STRINGID_SUBSTITUTEDAMAGED 128 -#define STRINGID_PKMNSUBSTITUTEFADED 129 -#define STRINGID_PKMNMUSTRECHARGE 130 -#define STRINGID_PKMNRAGEBUILDING 131 -#define STRINGID_PKMNMOVEWASDISABLED 132 -#define STRINGID_PKMNMOVEISDISABLED 133 -#define STRINGID_PKMNMOVEDISABLEDNOMORE 134 -#define STRINGID_PKMNGOTENCORE 135 -#define STRINGID_PKMNENCOREENDED 136 -#define STRINGID_PKMNTOOKAIM 137 -#define STRINGID_PKMNSKETCHEDMOVE 138 -#define STRINGID_PKMNTRYINGTOTAKEFOE 139 -#define STRINGID_PKMNTOOKFOE 140 -#define STRINGID_PKMNREDUCEDPP 141 -#define STRINGID_PKMNSTOLEITEM 142 -#define STRINGID_TARGETCANTESCAPENOW 143 -#define STRINGID_PKMNFELLINTONIGHTMARE 144 -#define STRINGID_PKMNLOCKEDINNIGHTMARE 145 -#define STRINGID_PKMNLAIDCURSE 146 -#define STRINGID_PKMNAFFLICTEDBYCURSE 147 -#define STRINGID_SPIKESSCATTERED 148 -#define STRINGID_PKMNHURTBYSPIKES 149 -#define STRINGID_PKMNIDENTIFIED 150 -#define STRINGID_PKMNPERISHCOUNTFELL 151 -#define STRINGID_PKMNBRACEDITSELF 152 -#define STRINGID_PKMNENDUREDHIT 153 -#define STRINGID_MAGNITUDESTRENGTH 154 -#define STRINGID_PKMNCUTHPMAXEDATTACK 155 -#define STRINGID_PKMNCOPIEDSTATCHANGES 156 -#define STRINGID_PKMNGOTFREE 157 -#define STRINGID_PKMNSHEDLEECHSEED 158 -#define STRINGID_PKMNBLEWAWAYSPIKES 159 -#define STRINGID_PKMNFLEDFROMBATTLE 160 -#define STRINGID_PKMNFORESAWATTACK 161 -#define STRINGID_PKMNTOOKATTACK 162 -#define STRINGID_PKMNATTACK 163 -#define STRINGID_PKMNCENTERATTENTION 164 -#define STRINGID_PKMNCHARGINGPOWER 165 -#define STRINGID_NATUREPOWERTURNEDINTO 166 -#define STRINGID_PKMNSTATUSNORMAL 167 -#define STRINGID_PKMNHASNOMOVESLEFT 168 -#define STRINGID_PKMNSUBJECTEDTOTORMENT 169 -#define STRINGID_PKMNCANTUSEMOVETORMENT 170 -#define STRINGID_PKMNTIGHTENINGFOCUS 171 -#define STRINGID_PKMNFELLFORTAUNT 172 -#define STRINGID_PKMNCANTUSEMOVETAUNT 173 -#define STRINGID_PKMNREADYTOHELP 174 -#define STRINGID_PKMNSWITCHEDITEMS 175 -#define STRINGID_PKMNCOPIEDFOE 176 -#define STRINGID_PKMNMADEWISH 177 -#define STRINGID_PKMNWISHCAMETRUE 178 -#define STRINGID_PKMNPLANTEDROOTS 179 -#define STRINGID_PKMNABSORBEDNUTRIENTS 180 -#define STRINGID_PKMNANCHOREDITSELF 181 -#define STRINGID_PKMNWASMADEDROWSY 182 -#define STRINGID_PKMNKNOCKEDOFF 183 -#define STRINGID_PKMNSWAPPEDABILITIES 184 -#define STRINGID_PKMNSEALEDOPPONENTMOVE 185 -#define STRINGID_PKMNCANTUSEMOVESEALED 186 -#define STRINGID_PKMNWANTSGRUDGE 187 -#define STRINGID_PKMNLOSTPPGRUDGE 188 -#define STRINGID_PKMNSHROUDEDITSELF 189 -#define STRINGID_PKMNMOVEBOUNCED 190 -#define STRINGID_PKMNWAITSFORTARGET 191 -#define STRINGID_PKMNSNATCHEDMOVE 192 -#define STRINGID_PKMNMADEITRAIN 193 -#define STRINGID_PKMNRAISEDSPEED 194 -#define STRINGID_PKMNPROTECTEDBY 195 -#define STRINGID_PKMNPREVENTSUSAGE 196 -#define STRINGID_PKMNRESTOREDHPUSING 197 -#define STRINGID_PKMNCHANGEDTYPEWITH 198 -#define STRINGID_PKMNPREVENTSPARALYSISWITH 199 -#define STRINGID_PKMNPREVENTSROMANCEWITH 200 -#define STRINGID_PKMNPREVENTSPOISONINGWITH 201 -#define STRINGID_PKMNPREVENTSCONFUSIONWITH 202 -#define STRINGID_PKMNRAISEDFIREPOWERWITH 203 -#define STRINGID_PKMNANCHORSITSELFWITH 204 -#define STRINGID_PKMNCUTSATTACKWITH 205 -#define STRINGID_PKMNPREVENTSSTATLOSSWITH 206 -#define STRINGID_PKMNHURTSWITH 207 -#define STRINGID_PKMNTRACED 208 -#define STRINGID_STATSHARPLY 209 -#define STRINGID_STATROSE 210 -#define STRINGID_STATHARSHLY 211 -#define STRINGID_STATFELL 212 -#define STRINGID_ATTACKERSSTATROSE 213 -#define STRINGID_DEFENDERSSTATROSE 214 -#define STRINGID_ATTACKERSSTATFELL 215 -#define STRINGID_DEFENDERSSTATFELL 216 -#define STRINGID_CRITICALHIT 217 -#define STRINGID_ONEHITKO 218 -#define STRINGID_123POOF 219 -#define STRINGID_ANDELLIPSIS 220 -#define STRINGID_NOTVERYEFFECTIVE 221 -#define STRINGID_SUPEREFFECTIVE 222 -#define STRINGID_GOTAWAYSAFELY 223 -#define STRINGID_WILDPKMNFLED 224 -#define STRINGID_NORUNNINGFROMTRAINERS 225 -#define STRINGID_CANTESCAPE 226 -#define STRINGID_DONTLEAVEBIRCH 227 -#define STRINGID_BUTNOTHINGHAPPENED 228 -#define STRINGID_BUTITFAILED 229 -#define STRINGID_ITHURTCONFUSION 230 -#define STRINGID_MIRRORMOVEFAILED 231 -#define STRINGID_STARTEDTORAIN 232 -#define STRINGID_DOWNPOURSTARTED 233 -#define STRINGID_RAINCONTINUES 234 -#define STRINGID_DOWNPOURCONTINUES 235 -#define STRINGID_RAINSTOPPED 236 -#define STRINGID_SANDSTORMBREWED 237 -#define STRINGID_SANDSTORMRAGES 238 -#define STRINGID_SANDSTORMSUBSIDED 239 -#define STRINGID_SUNLIGHTGOTBRIGHT 240 -#define STRINGID_SUNLIGHTSTRONG 241 -#define STRINGID_SUNLIGHTFADED 242 -#define STRINGID_STARTEDHAIL 243 -#define STRINGID_HAILCONTINUES 244 -#define STRINGID_HAILSTOPPED 245 -#define STRINGID_FAILEDTOSPITUP 246 -#define STRINGID_FAILEDTOSWALLOW 247 -#define STRINGID_WINDBECAMEHEATWAVE 248 -#define STRINGID_STATCHANGESGONE 249 -#define STRINGID_COINSSCATTERED 250 -#define STRINGID_TOOWEAKFORSUBSTITUTE 251 -#define STRINGID_SHAREDPAIN 252 -#define STRINGID_BELLCHIMED 253 -#define STRINGID_FAINTINTHREE 254 -#define STRINGID_NOPPLEFT 255 -#define STRINGID_BUTNOPPLEFT 256 -#define STRINGID_PLAYERUSEDITEM 257 -#define STRINGID_WALLYUSEDITEM 258 -#define STRINGID_TRAINERBLOCKEDBALL 259 -#define STRINGID_DONTBEATHIEF 260 -#define STRINGID_ITDODGEDBALL 261 -#define STRINGID_YOUMISSEDPKMN 262 -#define STRINGID_PKMNBROKEFREE 263 -#define STRINGID_ITAPPEAREDCAUGHT 264 -#define STRINGID_AARGHALMOSTHADIT 265 -#define STRINGID_SHOOTSOCLOSE 266 -#define STRINGID_GOTCHAPKMNCAUGHT 267 -#define STRINGID_GOTCHAPKMNCAUGHT2 268 -#define STRINGID_GIVENICKNAMECAPTURED 269 -#define STRINGID_PKMNSENTTOPC 270 -#define STRINGID_PKMNDATAADDEDTODEX 271 -#define STRINGID_ITISRAINING 272 -#define STRINGID_SANDSTORMISRAGING 273 -#define STRINGID_CANTESCAPE2 274 -#define STRINGID_PKMNIGNORESASLEEP 275 -#define STRINGID_PKMNIGNOREDORDERS 276 -#define STRINGID_PKMNBEGANTONAP 277 -#define STRINGID_PKMNLOAFING 278 -#define STRINGID_PKMNWONTOBEY 279 -#define STRINGID_PKMNTURNEDAWAY 280 -#define STRINGID_PKMNPRETENDNOTNOTICE 281 -#define STRINGID_ENEMYABOUTTOSWITCHPKMN 282 -#define STRINGID_CREPTCLOSER 283 -#define STRINGID_CANTGETCLOSER 284 -#define STRINGID_PKMNWATCHINGCAREFULLY 285 -#define STRINGID_PKMNCURIOUSABOUTX 286 -#define STRINGID_PKMNENTHRALLEDBYX 287 -#define STRINGID_PKMNIGNOREDX 288 -#define STRINGID_THREWPOKEBLOCKATPKMN 289 -#define STRINGID_OUTOFSAFARIBALLS 290 -#define STRINGID_PKMNSITEMCUREDPARALYSIS 291 -#define STRINGID_PKMNSITEMCUREDPOISON 292 -#define STRINGID_PKMNSITEMHEALEDBURN 293 -#define STRINGID_PKMNSITEMDEFROSTEDIT 294 -#define STRINGID_PKMNSITEMWOKEIT 295 -#define STRINGID_PKMNSITEMSNAPPEDOUT 296 -#define STRINGID_PKMNSITEMCUREDPROBLEM 297 -#define STRINGID_PKMNSITEMRESTOREDHEALTH 298 -#define STRINGID_PKMNSITEMRESTOREDPP 299 -#define STRINGID_PKMNSITEMRESTOREDSTATUS 300 -#define STRINGID_PKMNSITEMRESTOREDHPALITTLE 301 -#define STRINGID_ITEMALLOWSONLYYMOVE 302 -#define STRINGID_PKMNHUNGONWITHX 303 -#define STRINGID_EMPTYSTRING3 304 -#define STRINGID_PKMNSXPREVENTSBURNS 305 -#define STRINGID_PKMNSXBLOCKSY 306 -#define STRINGID_PKMNSXRESTOREDHPALITTLE2 307 -#define STRINGID_PKMNSXWHIPPEDUPSANDSTORM 308 -#define STRINGID_PKMNSXPREVENTSYLOSS 309 -#define STRINGID_PKMNSXINFATUATEDY 310 -#define STRINGID_PKMNSXMADEYINEFFECTIVE 311 -#define STRINGID_PKMNSXCUREDYPROBLEM 312 -#define STRINGID_ITSUCKEDLIQUIDOOZE 313 -#define STRINGID_PKMNTRANSFORMED 314 -#define STRINGID_ELECTRICITYWEAKENED 315 -#define STRINGID_FIREWEAKENED 316 -#define STRINGID_PKMNHIDUNDERWATER 317 -#define STRINGID_PKMNSPRANGUP 318 -#define STRINGID_HMMOVESCANTBEFORGOTTEN 319 -#define STRINGID_XFOUNDONEY 320 -#define STRINGID_PLAYERDEFEATEDTRAINER1 321 -#define STRINGID_SOOTHINGAROMA 322 -#define STRINGID_ITEMSCANTBEUSEDNOW 323 -#define STRINGID_FORXCOMMAYZ 324 -#define STRINGID_USINGITEMSTATOFPKMNROSE 325 -#define STRINGID_PKMNUSEDXTOGETPUMPED 326 -#define STRINGID_PKMNSXMADEYUSELESS 327 -#define STRINGID_PKMNTRAPPEDBYSANDTOMB 328 -#define STRINGID_EMPTYSTRING4 329 -#define STRINGID_ABOOSTED 330 -#define STRINGID_PKMNSXINTENSIFIEDSUN 331 -#define STRINGID_PKMNMAKESGROUNDMISS 332 -#define STRINGID_YOUTHROWABALLNOWRIGHT 333 -#define STRINGID_PKMNSXTOOKATTACK 334 -#define STRINGID_PKMNCHOSEXASDESTINY 335 -#define STRINGID_PKMNLOSTFOCUS 336 -#define STRINGID_USENEXTPKMN 337 -#define STRINGID_PKMNFLEDUSINGITS 338 -#define STRINGID_PKMNFLEDUSING 339 -#define STRINGID_PKMNWASDRAGGEDOUT 340 -#define STRINGID_PREVENTEDFROMWORKING 341 -#define STRINGID_PKMNSITEMNORMALIZEDSTATUS 342 -#define STRINGID_TRAINER1USEDITEM 343 -#define STRINGID_BOXISFULL 344 -#define STRINGID_PKMNAVOIDEDATTACK 345 -#define STRINGID_PKMNSXMADEITINEFFECTIVE 346 -#define STRINGID_PKMNSXPREVENTSFLINCHING 347 -#define STRINGID_PKMNALREADYHASBURN 348 -#define STRINGID_STATSWONTDECREASE2 349 -#define STRINGID_PKMNSXBLOCKSY2 350 -#define STRINGID_PKMNSXWOREOFF 351 -#define STRINGID_PKMNRAISEDDEFALITTLE 352 -#define STRINGID_PKMNRAISEDSPDEFALITTLE 353 -#define STRINGID_THEWALLSHATTERED 354 -#define STRINGID_PKMNSXPREVENTSYSZ 355 -#define STRINGID_PKMNSXCUREDITSYPROBLEM 356 -#define STRINGID_ATTACKERCANTESCAPE 357 -#define STRINGID_PKMNOBTAINEDX 358 -#define STRINGID_PKMNOBTAINEDX2 359 -#define STRINGID_PKMNOBTAINEDXYOBTAINEDZ 360 -#define STRINGID_BUTNOEFFECT 361 -#define STRINGID_PKMNSXHADNOEFFECTONY 362 -#define STRINGID_TWOENEMIESDEFEATED 363 -#define STRINGID_TRAINER2LOSETEXT 364 -#define STRINGID_PKMNINCAPABLEOFPOWER 365 -#define STRINGID_GLINTAPPEARSINEYE 366 -#define STRINGID_PKMNGETTINGINTOPOSITION 367 -#define STRINGID_PKMNBEGANGROWLINGDEEPLY 368 -#define STRINGID_PKMNEAGERFORMORE 369 -#define STRINGID_DEFEATEDOPPONENTBYREFEREE 370 -#define STRINGID_LOSTTOOPPONENTBYREFEREE 371 -#define STRINGID_TIEDOPPONENTBYREFEREE 372 -#define STRINGID_QUESTIONFORFEITMATCH 373 -#define STRINGID_FORFEITEDMATCH 374 -#define STRINGID_PKMNTRANSFERREDSOMEONESPC 375 -#define STRINGID_PKMNTRANSFERREDLANETTESPC 376 -#define STRINGID_PKMNBOXSOMEONESPCFULL 377 -#define STRINGID_PKMNBOXLANETTESPCFULL 378 -#define STRINGID_TRAINER1WINTEXT 379 -#define STRINGID_TRAINER2WINTEXT 380 +#define STRINGID_TRAINER1LOSETEXT 12 +#define STRINGID_PKMNGAINEDEXP 13 +#define STRINGID_PKMNGREWTOLV 14 +#define STRINGID_PKMNLEARNEDMOVE 15 +#define STRINGID_TRYTOLEARNMOVE1 16 +#define STRINGID_TRYTOLEARNMOVE2 17 +#define STRINGID_TRYTOLEARNMOVE3 18 +#define STRINGID_PKMNFORGOTMOVE 19 +#define STRINGID_STOPLEARNINGMOVE 20 +#define STRINGID_DIDNOTLEARNMOVE 21 +#define STRINGID_PKMNLEARNEDMOVE2 22 +#define STRINGID_ATTACKMISSED 23 +#define STRINGID_PKMNPROTECTEDITSELF 24 +#define STRINGID_STATSWONTINCREASE2 25 +#define STRINGID_AVOIDEDDAMAGE 26 +#define STRINGID_ITDOESNTAFFECT 27 +#define STRINGID_ATTACKERFAINTED 28 +#define STRINGID_TARGETFAINTED 29 +#define STRINGID_PLAYERGOTMONEY 30 +#define STRINGID_PLAYERWHITEOUT 31 +#define STRINGID_PLAYERWHITEOUT2 32 +#define STRINGID_PREVENTSESCAPE 33 +#define STRINGID_HITXTIMES 34 +#define STRINGID_PKMNFELLASLEEP 35 +#define STRINGID_PKMNMADESLEEP 36 +#define STRINGID_PKMNALREADYASLEEP 37 +#define STRINGID_PKMNALREADYASLEEP2 38 +#define STRINGID_PKMNWASNTAFFECTED 39 +#define STRINGID_PKMNWASPOISONED 40 +#define STRINGID_PKMNPOISONEDBY 41 +#define STRINGID_PKMNHURTBYPOISON 42 +#define STRINGID_PKMNALREADYPOISONED 43 +#define STRINGID_PKMNBADLYPOISONED 44 +#define STRINGID_PKMNENERGYDRAINED 45 +#define STRINGID_PKMNWASBURNED 46 +#define STRINGID_PKMNBURNEDBY 47 +#define STRINGID_PKMNHURTBYBURN 48 +#define STRINGID_PKMNWASFROZEN 49 +#define STRINGID_PKMNFROZENBY 50 +#define STRINGID_PKMNISFROZEN 51 +#define STRINGID_PKMNWASDEFROSTED 52 +#define STRINGID_PKMNWASDEFROSTED2 53 +#define STRINGID_PKMNWASDEFROSTEDBY 54 +#define STRINGID_PKMNWASPARALYZED 55 +#define STRINGID_PKMNWASPARALYZEDBY 56 +#define STRINGID_PKMNISPARALYZED 57 +#define STRINGID_PKMNISALREADYPARALYZED 58 +#define STRINGID_PKMNHEALEDPARALYSIS 59 +#define STRINGID_PKMNDREAMEATEN 60 +#define STRINGID_STATSWONTINCREASE 61 +#define STRINGID_STATSWONTDECREASE 62 +#define STRINGID_TEAMSTOPPEDWORKING 63 +#define STRINGID_FOESTOPPEDWORKING 64 +#define STRINGID_PKMNISCONFUSED 65 +#define STRINGID_PKMNHEALEDCONFUSION 66 +#define STRINGID_PKMNWASCONFUSED 67 +#define STRINGID_PKMNALREADYCONFUSED 68 +#define STRINGID_PKMNFELLINLOVE 69 +#define STRINGID_PKMNINLOVE 70 +#define STRINGID_PKMNIMMOBILIZEDBYLOVE 71 +#define STRINGID_PKMNBLOWNAWAY 72 +#define STRINGID_PKMNCHANGEDTYPE 73 +#define STRINGID_PKMNFLINCHED 74 +#define STRINGID_PKMNREGAINEDHEALTH 75 +#define STRINGID_PKMNHPFULL 76 +#define STRINGID_PKMNRAISEDSPDEF 77 +#define STRINGID_PKMNRAISEDDEF 78 +#define STRINGID_PKMNCOVEREDBYVEIL 79 +#define STRINGID_PKMNUSEDSAFEGUARD 80 +#define STRINGID_PKMNSAFEGUARDEXPIRED 81 +#define STRINGID_PKMNWENTTOSLEEP 82 +#define STRINGID_PKMNSLEPTHEALTHY 83 +#define STRINGID_PKMNWHIPPEDWHIRLWIND 84 +#define STRINGID_PKMNTOOKSUNLIGHT 85 +#define STRINGID_PKMNLOWEREDHEAD 86 +#define STRINGID_PKMNISGLOWING 87 +#define STRINGID_PKMNFLEWHIGH 88 +#define STRINGID_PKMNDUGHOLE 89 +#define STRINGID_PKMNSQUEEZEDBYBIND 90 +#define STRINGID_PKMNTRAPPEDINVORTEX 91 +#define STRINGID_PKMNWRAPPEDBY 92 +#define STRINGID_PKMNCLAMPED 93 +#define STRINGID_PKMNHURTBY 94 +#define STRINGID_PKMNFREEDFROM 95 +#define STRINGID_PKMNCRASHED 96 +#define STRINGID_PKMNSHROUDEDINMIST 97 +#define STRINGID_PKMNPROTECTEDBYMIST 98 +#define STRINGID_PKMNGETTINGPUMPED 99 +#define STRINGID_PKMNHITWITHRECOIL 100 +#define STRINGID_PKMNPROTECTEDITSELF2 101 +#define STRINGID_PKMNBUFFETEDBYSANDSTORM 102 +#define STRINGID_PKMNPELTEDBYHAIL 103 +#define STRINGID_PKMNSEEDED 104 +#define STRINGID_PKMNEVADEDATTACK 105 +#define STRINGID_PKMNSAPPEDBYLEECHSEED 106 +#define STRINGID_PKMNFASTASLEEP 107 +#define STRINGID_PKMNWOKEUP 108 +#define STRINGID_PKMNUPROARKEPTAWAKE 109 +#define STRINGID_PKMNWOKEUPINUPROAR 110 +#define STRINGID_PKMNCAUSEDUPROAR 111 +#define STRINGID_PKMNMAKINGUPROAR 112 +#define STRINGID_PKMNCALMEDDOWN 113 +#define STRINGID_PKMNCANTSLEEPINUPROAR 114 +#define STRINGID_PKMNSTOCKPILED 115 +#define STRINGID_PKMNCANTSTOCKPILE 116 +#define STRINGID_PKMNCANTSLEEPINUPROAR2 117 +#define STRINGID_UPROARKEPTPKMNAWAKE 118 +#define STRINGID_PKMNSTAYEDAWAKEUSING 119 +#define STRINGID_PKMNSTORINGENERGY 120 +#define STRINGID_PKMNUNLEASHEDENERGY 121 +#define STRINGID_PKMNFATIGUECONFUSION 122 +#define STRINGID_PLAYERPICKEDUPMONEY 123 +#define STRINGID_PKMNUNAFFECTED 124 +#define STRINGID_PKMNTRANSFORMEDINTO 125 +#define STRINGID_PKMNMADESUBSTITUTE 126 +#define STRINGID_PKMNHASSUBSTITUTE 127 +#define STRINGID_SUBSTITUTEDAMAGED 128 +#define STRINGID_PKMNSUBSTITUTEFADED 129 +#define STRINGID_PKMNMUSTRECHARGE 130 +#define STRINGID_PKMNRAGEBUILDING 131 +#define STRINGID_PKMNMOVEWASDISABLED 132 +#define STRINGID_PKMNMOVEISDISABLED 133 +#define STRINGID_PKMNMOVEDISABLEDNOMORE 134 +#define STRINGID_PKMNGOTENCORE 135 +#define STRINGID_PKMNENCOREENDED 136 +#define STRINGID_PKMNTOOKAIM 137 +#define STRINGID_PKMNSKETCHEDMOVE 138 +#define STRINGID_PKMNTRYINGTOTAKEFOE 139 +#define STRINGID_PKMNTOOKFOE 140 +#define STRINGID_PKMNREDUCEDPP 141 +#define STRINGID_PKMNSTOLEITEM 142 +#define STRINGID_TARGETCANTESCAPENOW 143 +#define STRINGID_PKMNFELLINTONIGHTMARE 144 +#define STRINGID_PKMNLOCKEDINNIGHTMARE 145 +#define STRINGID_PKMNLAIDCURSE 146 +#define STRINGID_PKMNAFFLICTEDBYCURSE 147 +#define STRINGID_SPIKESSCATTERED 148 +#define STRINGID_PKMNHURTBYSPIKES 149 +#define STRINGID_PKMNIDENTIFIED 150 +#define STRINGID_PKMNPERISHCOUNTFELL 151 +#define STRINGID_PKMNBRACEDITSELF 152 +#define STRINGID_PKMNENDUREDHIT 153 +#define STRINGID_MAGNITUDESTRENGTH 154 +#define STRINGID_PKMNCUTHPMAXEDATTACK 155 +#define STRINGID_PKMNCOPIEDSTATCHANGES 156 +#define STRINGID_PKMNGOTFREE 157 +#define STRINGID_PKMNSHEDLEECHSEED 158 +#define STRINGID_PKMNBLEWAWAYSPIKES 159 +#define STRINGID_PKMNFLEDFROMBATTLE 160 +#define STRINGID_PKMNFORESAWATTACK 161 +#define STRINGID_PKMNTOOKATTACK 162 +#define STRINGID_PKMNATTACK 163 +#define STRINGID_PKMNCENTERATTENTION 164 +#define STRINGID_PKMNCHARGINGPOWER 165 +#define STRINGID_NATUREPOWERTURNEDINTO 166 +#define STRINGID_PKMNSTATUSNORMAL 167 +#define STRINGID_PKMNHASNOMOVESLEFT 168 +#define STRINGID_PKMNSUBJECTEDTOTORMENT 169 +#define STRINGID_PKMNCANTUSEMOVETORMENT 170 +#define STRINGID_PKMNTIGHTENINGFOCUS 171 +#define STRINGID_PKMNFELLFORTAUNT 172 +#define STRINGID_PKMNCANTUSEMOVETAUNT 173 +#define STRINGID_PKMNREADYTOHELP 174 +#define STRINGID_PKMNSWITCHEDITEMS 175 +#define STRINGID_PKMNCOPIEDFOE 176 +#define STRINGID_PKMNMADEWISH 177 +#define STRINGID_PKMNWISHCAMETRUE 178 +#define STRINGID_PKMNPLANTEDROOTS 179 +#define STRINGID_PKMNABSORBEDNUTRIENTS 180 +#define STRINGID_PKMNANCHOREDITSELF 181 +#define STRINGID_PKMNWASMADEDROWSY 182 +#define STRINGID_PKMNKNOCKEDOFF 183 +#define STRINGID_PKMNSWAPPEDABILITIES 184 +#define STRINGID_PKMNSEALEDOPPONENTMOVE 185 +#define STRINGID_PKMNCANTUSEMOVESEALED 186 +#define STRINGID_PKMNWANTSGRUDGE 187 +#define STRINGID_PKMNLOSTPPGRUDGE 188 +#define STRINGID_PKMNSHROUDEDITSELF 189 +#define STRINGID_PKMNMOVEBOUNCED 190 +#define STRINGID_PKMNWAITSFORTARGET 191 +#define STRINGID_PKMNSNATCHEDMOVE 192 +#define STRINGID_PKMNMADEITRAIN 193 +#define STRINGID_PKMNRAISEDSPEED 194 +#define STRINGID_PKMNPROTECTEDBY 195 +#define STRINGID_PKMNPREVENTSUSAGE 196 +#define STRINGID_PKMNRESTOREDHPUSING 197 +#define STRINGID_PKMNCHANGEDTYPEWITH 198 +#define STRINGID_PKMNPREVENTSPARALYSISWITH 199 +#define STRINGID_PKMNPREVENTSROMANCEWITH 200 +#define STRINGID_PKMNPREVENTSPOISONINGWITH 201 +#define STRINGID_PKMNPREVENTSCONFUSIONWITH 202 +#define STRINGID_PKMNRAISEDFIREPOWERWITH 203 +#define STRINGID_PKMNANCHORSITSELFWITH 204 +#define STRINGID_PKMNCUTSATTACKWITH 205 +#define STRINGID_PKMNPREVENTSSTATLOSSWITH 206 +#define STRINGID_PKMNHURTSWITH 207 +#define STRINGID_PKMNTRACED 208 +#define STRINGID_STATSHARPLY 209 +#define STRINGID_STATROSE 210 +#define STRINGID_STATHARSHLY 211 +#define STRINGID_STATFELL 212 +#define STRINGID_ATTACKERSSTATROSE 213 +#define STRINGID_DEFENDERSSTATROSE 214 +#define STRINGID_ATTACKERSSTATFELL 215 +#define STRINGID_DEFENDERSSTATFELL 216 +#define STRINGID_CRITICALHIT 217 +#define STRINGID_ONEHITKO 218 +#define STRINGID_123POOF 219 +#define STRINGID_ANDELLIPSIS 220 +#define STRINGID_NOTVERYEFFECTIVE 221 +#define STRINGID_SUPEREFFECTIVE 222 +#define STRINGID_GOTAWAYSAFELY 223 +#define STRINGID_WILDPKMNFLED 224 +#define STRINGID_NORUNNINGFROMTRAINERS 225 +#define STRINGID_CANTESCAPE 226 +#define STRINGID_DONTLEAVEBIRCH 227 +#define STRINGID_BUTNOTHINGHAPPENED 228 +#define STRINGID_BUTITFAILED 229 +#define STRINGID_ITHURTCONFUSION 230 +#define STRINGID_MIRRORMOVEFAILED 231 +#define STRINGID_STARTEDTORAIN 232 +#define STRINGID_DOWNPOURSTARTED 233 +#define STRINGID_RAINCONTINUES 234 +#define STRINGID_DOWNPOURCONTINUES 235 +#define STRINGID_RAINSTOPPED 236 +#define STRINGID_SANDSTORMBREWED 237 +#define STRINGID_SANDSTORMRAGES 238 +#define STRINGID_SANDSTORMSUBSIDED 239 +#define STRINGID_SUNLIGHTGOTBRIGHT 240 +#define STRINGID_SUNLIGHTSTRONG 241 +#define STRINGID_SUNLIGHTFADED 242 +#define STRINGID_STARTEDHAIL 243 +#define STRINGID_HAILCONTINUES 244 +#define STRINGID_HAILSTOPPED 245 +#define STRINGID_FAILEDTOSPITUP 246 +#define STRINGID_FAILEDTOSWALLOW 247 +#define STRINGID_WINDBECAMEHEATWAVE 248 +#define STRINGID_STATCHANGESGONE 249 +#define STRINGID_COINSSCATTERED 250 +#define STRINGID_TOOWEAKFORSUBSTITUTE 251 +#define STRINGID_SHAREDPAIN 252 +#define STRINGID_BELLCHIMED 253 +#define STRINGID_FAINTINTHREE 254 +#define STRINGID_NOPPLEFT 255 +#define STRINGID_BUTNOPPLEFT 256 +#define STRINGID_PLAYERUSEDITEM 257 +#define STRINGID_WALLYUSEDITEM 258 +#define STRINGID_TRAINERBLOCKEDBALL 259 +#define STRINGID_DONTBEATHIEF 260 +#define STRINGID_ITDODGEDBALL 261 +#define STRINGID_YOUMISSEDPKMN 262 +#define STRINGID_PKMNBROKEFREE 263 +#define STRINGID_ITAPPEAREDCAUGHT 264 +#define STRINGID_AARGHALMOSTHADIT 265 +#define STRINGID_SHOOTSOCLOSE 266 +#define STRINGID_GOTCHAPKMNCAUGHT 267 +#define STRINGID_GOTCHAPKMNCAUGHT2 268 +#define STRINGID_GIVENICKNAMECAPTURED 269 +#define STRINGID_PKMNSENTTOPC 270 +#define STRINGID_PKMNDATAADDEDTODEX 271 +#define STRINGID_ITISRAINING 272 +#define STRINGID_SANDSTORMISRAGING 273 +#define STRINGID_CANTESCAPE2 274 +#define STRINGID_PKMNIGNORESASLEEP 275 +#define STRINGID_PKMNIGNOREDORDERS 276 +#define STRINGID_PKMNBEGANTONAP 277 +#define STRINGID_PKMNLOAFING 278 +#define STRINGID_PKMNWONTOBEY 279 +#define STRINGID_PKMNTURNEDAWAY 280 +#define STRINGID_PKMNPRETENDNOTNOTICE 281 +#define STRINGID_ENEMYABOUTTOSWITCHPKMN 282 +#define STRINGID_CREPTCLOSER 283 +#define STRINGID_CANTGETCLOSER 284 +#define STRINGID_PKMNWATCHINGCAREFULLY 285 +#define STRINGID_PKMNCURIOUSABOUTX 286 +#define STRINGID_PKMNENTHRALLEDBYX 287 +#define STRINGID_PKMNIGNOREDX 288 +#define STRINGID_THREWPOKEBLOCKATPKMN 289 +#define STRINGID_OUTOFSAFARIBALLS 290 +#define STRINGID_PKMNSITEMCUREDPARALYSIS 291 +#define STRINGID_PKMNSITEMCUREDPOISON 292 +#define STRINGID_PKMNSITEMHEALEDBURN 293 +#define STRINGID_PKMNSITEMDEFROSTEDIT 294 +#define STRINGID_PKMNSITEMWOKEIT 295 +#define STRINGID_PKMNSITEMSNAPPEDOUT 296 +#define STRINGID_PKMNSITEMCUREDPROBLEM 297 +#define STRINGID_PKMNSITEMRESTOREDHEALTH 298 +#define STRINGID_PKMNSITEMRESTOREDPP 299 +#define STRINGID_PKMNSITEMRESTOREDSTATUS 300 +#define STRINGID_PKMNSITEMRESTOREDHPALITTLE 301 +#define STRINGID_ITEMALLOWSONLYYMOVE 302 +#define STRINGID_PKMNHUNGONWITHX 303 +#define STRINGID_EMPTYSTRING3 304 +#define STRINGID_PKMNSXPREVENTSBURNS 305 +#define STRINGID_PKMNSXBLOCKSY 306 +#define STRINGID_PKMNSXRESTOREDHPALITTLE2 307 +#define STRINGID_PKMNSXWHIPPEDUPSANDSTORM 308 +#define STRINGID_PKMNSXPREVENTSYLOSS 309 +#define STRINGID_PKMNSXINFATUATEDY 310 +#define STRINGID_PKMNSXMADEYINEFFECTIVE 311 +#define STRINGID_PKMNSXCUREDYPROBLEM 312 +#define STRINGID_ITSUCKEDLIQUIDOOZE 313 +#define STRINGID_PKMNTRANSFORMED 314 +#define STRINGID_ELECTRICITYWEAKENED 315 +#define STRINGID_FIREWEAKENED 316 +#define STRINGID_PKMNHIDUNDERWATER 317 +#define STRINGID_PKMNSPRANGUP 318 +#define STRINGID_HMMOVESCANTBEFORGOTTEN 319 +#define STRINGID_XFOUNDONEY 320 +#define STRINGID_PLAYERDEFEATEDTRAINER1 321 +#define STRINGID_SOOTHINGAROMA 322 +#define STRINGID_ITEMSCANTBEUSEDNOW 323 +#define STRINGID_FORXCOMMAYZ 324 +#define STRINGID_USINGITEMSTATOFPKMNROSE 325 +#define STRINGID_PKMNUSEDXTOGETPUMPED 326 +#define STRINGID_PKMNSXMADEYUSELESS 327 +#define STRINGID_PKMNTRAPPEDBYSANDTOMB 328 +#define STRINGID_EMPTYSTRING4 329 +#define STRINGID_ABOOSTED 330 +#define STRINGID_PKMNSXINTENSIFIEDSUN 331 +#define STRINGID_PKMNMAKESGROUNDMISS 332 +#define STRINGID_YOUTHROWABALLNOWRIGHT 333 +#define STRINGID_PKMNSXTOOKATTACK 334 +#define STRINGID_PKMNCHOSEXASDESTINY 335 +#define STRINGID_PKMNLOSTFOCUS 336 +#define STRINGID_USENEXTPKMN 337 +#define STRINGID_PKMNFLEDUSINGITS 338 +#define STRINGID_PKMNFLEDUSING 339 +#define STRINGID_PKMNWASDRAGGEDOUT 340 +#define STRINGID_PREVENTEDFROMWORKING 341 +#define STRINGID_PKMNSITEMNORMALIZEDSTATUS 342 +#define STRINGID_TRAINER1USEDITEM 343 +#define STRINGID_BOXISFULL 344 +#define STRINGID_PKMNAVOIDEDATTACK 345 +#define STRINGID_PKMNSXMADEITINEFFECTIVE 346 +#define STRINGID_PKMNSXPREVENTSFLINCHING 347 +#define STRINGID_PKMNALREADYHASBURN 348 +#define STRINGID_STATSWONTDECREASE2 349 +#define STRINGID_PKMNSXBLOCKSY2 350 +#define STRINGID_PKMNSXWOREOFF 351 +#define STRINGID_PKMNRAISEDDEFALITTLE 352 +#define STRINGID_PKMNRAISEDSPDEFALITTLE 353 +#define STRINGID_THEWALLSHATTERED 354 +#define STRINGID_PKMNSXPREVENTSYSZ 355 +#define STRINGID_PKMNSXCUREDITSYPROBLEM 356 +#define STRINGID_ATTACKERCANTESCAPE 357 +#define STRINGID_PKMNOBTAINEDX 358 +#define STRINGID_PKMNOBTAINEDX2 359 +#define STRINGID_PKMNOBTAINEDXYOBTAINEDZ 360 +#define STRINGID_BUTNOEFFECT 361 +#define STRINGID_PKMNSXHADNOEFFECTONY 362 +#define STRINGID_TWOENEMIESDEFEATED 363 +#define STRINGID_TRAINER2LOSETEXT 364 +#define STRINGID_PKMNINCAPABLEOFPOWER 365 +#define STRINGID_GLINTAPPEARSINEYE 366 +#define STRINGID_PKMNGETTINGINTOPOSITION 367 +#define STRINGID_PKMNBEGANGROWLINGDEEPLY 368 +#define STRINGID_PKMNEAGERFORMORE 369 +#define STRINGID_DEFEATEDOPPONENTBYREFEREE 370 +#define STRINGID_LOSTTOOPPONENTBYREFEREE 371 +#define STRINGID_TIEDOPPONENTBYREFEREE 372 +#define STRINGID_QUESTIONFORFEITMATCH 373 +#define STRINGID_FORFEITEDMATCH 374 +#define STRINGID_PKMNTRANSFERREDSOMEONESPC 375 +#define STRINGID_PKMNTRANSFERREDLANETTESPC 376 +#define STRINGID_PKMNBOXSOMEONESPCFULL 377 +#define STRINGID_PKMNBOXLANETTESPCFULL 378 +#define STRINGID_TRAINER1WINTEXT 379 +#define STRINGID_TRAINER2WINTEXT 380 + +#define STRINGID_ENDUREDSTURDY 381 +#define STRINGID_POWERHERB 382 +#define STRINGID_HURTBYITEM 383 +#define STRINGID_PSNBYITEM 384 +#define STRINGID_BRNBYITEM 385 +#define STRINGID_DEFABILITYIN 386 +#define STRINGID_GRAVITYINTENSIFIED 387 +#define STRINGID_TARGETIDENTIFIED 388 +#define STRINGID_TARGETWOKEUP 389 +#define STRINGID_PKMNSTOLEANDATEITEM 390 +#define STRINGID_TAILWINDBLEW 391 +#define STRINGID_PKMNWENTBACK 392 +#define STRINGID_PKMNCANTUSEITEMSANYMORE 393 +#define STRINGID_PKMNFLUNG 394 +#define STRINGID_PKMNPREVENTEDFROMHEALING 395 +#define STRINGID_PKMNSWITCHEDATKANDDEF 396 +#define STRINGID_PKMNSABILITYSUPPRESSED 397 +#define STRINGID_SHIELDEDFROMCRITICALHITS 398 +#define STRINGID_SWITCHEDATKANDSPATK 399 +#define STRINGID_SWITCHEDDEFANDSPDEF 400 +#define STRINGID_PKMNACQUIREDABILITY 401 +#define STRINGID_POISONSPIKESSCATTERED 402 +#define STRINGID_PKMNSWITCHEDSTATCHANGES 403 +#define STRINGID_PKMNSURROUNDEDWITHVEILOFWATER 404 +#define STRINGID_PKMNLEVITATEDONELECTROMAGNETISM 405 +#define STRINGID_PKMNTWISTEDDIMENSIONS 406 +#define STRINGID_POINTEDSTONESFLOAT 407 +#define STRINGID_CLOAKEDINMYSTICALMOONLIGHT 408 +#define STRINGID_TRAPPERBYSWIRLINGMAGMA 409 +#define STRINGID_VANISHEDINSTANTLY 410 +#define STRINGID_PROTECTEDTEAM 411 +#define STRINGID_SHAREDITSGUARD 412 +#define STRINGID_SHAREDITSPOWER 413 +#define STRINGID_SWAPSDEFANDSPDEFOFALLPOKEMON 414 +#define STRINGID_BECAMENIMBLE 415 +#define STRINGID_HURLEDINTOTHEAIR 416 +#define STRINGID_HELDITEMSLOSEEFFECTS 417 +#define STRINGID_FELLSTRAIGHTDOWN 418 +#define STRINGID_TRANSFORMEDINTOWATERTYPE 419 +#define STRINGID_PKMNACQUIREDSIMPLE 420 +#define STRINGID_EMPTYSTRING5 421 +#define STRINGID_KINDOFFER 422 +#define STRINGID_RESETSTARGETSSTATLEVELS 423 +#define STRINGID_EMPTYSTRING6 424 +#define STRINGID_ALLYSWITCHPOSITION 425 +#define STRINGID_RESTORETARGETSHEALTH 426 +#define STRINGID_TOOKPJMNINTOTHESKY 427 +#define STRINGID_FREEDFROMSKYDROP 428 +#define STRINGID_POSTPONETARGETMOVE 429 +#define STRINGID_REFLECTTARGETSTYPE 430 +#define STRINGID_TRANSFERHELDITEM 431 +#define STRINGID_EMBARGOENDS 432 +#define STRINGID_ELECTROMAGNETISM 433 +#define STRINGID_BUFFERENDS 434 +#define STRINGID_TELEKINESISENDS 435 +#define STRINGID_TAILWINDENDS 436 +#define STRINGID_LUCKYCHANTENDS 437 +#define STRINGID_TRICKROOMENDS 438 +#define STRINGID_WONDERROOMENDS 439 +#define STRINGID_MAGICROOMENDS 440 +#define STRINGID_MUDSPORTENDS 441 +#define STRINGID_WATERSPORTENDS 442 +#define STRINGID_GRAVITYENDS 443 +#define STRINGID_AQUARINGHEAL 444 +#define STRINGID_AURORAVEILENDS 445 +#define STRINGID_ELECTRICTERRAINENDS 446 +#define STRINGID_MISTYTERRAINENDS 447 +#define STRINGID_PSYCHICTERRAINENDS 448 +#define STRINGID_GRASSYTERRAINENDS 449 +#define STRINGID_TARGETABILITYSTATRAISE 450 +#define STRINGID_TARGETSSTATWASMAXEDOUT 451 +#define STRINGID_ATTACKERABILITYSTATRAISE 452 +#define STRINGID_POISONHEALHPUP 453 +#define STRINGID_BADDREAMSDMG 454 +#define STRINGID_MOLDBREAKERENTERS 455 +#define STRINGID_TERAVOLTENTERS 456 +#define STRINGID_TURBOBLAZEENTERS 457 +#define STRINGID_SLOWSTARTENTERS 458 +#define STRINGID_SLOWSTARTEND 459 +#define STRINGID_SOLARPOWERHPDROP 460 +#define STRINGID_AFTERMATHDMG 461 +#define STRINGID_ANTICIPATIONACTIVATES 462 +#define STRINGID_FOREWARNACTIVATES 463 +#define STRINGID_ICEBODYHPGAIN 464 +#define STRINGID_SNOWWARNINGHAIL 465 +#define STRINGID_FRISKACTIVATES 466 +#define STRINGID_UNNERVEENTERS 467 +#define STRINGID_HARVESTBERRY 468 +#define STRINGID_LASTABILITYRAISEDSTAT 469 +#define STRINGID_MAGICBOUNCEACTIVATES 470 +#define STRINGID_PROTEANTYPECHANGE 471 +#define STRINGID_SYMBIOSISITEMPASS 472 +#define STRINGID_STEALTHROCKDMG 473 +#define STRINGID_TOXICSPIKESABSORBED 474 +#define STRINGID_TOXICSPIKESPOISONED 475 +#define STRINGID_STICKYWEBSWITCHIN 476 +#define STRINGID_HEALINGWISHCAMETRUE 477 +#define STRINGID_HEALINGWISHHEALED 478 +#define STRINGID_LUNARDANCECAMETRUE 479 +#define STRINGID_CUSEDBODYDISABLED 480 +#define STRINGID_ATTACKERACQUIREDABILITY 481 +#define STRINGID_TARGETABILITYSTATLOWER 482 +#define STRINGID_TARGETSTATWONTGOHIGHER 483 +#define STRINGID_PKMNMOVEBOUNCEDABILITY 484 +#define STRINGID_IMPOSTERTRANSFORM 485 +#define STRINGID_ASSAULTVESTDOESNTALLOW 486 +#define STRINGID_GRAVITYPREVENTSUSAGE 487 +#define STRINGID_HEALBLOCKPREVENTSUSAGE 488 +#define STRINGID_NOTDONEYET 489 +#define STRINGID_STICKYWEBUSED 490 +#define STRINGID_QUASHSUCCESS 491 +#define STRINGID_PKMNBLEWAWAYTOXICSPIKES 492 +#define STRINGID_PKMNBLEWAWAYSTICKYWEB 493 +#define STRINGID_PKMNBLEWAWAYSTEALTHROCK 494 +#define STRINGID_IONDELUGEON 495 +#define STRINGID_TOPSYTURVYSWITCHEDSTATS 496 +#define STRINGID_TERRAINBECOMESMISTY 497 +#define STRINGID_TERRAINBECOMESGRASSY 498 +#define STRINGID_TERRAINBECOMESELECTRIC 499 +#define STRINGID_TERRAINBECOMESPSYCHIC 500 +#define STRINGID_TARGETELECTRIFIED 501 +#define STRINGID_MEGAEVOREACTING 502 +#define STRINGID_MEGAEVOEVOLVED 503 +#define STRINGID_DRASTICALLY 504 +#define STRINGID_SEVERELY 505 +#define STRINGID_INFESTATION 506 +#define STRINGID_NOEFFECTONTARGET 507 +#define STRINGID_BURSTINGFLAMESHIT 508 +#define STRINGID_BESTOWITEMGIVING 509 +#define STRINGID_THIRDTYPEADDED 510 +#define STRINGID_FELLFORFEINT 511 +#define STRINGID_POKEMONCANNOTUSEMOVE 512 +#define STRINGID_COVEREDINPOWDER 513 +#define STRINGID_POWDEREXPLODES 514 +#define STRINGID_BELCHCANTSELECT 515 +#define STRINGID_SPECTRALTHIEFSTEAL 516 +#define STRINGID_GRAVITYGROUNDING 517 +#define STRINGID_MISTYTERRAINPREVENTS 518 +#define STRINGID_GRASSYTERRAINHEALS 519 +#define STRINGID_ELECTRICTERRAINPREVENTS 520 +#define STRINGID_PSYCHICTERRAINPREVENTS 521 +#define STRINGID_SAFETYGOOGLESPROTECTED 522 +#define STRINGID_FLOWERVEILPROTECTED 523 +#define STRINGID_SWEETVEILPROTECTED 524 +#define STRINGID_AROMAVEILPROTECTED 525 +#define STRINGID_CELEBRATEMESSAGE 526 +#define STRINGID_USEDINSTRUCTEDMOVE 527 +#define STRINGID_THROATCHOPENDS 528 +#define STRINGID_PKMNCANTUSEMOVETHROATCHOP 529 +#define STRINGID_LASERFOCUS 530 +#define STRINGID_GEMACTIVATES 531 +#define STRINGID_BERRYDMGREDUCES 532 +#define STRINGID_TARGETATEITEM 533 +#define STRINGID_AIRBALLOONFLOAT 534 +#define STRINGID_AIRBALLOONPOP 535 +#define STRINGID_INCINERATEBURN 536 +#define STRINGID_BUGBITE 537 +#define STRINGID_ILLUSIONWOREOFF 538 +#define STRINGID_ATTACKERCUREDTARGETSTATUS 539 +#define STRINGID_ATTACKERLOSTFIRETYPE 540 +#define STRINGID_HEALERCURE 541 +#define STRINGID_SCRIPTINGABILITYSTATRAISE 542 +#define STRINGID_RECEIVERABILITYTAKEOVER 543 +#define STRINGID_PKNMABSORBINGPOWER 544 +#define STRINGID_NOONEWILLBEABLETORUNAWAY 545 +#define STRINGID_DESTINYKNOTACTIVATES 546 +#define STRINGID_CLOAKEDINAFREEZINGLIGHT 547 +#define STRINGID_STATWASNOTLOWERED 548 +#define STRINGID_FERVENTWISHREACHED 549 +#define STRINGID_AIRLOCKACTIVATES 550 +#define STRINGID_PRESSUREENTERS 551 +#define STRINGID_DARKAURAENTERS 552 +#define STRINGID_FAIRYAURAENTERS 553 +#define STRINGID_AURABREAKENTERS 554 +#define STRINGID_COMATOSEENTERS 555 +#define STRINGID_SCREENCLEANERENTERS 556 +#define STRINGID_FETCHEDPOKEBALL 557 +#define STRINGID_BATTLERABILITYRAISEDSTAT 558 +#define STRINGID_ASANDSTORMKICKEDUP 559 +#define STRINGID_PKMNSWILLPERISHIN3TURNS 560 +#define STRINGID_ABILITYRAISEDSTATDRASTICALLY 561 +#define STRINGID_AURAFLAREDTOLIFE 562 +#define STRINGID_ASONEENTERS 563 +#define STRINGID_CURIOUSMEDICINEENTERS 564 +#define STRINGID_CANACTFASTERTHANKSTO 565 +#define STRINGID_MICLEBERRYACTIVATES 566 +#define STRINGID_PKMNSHOOKOFFTHETAUNT 567 +#define STRINGID_PKMNGOTOVERITSINFATUATION 568 +#define STRINGID_EXTREMELYHARSHSUNLIGHT 569 +#define STRINGID_EXTREMESUNLIGHTFADED 570 +#define STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT 571 +#define STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED 572 +#define STRINGID_HEAVYRAIN 573 +#define STRINGID_HEAVYRAINLIFTED 574 +#define STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN 575 +#define STRINGID_NORELIEFROMHEAVYRAIN 576 +#define STRINGID_MYSTERIOUSAIRCURRENT 577 +#define STRINGID_STRONGWINDSDISSIPATED 578 +#define STRINGID_MYSTERIOUSAIRCURRENTBLOWSON 579 +#define STRINGID_ATTACKWEAKENEDBSTRONGWINDS 580 -#define STRINGID_ENDUREDSTURDY 381 -#define STRINGID_POWERHERB 382 -#define STRINGID_HURTBYITEM 383 -#define STRINGID_PSNBYITEM 384 -#define STRINGID_BRNBYITEM 385 -#define STRINGID_DEFABILITYIN 386 -#define STRINGID_GRAVITYINTENSIFIED 387 -#define STRINGID_TARGETIDENTIFIED 388 -#define STRINGID_TARGETWOKEUP 389 -#define STRINGID_PKMNSTOLEANDATEITEM 390 -#define STRINGID_TAILWINDBLEW 391 -#define STRINGID_PKMNWENTBACK 392 -#define STRINGID_PKMNCANTUSEITEMSANYMORE 393 -#define STRINGID_PKMNFLUNG 394 -#define STRINGID_PKMNPREVENTEDFROMHEALING 395 -#define STRINGID_PKMNSWITCHEDATKANDDEF 396 -#define STRINGID_PKMNSABILITYSUPPRESSED 397 -#define STRINGID_SHIELDEDFROMCRITICALHITS 398 -#define STRINGID_SWITCHEDATKANDSPATK 399 -#define STRINGID_SWITCHEDDEFANDSPDEF 400 -#define STRINGID_PKMNACQUIREDABILITY 401 -#define STRINGID_POISONSPIKESSCATTERED 402 -#define STRINGID_PKMNSWITCHEDSTATCHANGES 403 -#define STRINGID_PKMNSURROUNDEDWITHVEILOFWATER 404 -#define STRINGID_PKMNLEVITATEDONELECTROMAGNETISM 405 -#define STRINGID_PKMNTWISTEDDIMENSIONS 406 -#define STRINGID_POINTEDSTONESFLOAT 407 -#define STRINGID_CLOAKEDINMYSTICALMOONLIGHT 408 -#define STRINGID_TRAPPERBYSWIRLINGMAGMA 409 -#define STRINGID_VANISHEDINSTANTLY 410 -#define STRINGID_PROTECTEDTEAM 411 -#define STRINGID_SHAREDITSGUARD 412 -#define STRINGID_SHAREDITSPOWER 413 -#define STRINGID_SWAPSDEFANDSPDEFOFALLPOKEMON 414 -#define STRINGID_BECAMENIMBLE 415 -#define STRINGID_HURLEDINTOTHEAIR 416 -#define STRINGID_HELDITEMSLOSEEFFECTS 417 -#define STRINGID_FELLSTRAIGHTDOWN 418 -#define STRINGID_TRANSFORMEDINTOWATERTYPE 419 -#define STRINGID_PKMNACQUIREDSIMPLE 420 -#define STRINGID_EMPTYSTRING5 421 -#define STRINGID_KINDOFFER 422 -#define STRINGID_RESETSTARGETSSTATLEVELS 423 -#define STRINGID_EMPTYSTRING6 424 -#define STRINGID_ALLYSWITCHPOSITION 425 -#define STRINGID_RESTORETARGETSHEALTH 426 -#define STRINGID_TOOKPJMNINTOTHESKY 427 -#define STRINGID_FREEDFROMSKYDROP 428 -#define STRINGID_POSTPONETARGETMOVE 429 -#define STRINGID_REFLECTTARGETSTYPE 430 -#define STRINGID_TRANSFERHELDITEM 431 -#define STRINGID_EMBARGOENDS 432 -#define STRINGID_ELECTROMAGNETISM 433 -#define STRINGID_BUFFERENDS 434 -#define STRINGID_TELEKINESISENDS 435 -#define STRINGID_TAILWINDENDS 436 -#define STRINGID_LUCKYCHANTENDS 437 -#define STRINGID_TRICKROOMENDS 438 -#define STRINGID_WONDERROOMENDS 439 -#define STRINGID_MAGICROOMENDS 440 -#define STRINGID_MUDSPORTENDS 441 -#define STRINGID_WATERSPORTENDS 442 -#define STRINGID_GRAVITYENDS 443 -#define STRINGID_AQUARINGHEAL 444 -#define STRINGID_AURORAVEILENDS 445 -#define STRINGID_ELECTRICTERRAINENDS 446 -#define STRINGID_MISTYTERRAINENDS 447 -#define STRINGID_PSYCHICTERRAINENDS 448 -#define STRINGID_GRASSYTERRAINENDS 449 -#define STRINGID_TARGETABILITYSTATRAISE 450 -#define STRINGID_TARGETSSTATWASMAXEDOUT 451 -#define STRINGID_ATTACKERABILITYSTATRAISE 452 -#define STRINGID_POISONHEALHPUP 453 -#define STRINGID_BADDREAMSDMG 454 -#define STRINGID_MOLDBREAKERENTERS 455 -#define STRINGID_TERAVOLTENTERS 456 -#define STRINGID_TURBOBLAZEENTERS 457 -#define STRINGID_SLOWSTARTENTERS 458 -#define STRINGID_SLOWSTARTEND 459 -#define STRINGID_SOLARPOWERHPDROP 460 -#define STRINGID_AFTERMATHDMG 461 -#define STRINGID_ANTICIPATIONACTIVATES 462 -#define STRINGID_FOREWARNACTIVATES 463 -#define STRINGID_ICEBODYHPGAIN 464 -#define STRINGID_SNOWWARNINGHAIL 465 -#define STRINGID_FRISKACTIVATES 466 -#define STRINGID_UNNERVEENTERS 467 -#define STRINGID_HARVESTBERRY 468 -#define STRINGID_LASTABILITYRAISEDSTAT 469 -#define STRINGID_MAGICBOUNCEACTIVATES 470 -#define STRINGID_PROTEANTYPECHANGE 471 -#define STRINGID_SYMBIOSISITEMPASS 472 -#define STRINGID_STEALTHROCKDMG 473 -#define STRINGID_TOXICSPIKESABSORBED 474 -#define STRINGID_TOXICSPIKESPOISONED 475 -#define STRINGID_STICKYWEBSWITCHIN 476 -#define STRINGID_HEALINGWISHCAMETRUE 477 -#define STRINGID_HEALINGWISHHEALED 478 -#define STRINGID_LUNARDANCECAMETRUE 479 -#define STRINGID_CUSEDBODYDISABLED 480 -#define STRINGID_ATTACKERACQUIREDABILITY 481 -#define STRINGID_TARGETABILITYSTATLOWER 482 -#define STRINGID_TARGETSTATWONTGOHIGHER 483 -#define STRINGID_PKMNMOVEBOUNCEDABILITY 484 -#define STRINGID_IMPOSTERTRANSFORM 485 -#define STRINGID_ASSAULTVESTDOESNTALLOW 486 -#define STRINGID_GRAVITYPREVENTSUSAGE 487 -#define STRINGID_HEALBLOCKPREVENTSUSAGE 488 -#define STRINGID_NOTDONEYET 489 -#define STRINGID_STICKYWEBUSED 490 -#define STRINGID_QUASHSUCCESS 491 -#define STRINGID_PKMNBLEWAWAYTOXICSPIKES 492 -#define STRINGID_PKMNBLEWAWAYSTICKYWEB 493 -#define STRINGID_PKMNBLEWAWAYSTEALTHROCK 494 -#define STRINGID_IONDELUGEON 495 -#define STRINGID_TOPSYTURVYSWITCHEDSTATS 496 -#define STRINGID_TERRAINBECOMESMISTY 497 -#define STRINGID_TERRAINBECOMESGRASSY 498 -#define STRINGID_TERRAINBECOMESELECTRIC 499 -#define STRINGID_TERRAINBECOMESPSYCHIC 500 -#define STRINGID_TARGETELECTRIFIED 501 -#define STRINGID_MEGAEVOREACTING 502 -#define STRINGID_MEGAEVOEVOLVED 503 -#define STRINGID_DRASTICALLY 504 -#define STRINGID_SEVERELY 505 -#define STRINGID_INFESTATION 506 -#define STRINGID_NOEFFECTONTARGET 507 -#define STRINGID_BURSTINGFLAMESHIT 508 -#define STRINGID_BESTOWITEMGIVING 509 -#define STRINGID_THIRDTYPEADDED 510 -#define STRINGID_FELLFORFEINT 511 -#define STRINGID_POKEMONCANNOTUSEMOVE 512 -#define STRINGID_COVEREDINPOWDER 513 -#define STRINGID_POWDEREXPLODES 514 -#define STRINGID_BELCHCANTSELECT 515 -#define STRINGID_SPECTRALTHIEFSTEAL 516 -#define STRINGID_GRAVITYGROUNDING 517 -#define STRINGID_MISTYTERRAINPREVENTS 518 -#define STRINGID_GRASSYTERRAINHEALS 519 -#define STRINGID_ELECTRICTERRAINPREVENTS 520 -#define STRINGID_PSYCHICTERRAINPREVENTS 521 -#define STRINGID_SAFETYGOOGLESPROTECTED 522 -#define STRINGID_FLOWERVEILPROTECTED 523 -#define STRINGID_SWEETVEILPROTECTED 524 -#define STRINGID_AROMAVEILPROTECTED 525 -#define STRINGID_CELEBRATEMESSAGE 526 -#define STRINGID_USEDINSTRUCTEDMOVE 527 -#define STRINGID_THROATCHOPENDS 528 -#define STRINGID_PKMNCANTUSEMOVETHROATCHOP 529 -#define STRINGID_LASERFOCUS 530 -#define STRINGID_GEMACTIVATES 531 -#define STRINGID_BERRYDMGREDUCES 532 -#define STRINGID_TARGETATEITEM 533 -#define STRINGID_AIRBALLOONFLOAT 534 -#define STRINGID_AIRBALLOONPOP 535 -#define STRINGID_INCINERATEBURN 536 -#define STRINGID_BUGBITE 537 -#define STRINGID_ILLUSIONWOREOFF 538 -#define STRINGID_ATTACKERCUREDTARGETSTATUS 539 -#define STRINGID_ATTACKERLOSTFIRETYPE 540 -#define STRINGID_HEALERCURE 541 -#define STRINGID_SCRIPTINGABILITYSTATRAISE 542 -#define STRINGID_RECEIVERABILITYTAKEOVER 543 -#define STRINGID_PKNMABSORBINGPOWER 544 -#define STRINGID_NOONEWILLBEABLETORUNAWAY 545 -#define STRINGID_DESTINYKNOTACTIVATES 546 -#define STRINGID_CLOAKEDINAFREEZINGLIGHT 547 -#define STRINGID_STATWASNOTLOWERED 548 -#define STRINGID_FERVENTWISHREACHED 549 -#define STRINGID_AIRLOCKACTIVATES 550 -#define STRINGID_PRESSUREENTERS 551 -#define STRINGID_DARKAURAENTERS 552 -#define STRINGID_FAIRYAURAENTERS 553 -#define STRINGID_AURABREAKENTERS 554 -#define STRINGID_COMATOSEENTERS 555 -#define STRINGID_SCREENCLEANERENTERS 556 -#define STRINGID_FETCHEDPOKEBALL 557 -#define STRINGID_BATTLERABILITYRAISEDSTAT 558 -#define STRINGID_ASANDSTORMKICKEDUP 559 -#define STRINGID_PKMNSWILLPERISHIN3TURNS 560 -#define STRINGID_ABILITYRAISEDSTATDRASTICALLY 561 -#define STRINGID_AURAFLAREDTOLIFE 562 -#define STRINGID_ASONEENTERS 563 -#define STRINGID_CURIOUSMEDICINEENTERS 564 -#define STRINGID_CANACTFASTERTHANKSTO 565 -#define STRINGID_MICLEBERRYACTIVATES 566 -#define STRINGID_PKMNSHOOKOFFTHETAUNT 567 -#define STRINGID_PKMNGOTOVERITSINFATUATION 568 - -#define BATTLESTRINGS_COUNT 569 +#define BATTLESTRINGS_COUNT 581 // 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 8a00cbf2b..fdc1d8a1e 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -696,9 +696,33 @@ static const u8 sText_CanActFaster[] = _("{B_ATK_NAME_WITH_PREFIX} can act faste static const u8 sText_MicleBerryActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} boosted the accuracy of its\nnext move using {B_LAST_ITEM}!"); static const u8 sText_PkmnShookOffTheTaunt[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} shook off\nthe taunt!"); static const u8 sText_PkmnGotOverItsInfatuation[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} got over\nits infatuation!"); +static const u8 sText_ExtremelyHarshSunlight[] = _("The sunlight turned\nextremely harsh!"); +static const u8 sText_ExtremeSunlightFaded[] = _("The extreme sunlight faded.{PAUSE 64}"); +static const u8 sText_MoveEvaporatedInTheHarshSunlight[] = _("The Water-type attack evaporated\nin the harsh sunlight!"); +static const u8 sText_ExtremelyHarshSunlightWasNotLessened[] = _("The extremely harsh sunlight\nwas not lessened at all!"); +static const u8 sText_HeavyRain[] = _("A heavy rain began to fall!"); +static const u8 sText_HeavyRainLifted[] = _("The heavy rain has lifted!{PAUSE 64}"); +static const u8 sText_MoveFizzledOutInTheHeavyRain[] = _("The Fire-type attack fizzled out\nin the heavy rain!"); +static const u8 sText_NoReliefFromHeavyRain[] = _("There is no relief from\nthis heavy rain!"); +static const u8 sText_MysteriousAirCurrent[] = _("A mysterious air current is\nprotecting Flying-type Pokémon!"); +static const u8 sText_StrongWindsDissipated[] = _("The mysterious strong winds\nhave dissipated!{PAUSE 64}"); +static const u8 sText_MysteriousAirCurrentBlowsOn[] = _("The mysterious air current\nblows on regardless!"); +static const u8 sText_AttackWeakenedByStrongWinds[] = _("The mysterious strong winds\nweakened the attack!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_ATTACKWEAKENEDBSTRONGWINDS - 12] = sText_AttackWeakenedByStrongWinds, + [STRINGID_MYSTERIOUSAIRCURRENTBLOWSON - 12] = sText_MysteriousAirCurrentBlowsOn, + [STRINGID_STRONGWINDSDISSIPATED - 12] = sText_StrongWindsDissipated, + [STRINGID_MYSTERIOUSAIRCURRENT - 12] = sText_MysteriousAirCurrent, + [STRINGID_NORELIEFROMHEAVYRAIN - 12] = sText_NoReliefFromHeavyRain, + [STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN - 12] = sText_MoveFizzledOutInTheHeavyRain, + [STRINGID_HEAVYRAINLIFTED - 12] = sText_HeavyRainLifted, + [STRINGID_HEAVYRAIN - 12] = sText_HeavyRain, + [STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED - 12] = sText_ExtremelyHarshSunlightWasNotLessened, + [STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT - 12] = sText_MoveEvaporatedInTheHarshSunlight, + [STRINGID_EXTREMESUNLIGHTFADED - 12] = sText_ExtremeSunlightFaded, + [STRINGID_EXTREMELYHARSHSUNLIGHT - 12] = sText_ExtremelyHarshSunlight, [STRINGID_PKMNGOTOVERITSINFATUATION - 12] = sText_PkmnGotOverItsInfatuation, [STRINGID_PKMNSHOOKOFFTHETAUNT - 12] = sText_PkmnShookOffTheTaunt, [STRINGID_MICLEBERRYACTIVATES - 12] = sText_MicleBerryActivates, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 21bc7945b..85cd16066 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1323,6 +1323,30 @@ static void Cmd_attackcanceler(void) { s32 i, moveType; + GET_MOVE_TYPE(gCurrentMove, moveType); + if (moveType == TYPE_FIRE + && (gBattleWeather & WEATHER_RAIN_PRIMAL) + && !IsAbilityOnField(ABILITY_AIR_LOCK) + && !IsAbilityOnField(ABILITY_CLOUD_NINE) + && gBattleMoves[gCurrentMove].power >= 1) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_PrimordialSeaFizzlesOutFireTypeMoves; + return; + } + + GET_MOVE_TYPE(gCurrentMove, moveType); + if (moveType == TYPE_WATER + && (gBattleWeather & WEATHER_SUN_PRIMAL) + && !IsAbilityOnField(ABILITY_AIR_LOCK) + && !IsAbilityOnField(ABILITY_CLOUD_NINE) + && gBattleMoves[gCurrentMove].power >= 1) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_DesolateLandEvaporatesWaterTypeMoves; + return; + } + if (gBattleOutcome != 0) { gCurrentActionFuncId = B_ACTION_FINISHED; @@ -8422,6 +8446,26 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; // exit if loop failed (failsafe) } return; + case VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER: + if (gBattleWeather & WEATHER_SUN_PRIMAL) + { + gBattleWeather &= ~WEATHER_SUN_PRIMAL; + PrepareStringBattle(STRINGID_EXTREMESUNLIGHTFADED, gActiveBattler); + gBattleCommunication[MSG_DISPLAY] = 1; + } + else if (gBattleWeather & WEATHER_RAIN_PRIMAL) + { + gBattleWeather &= ~WEATHER_RAIN_PRIMAL; + PrepareStringBattle(STRINGID_HEAVYRAINLIFTED, gActiveBattler); + gBattleCommunication[MSG_DISPLAY] = 1; + } + else if (gBattleWeather & WEATHER_STRONG_WINDS) + { + gBattleWeather &= ~WEATHER_STRONG_WINDS; + PrepareStringBattle(STRINGID_STRONGWINDSDISSIPATED, gActiveBattler); + gBattleCommunication[MSG_DISPLAY] = 1; + } + break; } gBattlescriptCurrInstr += 3; diff --git a/src/battle_util.c b/src/battle_util.c index b85ad9fab..a231f14cd 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2098,9 +2098,10 @@ u8 DoFieldEndTurnEffects(void) } break; case ENDTURN_RAIN: - if (gBattleWeather & WEATHER_RAIN_ANY) + if (gBattleWeather & WEATHER_RAIN_ANY || gBattleWeather & WEATHER_RAIN_PRIMAL) { - if (!(gBattleWeather & WEATHER_RAIN_PERMANENT)) + if (!(gBattleWeather & WEATHER_RAIN_PERMANENT) + && !(gBattleWeather & WEATHER_RAIN_PRIMAL)) { if (--gWishFutureKnock.weatherDuration == 0) { @@ -2148,9 +2149,11 @@ u8 DoFieldEndTurnEffects(void) gBattleStruct->turnCountersTracker++; break; case ENDTURN_SUN: - if (gBattleWeather & WEATHER_SUN_ANY) + if (gBattleWeather & WEATHER_SUN_ANY || gBattleWeather & WEATHER_SUN_PRIMAL) { - if (!(gBattleWeather & WEATHER_SUN_PERMANENT) && --gWishFutureKnock.weatherDuration == 0) + if (!(gBattleWeather & WEATHER_SUN_PERMANENT) + && !(gBattleWeather & WEATHER_SUN_PRIMAL) + && --gWishFutureKnock.weatherDuration == 0) { gBattleWeather &= ~WEATHER_SUN_TEMPORARY; gBattlescriptCurrInstr = BattleScript_SunlightFaded; @@ -3643,9 +3646,12 @@ u8 TryWeatherFormChange(u8 battler) static const u16 sWeatherFlagsInfo[][3] = { [ENUM_WEATHER_RAIN] = {WEATHER_RAIN_TEMPORARY, WEATHER_RAIN_PERMANENT, HOLD_EFFECT_DAMP_ROCK}, + [ENUM_WEATHER_RAIN_PRIMAL] = {WEATHER_RAIN_PRIMAL, WEATHER_RAIN_PRIMAL, HOLD_EFFECT_DAMP_ROCK}, [ENUM_WEATHER_SUN] = {WEATHER_SUN_TEMPORARY, WEATHER_SUN_PERMANENT, HOLD_EFFECT_HEAT_ROCK}, + [ENUM_WEATHER_SUN_PRIMAL] = {WEATHER_SUN_PRIMAL, WEATHER_SUN_PRIMAL, HOLD_EFFECT_HEAT_ROCK}, [ENUM_WEATHER_SANDSTORM] = {WEATHER_SANDSTORM_TEMPORARY, WEATHER_SANDSTORM_PERMANENT, HOLD_EFFECT_SMOOTH_ROCK}, [ENUM_WEATHER_HAIL] = {WEATHER_HAIL_TEMPORARY, WEATHER_HAIL_PERMANENT, HOLD_EFFECT_ICY_ROCK}, + [ENUM_WEATHER_STRONG_WINDS] = {WEATHER_STRONG_WINDS, WEATHER_STRONG_WINDS, HOLD_EFFECT_NONE}, }; bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) @@ -3656,6 +3662,13 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]); return TRUE; } + else if (gBattleWeather & WEATHER_PRIMAL_ANY + && GetBattlerAbility(battler) != ABILITY_DESOLATE_LAND + && GetBattlerAbility(battler) != ABILITY_PRIMORDIAL_SEA + && GetBattlerAbility(battler) != ABILITY_DELTA_STREAM) + { + return FALSE; + } else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]))) { gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0]); @@ -4233,6 +4246,27 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_DESOLATE_LAND: + if (TryChangeBattleWeather(battler, ENUM_WEATHER_SUN_PRIMAL, TRUE)) + { + BattleScriptPushCursorAndCallback(BattleScript_DesolateLandActivates); + effect++; + } + break; + case ABILITY_PRIMORDIAL_SEA: + if (TryChangeBattleWeather(battler, ENUM_WEATHER_RAIN_PRIMAL, TRUE)) + { + BattleScriptPushCursorAndCallback(BattleScript_PrimordialSeaActivates); + effect++; + } + break; + case ABILITY_DELTA_STREAM: + if (TryChangeBattleWeather(battler, ENUM_WEATHER_STRONG_WINDS, TRUE)) + { + BattleScriptPushCursorAndCallback(BattleScript_DeltaStreamActivates); + effect++; + } + break; } break; case ABILITYEFFECT_ENDTURN: // 1 @@ -8105,6 +8139,18 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat modifier = UQ_4_12(1.0); } + // WEATHER_STRONG_WINDS weakens super effective moves against flying type mons + if (gBattleWeather & WEATHER_STRONG_WINDS + && modifier == UQ_4_12(2.0) + && (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)) + && !IsAbilityOnField(ABILITY_AIR_LOCK) + && !IsAbilityOnField(ABILITY_CLOUD_NINE)) + { + modifier = UQ_4_12(1.0); + gBattlescriptCurrInstr = BattleScript_AttackWeakenedByStrongWinds; + gBattlescriptCurrInstr++; + } + if (GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0) && gBattleMoves[move].power) { modifier = UQ_4_12(0.0); From 216d8f0608af0b44f472437c1a6ee095955af1b4 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 27 Aug 2021 18:28:34 -0300 Subject: [PATCH 10/79] Solved game freezing issue My approach with BattleScript_AttackWeakenedByStrongWinds was incorrect and thus caused the game to freeze when Battle Scene is enabled, so I resorted to printing the string directly, which I don't like because there is no pauses between `attackstring` and `STRINGID_ATTACKWEAKENEDBSTRONGWINDS`. --- data/battle_scripts_1.s | 9 --------- include/battle_scripts.h | 1 - src/battle_util.c | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 63c300a74..f46bffcf3 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6936,15 +6936,6 @@ BattleScript_DeltaStreamActivates:: waitmessage B_WAIT_TIME_LONG end3 -BattleScript_AttackWeakenedByStrongWinds:: - pause B_WAIT_TIME_SHORT - call BattleScript_AbilityPopUp - printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS - waitmessage B_WAIT_TIME_LONG - printstring STRINGID_EMPTYSTRING3 - waitmessage 1 - goto BattleScript_HitFromAtkAnimation - BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp diff --git a/include/battle_scripts.h b/include/battle_scripts.h index f3470776a..28118b21c 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -375,6 +375,5 @@ extern const u8 BattleScript_PrimordialSeaActivates[]; extern const u8 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves[]; extern const u8 BattleScript_DeltaStreamActivates[]; extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[]; -extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/src/battle_util.c b/src/battle_util.c index a231f14cd..e258daac5 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8147,7 +8147,7 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat && !IsAbilityOnField(ABILITY_CLOUD_NINE)) { modifier = UQ_4_12(1.0); - gBattlescriptCurrInstr = BattleScript_AttackWeakenedByStrongWinds; + PrepareStringBattle(STRINGID_ATTACKWEAKENEDBSTRONGWINDS, battlerDef); gBattlescriptCurrInstr++; } From c0c6821f6299e3a143291ff5977d9f397c41919b Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 19:48:59 -0300 Subject: [PATCH 11/79] Made AI_CheckBadMove take the primal weathers into account Credits to Syreldar. Also took the chance and removed trailing spaces from the file. --- src/battle_ai_main.c | 278 +++++++++++++++++++++++++------------------ 1 file changed, 163 insertions(+), 115 deletions(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 07f5e68fc..f6ed7335d 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -249,7 +249,7 @@ static u8 ChooseMoveOrAction_Singles(void) RecordLastUsedMoveByTarget(); GetAiLogicData(sBattler_AI, gBattlerTarget); - + while (flags != 0) { if (flags & 1) @@ -364,10 +364,10 @@ static u8 ChooseMoveOrAction_Doubles(void) BattleAI_SetupAIData(gBattleStruct->palaceFlags >> 4); else BattleAI_SetupAIData(0xF); - + gBattlerTarget = i; GetAiLogicData(sBattler_AI, gBattlerTarget); - + if ((i & BIT_SIDE) != (sBattler_AI & BIT_SIDE)) RecordLastUsedMoveByTarget(); @@ -510,19 +510,21 @@ static void BattleAI_DoAIProcessing(void) static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { // move data + s32 moveType; u8 atkPriority = GetMovePriority(battlerAtk, move); u16 moveEffect = gBattleMoves[move].effect; - u8 moveType = gBattleMoves[move].type; u8 moveTarget = gBattleMoves[move].target; u16 accuracy = AI_GetMoveAccuracy(battlerAtk, battlerDef, AI_DATA->atkAbility, AI_DATA->defAbility, AI_DATA->atkHoldEffect, AI_DATA->defHoldEffect, move); u8 effectiveness = AI_GetMoveEffectiveness(move, battlerAtk, battlerDef); bool32 isDoubleBattle = IsValidDoubleBattle(battlerAtk); u32 i; u16 predictedMove = gLastMoves[battlerDef]; // TODO better move prediction - + if (IsTargetingPartner(battlerAtk, battlerDef)) return score; - + + GET_MOVE_TYPE(move, move); + // check non-user target if (!(gBattleMoves[move].target & MOVE_TARGET_USER)) { @@ -532,7 +534,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { RETURN_SCORE_MINUS(20); } - + // check ground immunities if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef) @@ -544,11 +546,11 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { RETURN_SCORE_MINUS(20); } - + // check off screen if (IsSemiInvulnerable(battlerDef, move) && moveEffect != EFFECT_SEMI_INVULNERABLE && GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) != 1) RETURN_SCORE_MINUS(20); // if target off screen and we go first, don't use move - + // check if negates type switch (effectiveness) { @@ -559,7 +561,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) RETURN_SCORE_MINUS(10); break; } - + // target ability checks if (!DoesBattlerIgnoreAbilityChecks(AI_DATA->atkAbility, move)) { @@ -674,7 +676,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) RETURN_SCORE_MINUS(10); break; } // def ability checks - + // target partner ability checks & not attacking partner if (isDoubleBattle) { @@ -712,35 +714,35 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } } // def partner ability checks } // ignore def ability check - + // gen7+ dark type mons immune to priority->elevated moves from prankster #if B_PRANKSTER >= GEN_7 if (AI_DATA->atkAbility == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) && IS_MOVE_STATUS(move) && !(moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_USER))) RETURN_SCORE_MINUS(10); #endif - + // terrain & effect checks if (AI_IsTerrainAffected(battlerDef, STATUS_FIELD_ELECTRIC_TERRAIN)) { if (moveEffect == EFFECT_SLEEP || moveEffect == EFFECT_YAWN) RETURN_SCORE_MINUS(20); } - + if (AI_IsTerrainAffected(battlerDef, STATUS_FIELD_MISTY_TERRAIN)) { if (IsNonVolatileStatusMoveEffect(moveEffect) || IsConfusionMoveEffect(moveEffect)) RETURN_SCORE_MINUS(20); } - + if (AI_IsTerrainAffected(battlerAtk, STATUS_FIELD_PSYCHIC_TERRAIN) && atkPriority > 0) { RETURN_SCORE_MINUS(20); } } // end check MOVE_TARGET_USER - + // the following checks apply to any target (including user) - + // throat chop check if (gDisableStructs[battlerAtk].throatChopTimer && TestMoveFlags(move, FLAG_SOUND)) return 0; // Can't even select move at all @@ -748,8 +750,35 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gStatuses3[battlerAtk] & STATUS3_HEAL_BLOCK && IsHealBlockPreventingMove(battlerAtk, move)) return 0; // Can't even select heal blocked move // primal weather check - //TODO - + if (WEATHER_HAS_EFFECT) + { + if (gBattleWeather & WEATHER_PRIMAL_ANY) + { + switch (move) + { + case MOVE_SUNNY_DAY: + case MOVE_RAIN_DANCE: + case MOVE_HAIL: + case MOVE_SANDSTORM: + RETURN_SCORE_MINUS(30); + } + } + + if (!IS_MOVE_STATUS(move)) + { + if (gBattleWeather & WEATHER_SUN_PRIMAL) + { + if (moveType == TYPE_WATER) + RETURN_SCORE_MINUS(30); + } + else if (gBattleWeather & WEATHER_RAIN_PRIMAL) + { + if (moveType == TYPE_FIRE) + RETURN_SCORE_MINUS(30); + } + } + } + // check move effects switch (moveEffect) { @@ -763,7 +792,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_EXPLOSION: if (!(AI_THINKING_STRUCT->aiFlags & AI_FLAG_WILL_SUICIDE)) score -= 2; - + if (effectiveness == AI_EFFECTIVENESS_x0) { score -= 10; @@ -813,7 +842,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (!BattlerStatCanRise(battlerAtk, AI_DATA->atkAbility, STAT_SPATK) || !HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) score -= 10; break; - case EFFECT_SPECIAL_DEFENSE_UP: + case EFFECT_SPECIAL_DEFENSE_UP: case EFFECT_SPECIAL_DEFENSE_UP_2: if (!BattlerStatCanRise(battlerAtk, AI_DATA->atkAbility, STAT_SPDEF)) score -= 10; @@ -1121,7 +1150,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_LOW_KICK: // AI_CBM_HighRiskForDamage if (AI_DATA->defAbility == ABILITY_WONDER_GUARD && effectiveness < AI_EFFECTIVENESS_x2) - score -= 10; + score -= 10; break; case EFFECT_COUNTER: case EFFECT_MIRROR_COAT: @@ -1131,7 +1160,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) || DoesSubstituteBlockMove(battlerAtk, AI_DATA->battlerDefPartner, predictedMove)) score -= 10; break; - + case EFFECT_ROAR: if (CountUsablePartyMons(battlerDef) == 0) score -= 10; @@ -1279,7 +1308,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SPIKES: if (gSideTimers[GetBattlerSide(battlerDef)].spikesAmount >= 3) score -= 10; - else if (PartnerMoveIsSameNoTarget(AI_DATA->battlerAtkPartner, move, AI_DATA->partnerMove) + else if (PartnerMoveIsSameNoTarget(AI_DATA->battlerAtkPartner, move, AI_DATA->partnerMove) && gSideTimers[GetBattlerSide(battlerDef)].spikesAmount == 2) score -= 10; // only one mon needs to set up the last layer of Spikes break; @@ -1457,7 +1486,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; } - + if (B_MENTAL_HERB >= GEN_5 && AI_DATA->defHoldEffect == HOLD_EFFECT_CURE_ATTRACT) score -= 6; break; @@ -1687,7 +1716,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gBattleMons[battlerAtk].hp > (gBattleMons[battlerAtk].hp + gBattleMons[battlerDef].hp) / 2) score -= 10; break; - + case EFFECT_CONVERSION_2: //TODO break; @@ -1747,7 +1776,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; } // move check - + if (decreased) break; if (IsBattlerIncapacitated(battlerDef, AI_DATA->defAbility)) @@ -1789,7 +1818,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) IncreaseAllyProtectionViability(&viability, 0xFF); }*/ } - break; + break; case EFFECT_MIRACLE_EYE: if (gStatuses3[battlerDef] & STATUS3_MIRACLE_EYED) score -= 10; @@ -1837,7 +1866,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) || ((AI_DATA->defAbility == ABILITY_CONTRARY) && !IsTargetingPartner(battlerAtk, battlerDef))) // don't want to raise target stats unless its your partner score -= 10; break; - + case EFFECT_PSYCH_UP: // haze stats check { for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++) @@ -2001,7 +2030,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) u32 atkNegativeStages = CountNegativeStatStages(battlerAtk); u32 defPositiveStages = CountPositiveStatStages(battlerDef); u32 defNegativeStages = CountNegativeStatStages(battlerDef); - + if (atkPositiveStages >= defPositiveStages && atkNegativeStages <= defNegativeStages) score -= 10; break; @@ -2399,21 +2428,21 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break;*/ } // move effect checks - + if (score < 0) score = 0; - + return score; } static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) -{ +{ if (IsTargetingPartner(battlerAtk, battlerDef)) return score; - + if (gBattleMoves[move].power == 0) return score; // can't make anything faint with no power - + if (CanAttackerFaintTarget(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex, 0) && gBattleMoves[move].effect != EFFECT_EXPLOSION) { // this move can faint the target @@ -2427,24 +2456,43 @@ static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // this move isn't expected to faint the target if (TestMoveFlags(move, FLAG_HIGH_CRIT)) score += 2; // crit makes it more likely to make them faint - + if (GetMoveDamageResult(move) == MOVE_POWER_OTHER) score--; - + switch (AI_GetMoveEffectiveness(move, battlerAtk, battlerDef)) { case AI_EFFECTIVENESS_x4: - score += 4; + if (WEATHER_HAS_EFFECT + && gBattleWeather & WEATHER_STRONG_WINDS + && IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)) + { + if (AI_RandLessThan(176)) //Consider it supereffective instead of hypereffective. + score += 2; + else + score++; + } + else + score += 4; break; case AI_EFFECTIVENESS_x2: - if (AI_RandLessThan(176)) - score += 2; + if (WEATHER_HAS_EFFECT + && gBattleWeather & WEATHER_STRONG_WINDS + && IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)) + { + break; // Don't increase score, consider it neutral. + } else - score++; + { + if (AI_RandLessThan(176)) + score += 2; + else + score++; + } break; } } - + //AI_TryToFaint_CheckIfDanger if (!IsAiFaster(AI_CHECK_FASTER) && CanTargetFaintAi(battlerDef, battlerAtk)) { // AI_TryToFaint_Danger @@ -2453,7 +2501,7 @@ static s16 AI_TryToFaint(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) else score++; } - + return score; } @@ -2472,7 +2520,7 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) bool32 attackerHasBadAbility = (GetAbilityRating(AI_DATA->atkAbility) < 0); bool32 partnerHasBadAbility = (GetAbilityRating(atkPartnerAbility) < 0); u16 predictedMove = gLastMoves[battlerDef]; //for now - + // check what effect partner is using if (AI_DATA->partnerMove != 0) { @@ -2506,8 +2554,8 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } } // check partner move effect - - + + // consider our move effect relative to partner state switch (effect) { @@ -2528,8 +2576,8 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; } // our effect relative to partner - - + + // consider global move effects switch (effect) { @@ -2559,8 +2607,8 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; } // global move effect check - - + + // check specific target if (IsTargetingPartner(battlerAtk, battlerDef)) { @@ -2667,11 +2715,11 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { RETURN_SCORE_PLUS(1); } - break; + break; } } // ability checks } // move power check - + // attacker move effects specifically targeting partner if (!partnerProtecting) { @@ -2784,12 +2832,12 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } // attacker move effects } // check partner protecting - + score -= 30; // otherwise, don't target partner } else // checking opponent { - // these checks mostly handled in AI_CheckBadMove and AI_CheckViability + // these checks mostly handled in AI_CheckBadMove and AI_CheckViability switch (effect) { case EFFECT_SKILL_SWAP: @@ -2812,10 +2860,10 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 3; break; } - + // lightning rod, flash fire against enemy handled in AI_CheckBadMove } - + return score; } @@ -2831,11 +2879,11 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) u32 i; u8 atkHpPercent = GetHealthPercentage(battlerAtk); u8 defHpPercent = GetHealthPercentage(battlerDef); - + // Targeting partner, check benefits of doing that instead if (IsTargetingPartner(battlerAtk, battlerDef)) return score; - + // check always hits if (!IS_MOVE_STATUS(move) && gBattleMoves[move].accuracy == 0) { @@ -2844,22 +2892,22 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (AI_RandLessThan(100) && (gBattleMons[battlerDef].statStages[STAT_EVASION] >= 8 || gBattleMons[battlerAtk].statStages[STAT_ACC] <= 4)) score++; } - + // check high crit if (TestMoveFlags(move, FLAG_HIGH_CRIT) && effectiveness >= AI_EFFECTIVENESS_x2 && AI_RandLessThan(128)) score++; - + // check already dead if (!IsBattlerIncapacitated(battlerDef, AI_DATA->defAbility) && CanTargetFaintAi(battlerAtk, battlerDef) && GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 1) // opponent should go first { - if (atkPriority > 0) + if (atkPriority > 0) score++; else score--; } - + // check damage if (gBattleMoves[move].power != 0 && GetMoveDamageResult(move) == MOVE_POWER_WEAK) score--; @@ -2867,11 +2915,11 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // check status move preference if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_PREFER_STATUS_MOVES && IS_MOVE_STATUS(move) && effectiveness != AI_EFFECTIVENESS_x0) score++; - + // check thawing moves if ((gBattleMons[battlerAtk].status1 & STATUS1_FREEZE) && TestMoveFlags(move, FLAG_THAW_USER)) score += (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) ? 20 : 10; - + // check burn if (gBattleMons[battlerAtk].status1 & STATUS1_BURN) { @@ -2890,7 +2938,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } } - + // ability checks switch (AI_DATA->atkAbility) { @@ -2917,12 +2965,12 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } break; - } // ability checks - + } // ability checks + // move effect checks switch (moveEffect) { - + case EFFECT_HIT: break; case EFFECT_SLEEP: @@ -2964,7 +3012,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } } - + if (!AI_RandLessThan(100)) { score--; @@ -3010,7 +3058,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; } } - + if (!AI_RandLessThan(100)) { score--; @@ -3033,7 +3081,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 2; else if (atkHpPercent <= 70) score -= 2; - else + else score++; break; case EFFECT_EVASION_UP: @@ -3163,7 +3211,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_ATTACK_SPATK_UP: // work up if (GetHealthPercentage(battlerAtk) <= 40 || AI_DATA->atkAbility == ABILITY_CONTRARY) break; - + if (HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL)) IncreaseStatUpScore(battlerAtk, battlerDef, STAT_ATK, &score); else if (HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL)) @@ -3215,7 +3263,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) default: break; } - + if (ShouldRecover(battlerAtk, battlerDef, move, healPercent)) score += 2; } @@ -3443,7 +3491,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (newHp > healthBenchmark && ShouldAbsorb(battlerAtk, battlerDef, move, AI_THINKING_STRUCT->simulatedDmg[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex])) score += 2; } - break; + break; case EFFECT_SLEEP_TALK: case EFFECT_SNORE: if (!IsWakeupTurn(battlerAtk) && gBattleMons[battlerAtk].status1 & STATUS1_SLEEP) @@ -3478,13 +3526,13 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_THIEF: { bool32 canSteal = FALSE; - + #if defined B_TRAINERS_KNOCK_OFF_ITEMS && B_TRAINERS_KNOCK_OFF_ITEMS == TRUE canSteal = TRUE; #endif if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || GetBattlerSide(battlerAtk) == B_SIDE_PLAYER) canSteal = TRUE; - + if (canSteal && AI_DATA->atkItem == ITEM_NONE && AI_DATA->defItem != ITEM_NONE && CanBattlerGetOrLoseItem(battlerDef, AI_DATA->defItem) @@ -3628,8 +3676,8 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (AI_DATA->defAbility == ABILITY_MAGIC_BOUNCE || CountUsablePartyMons(battlerDef) == 0) break; if (gDisableStructs[battlerAtk].isFirstTurn) - score += 2; - //TODO - track entire opponent party data to determine hazard effectiveness + score += 2; + //TODO - track entire opponent party data to determine hazard effectiveness break; case EFFECT_FORESIGHT: if (AI_DATA->atkAbility == ABILITY_SCRAPPY) @@ -3658,7 +3706,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (HasMoveEffect(battlerDef, EFFECT_MORNING_SUN) || HasMoveEffect(battlerDef, EFFECT_SYNTHESIS) || HasMoveEffect(battlerDef, EFFECT_MOONLIGHT)) - score += 2; + score += 2; } break; case EFFECT_HAIL: @@ -3667,7 +3715,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if ((HasMoveEffect(battlerAtk, EFFECT_AURORA_VEIL) || HasMoveEffect(AI_DATA->battlerAtkPartner, EFFECT_AURORA_VEIL)) && ShouldSetScreen(battlerAtk, battlerDef, EFFECT_AURORA_VEIL)) score += 3; - + score++; if (AI_DATA->atkHoldEffect == HOLD_EFFECT_ICY_ROCK) score++; @@ -3726,7 +3774,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SPECTRAL_THIEF: // Want to copy positive stat changes for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++) - { + { if (gBattleMons[battlerDef].statStages[i] > gBattleMons[battlerAtk].statStages[i]) { switch (i) @@ -3785,7 +3833,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (HasMoveEffect(battlerAtk, EFFECT_SWALLOW) || HasMoveEffect(battlerAtk, EFFECT_SPIT_UP)) score += 2; - + IncreaseStatUpScore(battlerAtk, battlerDef, STAT_DEF, &score); IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPDEF, &score); break; @@ -3802,20 +3850,20 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) || HasMoveEffect(battlerAtk, EFFECT_PSYCH_UP) || HasMoveEffect(battlerAtk, EFFECT_SPECTRAL_THIEF)) score++; - + if (AI_DATA->defAbility == ABILITY_CONTRARY) score += 2; - + IncreaseConfusionScore(battlerAtk, battlerDef, move, &score); break; case EFFECT_FLATTER: if (HasMoveEffect(battlerAtk, EFFECT_PSYCH_UP) || HasMoveEffect(battlerAtk, EFFECT_SPECTRAL_THIEF)) score += 2; - + if (AI_DATA->defAbility == ABILITY_CONTRARY) score += 2; - + IncreaseConfusionScore(battlerAtk, battlerDef, move, &score); break; case EFFECT_FURY_CUTTER: @@ -3856,7 +3904,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score += 3; break; } - + switch (move) { case MOVE_DEFOG: @@ -3872,7 +3920,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) && GetWhoStrikesFirst(battlerAtk, AI_DATA->battlerAtkPartner, TRUE) == 1) // Partner going first break; // Don't use Defog if partner is going to set up hazards } - + // check defog lowering evasion if (ShouldLowerEvasion(battlerAtk, battlerDef, AI_DATA->defAbility)) { @@ -3912,7 +3960,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_CHARGE: if (HasDamagingMoveOfType(battlerAtk, TYPE_ELECTRIC)) score += 2; - + IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPDEF, &score); break; case EFFECT_TAUNT: @@ -4081,7 +4129,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { if (AI_DATA->defAbility != AI_DATA->atkAbility && !(gStatuses3[battlerDef] & STATUS3_GASTRO_ACID)) score += 2; - } + } break; case EFFECT_IMPRISON: if (predictedMove != MOVE_NONE && HasMove(battlerAtk, predictedMove)) @@ -4152,7 +4200,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_SHELL_SMASH: if (AI_DATA->atkHoldEffect == HOLD_EFFECT_POWER_HERB) score += 3; - + IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPEED, &score); IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPATK, &score); IncreaseStatUpScore(battlerAtk, battlerDef, STAT_ATK, &score); @@ -4256,7 +4304,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gStatuses3[battlerAtk] & STATUS3_YAWN && IsBattlerGrounded(battlerAtk)) score += 10; //fallthrough - case EFFECT_GRASSY_TERRAIN: + case EFFECT_GRASSY_TERRAIN: case EFFECT_PSYCHIC_TERRAIN: score += 2; if (AI_DATA->atkHoldEffect == HOLD_EFFECT_TERRAIN_EXTENDER) @@ -4529,7 +4577,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) //case EFFECT_SKY_DROP //break; } // move effect checks - + return score; } @@ -4539,15 +4587,15 @@ static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (IsTargetingPartner(battlerAtk, battlerDef) || gBattleResults.battleTurnCounter != 0) return score; - - if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_SMART_SWITCHING + + if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_SMART_SWITCHING && GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 1 && CanTargetFaintAi(battlerDef, battlerAtk) && GetMovePriority(battlerAtk, move) == 0) { RETURN_SCORE_MINUS(20); // No point in setting up if you will faint. Should just switch if possible.. } - + // check effects to prioritize first turn switch (gBattleMoves[move].effect) { @@ -4636,7 +4684,7 @@ static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) default: break; } - + return score; } @@ -4645,10 +4693,10 @@ static s16 AI_Risky(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { if (IsTargetingPartner(battlerAtk, battlerDef)) return score; - + if (TestMoveFlags(move, FLAG_HIGH_CRIT)) score += 2; - + switch (gBattleMoves[move].effect) { case EFFECT_SLEEP: @@ -4675,7 +4723,7 @@ static s16 AI_Risky(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) default: break; } - + return score; } @@ -4684,10 +4732,10 @@ static s16 AI_PreferStrongestMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 sc { if (IsTargetingPartner(battlerAtk, battlerDef)) return score; - + if (GetMoveDamageResult(move) == MOVE_POWER_BEST) score += 2; - + return score; } @@ -4695,14 +4743,14 @@ static s16 AI_PreferStrongestMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 sc static s16 AI_PreferBatonPass(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { u32 i; - + if (IsTargetingPartner(battlerAtk, battlerDef) || CountUsablePartyMons(battlerAtk) == 0 || GetMoveDamageResult(move) != MOVE_POWER_OTHER || !HasMoveEffect(battlerAtk, EFFECT_BATON_PASS) || IsBattlerTrapped(battlerAtk, TRUE)) return score; - + if (IsStatRaisingEffect(gBattleMoves[move].effect)) { if (gBattleResults.battleTurnCounter == 0) @@ -4710,9 +4758,9 @@ static s16 AI_PreferBatonPass(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) else if (GetHealthPercentage(battlerAtk) < 60) score -= 10; else - score++; + score++; } - + // other specific checks switch (gBattleMoves[move].effect) { @@ -4738,12 +4786,12 @@ static s16 AI_PreferBatonPass(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (gStatuses3[battlerAtk] & (STATUS3_ROOTED | STATUS3_AQUA_RING)) score += 2; if (gStatuses3[battlerAtk] & STATUS3_LEECHSEED) - score -= 3; + score -= 3; break; default: break; } - + return score; } @@ -4751,7 +4799,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { u16 effect = gBattleMoves[move].effect; u8 moveType = gBattleMoves[move].type; - + if (IsTargetingPartner(battlerAtk, battlerDef)) { if ((effect == EFFECT_HEAL_PULSE || effect == EFFECT_HIT_ENEMY_HEAL_ALLY) @@ -4761,7 +4809,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (CanTargetFaintAi(FOE(battlerAtk), AI_DATA->battlerAtkPartner) || (CanTargetFaintAi(BATTLE_PARTNER(FOE(battlerAtk)), AI_DATA->battlerAtkPartner))) score--; - + if (GetHealthPercentage(battlerDef) <= 50) score++; } @@ -4800,7 +4848,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // med hp if (IsStatRaisingEffect(effect) || IsStatLoweringEffect(effect)) score -= 2; - + switch (effect) { case EFFECT_EXPLOSION: @@ -4823,7 +4871,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) // low hp if (IsStatRaisingEffect(effect) || IsStatLoweringEffect(effect)) score -= 2; - + // check other discouraged low hp effects switch (effect) { @@ -4856,7 +4904,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } } } - + // consider target HP if (CanAttackerFaintTarget(battlerAtk, battlerDef, AI_THINKING_STRUCT->movesetIndex, 0)) { @@ -4928,7 +4976,7 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 2; // don't use status moves if target is at low health } } - + return score; } @@ -4947,7 +4995,7 @@ static s16 AI_Roaming(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { if (IsBattlerTrapped(battlerAtk, FALSE)) return score; - + AI_Flee(); return score; } From e39dc493fc8767621796d41e569917053bd0812c Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 20:33:21 -0300 Subject: [PATCH 12/79] A couple of improvements, courtesy of Syreldar -Optimized the checks for `WEATHER_RAIN_PRIMAL` and `WEATHER_SUN_PRIMAL` in `Cmd_attackcanceler`. -Moved the dmg calculation effect of `WEATHER_STRONG_WINDS` to the `CalcFinalDmg` function. --- src/battle_script_commands.c | 13 +++++-------- src/battle_util.c | 18 ++++++------------ 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 85cd16066..2df8edc91 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1324,23 +1324,21 @@ static void Cmd_attackcanceler(void) s32 i, moveType; GET_MOVE_TYPE(gCurrentMove, moveType); + if (moveType == TYPE_FIRE && (gBattleWeather & WEATHER_RAIN_PRIMAL) - && !IsAbilityOnField(ABILITY_AIR_LOCK) - && !IsAbilityOnField(ABILITY_CLOUD_NINE) - && gBattleMoves[gCurrentMove].power >= 1) + && WEATHER_HAS_EFFECT + && gBattleMoves[gCurrentMove].power) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_PrimordialSeaFizzlesOutFireTypeMoves; return; } - GET_MOVE_TYPE(gCurrentMove, moveType); if (moveType == TYPE_WATER && (gBattleWeather & WEATHER_SUN_PRIMAL) - && !IsAbilityOnField(ABILITY_AIR_LOCK) - && !IsAbilityOnField(ABILITY_CLOUD_NINE) - && gBattleMoves[gCurrentMove].power >= 1) + && WEATHER_HAS_EFFECT + && gBattleMoves[gCurrentMove].power) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_DesolateLandEvaporatesWaterTypeMoves; @@ -1366,7 +1364,6 @@ static void Cmd_attackcanceler(void) return; // Check Protean activation. - GET_MOVE_TYPE(gCurrentMove, moveType); if ((GetBattlerAbility(gBattlerAttacker) == ABILITY_PROTEAN || GetBattlerAbility(gBattlerAttacker) == ABILITY_LIBERO) && (gBattleMons[gBattlerAttacker].type1 != moveType || gBattleMons[gBattlerAttacker].type2 != moveType || (gBattleMons[gBattlerAttacker].type3 != moveType && gBattleMons[gBattlerAttacker].type3 != TYPE_MYSTERY)) diff --git a/src/battle_util.c b/src/battle_util.c index e258daac5..96cbfbc87 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7898,6 +7898,12 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move else if (moveType == TYPE_WATER) dmg = ApplyModifier(UQ_4_12(0.5), dmg); } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) + { + if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING) + && typeEffectivenessModifier >= UQ_4_12(2.0)) + dmg = ApplyModifier(UQ_4_12(0.5), dmg); + } // check stab if (IS_BATTLER_OF_TYPE(battlerAtk, moveType) && move != MOVE_STRUGGLE) @@ -8139,18 +8145,6 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat modifier = UQ_4_12(1.0); } - // WEATHER_STRONG_WINDS weakens super effective moves against flying type mons - if (gBattleWeather & WEATHER_STRONG_WINDS - && modifier == UQ_4_12(2.0) - && (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)) - && !IsAbilityOnField(ABILITY_AIR_LOCK) - && !IsAbilityOnField(ABILITY_CLOUD_NINE)) - { - modifier = UQ_4_12(1.0); - PrepareStringBattle(STRINGID_ATTACKWEAKENEDBSTRONGWINDS, battlerDef); - gBattlescriptCurrInstr++; - } - if (GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0) && gBattleMoves[move].power) { modifier = UQ_4_12(0.0); From 0a3805492577ca978e19cec9222c79debbe78620 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 21:21:07 -0300 Subject: [PATCH 13/79] Print `STRINGID_ATTACKWEAKENEDBSTRONGWINDS` properly --- data/battle_scripts_1.s | 7 +++++++ include/battle_scripts.h | 1 + src/battle_util.c | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f46bffcf3..ecfddf762 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6936,6 +6936,13 @@ BattleScript_DeltaStreamActivates:: waitmessage B_WAIT_TIME_LONG end3 +BattleScript_AttackWeakenedByStrongWinds:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS + waitmessage B_WAIT_TIME_LONG + end3 + BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 28118b21c..f3470776a 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -375,5 +375,6 @@ extern const u8 BattleScript_PrimordialSeaActivates[]; extern const u8 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves[]; extern const u8 BattleScript_DeltaStreamActivates[]; extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[]; +extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/src/battle_util.c b/src/battle_util.c index 96cbfbc87..0f89def27 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -484,6 +484,14 @@ void HandleAction_UseMove(void) for (i = 0; i < MAX_BATTLERS_COUNT; i++) gBattleStruct->hpBefore[i] = gBattleMons[i].hp; + GET_MOVE_TYPE(gCurrentMove, moveType); + if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) + { + if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_FLYING) + && CalcTypeEffectivenessMultiplier(gCurrentMove, moveType, gBattlerAttacker, gBattlerTarget, FALSE) >= UQ_4_12(2.0)) + BattleScriptPushCursorAndCallback(BattleScript_AttackWeakenedByStrongWinds); + } + gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; } From d0fd883ec71fdefa62e510dc17ac1f3fd580e079 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 21:49:45 -0300 Subject: [PATCH 14/79] Small comment tweak --- 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 0f89def27..ad4753119 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7891,7 +7891,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move && gBattleMoves[move].effect != EFFECT_FACADE && abilityAtk != ABILITY_GUTS) dmg = ApplyModifier(UQ_4_12(0.5), dmg); - // check sunny/rain weather + // check weather if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_RAIN_ANY) { if (moveType == TYPE_FIRE) From 97ce02464b247ce6961062d8154f6e19f4e2b17a Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 22:09:33 -0300 Subject: [PATCH 15/79] Removed small redundancy --- src/battle_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index ad4753119..ba651877e 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2106,7 +2106,7 @@ u8 DoFieldEndTurnEffects(void) } break; case ENDTURN_RAIN: - if (gBattleWeather & WEATHER_RAIN_ANY || gBattleWeather & WEATHER_RAIN_PRIMAL) + if (gBattleWeather & WEATHER_RAIN_ANY) { if (!(gBattleWeather & WEATHER_RAIN_PERMANENT) && !(gBattleWeather & WEATHER_RAIN_PRIMAL)) @@ -2157,7 +2157,7 @@ u8 DoFieldEndTurnEffects(void) gBattleStruct->turnCountersTracker++; break; case ENDTURN_SUN: - if (gBattleWeather & WEATHER_SUN_ANY || gBattleWeather & WEATHER_SUN_PRIMAL) + if (gBattleWeather & WEATHER_SUN_ANY) { if (!(gBattleWeather & WEATHER_SUN_PERMANENT) && !(gBattleWeather & WEATHER_SUN_PRIMAL) From 69b7910f470b5077d6dbdc7d2d9af99da3290d25 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 23:52:52 -0300 Subject: [PATCH 16/79] Gave an entrance animation to Delta Stream --- data/battle_anim_scripts.s | 25 +++++ data/battle_scripts_1.s | 3 +- .../backgrounds/windstorm_brew.png | Bin 0 -> 1100 bytes include/constants/battle_anim.h | 1 + include/graphics.h | 4 + src/battle_anim_flying.c | 100 +++++++++++++++++- src/graphics.c | 5 +- 7 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 graphics/battle_anims/backgrounds/windstorm_brew.png diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 33182e878..11fb01724 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -822,6 +822,7 @@ gBattleAnims_General:: .4byte General_SlideOffScreen @ B_ANIM_SLIDE_OFFSCREEN .4byte General_RestoreBg @ B_ANIM_RESTORE_BG .4byte General_TotemFlare @ B_ANIM_TOTEM_FLARE + .4byte General_StrongWinds @ B_ANIM_STRONG_WINDS .align 2 gBattleAnims_Special:: @@ -24397,6 +24398,30 @@ General_TotemFlare:: clearmonbg ANIM_ATTACKER end +General_StrongWinds:: + loadspritegfx ANIM_TAG_FLYING_DIRT + playsewithpan SE_M_GUST, 0 + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_FLYING_DIRT, 0, 12, 12, RGB(20, 20, 20) + waitforvisualfinish + createvisualtask AnimTask_LoadWindstormBackground, 5, FALSE + delay 16 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 10, 2304, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 90, 2048, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 50, 2560, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 20, 2304, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 70, 1984, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 0, 2816, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 60, 2560, 96, 0 + waitforvisualfinish + stopsound + end + RainbowEndureEffect: launchtemplate gBlueEndureEnergySpriteTemplate 0x2 0x4 0x0 0xffe8 0x1a 0x2 delay 0x3 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ecfddf762..45d654cd6 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6933,7 +6933,8 @@ BattleScript_DeltaStreamActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp printstring STRINGID_MYSTERIOUSAIRCURRENT - waitmessage B_WAIT_TIME_LONG + waitstate + playanimation BS_ATTACKER, B_ANIM_STRONG_WINDS, NULL end3 BattleScript_AttackWeakenedByStrongWinds:: diff --git a/graphics/battle_anims/backgrounds/windstorm_brew.png b/graphics/battle_anims/backgrounds/windstorm_brew.png new file mode 100644 index 0000000000000000000000000000000000000000..c36e720cfe8a114139595802c7642a920f67a831 GIT binary patch literal 1100 zcmV-S1he~zP){FYyfYAzTU@aYmx`yA^CJV9g%a^ocNnri4!k6 z51jd*$ay_C)>gCVPg+Mz7RXJh~d#xWFU#c}uf28t;dEleLl`{U{nOB_fRe9TOA zHei#`aO-4>7G&?otBv-n5&1NyvIh#XhvbW^}Yh`}6PyOT`MMsiqIHgt1ZmF)d=A$s7Hw0aM-kUP=7aAR-- zRgmyC6*cQqL;H*xFo;8?u^I(`mZ^cpLW-RHQIZzI+Y30TNrH%*oRiD?Hxo#538%0F6ZX8S{JnW_{AD_7zq_s9g*%`%-HOV4!{^+x z`oBs|&!)p!$_e0Qm+-x?c$sBMc%F~3Jrmu$>eESd@sZivrf{6{$z@y5^k1pETUYE- z>`{`jxTAergLOu?|5$A5)uAHPSV6*UzWMMe^5wQ7u>98G`(pil$x)JIM5+AF8Nx8P zKZr-p$&_PtHchHl2@0&s23$n!TIWY zjZTBlZ8Y6H=*_g1C^<3HPxA3R^6D*VDFW=f7jjD3L&g@*@Pu!J@`Um=o__$VNqB*f SRB7S>00005L{ literal 0 HcmV?d00001 diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index c04bc14f7..4cfcafcd3 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -523,6 +523,7 @@ #define B_ANIM_SLIDE_OFFSCREEN 26 // for Emergency Exit #define B_ANIM_RESTORE_BG 27 // for Terrain Endings #define B_ANIM_TOTEM_FLARE 28 // Totem boosts aura flare +#define B_ANIM_STRONG_WINDS 29 // special animations table (gBattleAnims_Special) #define B_ANIM_LVL_UP 0 diff --git a/include/graphics.h b/include/graphics.h index dc020c401..6139e90cf 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4697,6 +4697,7 @@ extern const u32 gBattleAnimSpritePal_MagnifyingGlass[]; extern const u32 gBattleAnimSpritePal_BrownOrb[]; extern const u32 gBattleAnimSpritePal_MetalSoundWaves[]; extern const u32 gBattleAnimSpritePal_FlyingDirt[]; +extern const u32 gBattleAnimSpritePal_Windstorm[]; extern const u32 gBattleAnimSpritePal_IcicleSpear[]; extern const u32 gBattleAnimSpritePal_Hail[]; extern const u32 gBattleAnimSpritePal_GlowyRedOrb[]; @@ -5199,6 +5200,9 @@ extern const u16 gSlotMachineReelTimePikachu_Pal[]; extern const u32 gBattleAnimBgTilemap_Sandstorm[]; extern const u32 gBattleAnimBgImage_Sandstorm[]; +extern const u32 gBattleAnimBgTilemap_Windstorm[]; +extern const u32 gBattleAnimBgImage_Windstorm[]; + // Pokedex Area Screen extern const u32 gPokedexAreaScreenAreaUnknown_Gfx[]; extern const u16 gPokedexAreaScreenAreaUnknown_Pal[]; diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index 2b93206ca..cce21c84e 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -5,6 +5,8 @@ #include "constants/battle_anim.h" #include "constants/rgb.h" #include "random.h" +#include "gpu_regs.h" +#include "graphics.h" extern const struct SpriteTemplate gFlashingHitSplatSpriteTemplate; @@ -30,7 +32,7 @@ static void AnimUnusedFlashingLight_Step(struct Sprite *); static void AnimSkyAttackBird(struct Sprite *); static void AnimSkyAttackBird_Step(struct Sprite *); static void AnimTask_AnimateGustTornadoPalette_Step(u8); - +static void AnimTask_LoadWindstormBackground_Step(u8 taskId); const struct SpriteTemplate gEllipticalGustSpriteTemplate = { @@ -1231,3 +1233,99 @@ static void AnimTask_SetAttackerVisibility(u8 taskId) } DestroyAnimVisualTask(taskId); } + +void AnimTask_LoadWindstormBackground(u8 taskId) +{ + int var0; + struct BattleAnimBgData animBg; + + var0 = 0; + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); + SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); + SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0); + + if (!IsContest()) + SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1); + + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + + GetBattleAnimBg1Data(&animBg); + AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Windstorm, animBg.tilesOffset); + AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimBgTilemap_Windstorm, 0); + LoadCompressedPalette(gBattleAnimSpritePal_Windstorm, animBg.paletteId * 16, 32); + + if (gBattleAnimArgs[0] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + var0 = 1; + + gTasks[taskId].data[0] = var0; + gTasks[taskId].func = AnimTask_LoadWindstormBackground_Step; +} + +static void AnimTask_LoadWindstormBackground_Step(u8 taskId) +{ + struct BattleAnimBgData animBg; + + if (gTasks[taskId].data[0] == 0) + gBattle_BG1_X += -6; + else + gBattle_BG1_X += 6; + + gBattle_BG1_Y += -1; + + switch (gTasks[taskId].data[12]) + { + case 0: + if (++gTasks[taskId].data[10] == 4) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11]++; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11])); + if (gTasks[taskId].data[11] == 7) + { + gTasks[taskId].data[12]++; + gTasks[taskId].data[11] = 0; + } + } + break; + case 1: + if (++gTasks[taskId].data[11] == 101) + { + gTasks[taskId].data[11] = 7; + gTasks[taskId].data[12]++; + } + break; + case 2: + if (++gTasks[taskId].data[10] == 4) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11]--; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11])); + if (gTasks[taskId].data[11] == 0) + { + gTasks[taskId].data[12]++; + gTasks[taskId].data[11] = 0; + } + } + break; + case 3: + GetBattleAnimBg1Data(&animBg); + ClearBattleAnimBg(animBg.bgId); + gTasks[taskId].data[12]++; + break; + case 4: + if (!IsContest()) + SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0); + + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); + DestroyAnimVisualTask(taskId); + break; + } +} diff --git a/src/graphics.c b/src/graphics.c index 4c648a479..247231d55 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1312,11 +1312,14 @@ const u32 gUnknown_08D85A1C[] = INCBIN_U32("graphics/battle_frontier/battle_tile #include "data/graphics/intro_scene.h" const u32 gBattleAnimSpriteGfx_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.4bpp.lz"); +const u32 gBattleAnimSpritePal_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.gbapal.lz"); const u32 gBattleAnimBgTilemap_Sandstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.bin.lz"); const u32 gBattleAnimBgImage_Sandstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.4bpp.lz"); -const u32 gBattleAnimSpritePal_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.bin.lz"); +const u32 gBattleAnimBgImage_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/windstorm_brew.4bpp.lz"); +const u32 gBattleAnimSpritePal_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/windstorm_brew.gbapal.lz"); const u32 gBattleAnimSpriteGfx_MetalSoundWaves[] = INCBIN_U32("graphics/battle_anims/sprites/metal_sound_waves.4bpp.lz"); const u32 gBattleAnimSpritePal_MetalSoundWaves[] = INCBIN_U32("graphics/battle_anims/sprites/metal_sound_waves.gbapal.lz"); From aeafd9e2227db86dc5fd63aca0976a5cbf8c4677 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 16 Sep 2021 11:34:01 -0400 Subject: [PATCH 17/79] perish song + prankster interaction --- data/battle_scripts_1.s | 19 ++++++++++++++----- src/battle_script_commands.c | 3 ++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 4c41db86e..a1076e921 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3647,19 +3647,28 @@ BattleScript_EffectPerishSong:: waitanimation printstring STRINGID_FAINTINTHREE waitmessage B_WAIT_TIME_LONG - setbyte sBATTLER, 0 + setbyte gBattlerTarget, 0 BattleScript_PerishSongLoop:: - jumpifability BS_SCRIPTING, ABILITY_SOUNDPROOF, BattleScript_PerishSongNotAffected + jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked + jumpifability BS_ATTACKER, ABILITY_PRANKSTER, BattleScript_PerishSongCheckPrankster + goto BattleScript_PerishSongLoopIncrement +BattleScript_PerishSongCheckPrankster: + jumpiftype BS_TARGET, TYPE_DARK, BattleScript_PerishSongNotAffected BattleScript_PerishSongLoopIncrement:: - addbyte sBATTLER, 1 - jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_PerishSongLoop + addbyte gBattlerTarget, 1 + jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_PerishSongLoop goto BattleScript_MoveEnd -BattleScript_PerishSongNotAffected:: +BattleScript_PerishSongBlocked:: printstring STRINGID_PKMNSXBLOCKSY2 waitmessage B_WAIT_TIME_LONG goto BattleScript_PerishSongLoopIncrement +BattleScript_PerishSongNotAffected: + printstring STRINGID_ITDOESNTAFFECT + waitmessage B_WAIT_TIME_LONG + goto BattleScript_PerishSongLoopIncrement + BattleScript_EffectSandstorm:: attackcanceler attackstring diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 28e000a7b..c1da44b2e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10605,7 +10605,8 @@ static void Cmd_trysetperishsong(void) for (i = 0; i < gBattlersCount; i++) { if (gStatuses3[i] & STATUS3_PERISH_SONG - || gBattleMons[i].ability == ABILITY_SOUNDPROOF) + || gBattleMons[i].ability == ABILITY_SOUNDPROOF + || (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(i, TYPE_DARK))) { notAffectedCount++; } From 2067f563cd66de8342c3c71c4bbca86e7b0bae45 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 16 Sep 2021 11:47:05 -0400 Subject: [PATCH 18/79] cannot block your own prankster elevated perish song --- data/battle_scripts_1.s | 1 + src/battle_script_commands.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a1076e921..cb450c385 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3650,6 +3650,7 @@ BattleScript_EffectPerishSong:: setbyte gBattlerTarget, 0 BattleScript_PerishSongLoop:: jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked + jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ cannot block your own perish song jumpifability BS_ATTACKER, ABILITY_PRANKSTER, BattleScript_PerishSongCheckPrankster goto BattleScript_PerishSongLoopIncrement BattleScript_PerishSongCheckPrankster: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c1da44b2e..5abc8a9d5 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10606,7 +10606,7 @@ static void Cmd_trysetperishsong(void) { if (gStatuses3[i] & STATUS3_PERISH_SONG || gBattleMons[i].ability == ABILITY_SOUNDPROOF - || (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(i, TYPE_DARK))) + || (i != gBattlerAttacker && GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(i, TYPE_DARK))) { notAffectedCount++; } From a50f03a06b20cd5858e7729aaccc96e8e6e54a63 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 16 Sep 2021 11:53:24 -0400 Subject: [PATCH 19/79] magic bounce overrides prankster blockage --- src/battle_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 6e15aead1..9f8521e62 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3408,7 +3408,8 @@ u8 AtkCanceller_UnableToUseMove(void) && gBattlerAttacker != gBattlerTarget && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_OPPONENTS_FIELD) && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) - && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE)) + && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE) + && GetBattlerAbility(gBattlerTarget) != ABILITY_MAGIC_BOUNCE) // Magic bounce will bounce back prankster'd status move instead of blocking it { if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) CancelMultiTurnMoves(gBattlerAttacker); // don't cancel moves that can hit two targets bc one target might not be protected From ac42b19de7fb4f581c81840ea1fd8937944b9557 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 16 Sep 2021 11:54:27 -0400 Subject: [PATCH 20/79] some formatting fixes --- include/constants/battle_config.h | 2 +- src/battle_util.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 67d3cc5e7..893ed06d1 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -125,7 +125,7 @@ #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_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. -#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7, Prankster-elevated status moves do not affect Dark type Pokémon. +#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7+, Prankster-elevated status moves do not affect Dark type Pokémon. // Item settings #define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. diff --git a/src/battle_util.c b/src/battle_util.c index 9f8521e62..edf242619 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3418,8 +3418,8 @@ u8 AtkCanceller_UnableToUseMove(void) effect = 1; } #endif - gBattleStruct->atkCancellerTracker++; - break; + gBattleStruct->atkCancellerTracker++; + break; case CANCELLER_END: break; } From b6862a41532331a12384fbf56de4921a73334f6f Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 16 Sep 2021 14:01:19 -0400 Subject: [PATCH 21/79] fix jumptocalledmove for assist + attackcanceler --- src/battle_script_commands.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5abc8a9d5..18fd4091b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6505,6 +6505,7 @@ static void Cmd_jumptocalledmove(void) else gChosenMove = gCurrentMove = gCalledMove; + gBattleStruct->atkCancellerTracker = 0; gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]; } From 32d19a9b19456463fcac5046be0a80ba0dcc35c0 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Mon, 20 Sep 2021 21:36:10 -0400 Subject: [PATCH 22/79] syntax fixes. add B_PRANKSTER_DARK_TYPES check to perish song --- data/battle_scripts_1.s | 4 ++-- src/battle_script_commands.c | 8 ++++++-- src/battle_util.c | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 075e9d45b..a7a8c1aa2 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8153,8 +8153,8 @@ BattleScript_EjectPackActivates:: BattleScript_DarkTypePreventsPrankster:: attackstring ppreduce - pause 0x20 + pause B_WAIT_TIME_SHORT printstring STRINGID_ITDOESNTAFFECT - waitmessage 0x40 + waitmessage B_WAIT_TIME_LONG orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT goto BattleScript_MoveEnd diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e63653b45..4413eeec6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5046,7 +5046,7 @@ static void Cmd_moveend(void) MoveValuesCleanUp(); gBattleScripting.moveEffect = gBattleScripting.savedMoveEffect; BattleScriptPush(gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]); - gBattleStruct->atkCancellerTracker = 0; // run all cancellers on next target + gBattleStruct->atkCancellerTracker = 0; // Run all cancellers on next target gBattlescriptCurrInstr = BattleScript_FlushMessageBox; return; } @@ -10730,7 +10730,11 @@ static void Cmd_trysetperishsong(void) { if (gStatuses3[i] & STATUS3_PERISH_SONG || gBattleMons[i].ability == ABILITY_SOUNDPROOF - || (i != gBattlerAttacker && GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(i, TYPE_DARK))) + || (B_PRANKSTER_DARK_TYPES >= GEN_7 + && i != gBattlerAttacker + && GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER + && IS_BATTLER_OF_TYPE(i, TYPE_DARK)) + ) { notAffectedCount++; } diff --git a/src/battle_util.c b/src/battle_util.c index 21efe63a6..00edf0787 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3424,7 +3424,7 @@ u8 AtkCanceller_UnableToUseMove(void) && GetBattlerAbility(gBattlerTarget) != ABILITY_MAGIC_BOUNCE) // Magic bounce will bounce back prankster'd status move instead of blocking it { if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) - CancelMultiTurnMoves(gBattlerAttacker); // don't cancel moves that can hit two targets bc one target might not be protected + CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected gBattleScripting.battler = gBattlerAbility = gBattlerTarget; gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster; effect = 1; From 9c79ba05fc1d1c5fdc312425ed1bf5acdcbfe7b8 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Tue, 21 Sep 2021 11:38:37 -0400 Subject: [PATCH 23/79] allies do not block prankster --- 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 00edf0787..a7af8232b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3417,7 +3417,7 @@ u8 AtkCanceller_UnableToUseMove(void) #if B_PRANKSTER_DARK_TYPES >= GEN_7 if (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_MOVE_STATUS(gCurrentMove) - && gBattlerAttacker != gBattlerTarget + && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget) && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_OPPONENTS_FIELD) && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE) From 80a48de70256b9639761d5c295d17fc8bc023f9a Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Tue, 21 Sep 2021 11:54:59 -0400 Subject: [PATCH 24/79] ally cannot block prankster + perish song --- data/battle_scripts_1.s | 3 ++- src/battle_script_commands.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a7a8c1aa2..c843fb96b 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3700,7 +3700,8 @@ BattleScript_EffectPerishSong:: setbyte gBattlerTarget, 0 BattleScript_PerishSongLoop:: jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked - jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ cannot block your own perish song + jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ Cannot block your own perish song + jumpiftargetally BattleScript_PerishSongLoopIncrement @ Cannot block ally perish song jumpifability BS_ATTACKER, ABILITY_PRANKSTER, BattleScript_PerishSongCheckPrankster goto BattleScript_PerishSongLoopIncrement BattleScript_PerishSongCheckPrankster: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 4413eeec6..5dce3cda2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10731,7 +10731,7 @@ static void Cmd_trysetperishsong(void) if (gStatuses3[i] & STATUS3_PERISH_SONG || gBattleMons[i].ability == ABILITY_SOUNDPROOF || (B_PRANKSTER_DARK_TYPES >= GEN_7 - && i != gBattlerAttacker + && GetBattlerSide(i) != GetBattlerSide(gBattlerAttacker) && GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(i, TYPE_DARK)) ) From fc84ebbd3eb9333bc4df1b4eb2b98d0d518c6435 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 22 Sep 2021 08:06:42 -0400 Subject: [PATCH 25/79] redo prankster checks to handle assist --- include/battle.h | 1 + src/battle_main.c | 2 ++ src/battle_util.c | 17 +++++++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/battle.h b/include/battle.h index 36646c9fe..103936540 100644 --- a/include/battle.h +++ b/include/battle.h @@ -146,6 +146,7 @@ struct ProtectStruct u32 custap:1; // also quick claw u32 touchedProtectLike:1; u32 disableEjectPack:1; + u32 pranksterElevated:1; u32 physicalDmg; u32 specialDmg; u8 physicalBattlerId; diff --git a/src/battle_main.c b/src/battle_main.c index 74995bbf3..aec69362b 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4293,6 +4293,7 @@ s8 GetChosenMovePriority(u32 battlerId) { u16 move; + gProtectStructs[battlerId].pranksterElevated = 0; if (gProtectStructs[battlerId].noValidMoves) move = MOVE_STRUGGLE; else @@ -4314,6 +4315,7 @@ s8 GetMovePriority(u32 battlerId, u16 move) } else if (GetBattlerAbility(battlerId) == ABILITY_PRANKSTER && IS_MOVE_STATUS(move)) { + gProtectStructs[battlerId].pranksterElevated = 1; priority++; } else if (GetBattlerAbility(battlerId) == ABILITY_TRIAGE) diff --git a/src/battle_util.c b/src/battle_util.c index a7af8232b..f438df057 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3415,13 +3415,14 @@ u8 AtkCanceller_UnableToUseMove(void) break; case CANCELLER_PRANKSTER: #if B_PRANKSTER_DARK_TYPES >= GEN_7 - if (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER - && IS_MOVE_STATUS(gCurrentMove) + if (gProtectStructs[gBattlerAttacker].pranksterElevated && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget) - && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_OPPONENTS_FIELD) - && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) + && !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves + && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) // Only Dark types can block Prankster'e && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE) - && GetBattlerAbility(gBattlerTarget) != ABILITY_MAGIC_BOUNCE) // Magic bounce will bounce back prankster'd status move instead of blocking it + && !(IS_MOVE_STATUS(gCurrentMove) // Magic bounce/coat will bounce back prankster'd status move instead of blocking it + && (GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE || TestMoveFlags(gCurrentMove, FLAG_MAGIC_COAT_AFFECTED))) + ) { if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected @@ -6853,7 +6854,11 @@ u8 GetMoveTarget(u16 move, u8 setTarget) moveTarget = setTarget - 1; else moveTarget = gBattleMoves[move].target; - + + // Special cases + if (move == MOVE_CURSE && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GHOST)) + moveTarget = MOVE_TARGET_USER; + switch (moveTarget) { case MOVE_TARGET_SELECTED: From 3559a1b8e6364f638995311451230a0648a85e80 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 22 Sep 2021 16:09:23 -0400 Subject: [PATCH 26/79] fix prankster + magic coat --- data/battle_scripts_1.s | 11 +++++++++++ include/battle_scripts.h | 1 + include/battle_util.h | 1 + src/battle_script_commands.c | 13 +++++++++++-- src/battle_util.c | 22 ++++++++++++++-------- 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index c843fb96b..f949278fb 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6169,6 +6169,17 @@ BattleScript_MagicCoatBounce:: setmagiccoattarget BS_ATTACKER return +BattleScript_MagicCoatBouncePrankster:: + attackstring + ppreduce + pause B_WAIT_TIME_SHORT + printfromtable gMagicCoatBounceStringIds + waitmessage B_WAIT_TIME_LONG + printstring STRINGID_ITDOESNTAFFECT + waitmessage B_WAIT_TIME_LONG + orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT + goto BattleScript_MoveEnd + BattleScript_SnatchedMove:: attackstring ppreduce diff --git a/include/battle_scripts.h b/include/battle_scripts.h index c7b8cb091..e215d984e 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -97,6 +97,7 @@ extern const u8 BattleScript_SelectingImprisonedMove[]; extern const u8 BattleScript_SelectingImprisonedMoveInPalace[]; extern const u8 BattleScript_GrudgeTakesPp[]; extern const u8 BattleScript_MagicCoatBounce[]; +extern const u8 BattleScript_MagicCoatBouncePrankster[]; extern const u8 BattleScript_SnatchedMove[]; extern const u8 BattleScript_EnduredMsg[]; extern const u8 BattleScript_OneHitKOMsg[]; diff --git a/include/battle_util.h b/include/battle_util.h index 4dac63111..9186a8b82 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -151,6 +151,7 @@ void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast); bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind); bool32 TryRoomService(u8 battlerId); void BufferStatChange(u8 battlerId, u8 statId, u8 stringId); +bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef); // ability checks bool32 IsRolePlayBannedAbilityAtk(u16 ability); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5dce3cda2..2df5abcda 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1405,8 +1405,17 @@ static void Cmd_attackcanceler(void) gProtectStructs[gBattlerTarget].bounceMove = 0; gProtectStructs[gBattlerTarget].usesBouncedMove = 1; gBattleCommunication[MULTISTRING_CHOOSER] = 0; - BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_MagicCoatBounce; + if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker)) + { + // Opponent used a prankster'ed magic coat -> reflected status move should fail against a dark type attacker + gBattlerTarget = gBattlerAttacker; + gBattlescriptCurrInstr = BattleScript_MagicCoatBouncePrankster; + } + else + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_MagicCoatBounce; + } return; } else if (GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE diff --git a/src/battle_util.c b/src/battle_util.c index f438df057..24ae91735 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3415,14 +3415,8 @@ u8 AtkCanceller_UnableToUseMove(void) break; case CANCELLER_PRANKSTER: #if B_PRANKSTER_DARK_TYPES >= GEN_7 - if (gProtectStructs[gBattlerAttacker].pranksterElevated - && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget) - && !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves - && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) // Only Dark types can block Prankster'e - && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE) - && !(IS_MOVE_STATUS(gCurrentMove) // Magic bounce/coat will bounce back prankster'd status move instead of blocking it - && (GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE || TestMoveFlags(gCurrentMove, FLAG_MAGIC_COAT_AFFECTED))) - ) + if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget) + && !(IS_MOVE_STATUS(gCurrentMove) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE)) { if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected @@ -9195,3 +9189,15 @@ bool32 TryRoomService(u8 battlerId) return FALSE; } } + +bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef) +{ + if (gProtectStructs[battlerPrankster].pranksterElevated + && GetBattlerSide(battlerPrankster) != GetBattlerSide(battlerDef) + && !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves + && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) // Only Dark types can block Prankster'ed + && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) + return TRUE; + else + return FALSE; +} From 936f2c7bcbe0fc67bcac40c0e7e805e1bb784f1d Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 22 Sep 2021 21:51:37 -0400 Subject: [PATCH 27/79] fix eject pack weak armor special case --- src/battle_main.c | 1 + src/battle_script_commands.c | 5 ++--- src/battle_util.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index e7139e0d1..4fa656856 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3094,6 +3094,7 @@ void FaintClearSetData(void) gProtectStructs[gActiveBattler].usedGravityPreventedMove = 0; gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = 0; gProtectStructs[gActiveBattler].statRaised = 0; + gProtectStructs[gActiveBattler].statFell = 0; gDisableStructs[gActiveBattler].isFirstTurn = 2; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 42e723ecc..a1e0d7e5f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5165,6 +5165,7 @@ static void Cmd_moveend(void) u8 battler = battlers[i]; if (IsBattlerAlive(battler) && gProtectStructs[battler].statFell + && gProtectStructs[battler].disableEjectPack == 0 && GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_EJECT_PACK && !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker)) // Does not activate if attacker used Parting Shot and can switch out && CountUsablePartyMons(battler) > 0) // Has mon to switch into @@ -9407,9 +9408,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) - gProtectStructs[gActiveBattler].statFell = 1; + gProtectStructs[gActiveBattler].statFell = 1; // Eject pack, lash out gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL } } diff --git a/src/battle_util.c b/src/battle_util.c index 80b5f824c..b9f29ae2d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5997,6 +5997,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) break; case HOLD_EFFECT_EJECT_PACK: if (gProtectStructs[battlerId].statFell + && gProtectStructs[battlerId].disableEjectPack == 0 && !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker))) // Does not activate if attacker used Parting Shot and can switch out { gProtectStructs[battlerId].statFell = FALSE; From d4a153bf14f76165dc36646625ccd918ce88d648 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Thu, 23 Sep 2021 12:21:16 -0600 Subject: [PATCH 28/79] Update data/battle_scripts_1.s Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- 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 2b290c673..ece6e73dc 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3701,7 +3701,7 @@ BattleScript_EffectPerishSong:: BattleScript_PerishSongLoop:: jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ Cannot block your own perish song - jumpiftargetally BattleScript_PerishSongLoopIncrement @ Cannot block ally perish song + jumpiftargetally BattleScript_PerishSongLoopIncrement @ Cannot block ally perish song jumpifability BS_ATTACKER, ABILITY_PRANKSTER, BattleScript_PerishSongCheckPrankster goto BattleScript_PerishSongLoopIncrement BattleScript_PerishSongCheckPrankster: From 2cea541b2afb47d7cfed84cf3c173fa994ee5670 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Thu, 23 Sep 2021 12:21:26 -0600 Subject: [PATCH 29/79] Update src/battle_script_commands.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- 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 b5c690dc2..cb0dfd23e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1407,7 +1407,7 @@ static void Cmd_attackcanceler(void) gBattleCommunication[MULTISTRING_CHOOSER] = 0; if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker)) { - // Opponent used a prankster'ed magic coat -> reflected status move should fail against a dark type attacker + // Opponent used a prankster'd magic coat -> reflected status move should fail against a dark-type attacker gBattlerTarget = gBattlerAttacker; gBattlescriptCurrInstr = BattleScript_MagicCoatBouncePrankster; } From 8a9d28d97f796498ca2ad49776c3663fa711c860 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Thu, 23 Sep 2021 12:21:36 -0600 Subject: [PATCH 30/79] Update src/battle_util.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- 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 574a11b4c..0854cb6e0 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -9239,7 +9239,7 @@ bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef) if (gProtectStructs[battlerPrankster].pranksterElevated && GetBattlerSide(battlerPrankster) != GetBattlerSide(battlerDef) && !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves - && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) // Only Dark types can block Prankster'ed + && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) // Only Dark-types can block Prankster'd && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) return TRUE; else From 94ec25319f2d51c6ab3f1211f9aba51f624c2359 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 23 Sep 2021 14:35:37 -0400 Subject: [PATCH 31/79] syntax fixes. Use BlocksPrankster for perish song battle script --- asm/macros/battle_script.inc | 5 +++++ data/battle_scripts_1.s | 7 +------ include/constants/battle_script_commands.h | 1 + src/battle_script_commands.c | 12 +++++++----- src/battle_util.c | 22 +++++++++++----------- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 7ca6bfa6d..6189c855d 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1796,6 +1796,11 @@ .4byte \terrainFlags .4byte \ptr .endm + + .macro jumpifpranksterblocked battler:req, ptr:req + various \battler, VARIOUS_JUMP_IF_PRANKSTER_BLOCKED + .4byte \ptr + .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 ece6e73dc..e5d4466c4 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3700,12 +3700,7 @@ BattleScript_EffectPerishSong:: setbyte gBattlerTarget, 0 BattleScript_PerishSongLoop:: jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked - jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ Cannot block your own perish song - jumpiftargetally BattleScript_PerishSongLoopIncrement @ Cannot block ally perish song - jumpifability BS_ATTACKER, ABILITY_PRANKSTER, BattleScript_PerishSongCheckPrankster - goto BattleScript_PerishSongLoopIncrement -BattleScript_PerishSongCheckPrankster: - jumpiftype BS_TARGET, TYPE_DARK, BattleScript_PerishSongNotAffected + jumpifpranksterblocked BS_TARGET, BattleScript_PerishSongNotAffected BattleScript_PerishSongLoopIncrement:: addbyte gBattlerTarget, 1 jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_PerishSongLoop diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 66f592503..e564f5479 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -179,6 +179,7 @@ #define VARIOUS_MAKE_INVISIBLE 107 #define VARIOUS_ROOM_SERVICE 108 #define VARIOUS_JUMP_IF_TERRAIN_AFFECTED 109 +#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 110 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index cb0dfd23e..4d12ae8fe 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8604,6 +8604,12 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 11; } return; + case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED: + if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler)) + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); + else + gBattlescriptCurrInstr += 7; + return; } gBattlescriptCurrInstr += 3; @@ -10757,11 +10763,7 @@ static void Cmd_trysetperishsong(void) { if (gStatuses3[i] & STATUS3_PERISH_SONG || gBattleMons[i].ability == ABILITY_SOUNDPROOF - || (B_PRANKSTER_DARK_TYPES >= GEN_7 - && GetBattlerSide(i) != GetBattlerSide(gBattlerAttacker) - && GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER - && IS_BATTLER_OF_TYPE(i, TYPE_DARK)) - ) + || BlocksPrankster(gCurrentMove, gBattlerAttacker, i)) { notAffectedCount++; } diff --git a/src/battle_util.c b/src/battle_util.c index 0854cb6e0..8655d47d8 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3414,17 +3414,15 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case CANCELLER_PRANKSTER: - #if B_PRANKSTER_DARK_TYPES >= GEN_7 - if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget) - && !(IS_MOVE_STATUS(gCurrentMove) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE)) - { - if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) - CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected - gBattleScripting.battler = gBattlerAbility = gBattlerTarget; - gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster; - effect = 1; - } - #endif + if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget) + && !(IS_MOVE_STATUS(gCurrentMove) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE)) + { + if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) + CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected + gBattleScripting.battler = gBattlerAbility = gBattlerTarget; + gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster; + effect = 1; + } gBattleStruct->atkCancellerTracker++; break; case CANCELLER_END: @@ -9236,6 +9234,7 @@ void DoBurmyFormChange(u32 monId) bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef) { + #if B_PRANKSTER_DARK_TYPES >= GEN_7 if (gProtectStructs[battlerPrankster].pranksterElevated && GetBattlerSide(battlerPrankster) != GetBattlerSide(battlerDef) && !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves @@ -9243,5 +9242,6 @@ bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef) && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) return TRUE; else + #endif return FALSE; } From 767e25bfed68ff1939c1074d34f5f7d03da2592a Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Thu, 23 Sep 2021 13:19:12 -0600 Subject: [PATCH 32/79] Update asm/macros/battle_script.inc Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- asm/macros/battle_script.inc | 1 - 1 file changed, 1 deletion(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index b2e8bf343..d1a0fb63f 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1796,7 +1796,6 @@ .4byte \terrainFlags .4byte \ptr .endm - .macro jumpifpranksterblocked battler:req, ptr:req various \battler, VARIOUS_JUMP_IF_PRANKSTER_BLOCKED .4byte \ptr From fe6a11e5ec9210be4a183cb10b7bac8424a3bc32 Mon Sep 17 00:00:00 2001 From: ultima-soul <33333039+ultima-soul@users.noreply.github.com> Date: Thu, 23 Sep 2021 12:26:36 -0700 Subject: [PATCH 33/79] Update asm/macros/battle_script.inc --- asm/macros/battle_script.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index d1a0fb63f..12cf20a9c 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1796,6 +1796,7 @@ .4byte \terrainFlags .4byte \ptr .endm + .macro jumpifpranksterblocked battler:req, ptr:req various \battler, VARIOUS_JUMP_IF_PRANKSTER_BLOCKED .4byte \ptr From 8a2921ef718b5086ed29a11c2570d43a47795afa Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 24 Sep 2021 06:34:25 -0300 Subject: [PATCH 34/79] Completed Black Sludge's effect --- src/battle_util.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/battle_util.c b/src/battle_util.c index e6137b0f2..e669bfa03 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -6120,7 +6120,20 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) break; case HOLD_EFFECT_BLACK_SLUDGE: if (IS_BATTLER_OF_TYPE(battlerId, TYPE_POISON)) + { goto LEFTOVERS; + } + else if (GetBattlerAbility(battlerId) != ABILITY_MAGIC_GUARD && !moveTurn) + { + gBattleMoveDamage = gBattleMons[battlerId].maxHP / 8; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + BattleScriptExecute(BattleScript_ItemHurtEnd2); + effect = ITEM_HP_CHANGE; + RecordItemEffectBattle(battlerId, battlerHoldEffect); + PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem); + } + break; case HOLD_EFFECT_LEFTOVERS: LEFTOVERS: if (gBattleMons[battlerId].hp < gBattleMons[battlerId].maxHP && !moveTurn) From 4c05520bf3570997e52a6b2619401ffc154995fd Mon Sep 17 00:00:00 2001 From: Syreldar Date: Fri, 24 Sep 2021 16:02:26 +0200 Subject: [PATCH 35/79] Fixed Retaliate's naming. --- data/battle_anim_scripts.s | 4 ++-- data/battle_scripts_1.s | 2 +- include/constants/battle_move_effects.h | 2 +- src/battle_util.c | 2 +- src/data/battle_moves.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index d274717dc..32f089102 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -532,7 +532,7 @@ gBattleAnims_Moves:: .4byte Move_QUASH .4byte Move_ACROBATICS .4byte Move_REFLECT_TYPE - .4byte Move_RETALITATE + .4byte Move_RETALIATE .4byte Move_FINAL_GAMBIT .4byte Move_BESTOW .4byte Move_INFERNO @@ -5610,7 +5610,7 @@ Move_REFLECT_TYPE: blendoff end -Move_RETALITATE: +Move_RETALIATE: loadspritegfx ANIM_TAG_CUT @Cut monbg ANIM_DEF_PARTNER setalpha 9, 8 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a272f6753..c5c013db1 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -252,7 +252,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectHit @ EFFECT_ROUND .4byte BattleScript_EffectHit @ EFFECT_BRINE .4byte BattleScript_EffectHit @ EFFECT_VENOSHOCK - .4byte BattleScript_EffectHit @ EFFECT_RETALITATE + .4byte BattleScript_EffectHit @ EFFECT_RETALIATE .4byte BattleScript_EffectBulldoze @ EFFECT_BULLDOZE .4byte BattleScript_EffectHit @ EFFECT_FOUL_PLAY .4byte BattleScript_EffectHit @ EFFECT_PSYSHOCK diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 760ee66fd..440e6e76b 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -236,7 +236,7 @@ #define EFFECT_ROUND 230 #define EFFECT_BRINE 231 #define EFFECT_VENOSHOCK 232 -#define EFFECT_RETALITATE 233 +#define EFFECT_RETALIATE 233 #define EFFECT_BULLDOZE 234 #define EFFECT_FOUL_PLAY 235 #define EFFECT_PSYSHOCK 236 diff --git a/src/battle_util.c b/src/battle_util.c index e669bfa03..ee1bfe551 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7778,7 +7778,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe if (gBattleMons[battlerDef].status1 & STATUS1_PSN_ANY) MulModifier(&modifier, UQ_4_12(2.0)); break; - case EFFECT_RETALITATE: + case EFFECT_RETALIATE: // todo break; case EFFECT_SOLARBEAM: diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 097f9e07d..a7a2752e0 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -8097,7 +8097,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_RETALIATE] = { - .effect = EFFECT_RETALITATE, + .effect = EFFECT_RETALIATE, .power = 70, .type = TYPE_NORMAL, .accuracy = 100, From 872d2a700858081148dfab5e92a02cbef36f87fd Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 25 Sep 2021 22:30:45 -0300 Subject: [PATCH 36/79] Made this build again --- 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 e875e01e7..cf3204727 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6032,7 +6032,7 @@ BattleScript_GulpMissileGulping:: setgraphicalstatchangevalues playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 waitanimation - printstring STRINGID_PKMNSSTATCHANGED + printstring STRINGID_ATTACKERSSTATROSE waitmessage 0x40 return From a49ea33dd063618a6d6375ef945ed5019e63704c Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sun, 26 Sep 2021 19:59:56 -0300 Subject: [PATCH 37/79] A lot of fixes -Fixed Gulp Missile's activation. Its effects were happening even if the conditions weren't actually met in battle. -Fixed Gulp Missile activating if the only/last target has already fainted. -Fixed Gulp Missile's Gorging animation, though it still uses Tackle's. -Fixed Gulp Missile's Gorging attack affecting an opponent with Magic Guard. -Fixed Gulp Missile changing Cramorant's form if Surf failed. --- data/battle_anim_scripts.s | 10 ++++----- data/battle_scripts_1.s | 10 +++++++++ src/battle_util.c | 43 +++++++++++++++++++++++--------------- 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 71dcf8b2b..d7de92096 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -24398,18 +24398,16 @@ General_TotemFlare:: clearmonbg ANIM_ATTACKER end -General_GulpMissile: @ Modified Tackle anim (placeholder) +General_GulpMissile: @ Tackle anim (placeholder) loadspritegfx ANIM_TAG_IMPACT monbg ANIM_ATTACKER setalpha 12, 8 - createsprite gHorizontalLungeSpriteTemplate, ANIM_TARGET, 2, 4, 4 + createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 4 delay 6 - createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, 0, 0, ANIM_ATTACKER, 2 + createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_ATTACKER, 2 createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 3, 0, 6, 1 - playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_ATTACKER + playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET waitforvisualfinish - delay 10 - playse SE_EFFECTIVE clearmonbg ANIM_ATTACKER blendoff end diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index cf3204727..381c67a30 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6005,9 +6005,14 @@ BattleScript_GulpMissileGorging:: playanimation BS_ATTACKER, B_ANIM_GULP_MISSILE, NULL waitanimation orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 + effectivenesssound + hitanimation BS_ATTACKER + waitstate + jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_GulpMissileNoDmgGorging healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER tryfaintmon BS_ATTACKER, FALSE, NULL +BattleScript_GulpMissileNoDmgGorging: handleformchange BS_TARGET, 0 playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL waitanimation @@ -6022,9 +6027,14 @@ BattleScript_GulpMissileGulping:: playanimation BS_ATTACKER, B_ANIM_GULP_MISSILE, NULL waitanimation orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 + effectivenesssound + hitanimation BS_ATTACKER + waitstate + jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_GulpMissileNoDmgGulping healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER tryfaintmon BS_ATTACKER, FALSE, NULL +BattleScript_GulpMissileNoDmgGulping: handleformchange BS_TARGET, 0 playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL waitanimation diff --git a/src/battle_util.c b/src/battle_util.c index ac4257fe7..436ac4d1a 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4985,17 +4985,22 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_GULP_MISSILE: + gBattlerAttacker = battler; + gBattlerTarget = BATTLE_OPPOSITE(battler); if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED - && IsBattlerAlive(battler) - && gBattleMons[battler].species == SPECIES_CRAMORANT_GORGING) + && IsBattlerAlive(gBattlerAttacker) + && gBattleMons[gBattlerTarget].species == SPECIES_CRAMORANT_GORGING) { - gBattleStruct->changedSpecies[gBattlerPartyIndexes[battler]] = gBattleMons[battler].species; - gBattleMons[battler].species = SPECIES_CRAMORANT; - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; + gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species; + gBattleMons[gBattlerTarget].species = SPECIES_CRAMORANT; + if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) + { + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + } BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_GulpMissileGorging; effect++; @@ -5003,14 +5008,17 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move else if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED - && IsBattlerAlive(battler) - && gBattleMons[battler].species == SPECIES_CRAMORANT_GULPING) + && IsBattlerAlive(gBattlerAttacker) + && gBattleMons[gBattlerTarget].species == SPECIES_CRAMORANT_GULPING) { - gBattleStruct->changedSpecies[gBattlerPartyIndexes[battler]] = gBattleMons[battler].species; - gBattleMons[battler].species = SPECIES_CRAMORANT; - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; + gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species; + gBattleMons[gBattlerTarget].species = SPECIES_CRAMORANT; + if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) + { + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + } SET_STATCHANGER(STAT_DEF, 1, TRUE); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_GulpMissileGulping; @@ -5054,9 +5062,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_GULP_MISSILE: - if ((effect = ShouldChangeFormHpBased(battler)) - && (gCurrentMove == MOVE_SURF - || gStatuses3[battler] & STATUS3_UNDERWATER)) + if ((effect = ShouldChangeFormHpBased(gBattlerAttacker)) + && (gCurrentMove == MOVE_SURF || gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER) + && TARGET_TURN_DAMAGED + && IsBattlerAlive(gBattlerAttacker)) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_AttackerFormChange; From ceffaa4e7635c82713d96676263eb3c22a4f0887 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 27 Sep 2021 19:53:42 -0300 Subject: [PATCH 38/79] Another condition fix I accidentally broke Gulp Missile's interaction with the user's Dive, lol. --- src/battle_util.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 436ac4d1a..556d98e46 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5063,9 +5063,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move break; case ABILITY_GULP_MISSILE: if ((effect = ShouldChangeFormHpBased(gBattlerAttacker)) - && (gCurrentMove == MOVE_SURF || gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER) - && TARGET_TURN_DAMAGED - && IsBattlerAlive(gBattlerAttacker)) + && ((gCurrentMove == MOVE_SURF && TARGET_TURN_DAMAGED) || gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER) + && IsBattlerAlive(gBattlerTarget)) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_AttackerFormChange; From e783cde3873916206b89297b51a72033f22d438f Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 27 Sep 2021 21:31:42 -0300 Subject: [PATCH 39/79] Another small condition fix and small optimization -Checking for IsBattlerAlive is incorrect because Gulp Missile's counterattack should happen even if Cramorant faints. -Made the code a bit more readable. --- src/battle_util.c | 57 +++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 556d98e46..6b65c72c6 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4985,44 +4985,39 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_GULP_MISSILE: - gBattlerAttacker = battler; - gBattlerTarget = BATTLE_OPPOSITE(battler); if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && TARGET_TURN_DAMAGED - && IsBattlerAlive(gBattlerAttacker) - && gBattleMons[gBattlerTarget].species == SPECIES_CRAMORANT_GORGING) + && TARGET_TURN_DAMAGED) { - gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species; - gBattleMons[gBattlerTarget].species = SPECIES_CRAMORANT; - if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) + if (gBattleMons[gBattlerTarget].species == SPECIES_CRAMORANT_GORGING) { - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; + gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species; + gBattleMons[gBattlerTarget].species = SPECIES_CRAMORANT; + if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) + { + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + } + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_GulpMissileGorging; + effect++; } - BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_GulpMissileGorging; - effect++; - } - else if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && TARGET_TURN_DAMAGED - && IsBattlerAlive(gBattlerAttacker) - && gBattleMons[gBattlerTarget].species == SPECIES_CRAMORANT_GULPING) - { - gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species; - gBattleMons[gBattlerTarget].species = SPECIES_CRAMORANT; - if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) + else if (gBattleMons[gBattlerTarget].species == SPECIES_CRAMORANT_GULPING) { - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; + gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species; + gBattleMons[gBattlerTarget].species = SPECIES_CRAMORANT; + if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) + { + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + } + SET_STATCHANGER(STAT_DEF, 1, TRUE); + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_GulpMissileGulping; + effect++; } - SET_STATCHANGER(STAT_DEF, 1, TRUE); - BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_GulpMissileGulping; - effect++; } break; } From 0389dbf9f239025b27f9250f113c9acfa742dc0a Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 29 Sep 2021 06:13:56 -0300 Subject: [PATCH 40/79] More fixes -Removed IsBattlerAlive check for case ABILITY_GULP_MISSILE in ABILITYEFFECT_MOVE_END_ATTACKER. Turns out Cramorant can change form even on single wild battles. -Added a check for IsBattlerAlive in the case ABILITY_GULP_MISSILE of ABILITYEFFECT_MOVE_END, because otherwise, for whatever reason, the user was trying to trigger the Gulping effect even in its base form. -Set the stat to change for the Gulping effect from within the battle script. The rest of the effect is handled there, so may as well. -Fixed the check for case ABILITY_GULP_MISSILE in ABILITYEFFECT_MOVE_END_ATTACKER. Apparently, a silent species change was happening because of the order of the checks. Thanks to AsparagusEduardo for pointing this one out. -Fixed the secondary effect of a target's Gulp Missile affecting an attacker that has fainted. -Fixed the Defense reduction of the Gulping effect bypassing Clear Body. --- data/battle_scripts_1.s | 15 +++++++++++++++ src/battle_util.c | 9 ++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 381c67a30..0743d21c1 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6012,6 +6012,7 @@ BattleScript_GulpMissileGorging:: healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER tryfaintmon BS_ATTACKER, FALSE, NULL + jumpifbyteequal gBattlerFainted, gBattlerAttacker, BattleScript_GulpMissileNoSecondEffectGorging BattleScript_GulpMissileNoDmgGorging: handleformchange BS_TARGET, 0 playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL @@ -6021,6 +6022,11 @@ BattleScript_GulpMissileNoDmgGorging: seteffectprimary swapattackerwithtarget return +BattleScript_GulpMissileNoSecondEffectGorging: + handleformchange BS_TARGET, 0 + playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL + waitanimation + return BattleScript_GulpMissileGulping:: call BattleScript_AbilityPopUp @@ -6034,10 +6040,13 @@ BattleScript_GulpMissileGulping:: healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER tryfaintmon BS_ATTACKER, FALSE, NULL + jumpifbyteequal gBattlerFainted, gBattlerAttacker, BattleScript_GulpMissileNoSecondEffectGulping + jumpifability BS_ATTACKER, ABILITY_CLEAR_BODY, BattleScript_GulpMissileGulpingRet BattleScript_GulpMissileNoDmgGulping: handleformchange BS_TARGET, 0 playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL waitanimation + setstatchanger STAT_DEF, 1, TRUE statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL setgraphicalstatchangevalues playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 @@ -6045,6 +6054,12 @@ BattleScript_GulpMissileNoDmgGulping: printstring STRINGID_ATTACKERSSTATROSE waitmessage 0x40 return +BattleScript_GulpMissileNoSecondEffectGulping: + handleformchange BS_TARGET, 0 + playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL + waitanimation +BattleScript_GulpMissileGulpingRet: + return BattleScript_PerishSongCountGoesDown:: printstring STRINGID_PKMNPERISHCOUNTFELL diff --git a/src/battle_util.c b/src/battle_util.c index 6b65c72c6..20e5d91d1 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4987,7 +4987,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move case ABILITY_GULP_MISSILE: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && TARGET_TURN_DAMAGED) + && TARGET_TURN_DAMAGED + && IsBattlerAlive(battler)) { if (gBattleMons[gBattlerTarget].species == SPECIES_CRAMORANT_GORGING) { @@ -5013,7 +5014,6 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; } - SET_STATCHANGER(STAT_DEF, 1, TRUE); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_GulpMissileGulping; effect++; @@ -5057,9 +5057,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_GULP_MISSILE: - if ((effect = ShouldChangeFormHpBased(gBattlerAttacker)) - && ((gCurrentMove == MOVE_SURF && TARGET_TURN_DAMAGED) || gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER) - && IsBattlerAlive(gBattlerTarget)) + if (((gCurrentMove == MOVE_SURF && TARGET_TURN_DAMAGED) || gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER) + && (effect = ShouldChangeFormHpBased(gBattlerAttacker))) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_AttackerFormChange; From d7e651696b86dd02965b922709d1e34539a05460 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 30 Sep 2021 10:30:46 -0300 Subject: [PATCH 41/79] Even more fixes -Changed the way in which Gulp Missile checks for a fainted opponent, just in case the reason why the attacker's defense wasn't being lowered is that the script was falling into BattleScript_GulpMissileNoSecondEffectGulping -Took into account max Defense stat stage, because I forgot to do that too. -Slightly changed the Defense reduction code, just in case. -Fixed the text string that was printed. Gulp Missile doesn't raise a stat, after all. -Fixed the script that was being called if the attacker has Clear Body, and also added jumps for Full Metal Body, White Smoke and Flower Veil. --- data/battle_scripts_1.s | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 0743d21c1..3c9397f98 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6012,7 +6012,8 @@ BattleScript_GulpMissileGorging:: healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER tryfaintmon BS_ATTACKER, FALSE, NULL - jumpifbyteequal gBattlerFainted, gBattlerAttacker, BattleScript_GulpMissileNoSecondEffectGorging + getbattlerfainted BS_ATTACKER + jumpifbyte CMP_EQUAL, gBattleCommunication, TRUE, BattleScript_GulpMissileNoSecondEffectGorging BattleScript_GulpMissileNoDmgGorging: handleformchange BS_TARGET, 0 playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL @@ -6040,25 +6041,30 @@ BattleScript_GulpMissileGulping:: healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER tryfaintmon BS_ATTACKER, FALSE, NULL - jumpifbyteequal gBattlerFainted, gBattlerAttacker, BattleScript_GulpMissileNoSecondEffectGulping - jumpifability BS_ATTACKER, ABILITY_CLEAR_BODY, BattleScript_GulpMissileGulpingRet + getbattlerfainted BS_ATTACKER + jumpifbyte CMP_EQUAL, gBattleCommunication, TRUE, BattleScript_GulpMissileNoSecondEffectGulping + jumpifability BS_ATTACKER, ABILITY_CLEAR_BODY, BattleScript_GulpMissileNoSecondEffectGulping + jumpifability BS_ATTACKER, ABILITY_FULL_METAL_BODY, BattleScript_GulpMissileNoSecondEffectGulping + jumpifability BS_ATTACKER, ABILITY_WHITE_SMOKE, BattleScript_GulpMissileNoSecondEffectGulping + jumpifability BS_ATTACKER, ABILITY_FLOWER_VEIL, BattleScript_GulpMissileNoSecondEffectGulping BattleScript_GulpMissileNoDmgGulping: handleformchange BS_TARGET, 0 playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL waitanimation + playstatchangeanimation BS_ATTACKER, BIT_DEF, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE setstatchanger STAT_DEF, 1, TRUE - statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL - setgraphicalstatchangevalues - playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 - waitanimation - printstring STRINGID_ATTACKERSSTATROSE - waitmessage 0x40 + statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_GulpMissileGorgingTargetDefenseCantGoLower + printstring STRINGID_ATTACKERSSTATFELL + waitmessage B_WAIT_TIME_LONG return BattleScript_GulpMissileNoSecondEffectGulping: handleformchange BS_TARGET, 0 playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL waitanimation -BattleScript_GulpMissileGulpingRet: + return +BattleScript_GulpMissileGorgingTargetDefenseCantGoLower: + printstring STRINGID_STATSWONTDECREASE + waitmessage B_WAIT_TIME_LONG return BattleScript_PerishSongCountGoesDown:: From a506bf03c6a1b8af80e0ad34127e03db99c9bbde Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 1 Oct 2021 02:14:46 -0300 Subject: [PATCH 42/79] Corrected Flower Veil check --- asm/macros/battle_script.inc | 6 ++++++ data/battle_scripts_1.s | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 12cf20a9c..f39818f7b 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1925,6 +1925,12 @@ 1: .endm + .macro jumpifflowerveilattacker jumpptr:req + jumpifnottype BS_ATTACKER, TYPE_GRASS, 1f + jumpifability BS_ATTACKER_SIDE, ABILITY_FLOWER_VEIL, \jumpptr + 1: + .endm + .macro setallytonexttarget jumpptr:req jumpifbyte CMP_GREATER_THAN, gBattlerTarget, 0x1, 1f addbyte gBattlerTarget, 0x2 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 3c9397f98..6324588b2 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6046,7 +6046,7 @@ BattleScript_GulpMissileGulping:: jumpifability BS_ATTACKER, ABILITY_CLEAR_BODY, BattleScript_GulpMissileNoSecondEffectGulping jumpifability BS_ATTACKER, ABILITY_FULL_METAL_BODY, BattleScript_GulpMissileNoSecondEffectGulping jumpifability BS_ATTACKER, ABILITY_WHITE_SMOKE, BattleScript_GulpMissileNoSecondEffectGulping - jumpifability BS_ATTACKER, ABILITY_FLOWER_VEIL, BattleScript_GulpMissileNoSecondEffectGulping + jumpifflowerveilattacker BattleScript_GulpMissileNoSecondEffectGulping BattleScript_GulpMissileNoDmgGulping: handleformchange BS_TARGET, 0 playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL From 43e73ac576fa67769f8d86dbd7674b6aee15c466 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 1 Oct 2021 05:25:25 -0300 Subject: [PATCH 43/79] Fixed Safari Zone --- src/battle_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index 5c3f2ecd8..25db65f78 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3465,10 +3465,13 @@ static void TryDoEventsBeforeFirstTurn(void) return; // Set invalid mons as absent(for example when starting a double battle with only one pokemon). - for (i = 0; i < gBattlersCount; i++) + if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) { - if (gBattleMons[i].hp == 0 || gBattleMons[i].species == SPECIES_NONE) - gAbsentBattlerFlags |= gBitTable[i]; + for (i = 0; i < gBattlersCount; i++) + { + if (gBattleMons[i].hp == 0 || gBattleMons[i].species == SPECIES_NONE) + gAbsentBattlerFlags |= gBitTable[i]; + } } if (gBattleStruct->switchInAbilitiesCounter == 0) From f6917696474272a5a8fddd380ac4b26acbaf13ee Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 1 Oct 2021 06:29:21 -0300 Subject: [PATCH 44/79] Fixed Def stat reduction --- data/battle_scripts_1.s | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 6324588b2..f1f5995ff 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6051,11 +6051,14 @@ BattleScript_GulpMissileNoDmgGulping: handleformchange BS_TARGET, 0 playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL waitanimation - playstatchangeanimation BS_ATTACKER, BIT_DEF, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE + swapattackerwithtarget @ to make gStatDownStringIds down below print the right battler setstatchanger STAT_DEF, 1, TRUE statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_GulpMissileGorgingTargetDefenseCantGoLower - printstring STRINGID_ATTACKERSSTATFELL + setgraphicalstatchangevalues + playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 + printfromtable gStatDownStringIds waitmessage B_WAIT_TIME_LONG + swapattackerwithtarget @ restore the battlers, just in case return BattleScript_GulpMissileNoSecondEffectGulping: handleformchange BS_TARGET, 0 From f3ded43a88fb5561a0a52ce7d6ea98f5703a7f96 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 1 Oct 2021 22:32:48 -0300 Subject: [PATCH 45/79] Implemented Battle Bond --- data/battle_scripts_1.s | 13 +++++++++++++ include/battle_scripts.h | 1 + include/constants/battle_config.h | 2 ++ include/constants/battle_string_ids.h | 4 +++- src/battle_message.c | 5 ++++- src/battle_util.c | 20 ++++++++++++++++++++ 6 files changed, 43 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f1f5995ff..f6f3d63cb 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7711,6 +7711,19 @@ BattleScript_AbilityStatusEffect:: seteffectsecondary return +BattleScript_BattleBondActivatesOnMoveEndAttacker:: + pause 5 + copybyte gBattlerAbility, gBattlerAttacker + call BattleScript_AbilityPopUp + printstring STRINGID_ATTACKERBECAMEFULLYCHARGED + handleformchange BS_ATTACKER, 0 + handleformchange BS_ATTACKER, 1 + playanimation BS_ATTACKER, B_ANIM_FORM_CHANGE, NULL + waitanimation + handleformchange BS_ATTACKER, 2 + printstring STRINGID_ATTACKERBECAMEASHGRENINJA + return + BattleScript_DancerActivates:: call BattleScript_AbilityPopUp waitmessage B_WAIT_TIME_SHORT diff --git a/include/battle_scripts.h b/include/battle_scripts.h index fbae42e24..203be6519 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -388,5 +388,6 @@ extern const u8 BattleScript_ElectricTerrainPrevents[]; extern const u8 BattleScript_DarkTypePreventsPrankster[]; extern const u8 BattleScript_GulpMissileGorging[]; extern const u8 BattleScript_GulpMissileGulping[]; +extern const u8 BattleScript_BattleBondActivatesOnMoveEndAttacker[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 26007ff9f..93202bed7 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -43,6 +43,8 @@ #define SPECIES_CRAMORANT 0 #define SPECIES_CRAMORANT_GORGING 10015 #define SPECIES_CRAMORANT_GULPING 10016 + #define SPECIES_GRENINJA_BATTLE_BOND 0 + #define SPECIES_GRENINJA_ASH 10017 #endif // Items with peculiar battle effects. diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index e32fd5778..144081974 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -578,8 +578,10 @@ #define STRINGID_ATKGOTOVERINFATUATION 574 #define STRINGID_TORMENTEDNOMORE 575 #define STRINGID_HEALBLOCKEDNOMORE 576 +#define STRINGID_ATTACKERBECAMEFULLYCHARGED 577 +#define STRINGID_ATTACKERBECAMEASHGRENINJA 578 -#define BATTLESTRINGS_COUNT 577 +#define BATTLESTRINGS_COUNT 579 // 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 ab10ceff0..cc8920141 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -704,10 +704,13 @@ static const u8 sText_EjectButtonActivate[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} static const u8 sText_AttackerGotOverInfatuation[] =_("{B_ATK_NAME_WITH_PREFIX} got over\nits infatuation!"); static const u8 sText_TormentedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is\ntormented no more!"); static const u8 sText_HealBlockedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is cured of\nits heal block!"); - +static const u8 sText_AttackerBecameFullyCharged[] = _("{B_ATK_NAME_WITH_PREFIX} became fully charged\ndue to its bond with its trainer!\p"); +static const u8 sText_AttackerBecameAshGreninja[] = _("{B_ATK_NAME_WITH_PREFIX} became Ash-{B_ATK_NAME_WITH_PREFIX}!\p"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_ATTACKERBECAMEASHGRENINJA - 12] = sText_AttackerBecameAshGreninja, + [STRINGID_ATTACKERBECAMEFULLYCHARGED - 12] = sText_AttackerBecameFullyCharged, [STRINGID_HEALBLOCKEDNOMORE - 12] = sText_HealBlockedNoMore, [STRINGID_TORMENTEDNOMORE - 12] = sText_TormentedNoMore, [STRINGID_ATKGOTOVERINFATUATION - 12] = sText_AttackerGotOverInfatuation, diff --git a/src/battle_util.c b/src/battle_util.c index 20e5d91d1..8898da5d7 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5065,6 +5065,16 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_BATTLE_BOND: + if (gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_BATTLE_BOND + && gBattleResults.opponentFaintCounter != 0) + { + gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species; + gBattleMons[gBattlerAttacker].species = SPECIES_GRENINJA_ASH; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_BattleBondActivatesOnMoveEndAttacker; + } + break; } break; case ABILITYEFFECT_MOVE_END_OTHER: // Abilities that activate on *another* battler's moveend: Dancer, Soul-Heart, Receiver, Symbiosis @@ -7562,6 +7572,15 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) break; } + // move-specific base power changes + switch (move) + { + case MOVE_WATER_SHURIKEN: + if (gBattleMons[battlerAtk].species == SPECIES_GRENINJA_ASH) + basePower = 20; + break; + } + if (basePower == 0) basePower = 1; return basePower; @@ -8726,6 +8745,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_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND}, }; if (isSwitchingOut) // Don't revert Mimikyu Busted when switching out From c464b1b5dd88936df6edb54061a44dee2d64449a Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 1 Oct 2021 23:12:07 -0300 Subject: [PATCH 46/79] STRINGID_ATTACKERBECAMEASHGRENINJA -> STRINGID_ATTACKERBECAMEASHSPECIES --- data/battle_scripts_1.s | 2 +- include/constants/battle_string_ids.h | 2 +- src/battle_message.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f6f3d63cb..5a9aec525 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7721,7 +7721,7 @@ BattleScript_BattleBondActivatesOnMoveEndAttacker:: playanimation BS_ATTACKER, B_ANIM_FORM_CHANGE, NULL waitanimation handleformchange BS_ATTACKER, 2 - printstring STRINGID_ATTACKERBECAMEASHGRENINJA + printstring STRINGID_ATTACKERBECAMEASHSPECIES return BattleScript_DancerActivates:: diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 144081974..ff5eb5366 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -579,7 +579,7 @@ #define STRINGID_TORMENTEDNOMORE 575 #define STRINGID_HEALBLOCKEDNOMORE 576 #define STRINGID_ATTACKERBECAMEFULLYCHARGED 577 -#define STRINGID_ATTACKERBECAMEASHGRENINJA 578 +#define STRINGID_ATTACKERBECAMEASHSPECIES 578 #define BATTLESTRINGS_COUNT 579 diff --git a/src/battle_message.c b/src/battle_message.c index cc8920141..b0ca25c95 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -705,11 +705,11 @@ static const u8 sText_AttackerGotOverInfatuation[] =_("{B_ATK_NAME_WITH_PREFIX} static const u8 sText_TormentedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is\ntormented no more!"); static const u8 sText_HealBlockedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is cured of\nits heal block!"); static const u8 sText_AttackerBecameFullyCharged[] = _("{B_ATK_NAME_WITH_PREFIX} became fully charged\ndue to its bond with its trainer!\p"); -static const u8 sText_AttackerBecameAshGreninja[] = _("{B_ATK_NAME_WITH_PREFIX} became Ash-{B_ATK_NAME_WITH_PREFIX}!\p"); +static const u8 sText_AttackerBecameAshSpecies[] = _("{B_ATK_NAME_WITH_PREFIX} became Ash-{B_ATK_NAME_WITH_PREFIX}!\p"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { - [STRINGID_ATTACKERBECAMEASHGRENINJA - 12] = sText_AttackerBecameAshGreninja, + [STRINGID_ATTACKERBECAMEASHSPECIES - 12] = sText_AttackerBecameAshSpecies, [STRINGID_ATTACKERBECAMEFULLYCHARGED - 12] = sText_AttackerBecameFullyCharged, [STRINGID_HEALBLOCKEDNOMORE - 12] = sText_HealBlockedNoMore, [STRINGID_TORMENTEDNOMORE - 12] = sText_TormentedNoMore, From 611da31ae3d269a4f716f0fca7e4986aa53f1c95 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Sat, 2 Oct 2021 15:51:16 +1300 Subject: [PATCH 47/79] Fix form ID check The six here should be a seven, and replacing it with this function call is better than hard-coding it. --- 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 a74cb3aaa..fc9e9a66e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7137,7 +7137,7 @@ u32 IsLeafGuardProtected(u32 battler) bool32 IsShieldsDownProtected(u32 battler) { return (gBattleMons[battler].ability == ABILITY_SHIELDS_DOWN - && GetFormIdFromFormSpeciesId(gBattleMons[battler].species) < 6); // Minior is not in core form + && GetFormIdFromFormSpeciesId(gBattleMons[battler].species) < GetFormIdFromFormSpeciesId(SPECIES_MINIOR_CORE_RED)); // Minior is not in core form } u32 IsAbilityStatusProtected(u32 battler) From 16d032e99d48ee58da7effba05d639f37e88acf8 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 02:01:34 -0300 Subject: [PATCH 48/79] Fix Unnerve not canceling out type resist berries. --- src/battle_util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 20e5d91d1..197bd6a25 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8203,6 +8203,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move u32 abilityDef = GetBattlerAbility(battlerDef); u32 defSide = GET_BATTLER_SIDE(battlerDef); u16 finalModifier = UQ_4_12(1.0); + u16 itemDef = gBattleMons[battlerDef].item; // check multiple targets in double battle if (GetMoveTargetCount(move, battlerAtk, battlerDef) >= 2) @@ -8323,7 +8324,8 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move // berries reducing dmg case HOLD_EFFECT_RESIST_BERRY: if (moveType == GetBattlerHoldEffectParam(battlerDef) - && (moveType == TYPE_NORMAL || typeEffectivenessModifier >= UQ_4_12(2.0))) + && (moveType == TYPE_NORMAL || typeEffectivenessModifier >= UQ_4_12(2.0)) + && !UnnerveOn(battlerDef, itemDef)) { if (abilityDef == ABILITY_RIPEN) MulModifier(&finalModifier, UQ_4_12(0.25)); From 63c6e73eb89714c56b8358c705fbe6830bd1aa21 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 09:38:43 -0300 Subject: [PATCH 49/79] Fixed Sleep talk being canceled by the user being asleep.. --- 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 20e5d91d1..e4bb55045 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3131,7 +3131,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleMons[gBattlerAttacker].status1 -= toSub; if (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP) { - if (gCurrentMove != MOVE_SNORE && gCurrentMove != MOVE_SLEEP_TALK) + if (gChosenMove != MOVE_SNORE && gChosenMove != MOVE_SLEEP_TALK) { gBattlescriptCurrInstr = BattleScript_MoveUsedIsAsleep; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; From a18b9c5b3228ec2a39d514d40f4c67a5029f4d4c Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 2 Oct 2021 10:39:29 -0300 Subject: [PATCH 50/79] Quick tweaks -Use the species name for sText_AttackerBecameAshSpecies -Make Battle Bond not activate if the opposing party doesn't have 2 members or more. --- src/battle_message.c | 2 +- src/battle_script_commands.c | 3 ++- src/battle_util.c | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/battle_message.c b/src/battle_message.c index b0ca25c95..69829a731 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -705,7 +705,7 @@ static const u8 sText_AttackerGotOverInfatuation[] =_("{B_ATK_NAME_WITH_PREFIX} static const u8 sText_TormentedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is\ntormented no more!"); static const u8 sText_HealBlockedNoMore[] = _("{B_ATK_NAME_WITH_PREFIX} is cured of\nits heal block!"); static const u8 sText_AttackerBecameFullyCharged[] = _("{B_ATK_NAME_WITH_PREFIX} became fully charged\ndue to its bond with its trainer!\p"); -static const u8 sText_AttackerBecameAshSpecies[] = _("{B_ATK_NAME_WITH_PREFIX} became Ash-{B_ATK_NAME_WITH_PREFIX}!\p"); +static const u8 sText_AttackerBecameAshSpecies[] = _("{B_ATK_NAME_WITH_PREFIX} became Ash-{B_BUFF1}!\p"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 40d84767e..18302cba3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8139,7 +8139,8 @@ static void Cmd_various(void) // Change species. if (gBattlescriptCurrInstr[3] == 0) { - PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gActiveBattler].species); + if (!gBattleTextBuff1) + PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gActiveBattler].species); BtlController_EmitSetMonData(0, REQUEST_SPECIES_BATTLE, gBitTable[gBattlerPartyIndexes[gActiveBattler]], 2, &gBattleMons[gActiveBattler].species); MarkBattlerForControllerExec(gActiveBattler); } diff --git a/src/battle_util.c b/src/battle_util.c index 8898da5d7..d5c588e21 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5067,8 +5067,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move break; case ABILITY_BATTLE_BOND: if (gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_BATTLE_BOND - && gBattleResults.opponentFaintCounter != 0) + && gBattleResults.opponentFaintCounter != 0 + && CalculateEnemyPartyCount() > 1) { + PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species); gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species; gBattleMons[gBattlerAttacker].species = SPECIES_GRENINJA_ASH; BattleScriptPushCursor(); From 57ea20bc6d7d951f42ac3535d70196471c5ecb0e Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 13:32:36 -0300 Subject: [PATCH 51/79] Implemented modern effect of struggle with config --- data/battle_scripts_1.s | 7 +++++++ include/constants/battle.h | 3 ++- include/constants/battle_move_effects.h | 3 ++- src/battle_script_commands.c | 8 ++++++++ src/data/battle_moves.h | 3 ++- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f1f5995ff..92a03a55a 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_EffectRecoilHP25 @ EFFECT_RECOIL_HP_25 BattleScript_EffectDecorate: attackcanceler @@ -4911,6 +4912,12 @@ BattleScript_EffectRecoil50: setmoveeffect MOVE_EFFECT_RECOIL_50 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN goto BattleScript_EffectHit +BattleScript_EffectRecoilHP25: + setmoveeffect MOVE_EFFECT_RECOIL_HP_25 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN + jumpifnotmove MOVE_STRUGGLE, BattleScript_EffectHit + incrementgamestat GAME_STAT_USED_STRUGGLE + goto BattleScript_EffectHit + BattleScript_EffectTeeterDance:: attackcanceler attackstring diff --git a/include/constants/battle.h b/include/constants/battle.h index e88bb66dd..bf6403a18 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -347,7 +347,8 @@ #define MOVE_EFFECT_THROAT_CHOP 0x43 #define MOVE_EFFECT_INCINERATE 0x44 #define MOVE_EFFECT_BUG_BITE 0x45 -#define NUM_MOVE_EFFECTS 0x46 +#define MOVE_EFFECT_RECOIL_HP_25 0x46 +#define NUM_MOVE_EFFECTS 0x47 #define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_CERTAIN 0x8000 diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 440e6e76b..5038b52c3 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_RECOIL_HP_25 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_script_commands.c b/src/battle_script_commands.c index 1393a8d8c..0eb1086af 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3177,6 +3177,14 @@ void SetMoveEffect(bool32 primary, u32 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_MoveEffectRecoilWithStatus; break; + case MOVE_EFFECT_RECOIL_HP_25: // Struggle + gBattleMoveDamage = (gBattleMons[gEffectBattler].maxHP) / 4; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_MoveEffectRecoil; + break; case MOVE_EFFECT_THRASH: if (gBattleMons[gEffectBattler].status2 & STATUS2_LOCK_CONFUSE) { diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index a7a2752e0..f63ef27fc 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -2599,11 +2599,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = #if B_UPDATED_MOVE_DATA >= GEN_4 .accuracy = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .effect = EFFECT_RECOIL_HP_25, #else .accuracy = 100, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, + .effect = EFFECT_RECOIL_25, #endif - .effect = EFFECT_RECOIL_25, .power = 50, .type = TYPE_NORMAL, .pp = 1, From 9aee8cbea501aaebf0f7bf12adf2db60d63f98b6 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 14:47:38 -0300 Subject: [PATCH 52/79] Fixed Sticky Hold not being negated by Gastro Acid when stealing and switching items --- 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 1393a8d8c..feff90aa4 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3067,7 +3067,7 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr++; } else if (gBattleMons[gBattlerTarget].item - && gBattleMons[gBattlerTarget].ability == ABILITY_STICKY_HOLD) + && GetBattlerAbility(gBattlerTarget) == ABILITY_STICKY_HOLD) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_NoItemSteal; @@ -11615,7 +11615,7 @@ static void Cmd_tryswapitems(void) // trick gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); } // check if ability prevents swapping - else if (gBattleMons[gBattlerTarget].ability == ABILITY_STICKY_HOLD) + else if (GetBattlerAbility(gBattlerTarget) == ABILITY_STICKY_HOLD) { gBattlescriptCurrInstr = BattleScript_StickyHoldActivates; gLastUsedAbility = gBattleMons[gBattlerTarget].ability; From 6208995606442d51bd7fc8fbf0b1f0598f69f873 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 15:52:55 -0300 Subject: [PATCH 53/79] Fixed Run Away. --- src/battle_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_main.c b/src/battle_main.c index 25db65f78..62662d1e4 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3685,7 +3685,7 @@ u8 IsRunningFromBattleImpossible(void) return 0; if (gBattleTypeFlags & BATTLE_TYPE_LINK) return 0; - if (gBattleMons[gActiveBattler].ability == ABILITY_RUN_AWAY) + if (GetBattlerAbility(gActiveBattler) == ABILITY_RUN_AWAY) return 0; if ((i = IsAbilityPreventingEscape(gActiveBattler))) From 5abb0c0dfeff902fe60656072d24106a0f9f2598 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 16:48:45 -0300 Subject: [PATCH 54/79] Fixed perish song + soundproof + gastro acid --- 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 feff90aa4..88157273a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10899,7 +10899,7 @@ static void Cmd_trysetperishsong(void) for (i = 0; i < gBattlersCount; i++) { if (gStatuses3[i] & STATUS3_PERISH_SONG - || gBattleMons[i].ability == ABILITY_SOUNDPROOF + || GetBattlerAbility(i) == ABILITY_SOUNDPROOF || BlocksPrankster(gCurrentMove, gBattlerAttacker, i)) { notAffectedCount++; From 8d54e5666d5b6fa943fbc24cf86755ca5c4e599a Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 17:05:23 -0300 Subject: [PATCH 55/79] Fixed waking up from uproar --- 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 88157273a..88851909b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9121,7 +9121,7 @@ bool8 UproarWakeUpCheck(u8 battlerId) for (i = 0; i < gBattlersCount; i++) { - if (!(gBattleMons[i].status2 & STATUS2_UPROAR) || gBattleMons[battlerId].ability == ABILITY_SOUNDPROOF) + if (!(gBattleMons[i].status2 & STATUS2_UPROAR) || GetBattlerAbility(battlerId) == ABILITY_SOUNDPROOF) continue; gBattleScripting.battler = i; From ebe5e039986b2197f1b8bfbc8f4c949df0f78f64 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 17:07:29 -0300 Subject: [PATCH 56/79] Added Gen 8 abilities affected by Mold Breaker --- src/battle_util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/battle_util.c b/src/battle_util.c index 20e5d91d1..ae18d0a7d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -983,6 +983,11 @@ static const u8 sAbilitiesAffectedByMoldBreaker[] = [ABILITY_FLUFFY] = 1, [ABILITY_QUEENLY_MAJESTY] = 1, [ABILITY_WATER_BUBBLE] = 1, + [ABILITY_MIRROR_ARMOR] = 1, + [ABILITY_PUNK_ROCK] = 1, + [ABILITY_ICE_SCALES] = 1, + [ABILITY_ICE_FACE] = 1, + [ABILITY_PASTEL_VEIL] = 1, }; static const u8 sAbilitiesNotTraced[ABILITIES_COUNT] = From b29f5c801fc793545088b5336964127ca0550e6d Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 18:16:14 -0300 Subject: [PATCH 57/79] Fixed Gastro Acid's effect on Early Bird --- 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 ae18d0a7d..a34611886 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3126,7 +3126,7 @@ u8 AtkCanceller_UnableToUseMove(void) else { u8 toSub; - if (gBattleMons[gBattlerAttacker].ability == ABILITY_EARLY_BIRD) + if (GetBattlerAbility(gBattlerAttacker) == ABILITY_EARLY_BIRD) toSub = 2; else toSub = 1; From a22a456268445be038cf3b35dbb0cfa0b1e1a921 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 18:21:02 -0300 Subject: [PATCH 58/79] Fixed heal bell + soundproof + gastro acid --- 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 88851909b..713101765 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10770,7 +10770,7 @@ static void Cmd_healpartystatus(void) else party = gEnemyParty; - if (gBattleMons[gBattlerAttacker].ability != ABILITY_SOUNDPROOF) + if (GetBattlerAbility(gBattlerAttacker) != ABILITY_SOUNDPROOF) { gBattleMons[gBattlerAttacker].status1 = 0; gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_NIGHTMARE); @@ -10786,7 +10786,7 @@ static void Cmd_healpartystatus(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) { - if (gBattleMons[gActiveBattler].ability != ABILITY_SOUNDPROOF) + if (GetBattlerAbility(gActiveBattler) != ABILITY_SOUNDPROOF) { gBattleMons[gActiveBattler].status1 = 0; gBattleMons[gActiveBattler].status2 &= ~(STATUS2_NIGHTMARE); From 9d64a26625f66b238735c9b8c15c641dd82326ab Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 18:31:09 -0300 Subject: [PATCH 59/79] Fix preasure + Gastro Acid --- src/battle_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index a34611886..be88bda67 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1268,7 +1268,7 @@ void PressurePPLose(u8 target, u8 attacker, u16 move) { int moveIndex; - if (gBattleMons[target].ability != ABILITY_PRESSURE) + if (GetBattlerAbility(target) != ABILITY_PRESSURE) return; for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) @@ -1300,7 +1300,7 @@ void PressurePPLoseOnUsingImprison(u8 attacker) for (i = 0; i < gBattlersCount; i++) { - if (atkSide != GetBattlerSide(i) && gBattleMons[i].ability == ABILITY_PRESSURE) + if (atkSide != GetBattlerSide(i) && GetBattlerAbility(i) == ABILITY_PRESSURE) { for (j = 0; j < MAX_MON_MOVES; j++) { @@ -1333,7 +1333,7 @@ void PressurePPLoseOnUsingPerishSong(u8 attacker) for (i = 0; i < gBattlersCount; i++) { - if (gBattleMons[i].ability == ABILITY_PRESSURE && i != attacker) + if (GetBattlerAbility(i) == ABILITY_PRESSURE && i != attacker) { for (j = 0; j < MAX_MON_MOVES; j++) { From 2d5da7852cf396ad181da7bb4d7d9a0fcf93f646 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 18:44:04 -0300 Subject: [PATCH 60/79] Fixed Yawn + Vital Spirit + Gastro Acid --- src/battle_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index be88bda67..5c2de28c3 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2728,8 +2728,8 @@ u8 DoBattlerEndTurnEffects(void) { gStatuses3[gActiveBattler] -= STATUS3_YAWN_TURN(1); if (!(gStatuses3[gActiveBattler] & STATUS3_YAWN) && !(gBattleMons[gActiveBattler].status1 & STATUS1_ANY) - && gBattleMons[gActiveBattler].ability != ABILITY_VITAL_SPIRIT - && gBattleMons[gActiveBattler].ability != ABILITY_INSOMNIA && !UproarWakeUpCheck(gActiveBattler) + && GetBattlerAbility(gActiveBattler) != ABILITY_VITAL_SPIRIT + && GetBattlerAbility(gActiveBattler) != ABILITY_INSOMNIA && !UproarWakeUpCheck(gActiveBattler) && !IsLeafGuardProtected(gActiveBattler)) { CancelMultiTurnMoves(gActiveBattler); From 978f73475b462def6c39320630ad2d0c6c988239 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 19:01:11 -0300 Subject: [PATCH 61/79] Config for Shadow Tag vs Shadow Tag --- include/constants/battle_config.h | 1 + src/battle_util.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 26007ff9f..b2c821513 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -127,6 +127,7 @@ #define B_GALE_WINGS GEN_7 // In Gen7+ requires full HP to trigger. #define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't. #define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, Ghost-type Pokémon can escape even when blocked by abilities such as Shadow Tag. +#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. diff --git a/src/battle_util.c b/src/battle_util.c index 20e5d91d1..d95a3fa83 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5387,11 +5387,15 @@ u32 IsAbilityOnFieldExcept(u32 battlerId, u32 ability) u32 IsAbilityPreventingEscape(u32 battlerId) { u32 id; - - if (B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) - return 0; - - if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && gBattleMons[battlerId].ability != ABILITY_SHADOW_TAG) + #if B_GHOSTS_ESCAPE >= GEN_6 + if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) + return 0; + #endif + #if B_SHADOW_TAG_ESCAPE >= GEN_4 + if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && gBattleMons[battlerId].ability != ABILITY_SHADOW_TAG) + #else + if (id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) + #endif return id; if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_ARENA_TRAP)) && IsBattlerGrounded(battlerId)) return id; From 76bdbf164efe67bada54003b7d9a07d2d4df22a3 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 20:00:00 -0300 Subject: [PATCH 62/79] Updated sound flags for Howl and Heal Bell --- src/data/battle_moves.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index a7a2752e0..dea104b24 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -3424,6 +3424,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_HEAL_BELL] = { + #if B_UPDATED_MOVE_DATA != GEN_5 + .flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND, + #else + .flags = FLAG_SNATCH_AFFECTED, + #endif .effect = EFFECT_HEAL_BELL, .power = 0, .type = TYPE_NORMAL, @@ -3432,7 +3437,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, }, @@ -5338,6 +5342,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_HOWL] = { + #if B_UPDATED_MOVE_DATA >= GEN_8 + .flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND, + #else + .flags = FLAG_SNATCH_AFFECTED, + #endif .effect = EFFECT_ATTACK_UP, .power = 0, .type = TYPE_NORMAL, @@ -5346,7 +5355,6 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .secondaryEffectChance = 0, .target = MOVE_TARGET_USER, .priority = 0, - .flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND, .split = SPLIT_STATUS, }, From 1e0ae9a1546c2d77a626324926d5b993ae1d29e8 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 2 Oct 2021 20:54:04 -0300 Subject: [PATCH 63/79] Tabs to spaces. --- 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 92a03a55a..47a034ce1 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -379,7 +379,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectDecorate @ EFFECT_DECORATE .4byte BattleScript_EffectHit @ EFFECT_SNIPE_SHOT .4byte BattleScript_EffectTripleHit @ EFFECT_TRIPLE_HIT - .4byte BattleScript_EffectRecoilHP25 @ EFFECT_RECOIL_HP_25 + .4byte BattleScript_EffectRecoilHP25 @ EFFECT_RECOIL_HP_25 BattleScript_EffectDecorate: attackcanceler From 64a45d8f4851e0d56af1cfcec1c6023f48871f27 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sun, 3 Oct 2021 07:21:47 -0300 Subject: [PATCH 64/79] =?UTF-8?q?Tweaked=20trytoclearprimalweather=20Made?= =?UTF-8?q?=20it=20so=20it=20won't=20actually=20try=20to=20clear=20a=20pri?= =?UTF-8?q?mal=20weather=20if=20a=20Pok=C3=A9mon=20with=20Desolate=20Land,?= =?UTF-8?q?=20Primordial=20Sea=20or=20Delta=20Stream=20is=20present=20on?= =?UTF-8?q?=20the=20field.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/battle_script_commands.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6b1e4e77a..90979264a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8762,19 +8762,30 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; return; case VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER: - if (gBattleWeather & WEATHER_SUN_PRIMAL) + { + bool8 shouldNotClear = FALSE; + + for (i = 0; i < gBattlersCount; i++) + { + if (((GetBattlerAbility(i) == ABILITY_DESOLATE_LAND && gBattleWeather & WEATHER_SUN_PRIMAL) + || (GetBattlerAbility(i) == ABILITY_PRIMORDIAL_SEA && gBattleWeather & WEATHER_RAIN_PRIMAL) + || (GetBattlerAbility(i) == ABILITY_DELTA_STREAM && gBattleWeather & WEATHER_STRONG_WINDS)) + && IsBattlerAlive(i)) + shouldNotClear = TRUE; + } + if (gBattleWeather & WEATHER_SUN_PRIMAL && !shouldNotClear) { gBattleWeather &= ~WEATHER_SUN_PRIMAL; PrepareStringBattle(STRINGID_EXTREMESUNLIGHTFADED, gActiveBattler); gBattleCommunication[MSG_DISPLAY] = 1; } - else if (gBattleWeather & WEATHER_RAIN_PRIMAL) + else if (gBattleWeather & WEATHER_RAIN_PRIMAL && !shouldNotClear) { gBattleWeather &= ~WEATHER_RAIN_PRIMAL; PrepareStringBattle(STRINGID_HEAVYRAINLIFTED, gActiveBattler); gBattleCommunication[MSG_DISPLAY] = 1; } - else if (gBattleWeather & WEATHER_STRONG_WINDS) + else if (gBattleWeather & WEATHER_STRONG_WINDS && !shouldNotClear) { gBattleWeather &= ~WEATHER_STRONG_WINDS; PrepareStringBattle(STRINGID_STRONGWINDSDISSIPATED, gActiveBattler); @@ -8782,6 +8793,7 @@ static void Cmd_various(void) } break; } + } gBattlescriptCurrInstr += 3; } From dcefb523f828619a923ea7c8403be2ffecb05bf1 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 4 Oct 2021 06:43:43 -0300 Subject: [PATCH 65/79] Tweaks and fixes -Fixed the Flying-type checks of WEATHER_STRONG_WINDS. -Fixed the order of actions involving the printing of STRINGID_ATTACKWEAKENEDBSTRONGWINDS. --- data/battle_scripts_1.s | 2 +- src/battle_script_commands.c | 20 ++++++++++++++++++++ src/battle_util.c | 16 ++++++---------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 39fb01cdd..083db5f07 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7293,7 +7293,7 @@ BattleScript_AttackWeakenedByStrongWinds:: call BattleScript_AbilityPopUp printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS waitmessage B_WAIT_TIME_LONG - end3 + return BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 90979264a..1fd7daea5 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1914,6 +1914,9 @@ static void Cmd_typecalc(void) static void Cmd_adjustdamage(void) { u8 holdEffect, param; + u32 moveType; + + GET_MOVE_TYPE(gCurrentMove, moveType); if (DoesSubstituteBlockMove(gBattlerAttacker, gBattlerTarget, gCurrentMove)) goto END; @@ -1991,6 +1994,23 @@ END: gBattlescriptCurrInstr = BattleScript_GemActivates; gLastUsedItem = gBattleMons[gBattlerAttacker].item; } + + // WEATHER_STRONG_WINDS prints a string when it's about to reduce the power + // of a move that is Super Effective against a Flying-type Pokémon. + if (gBattleWeather & WEATHER_STRONG_WINDS) + { + if ((gBattleMons[gBattlerTarget].type1 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type1) >= UQ_4_12(2.0)) + || (gBattleMons[gBattlerTarget].type2 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type2) >= UQ_4_12(2.0)) + || (gBattleMons[gBattlerTarget].type3 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type3) >= UQ_4_12(2.0))) + { + gBattlerAbility = gBattlerTarget; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_AttackWeakenedByStrongWinds; + } + } } static void Cmd_multihitresultmessage(void) diff --git a/src/battle_util.c b/src/battle_util.c index 2e7f3e18d..8873d7ae3 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -486,14 +486,6 @@ void HandleAction_UseMove(void) for (i = 0; i < MAX_BATTLERS_COUNT; i++) gBattleStruct->hpBefore[i] = gBattleMons[i].hp; - GET_MOVE_TYPE(gCurrentMove, moveType); - if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) - { - if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_FLYING) - && CalcTypeEffectivenessMultiplier(gCurrentMove, moveType, gBattlerAttacker, gBattlerTarget, FALSE) >= UQ_4_12(2.0)) - BattleScriptPushCursorAndCallback(BattleScript_AttackWeakenedByStrongWinds); - } - gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; } @@ -8300,8 +8292,12 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move } else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) { - if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING) - && typeEffectivenessModifier >= UQ_4_12(2.0)) + if ((gBattleMons[battlerDef].type1 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type1) >= UQ_4_12(2.0)) + || (gBattleMons[battlerDef].type2 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type2) >= UQ_4_12(2.0)) + || (gBattleMons[battlerDef].type3 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type3) >= UQ_4_12(2.0))) dmg = ApplyModifier(UQ_4_12(0.5), dmg); } From b3167b7d53cb4478b9f6d54e1745a188132169f0 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 4 Oct 2021 19:40:36 -0300 Subject: [PATCH 66/79] Fixed Trump Card's damage check --- 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 462b58bd4..71a9a3130 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7489,7 +7489,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) if (gBattleMons[battlerAtk].pp[i] >= ARRAY_COUNT(sTrumpCardPowerTable)) basePower = sTrumpCardPowerTable[ARRAY_COUNT(sTrumpCardPowerTable) - 1]; else - basePower = sTrumpCardPowerTable[i]; + basePower = sTrumpCardPowerTable[gBattleMons[battlerAtk].pp[i]]; } break; case EFFECT_ACROBATICS: From 4ab8c95207b679a92e713a2a35a26c0121e611be Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 4 Oct 2021 20:17:43 -0300 Subject: [PATCH 67/79] Fixed Heat Crash's power table name --- src/battle_util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 462b58bd4..09a2ae0ae 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7317,7 +7317,7 @@ static const u16 sWeightToDamageTable[] = }; static const u8 sSpeedDiffPowerTable[] = {40, 60, 80, 120, 150}; -static const u8 sHeatCrushPowerTable[] = {40, 40, 60, 80, 100, 120}; +static const u8 sHeatCrashPowerTable[] = {40, 40, 60, 80, 100, 120}; static const u8 sTrumpCardPowerTable[] = {200, 80, 60, 50, 40}; const struct TypePower gNaturalGiftTable[] = @@ -7512,10 +7512,10 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) break; case EFFECT_HEAT_CRASH: weight = GetBattlerWeight(battlerAtk) / GetBattlerWeight(battlerDef); - if (weight >= ARRAY_COUNT(sHeatCrushPowerTable)) - basePower = sHeatCrushPowerTable[ARRAY_COUNT(sHeatCrushPowerTable) - 1]; + if (weight >= ARRAY_COUNT(sHeatCrashPowerTable)) + basePower = sHeatCrashPowerTable[ARRAY_COUNT(sHeatCrashPowerTable) - 1]; else - basePower = sHeatCrushPowerTable[i]; + basePower = sHeatCrashPowerTable[i]; break; case EFFECT_PUNISHMENT: basePower = 60 + (CountBattlerStatIncreases(battlerDef, FALSE) * 20); From 92f0f6f82013329fcc133cc47fa6bb206c03a72c Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 4 Oct 2021 20:20:00 -0300 Subject: [PATCH 68/79] Fixed Psychic Fangs power --- src/data/battle_moves.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index a7a2752e0..84ba59f24 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -10226,7 +10226,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_PSYCHIC_FANGS] = { .effect = EFFECT_BRICK_BREAK, - .power = 75, + .power = 85, .type = TYPE_PSYCHIC, .accuracy = 100, .pp = 15, From a6198e5d4682d284a6259467505ffd947280cbcb Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 6 Oct 2021 15:30:52 +1300 Subject: [PATCH 69/79] Fix Simple Beam - No longer freezes the game - Now fails if the target already has simple - Explicitly checks and changes the target's ability instead of gActiveBattler's ability --- src/battle_script_commands.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8d6dd5bdb..ead08479a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7910,15 +7910,15 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; return; case VARIOUS_SET_SIMPLE_BEAM: - if (IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gActiveBattler].ability)) + if (IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability) + || gBattleMons[gBattlerTarget].ability == ABILITY_SIMPLE) { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); } else { - gBattleMons[gActiveBattler].ability = ABILITY_SIMPLE; + gBattleMons[gBattlerTarget].ability = ABILITY_SIMPLE; gBattlescriptCurrInstr += 7; - break; } return; case VARIOUS_TRY_ENTRAINMENT: From 38b816ccdd8b7ac345c628ee93a8bb62aa9b2c92 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 6 Oct 2021 21:53:30 +1300 Subject: [PATCH 70/79] AI handles dynamic move types This will make the AI account for the type of moves like Weather Ball, Hidden Power and Revelation Dance when considering abilities that make the useless. E.g. Water-type Hidden Power vs. Storm Drain. --- src/battle_ai_main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 03472271d..42b8b9d40 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -520,6 +520,9 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) u32 i; u16 predictedMove = gLastMoves[battlerDef]; // TODO better move prediction + SetTypeBeforeUsingMove(move, battlerAtk); + GET_MOVE_TYPE(move, moveType); + if (IsTargetingPartner(battlerAtk, battlerDef)) return score; @@ -2472,7 +2475,10 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) bool32 attackerHasBadAbility = (GetAbilityRating(AI_DATA->atkAbility) < 0); bool32 partnerHasBadAbility = (GetAbilityRating(atkPartnerAbility) < 0); u16 predictedMove = gLastMoves[battlerDef]; //for now - + + SetTypeBeforeUsingMove(move, battlerAtk); + GET_MOVE_TYPE(move, moveType); + // check what effect partner is using if (AI_DATA->partnerMove != 0) { @@ -4751,7 +4757,10 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { u16 effect = gBattleMoves[move].effect; u8 moveType = gBattleMoves[move].type; - + + SetTypeBeforeUsingMove(move, battlerAtk); + GET_MOVE_TYPE(move, moveType); + if (IsTargetingPartner(battlerAtk, battlerDef)) { if ((effect == EFFECT_HEAL_PULSE || effect == EFFECT_HIT_ENEMY_HEAL_ALLY) From dc451167d13d42bca8b402335c08e8ab171e163b Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 05:09:47 -0300 Subject: [PATCH 71/79] More fixes -Removed ability popup when Strong Winds weakens a SE Flying-type move -Went back to the way I handled the dmg calculation for that originally -Made sure to try to clear the primal weathers in a couple of other battle scripts -Allowed Drought, Drizzle, Sand Stream and Snow Warning to activate but fail if WEATHER_STRONG_WINDS is in effect. --- data/battle_scripts_1.s | 21 +++++++++++++++++++-- src/battle_util.c | 22 ++++++++++++---------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 083db5f07..8aa2b32ba 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4135,6 +4135,12 @@ BattleScript_MysteriousAirCurrentBlowsOn: waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd +BattleScript_MysteriousAirCurrentBlowsOnEnd3: + pause B_WAIT_TIME_SHORT + printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON + waitmessage B_WAIT_TIME_LONG + end3 + BattleScript_EffectDefenseUpHit:: setmoveeffect MOVE_EFFECT_DEF_PLUS_1 | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -5255,6 +5261,9 @@ BattleScript_FaintedMonTryChooseAnother: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON hidepartystatussummary BS_ATTACKER switchinanim BS_ATTACKER, 0 @@ -5265,6 +5274,9 @@ BattleScript_FaintedMonChooseAnother: getswitchedmondata BS_FAINTED switchindataupdate BS_FAINTED hpthresholds BS_FAINTED + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON hidepartystatussummary BS_FAINTED switchinanim BS_FAINTED, FALSE @@ -5297,6 +5309,9 @@ BattleScript_HandleFaintedMonLoop:: getswitchedmondata BS_FAINTED switchindataupdate BS_FAINTED hpthresholds BS_FAINTED + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON hidepartystatussummary BS_FAINTED switchinanim BS_FAINTED, FALSE @@ -6974,6 +6989,7 @@ BattleScript_ItemSteal:: BattleScript_DrizzleActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNMADEITRAIN waitstate playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES, NULL @@ -7132,6 +7148,7 @@ BattleScript_HealerActivates:: BattleScript_SandstreamActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXWHIPPEDUPSANDSTORM waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL @@ -7238,6 +7255,7 @@ BattleScript_IntimidatePrevented: BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXINTENSIFIEDSUN waitstate playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL @@ -7289,8 +7307,6 @@ BattleScript_DeltaStreamActivates:: end3 BattleScript_AttackWeakenedByStrongWinds:: - pause B_WAIT_TIME_SHORT - call BattleScript_AbilityPopUp printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS waitmessage B_WAIT_TIME_LONG return @@ -7298,6 +7314,7 @@ BattleScript_AttackWeakenedByStrongWinds:: BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_SNOWWARNINGHAIL waitstate playanimation BS_BATTLER_0, B_ANIM_HAIL_CONTINUES, NULL diff --git a/src/battle_util.c b/src/battle_util.c index 8873d7ae3..17b04ebf8 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8290,16 +8290,6 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move else if (moveType == TYPE_WATER) dmg = ApplyModifier(UQ_4_12(0.5), dmg); } - else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) - { - if ((gBattleMons[battlerDef].type1 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type1) >= UQ_4_12(2.0)) - || (gBattleMons[battlerDef].type2 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type2) >= UQ_4_12(2.0)) - || (gBattleMons[battlerDef].type3 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type3) >= UQ_4_12(2.0))) - dmg = ApplyModifier(UQ_4_12(0.5), dmg); - } // check stab if (IS_BATTLER_OF_TYPE(battlerAtk, moveType) && move != MOVE_STRUGGLE) @@ -8541,6 +8531,18 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat modifier = UQ_4_12(1.0); } + // WEATHER_STRONG_WINDS weakens Super Effective moves against Flying-type Pokémon + if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) + { + if ((gBattleMons[battlerDef].type1 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type1) >= UQ_4_12(2.0)) + || (gBattleMons[battlerDef].type2 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type2) >= UQ_4_12(2.0)) + || (gBattleMons[battlerDef].type3 == TYPE_FLYING + && GetTypeModifier(moveType, gBattleMons[battlerDef].type3) >= UQ_4_12(2.0))) + modifier = UQ_4_12(1.0); + } + if (((GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0)) || (GetBattlerAbility(battlerDef) == ABILITY_TELEPATHY && battlerDef == BATTLE_PARTNER(battlerAtk))) && gBattleMoves[move].power) From b93c746a495c8a7fe4bb01e16f4227fe6a7af3a1 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 06:04:56 -0300 Subject: [PATCH 72/79] Reverted comment after the previous commit --- 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 17b04ebf8..d783edab2 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8275,7 +8275,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move && gBattleMoves[move].effect != EFFECT_FACADE && abilityAtk != ABILITY_GUTS) dmg = ApplyModifier(UQ_4_12(0.5), dmg); - // check weather + // check sunny/rain weather if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_RAIN_ANY) { if (moveType == TYPE_FIRE) From 0f2cc99f45d46f9c5780bbf265b023e4dcc1832c Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 06:32:06 -0300 Subject: [PATCH 73/79] WEATHER_STRONG_WINDS modifier fix MulByTypeEffectiveness was the right answer all along. I also added a short pause to BattleScript_AttackWeakenedByStrongWinds before STRINGID_ATTACKWEAKENEDBSTRONGWINDS is printed. --- data/battle_scripts_1.s | 1 + src/battle_util.c | 19 +++++++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 8aa2b32ba..e3a395e18 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7307,6 +7307,7 @@ BattleScript_DeltaStreamActivates:: end3 BattleScript_AttackWeakenedByStrongWinds:: + pause B_WAIT_TIME_SHORT printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS waitmessage B_WAIT_TIME_LONG return diff --git a/src/battle_util.c b/src/battle_util.c index d783edab2..4e57d3425 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8476,6 +8476,13 @@ static void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, u8 batt if (gProtectStructs[battlerDef].kingsShielded && gBattleMoves[move].effect != EFFECT_FEINT) mod = UQ_4_12(1.0); + // WEATHER_STRONG_WINDS weakens Super Effective moves against Flying-type Pokémon + if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) + { + if (defType == TYPE_FLYING && mod >= UQ_4_12(2.0)) + mod = UQ_4_12(1.0); + } + MulModifier(modifier, mod); } @@ -8531,18 +8538,6 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat modifier = UQ_4_12(1.0); } - // WEATHER_STRONG_WINDS weakens Super Effective moves against Flying-type Pokémon - if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) - { - if ((gBattleMons[battlerDef].type1 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type1) >= UQ_4_12(2.0)) - || (gBattleMons[battlerDef].type2 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type2) >= UQ_4_12(2.0)) - || (gBattleMons[battlerDef].type3 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type3) >= UQ_4_12(2.0))) - modifier = UQ_4_12(1.0); - } - if (((GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0)) || (GetBattlerAbility(battlerDef) == ABILITY_TELEPATHY && battlerDef == BATTLE_PARTNER(battlerAtk))) && gBattleMoves[move].power) From a646c3311b15c3c7bf5fe45dd6e94c41c3f8bc41 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 07:59:43 -0300 Subject: [PATCH 74/79] Another set of fixes The ability pop up is supposed to show as weather changing abilities try but fail to activate. --- data/battle_scripts_1.s | 41 +++++++++++++++++++++++++++++++++++++++++ src/battle_util.c | 3 ++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index e3a395e18..ed34b9461 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4123,12 +4123,36 @@ BattleScript_ExtremelyHarshSunlightWasNotLessened: waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd +BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3: + pause B_WAIT_TIME_SHORT + printstring STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED + waitmessage B_WAIT_TIME_LONG + end3 + +BattleScript_ExtremelyHarshSunlightWasNotLessenedRet: + pause B_WAIT_TIME_SHORT + printstring STRINGID_EXTREMELYHARSHSUNLIGHTWASNOTLESSENED + waitmessage B_WAIT_TIME_LONG + return + BattleScript_NoReliefFromHeavyRain: pause B_WAIT_TIME_SHORT printstring STRINGID_NORELIEFROMHEAVYRAIN waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd +BattleScript_NoReliefFromHeavyRainEnd3: + pause B_WAIT_TIME_SHORT + printstring STRINGID_NORELIEFROMHEAVYRAIN + waitmessage B_WAIT_TIME_LONG + end3 + +BattleScript_NoReliefFromHeavyRainRet: + pause B_WAIT_TIME_SHORT + printstring STRINGID_NORELIEFROMHEAVYRAIN + waitmessage B_WAIT_TIME_LONG + return + BattleScript_MysteriousAirCurrentBlowsOn: pause B_WAIT_TIME_SHORT printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON @@ -4141,6 +4165,12 @@ BattleScript_MysteriousAirCurrentBlowsOnEnd3: waitmessage B_WAIT_TIME_LONG end3 +BattleScript_MysteriousAirCurrentBlowsOnRet: + pause B_WAIT_TIME_SHORT + printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON + waitmessage B_WAIT_TIME_LONG + return + BattleScript_EffectDefenseUpHit:: setmoveeffect MOVE_EFFECT_DEF_PLUS_1 | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -6989,6 +7019,8 @@ BattleScript_ItemSteal:: BattleScript_DrizzleActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNMADEITRAIN waitstate @@ -7148,6 +7180,8 @@ BattleScript_HealerActivates:: BattleScript_SandstreamActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXWHIPPEDUPSANDSTORM waitstate @@ -7158,6 +7192,9 @@ BattleScript_SandstreamActivates:: BattleScript_SandSpitActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedRet + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainRet + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnRet printstring STRINGID_ASANDSTORMKICKEDUP waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL @@ -7255,6 +7292,8 @@ BattleScript_IntimidatePrevented: BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXINTENSIFIEDSUN waitstate @@ -7315,6 +7354,8 @@ BattleScript_AttackWeakenedByStrongWinds:: BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_SNOWWARNINGHAIL waitstate diff --git a/src/battle_util.c b/src/battle_util.c index 4e57d3425..59c936b6b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3694,7 +3694,8 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) && GetBattlerAbility(battler) != ABILITY_PRIMORDIAL_SEA && GetBattlerAbility(battler) != ABILITY_DELTA_STREAM) { - return FALSE; + weatherEnumId = 0; + return TRUE; } else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]))) { From fe5a0a7f04bc287f542aec665f498d7b333dafde Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 08:29:53 -0300 Subject: [PATCH 75/79] Oopsie --- 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 ed34b9461..4948fd470 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7324,7 +7324,7 @@ BattleScript_PrimordialSeaActivates:: call BattleScript_AbilityPopUp printstring STRINGID_HEAVYRAIN waitstate - playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL + playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES, NULL call BattleScript_WeatherFormChanges end3 From b520fe5d89e173217cf7d535129e59068f3f4aed Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 08:38:19 -0300 Subject: [PATCH 76/79] Tweaked Strong Winds' animation --- data/battle_anim_scripts.s | 15 +-------------- .../backgrounds/windstorm_brew.png | Bin 1100 -> 1067 bytes 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 948fe221a..4063885e0 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -24419,20 +24419,7 @@ General_StrongWinds:: createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_FLYING_DIRT, 0, 12, 12, RGB(20, 20, 20) waitforvisualfinish createvisualtask AnimTask_LoadWindstormBackground, 5, FALSE - delay 16 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 10, 2304, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 90, 2048, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 50, 2560, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 20, 2304, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 70, 1984, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 0, 2816, 96, 0 - delay 10 - createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 60, 2560, 96, 0 + delay 32 waitforvisualfinish stopsound end diff --git a/graphics/battle_anims/backgrounds/windstorm_brew.png b/graphics/battle_anims/backgrounds/windstorm_brew.png index c36e720cfe8a114139595802c7642a920f67a831..2a28952662266dc252e5a0b850e41ed187241047 100644 GIT binary patch delta 84 zcmX@Zv6^Fo%EUZl&Av1J)my3xmL^9wg*z8Hnnzpg5!#c+z`(#>;_2(k{*;T2ThY?W oQ}o$H6IBl80#6sm5Rc;<&*d=-bl5)Y1FB>2boFyt=akR{0037Uc>n+a delta 115 zcmZ3@afV}piU50wr>`sfQx171Ex|1uBDxbBRD~EgN(%hk-F;k)8Gyj6K~sLBqM7ck zs|Sv3TefY*ym^y)n`^4l65=+uZb}C#U`+CMcVXyYmGxj?U@q` Date: Wed, 6 Oct 2021 09:10:56 -0300 Subject: [PATCH 77/79] Fixed infinite loop --- data/battle_scripts_1.s | 29 ++++++++++++++--------------- include/battle_scripts.h | 2 ++ src/battle_util.c | 36 +++++++++++++++++++++++++++++++++--- 3 files changed, 49 insertions(+), 18 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 4948fd470..5803a0220 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4171,6 +4171,20 @@ BattleScript_MysteriousAirCurrentBlowsOnRet: waitmessage B_WAIT_TIME_LONG return +BattleScript_BlockedByPrimalWeatherEnd3:: + call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 + end3 + +BattleScript_BlockedByPrimalWeatherRet:: + call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedRet + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainRet + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnRet + return + BattleScript_EffectDefenseUpHit:: setmoveeffect MOVE_EFFECT_DEF_PLUS_1 | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -7019,9 +7033,6 @@ BattleScript_ItemSteal:: BattleScript_DrizzleActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNMADEITRAIN waitstate playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES, NULL @@ -7180,9 +7191,6 @@ BattleScript_HealerActivates:: BattleScript_SandstreamActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXWHIPPEDUPSANDSTORM waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL @@ -7192,9 +7200,6 @@ BattleScript_SandstreamActivates:: BattleScript_SandSpitActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedRet - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainRet - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnRet printstring STRINGID_ASANDSTORMKICKEDUP waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL @@ -7292,9 +7297,6 @@ BattleScript_IntimidatePrevented: BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXINTENSIFIEDSUN waitstate playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL @@ -7354,9 +7356,6 @@ BattleScript_AttackWeakenedByStrongWinds:: BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_PRIMAL, BattleScript_ExtremelyHarshSunlightWasNotLessenedEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_RAIN_PRIMAL, BattleScript_NoReliefFromHeavyRainEnd3 - jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_SNOWWARNINGHAIL waitstate playanimation BS_BATTLER_0, B_ANIM_HAIL_CONTINUES, NULL diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 1f22cedd5..cd4600543 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -396,5 +396,7 @@ extern const u8 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves[]; extern const u8 BattleScript_DeltaStreamActivates[]; extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[]; extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; +extern const u8 BattleScript_BlockedByPrimalWeatherEnd3[]; +extern const u8 BattleScript_BlockedByPrimalWeatherRet[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/src/battle_util.c b/src/battle_util.c index 59c936b6b..282a6ff74 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3694,8 +3694,7 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) && GetBattlerAbility(battler) != ABILITY_PRIMORDIAL_SEA && GetBattlerAbility(battler) != ABILITY_DELTA_STREAM) { - weatherEnumId = 0; - return TRUE; + return FALSE; } else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]))) { @@ -4167,6 +4166,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_DrizzleActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_SAND_STREAM: if (TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE)) @@ -4174,6 +4179,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_SandstreamActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_DROUGHT: if (TryChangeBattleWeather(battler, ENUM_WEATHER_SUN, TRUE)) @@ -4181,6 +4192,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_DroughtActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_SNOW_WARNING: if (TryChangeBattleWeather(battler, ENUM_WEATHER_HAIL, TRUE)) @@ -4188,6 +4205,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_SnowWarningActivates); effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone) + { + gSpecialStatuses[battler].switchInAbilityDone = 1; + BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3); + effect++; + } break; case ABILITY_ELECTRIC_SURGE: if (TryChangeBattleTerrain(battler, STATUS_FIELD_ELECTRIC_TERRAIN, &gFieldTimers.electricTerrainTimer)) @@ -4989,13 +5012,20 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED && !(WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SANDSTORM_ANY) - && TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE)) + && TryChangeBattleWeather(battler, ENUM_WEATHER_SANDSTORM, TRUE) + && !(WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY)) { gBattleScripting.battler = gActiveBattler = battler; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SandSpitActivates; effect++; } + else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_PRIMAL_ANY) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_BlockedByPrimalWeatherRet; + effect++; + } break; case ABILITY_PERISH_BODY: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) From 7548e74013197b6e22f816c5080c5e1b1766d0ea Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 7 Oct 2021 00:41:33 -0300 Subject: [PATCH 78/79] Forgot to clear the primal weathers in some places --- data/battle_scripts_1.s | 18 ++++++++++++++++++ src/battle_script_commands.c | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5803a0220..4e11922ff 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -737,6 +737,9 @@ BattleScript_EffectPartingShotSwitch: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON switchinanim BS_ATTACKER, TRUE waitstate @@ -1789,6 +1792,9 @@ BattleScript_EffectHealingWish: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON switchinanim BS_ATTACKER, TRUE waitstate @@ -2148,6 +2154,9 @@ BattleScript_EffectHitEscape: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON switchinanim BS_ATTACKER, TRUE waitstate @@ -4026,6 +4035,9 @@ BattleScript_EffectBatonPass:: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON switchinanim BS_ATTACKER, TRUE waitstate @@ -5862,6 +5874,9 @@ BattleScript_RoarSuccessSwitch:: call BattleScript_RoarSuccessRet getswitchedmondata BS_TARGET switchindataupdate BS_TARGET + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 switchinanim BS_TARGET, FALSE waitstate printstring STRINGID_PKMNWASDRAGGEDOUT @@ -8535,6 +8550,9 @@ BattleScript_EjectButtonActivates:: getswitchedmondata BS_SCRIPTING switchindataupdate BS_SCRIPTING hpthresholds BS_SCRIPTING + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring 0x3 switchinanim BS_SCRIPTING 0x1 waitstate diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 1fd7daea5..8f059df28 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8775,7 +8775,7 @@ static void Cmd_various(void) } gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain break; - case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED: + case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED: if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler)) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); else From 359da5313e0c472e65afc5533e82d54e53b3365b Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 7 Oct 2021 00:56:13 -0300 Subject: [PATCH 79/79] Handled some edge cases Gastro Acid, Worry Seed, Simple Beam, Core Enforcer and Transform --- data/battle_scripts_1.s | 15 +++++++++++++++ src/battle_script_commands.c | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 4e11922ff..32f741f65 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -645,6 +645,9 @@ BattleScript_MoveEffectCoreEnforcer:: setgastroacid BattleScript_CoreEnforcerRet printstring STRINGID_PKMNSABILITYSUPPRESSED waitmessage B_WAIT_TIME_LONG + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 BattleScript_CoreEnforcerRet: return @@ -1744,6 +1747,9 @@ BattleScript_EffectSimpleBeam: waitanimation printstring STRINGID_PKMNACQUIREDSIMPLE waitmessage B_WAIT_TIME_LONG + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 goto BattleScript_MoveEnd BattleScript_EffectSuckerPunch: @@ -1832,6 +1838,9 @@ BattleScript_EffectWorrySeed: waitanimation printstring STRINGID_PKMNACQUIREDABILITY waitmessage B_WAIT_TIME_LONG + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 goto BattleScript_MoveEnd BattleScript_EffectPowerSplit: @@ -1960,6 +1969,9 @@ BattleScript_EffectGastroAcid: waitanimation printstring STRINGID_PKMNSABILITYSUPPRESSED waitmessage B_WAIT_TIME_LONG + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 goto BattleScript_MoveEnd BattleScript_EffectToxicSpikes: @@ -3095,6 +3107,9 @@ BattleScript_EffectTransform:: attackcanceler attackstring ppreduce + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 transformdataexecution attackanimation waitanimation diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8f059df28..a372582da 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8790,7 +8790,8 @@ static void Cmd_various(void) if (((GetBattlerAbility(i) == ABILITY_DESOLATE_LAND && gBattleWeather & WEATHER_SUN_PRIMAL) || (GetBattlerAbility(i) == ABILITY_PRIMORDIAL_SEA && gBattleWeather & WEATHER_RAIN_PRIMAL) || (GetBattlerAbility(i) == ABILITY_DELTA_STREAM && gBattleWeather & WEATHER_STRONG_WINDS)) - && IsBattlerAlive(i)) + && IsBattlerAlive(i) + && !(gStatuses3[i] & STATUS3_GASTRO_ACID)) shouldNotClear = TRUE; } if (gBattleWeather & WEATHER_SUN_PRIMAL && !shouldNotClear)