From c2f718d3d35255552fdbe42f237a909a78a821cb Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 12 Jan 2021 14:58:24 -0300 Subject: [PATCH 01/60] 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/60] 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/60] 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/60] 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/60] 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/60] 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/60] 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/60] 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 aeafd9e2227db86dc5fd63aca0976a5cbf8c4677 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 16 Sep 2021 11:34:01 -0400 Subject: [PATCH 09/60] 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 10/60] 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 11/60] 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 12/60] 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 13/60] 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 14/60] 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 15/60] 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 16/60] 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 17/60] 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 18/60] 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 19/60] 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 20/60] 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 21/60] 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 22/60] 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 23/60] 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 24/60] 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 25/60] 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 26/60] 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 27/60] 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 28/60] 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 29/60] 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 30/60] 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 31/60] 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 32/60] 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 33/60] 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 34/60] 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 35/60] 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 36/60] 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 37/60] 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 38/60] 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 39/60] 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 40/60] 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 41/60] 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 42/60] 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 43/60] 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 44/60] 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 45/60] 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 46/60] 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 47/60] 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 48/60] 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 49/60] 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 50/60] 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 51/60] 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 52/60] 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 53/60] 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 54/60] 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 55/60] 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 b3167b7d53cb4478b9f6d54e1745a188132169f0 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 4 Oct 2021 19:40:36 -0300 Subject: [PATCH 56/60] 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 57/60] 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 58/60] 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 59/60] 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 60/60] 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)