From c026f705b37009aa4db723114e63beedb690691d Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 17 Nov 2020 19:45:27 -0700 Subject: [PATCH 01/15] permanent terrain move bgs --- data/battle_anim_scripts.s | 14 ++++++++++++++ data/battle_scripts_1.s | 4 ++++ include/battle_anim.h | 1 + include/battle_bg.h | 1 + include/constants/battle.h | 2 ++ include/constants/battle_anim.h | 1 + src/battle_anim.c | 5 +++-- src/battle_bg.c | 25 +++++++++++++++++++++++++ src/battle_script_commands.c | 2 +- 9 files changed, 52 insertions(+), 3 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 70ed22c9e..4042dcd0e 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -815,6 +815,7 @@ gBattleAnims_General:: .4byte General_IllusionOff .4byte General_FormChange .4byte General_SlideOffScreen + .4byte General_RestoreBg .align 2 gBattleAnims_Special:: @@ -8453,6 +8454,8 @@ Move_GRASSY_TERRAIN:: delay 4 createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 4, 0, RGB(31, 24, 31) waitforvisualfinish + restorebg + waitbgfadein end Move_MISTY_TERRAIN:: @@ -8491,6 +8494,8 @@ Move_MISTY_TERRAIN:: delay 4 createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 7, 0, RGB(31, 24, 31) waitforvisualfinish + restorebg + waitbgfadein end Move_ELECTRIFY:: @@ -9374,6 +9379,8 @@ Move_ELECTRIC_TERRAIN:: delay 2 createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 4, 0, RGB(28, 28, 0) waitforvisualfinish + restorebg + waitbgfadein end Move_DAZZLING_GLEAM:: @@ -11027,6 +11034,8 @@ Move_PSYCHIC_TERRAIN:: delay 4 createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 4, 0, RGB(27, 0, 13) waitforvisualfinish + restorebg + waitbgfadein end Move_LUNGE:: @@ -24320,6 +24329,11 @@ General_TerrainElectric: General_TerrainPsychic: end +General_RestoreBg: + restorebg + waitbgfadein + end + SnatchMoveTrySwapFromSubstitute: createvisualtask AnimTask_IsAttackerBehindSubstitute, 2 jumprettrue SnatchMoveSwapSubstituteForMon diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 504896d63..f8efc7e7d 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -5426,21 +5426,25 @@ BattleScript_MagicRoomEnds:: BattleScript_ElectricTerrainEnds:: printstring STRINGID_ELECTRICTERRAINENDS waitmessage 0x40 + playanimation BS_ATTACKER, B_ANIM_RESTORE_BG, NULL end2 BattleScript_MistyTerrainEnds:: printstring STRINGID_MISTYTERRAINENDS waitmessage 0x40 + playanimation BS_ATTACKER, B_ANIM_RESTORE_BG, NULL end2 BattleScript_GrassyTerrainEnds:: printstring STRINGID_GRASSYTERRAINENDS waitmessage 0x40 + playanimation BS_ATTACKER, B_ANIM_RESTORE_BG, NULL end2 BattleScript_PsychicTerrainEnds:: printstring STRINGID_PSYCHICTERRAINENDS waitmessage 0x40 + playanimation BS_ATTACKER, B_ANIM_RESTORE_BG, NULL end2 BattleScript_MudSportEnds:: diff --git a/include/battle_anim.h b/include/battle_anim.h index 2f481c5f2..2b28e92fb 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -68,6 +68,7 @@ s16 KeepPanInRange(s16 a, int oldPan); s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan); void sub_80A4720(u16 a, u16 *b, u32 c, u8 d); void sub_80A477C(bool8); +void LoadMoveBg(u16 bgId); // battle_intro.c void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value); diff --git a/include/battle_bg.h b/include/battle_bg.h index 167ea5cf7..43295476f 100644 --- a/include/battle_bg.h +++ b/include/battle_bg.h @@ -9,5 +9,6 @@ void LoadBattleTextboxAndBackground(void); void InitLinkBattleVsScreen(u8 taskId); void DrawBattleEntryBackground(void); bool8 LoadChosenBattleElement(u8 caseId); +void DrawTerrainTypeBattleBackground(void); #endif // GUARD_BATTLE_BG_H diff --git a/include/constants/battle.h b/include/constants/battle.h index 2c573dcbe..40c604c9e 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -234,6 +234,8 @@ #define STATUS_FIELD_ION_DELUGE 0x400 #define STATUS_FIELD_FAIRY_LOCK 0x800 +#define STATUS_TERRAIN_ANY (STATUS_FIELD_GRASSY_TERRAIN | STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_PSYCHIC_TERRAIN) + // Flags describing move's result #define MOVE_RESULT_MISSED (1 << 0) #define MOVE_RESULT_SUPER_EFFECTIVE (1 << 1) diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index 871aa1e35..406606050 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -525,6 +525,7 @@ #define B_ANIM_ILLUSION_OFF 0x1C #define B_ANIM_FORM_CHANGE 0x1D #define B_ANIM_SLIDE_OFFSCREEN 0x1E // for Emergency Exit +#define B_ANIM_RESTORE_BG 0x1F // for Terrain Endings // special animations table #define B_ANIM_LVL_UP 0x0 diff --git a/src/battle_anim.c b/src/battle_anim.c index 6482ccc6b..9f914f1e8 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -88,7 +88,6 @@ static void Task_PanFromInitialToTarget(u8 taskId); static void Task_LoopAndPlaySE(u8 taskId); static void Task_WaitAndPlaySE(u8 taskId); static void LoadDefaultBg(void); -static void LoadMoveBg(u16 bgId); // ewram EWRAM_DATA static const u8 *sBattleAnimScriptPtr = NULL; @@ -3177,7 +3176,7 @@ static void Task_FadeToBg(u8 taskId) } } -static void LoadMoveBg(u16 bgId) +void LoadMoveBg(u16 bgId) { if (IsContest()) { @@ -3205,6 +3204,8 @@ static void LoadDefaultBg(void) { if (IsContest()) LoadContestBgAfterMoveAnim(); + else if (gFieldStatuses & STATUS_TERRAIN_ANY) + DrawTerrainTypeBattleBackground(); else DrawMainBattleBackground(); } diff --git a/src/battle_bg.c b/src/battle_bg.c index d9d6bf87c..7ae123c12 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -1,5 +1,6 @@ #include "global.h" #include "battle.h" +#include "battle_anim.h" #include "battle_bg.h" #include "battle_main.h" #include "battle_message.h" @@ -23,6 +24,7 @@ #include "constants/map_types.h" #include "constants/songs.h" #include "constants/trainers.h" +#include "constants/battle_anim.h" struct BattleBackground { @@ -1413,3 +1415,26 @@ bool8 LoadChosenBattleElement(u8 caseId) return ret; } + +void DrawTerrainTypeBattleBackground(void) +{ + switch (gFieldStatuses & STATUS_TERRAIN_ANY) + { + case STATUS_FIELD_GRASSY_TERRAIN: + LoadMoveBg(BG_GRASSY_TERRAIN); + break; + case STATUS_FIELD_MISTY_TERRAIN: + LoadMoveBg(BG_MISTY_TERRAIN); + break; + case STATUS_FIELD_ELECTRIC_TERRAIN: + LoadMoveBg(BG_ELECTRIC_TERRAIN); + break; + case STATUS_FIELD_PSYCHIC_TERRAIN: + LoadMoveBg(BG_PSYCHIC_TERRAIN); + break; + default: + DrawMainBattleBackground(); + break; + } +} + diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d0811e77d..d59d579d3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6952,7 +6952,7 @@ static void HandleTerrainMove(u32 moveEffect) } else { - gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_GRASSY_TERRAIN | STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_PSYCHIC_TERRAIN); + gFieldStatuses &= ~STATUS_TERRAIN_ANY; gFieldStatuses |= statusFlag; if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_TERRAIN_EXTENDER) *timer = 8; From 5c658c695007a6ebb913bfb970e55a0ee2ee33aa Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 17 Nov 2020 20:26:09 -0700 Subject: [PATCH 02/15] config option for terrain bg change --- include/constants/battle_config.h | 1 + src/battle_anim.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index d7f178570..fc1e0d54e 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -164,5 +164,6 @@ #define B_NEW_SURF_PARTICLE_PALETTE TRUE // If set to TRUE, it updates Surf's wave palette. #define HIDE_HEALTHBOXES_DURING_ANIMS TRUE //if TRUE, hides healthboxes during move animations +#define B_TERRAIN_BG_CHANGE TRUE //if TRUE, terrain moves permanently change the default battle bg until the effect fades #endif // GUARD_CONSTANTS_BATTLE_CONFIG_H diff --git a/src/battle_anim.c b/src/battle_anim.c index 9f914f1e8..cb7ea5bea 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -3204,8 +3204,10 @@ static void LoadDefaultBg(void) { if (IsContest()) LoadContestBgAfterMoveAnim(); + #if B_TERRAIN_BG_CHANGE == TRUE else if (gFieldStatuses & STATUS_TERRAIN_ANY) DrawTerrainTypeBattleBackground(); + #endif else DrawMainBattleBackground(); } From ef43596a7915e34d1339c289ca67af06c35e7588 Mon Sep 17 00:00:00 2001 From: Evan Date: Thu, 19 Nov 2020 15:16:27 -0700 Subject: [PATCH 03/15] toggleable manual ability popup destruction --- asm/macros/battle_script.inc | 4 ++++ include/battle.h | 2 ++ include/battle_interface.h | 1 + include/constants/battle_script_commands.h | 2 ++ src/battle_interface.c | 13 ++++++++++++- src/battle_script_commands.c | 3 +++ 6 files changed, 24 insertions(+), 1 deletion(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 41a51efeb..1f0b6c807 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1755,6 +1755,10 @@ various \battler, VARIOUS_JUMP_IF_ABSENT .4byte \ptr .endm + + .macro destroyabilitypopup + various BS_ABILITY_BATTLER, VARIOUS_DESTROY_ABILITY_POPUP + .endm @ helpful macros .macro setstatchanger stat:req, stages:req, down:req diff --git a/include/battle.h b/include/battle.h index 13fe13171..1084d2bb9 100644 --- a/include/battle.h +++ b/include/battle.h @@ -520,6 +520,7 @@ struct BattleStruct u8 savedBattlerTarget; bool8 ateBoost[MAX_BATTLERS_COUNT]; u8 activeAbilityPopUps; // as bits for each battler + u8 abilityPopUpSpriteIds[MAX_BATTLERS_COUNT][2]; //two per battler bool8 throwingPokeBall; struct MegaEvolutionData mega; const u8 *trainerSlideMsg; @@ -611,6 +612,7 @@ struct BattleScripting u16 moveEffect; u16 multihitMoveEffect; u8 illusionNickHack; // To properly display nick in STRINGID_ENEMYABOUTTOSWITCHPKMN. + bool8 fixedPopup; // force ability popup to stick until manually called back }; // rom_80A5C6C diff --git a/include/battle_interface.h b/include/battle_interface.h index 32c679285..d06c44e88 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -92,5 +92,6 @@ s32 MoveBattleBar(u8 battler, u8 healthboxSpriteId, u8 whichBar, u8 arg3); u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale); u8 GetHPBarLevel(s16 hp, s16 maxhp); void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle); +void DestroyAbilityPopUp(u8 battlerId); #endif // GUARD_BATTLE_INTERFACE_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index b081907ec..36165558b 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -35,6 +35,7 @@ #define sMOVE_EFFECT gBattleScripting + 0x2E #define sMULTIHIT_EFFECT gBattleScripting + 0x30 #define sILLUSION_NICK_HACK gBattleScripting + 0x32 +#define sFIXED_ABILITY_POPUP gBattleScripting + 0x33 #define cMULTISTRING_CHOOSER gBattleCommunication + 5 @@ -165,6 +166,7 @@ #define VARIOUS_SET_LAST_USED_ITEM 99 #define VARIOUS_PARALYZE_TYPE_IMMUNITY 100 #define VARIOUS_JUMP_IF_ABSENT 101 +#define VARIOUS_DESTROY_ABILITY_POPUP 102 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_interface.c b/src/battle_interface.c index d302cd646..c97705edf 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3062,6 +3062,9 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle) gSprites[spriteId1].tRightToLeft = FALSE; gSprites[spriteId2].tRightToLeft = FALSE; } + + gBattleStruct->abilityPopUpSpriteIds[gBattleAnimAttacker][0] = spriteId1; + gBattleStruct->abilityPopUpSpriteIds[gBattleAnimAttacker][1] = spriteId2; taskId = CreateTask(Task_FreeAbilityPopUpGfx, 5); gTasks[taskId].tSpriteId1 = spriteId1; @@ -3110,11 +3113,19 @@ static void SpriteCb_AbilityPopUp(struct Sprite *sprite) } else { - sprite->tFrames--; + if (!gBattleScripting.fixedPopup) + sprite->tFrames--; } } } +void DestroyAbilityPopUp(u8 battlerId) +{ + gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][0]].tFrames = 0; + gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][1]].tFrames = 0; + gBattleScripting.fixedPopup = FALSE; +} + static void Task_FreeAbilityPopUpGfx(u8 taskId) { if (!gSprites[gTasks[taskId].tSpriteId1].inUse diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d0811e77d..ad3629cd6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8300,6 +8300,9 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 7; } return; + case VARIOUS_DESTROY_ABILITY_POPUP: + DestroyAbilityPopUp(gActiveBattler); + break; } gBattlescriptCurrInstr += 3; From 9472bc894f00768aa5a0ad78da12be57f595594a Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 20 Nov 2020 08:26:50 -0700 Subject: [PATCH 04/15] formatting --- src/battle_interface.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/battle_interface.c b/src/battle_interface.c index c97705edf..267b06ece 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -3063,8 +3063,8 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle) gSprites[spriteId2].tRightToLeft = FALSE; } - gBattleStruct->abilityPopUpSpriteIds[gBattleAnimAttacker][0] = spriteId1; - gBattleStruct->abilityPopUpSpriteIds[gBattleAnimAttacker][1] = spriteId2; + gBattleStruct->abilityPopUpSpriteIds[gBattleAnimAttacker][0] = spriteId1; + gBattleStruct->abilityPopUpSpriteIds[gBattleAnimAttacker][1] = spriteId2; taskId = CreateTask(Task_FreeAbilityPopUpGfx, 5); gTasks[taskId].tSpriteId1 = spriteId1; @@ -3121,8 +3121,8 @@ static void SpriteCb_AbilityPopUp(struct Sprite *sprite) void DestroyAbilityPopUp(u8 battlerId) { - gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][0]].tFrames = 0; - gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][1]].tFrames = 0; + gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][0]].tFrames = 0; + gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][1]].tFrames = 0; gBattleScripting.fixedPopup = FALSE; } From 9ec67db8fa3ed8e200c506d5948b56012c328181 Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 24 Nov 2020 17:03:40 -0500 Subject: [PATCH 05/15] keep permanent terrain bg from party menu, bag --- src/battle_bg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/battle_bg.c b/src/battle_bg.c index 7ae123c12..ca1893d65 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -865,7 +865,11 @@ void LoadBattleTextboxAndBackground(void) CopyBgTilemapBufferToVram(0); LoadCompressedPalette(gBattleTextboxPalette, 0, 0x40); LoadBattleMenuWindowGfx(); - DrawMainBattleBackground(); + #if B_TERRAIN_BG_CHANGE == TRUE + DrawTerrainTypeBattleBackground(); + #else + DrawMainBattleBackground(); + #endif } static void DrawLinkBattleParticipantPokeballs(u8 taskId, u8 multiplayerId, u8 bgId, u8 destX, u8 destY) From 7c6e74ab69ca4800b61d5f9006060ec3cb87e59e Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 24 Nov 2020 21:17:31 -0500 Subject: [PATCH 06/15] update terrain bg config option comment --- 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 fc1e0d54e..55c62af98 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -164,6 +164,6 @@ #define B_NEW_SURF_PARTICLE_PALETTE TRUE // If set to TRUE, it updates Surf's wave palette. #define HIDE_HEALTHBOXES_DURING_ANIMS TRUE //if TRUE, hides healthboxes during move animations -#define B_TERRAIN_BG_CHANGE TRUE //if TRUE, terrain moves permanently change the default battle bg until the effect fades +#define B_TERRAIN_BG_CHANGE TRUE // If TRUE, terrain moves permanently change the default battle background until the effect fades. #endif // GUARD_CONSTANTS_BATTLE_CONFIG_H From 3102e499da6af188fff123edce7e36427112f2f2 Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 2 Dec 2020 14:23:03 -0500 Subject: [PATCH 07/15] fix babydoll eyes anim priority --- data/battle_anim_scripts.s | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 70ed22c9e..69c2fe6cf 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -9451,6 +9451,7 @@ Move_BABY_DOLL_EYES:: loadspritegfx ANIM_TAG_PINK_CLOUD loadspritegfx ANIM_TAG_OPENING_EYE @eye setalpha 8, 8 + monbg ANIM_DEF_PARTNER launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x0 0x0 0xA 0x7FFF waitforvisualfinish launchtemplate gOpeningEyeSpriteTemplate 0x5 0x4 0x0 0x0 0x1 0x0 @@ -9463,6 +9464,7 @@ Move_BABY_DOLL_EYES:: launchtask AnimTask_ShakeMon2 0x2 0x5 0x3 0x1 0x0 0x9 0x1 launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x0 0xA 0x0 0x7FFF waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER blendoff end From 5c72a89105c11918656f1b60004e7fcfc8739c21 Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 2 Dec 2020 15:03:49 -0500 Subject: [PATCH 08/15] fix B_BUFF_ABILITY --- src/battle_message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_message.c b/src/battle_message.c index 22561dd07..35ccc6e26 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -3432,7 +3432,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst) srcID += 2; break; case B_BUFF_ABILITY: // ability names - StringAppend(dst, gAbilityNames[src[srcID + 1]]); + StringAppend(dst, gAbilityNames[T1_READ_16(&src[srcID + 1])]); srcID += 3; break; case B_BUFF_ITEM: // item name From 49ca76f880db267f9812e1b7720dd2acb65e0d2e Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 5 Dec 2020 20:39:05 -0300 Subject: [PATCH 09/15] Made Techno Blast's animation change depending on the Drive held --- src/battle_anim_new.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 0b54b4c40..f36eac6ae 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -5001,8 +5001,9 @@ void AnimTask_PurpleFlamesOnTarget(u8 taskId) void AnimTask_TechnoBlast(u8 taskId) { - //gBattleAnimArgs[0] = gItems[GetBattlerPartyData(gBattleAnimAttacker).item].holdEffectParam; - gBattleAnimArgs[0] = ItemId_GetHoldEffectParam(gBattleMons[gBattleAnimAttacker].item); + if (ItemId_GetHoldEffect(gBattleMons[gBattleAnimAttacker].item) == HOLD_EFFECT_DRIVE) + gBattleAnimArgs[0] = ItemId_GetSecondaryId(gBattleMons[gBattleAnimAttacker].item); + else + gBattleAnimArgs[0] = 0; DestroyAnimVisualTask(taskId); } - From b6d06817795caa72c6afcd3fb49c46f5d193679a Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 5 Dec 2020 20:50:33 -0300 Subject: [PATCH 10/15] Included hold_effects.h in battle_anim_new.c Otherwise the file won't recognize HOLD_EFFECT_PLATE and will refuse to build a ROM. --- src/battle_anim_new.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index f36eac6ae..9574f974b 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -14,6 +14,7 @@ #include "battle_scripts.h" #include "battle_controllers.h" #include "constants/moves.h" +#include "constants/hold_effects.h" //// function declarations static void SpriteCB_SpriteToCentreOfSide(struct Sprite* sprite); From 37aeeae27780e68c9de1bea467e80b7b730a0e65 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 5 Dec 2020 20:25:03 -0700 Subject: [PATCH 11/15] fix terrain bg on subsequent battle start --- src/battle_util2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_util2.c b/src/battle_util2.c index 081b73621..55f710a77 100644 --- a/src/battle_util2.c +++ b/src/battle_util2.c @@ -45,7 +45,8 @@ void FreeBattleResources(void) { if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) FreeTrainerHillBattleStruct(); - + + gFieldStatuses = 0; if (gBattleResources != NULL) { FREE_AND_SET_NULL(gBattleStruct); From 426ea191ad06b91604441c015fac671f6bc678cb Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 5 Dec 2020 21:04:12 -0700 Subject: [PATCH 12/15] style fix --- include/battle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/battle.h b/include/battle.h index 4b7ad8d1d..488e0fc51 100644 --- a/include/battle.h +++ b/include/battle.h @@ -520,7 +520,7 @@ struct BattleStruct u8 savedBattlerTarget; bool8 ateBoost[MAX_BATTLERS_COUNT]; u8 activeAbilityPopUps; // as bits for each battler - u8 abilityPopUpSpriteIds[MAX_BATTLERS_COUNT][2]; //two per battler + u8 abilityPopUpSpriteIds[MAX_BATTLERS_COUNT][2]; // two per battler bool8 throwingPokeBall; struct MegaEvolutionData mega; const u8 *trainerSlideMsg; From 9ec2e44f4cebd66845247b2f2f1188a1442e7ded Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 11 Dec 2020 21:36:59 -0300 Subject: [PATCH 13/15] Updated Spite --- include/constants/battle_config.h | 2 ++ src/battle_script_commands.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 55c62af98..8771ac73b 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -109,6 +109,8 @@ #define B_DISABLE_TURNS GEN_6 // Disable's turns. See Cmd_disablelastusedattack. #define B_INCINERATE_GEMS GEN_6 // In Gen6+, Incinerate can destroy Gems. #define B_MINIMIZE_DMG_ACC GEN_6 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks. +#define B_PP_REDUCED_BY_SPITE GEN_6 // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5. +#define B_SPITE_CAN_FAIL GEN_6 // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP. // Ability settings #define B_ABILITY_WEATHER GEN_6 // In Gen5+, weather caused by abilities lasts the same amount of turns as induced from a move. Before, they lasted till the battle's end or weather change by a move. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 16e2989f8..4e9537e49 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10192,9 +10192,18 @@ static void Cmd_tryspiteppreduce(void) break; } + #if B_CAN_SPITE_FAIL <= GEN_3 if (i != MAX_MON_MOVES && gBattleMons[gBattlerTarget].pp[i] > 1) + #else + if (i != MAX_MON_MOVES && gBattleMons[gBattlerTarget].pp[i] != 0) + #endif { + #if B_PP_REDUCED_BY_SPITE <= GEN_3 s32 ppToDeduct = (Random() & 3) + 2; + #else + s32 ppToDeduct = 4; + #endif + if (gBattleMons[gBattlerTarget].pp[i] < ppToDeduct) ppToDeduct = gBattleMons[gBattlerTarget].pp[i]; From 17a9555715ba06acd6cea56f4b4dd7ce7dd5ddc9 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 11 Dec 2020 21:43:18 -0300 Subject: [PATCH 14/15] Oopsie. --- 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 8771ac73b..ab03e1bde 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -110,7 +110,7 @@ #define B_INCINERATE_GEMS GEN_6 // In Gen6+, Incinerate can destroy Gems. #define B_MINIMIZE_DMG_ACC GEN_6 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks. #define B_PP_REDUCED_BY_SPITE GEN_6 // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5. -#define B_SPITE_CAN_FAIL GEN_6 // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP. +#define B_CAN_SPITE_FAIL GEN_6 // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP. // Ability settings #define B_ABILITY_WEATHER GEN_6 // In Gen5+, weather caused by abilities lasts the same amount of turns as induced from a move. Before, they lasted till the battle's end or weather change by a move. From 33d7f224947ddb3c47e1ebe42260ea38cc9682b5 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 11 Dec 2020 21:49:03 -0300 Subject: [PATCH 15/15] Improved the comment of B_STANCE_CHANGE_FAIL --- 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 55c62af98..9b017833d 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -113,7 +113,7 @@ // Ability settings #define B_ABILITY_WEATHER GEN_6 // In Gen5+, weather caused by abilities lasts the same amount of turns as induced from a move. Before, they lasted till the battle's end or weather change by a move. #define B_GALE_WINGS GEN_6 // In Gen7+ requires full HP to trigger. -#define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Aegislash's form change does not happen, if the Pokémon cannot use a move, because of confusion, paralysis, etc. In gen6, the form change occurs despite not being able to move. +#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_6 // In Gen6+, ghosts can escape even when blocked by abilities such as Shadow Tag. #define B_MOODY_ACC_EVASION GEN_6 // In Gen8+, Moody CANNOT raise Accuray and Evasion any more. #define B_FLASH_FIRE_FROZEN GEN_6 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before.