From ef43596a7915e34d1339c289ca67af06c35e7588 Mon Sep 17 00:00:00 2001 From: Evan Date: Thu, 19 Nov 2020 15:16:27 -0700 Subject: [PATCH 01/12] 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 02/12] 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 49ca76f880db267f9812e1b7720dd2acb65e0d2e Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 5 Dec 2020 20:39:05 -0300 Subject: [PATCH 03/12] 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 04/12] 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 42a06c6003e31aedbe3fa52e597891d811189d1c Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 5 Dec 2020 21:23:59 -0300 Subject: [PATCH 05/12] Fixed softlock caused by the majority of Techno Blast's animations And made the checks that sets its animation use the Type constants instead of their internal IDs. --- data/battle_anim_scripts.s | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index cf11f4d6a..0e3862250 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -6,6 +6,7 @@ .include "asm/macros.inc" .include "asm/macros/battle_anim_script.inc" .include "constants/constants.inc" +#include "constants/pokemon.h" .section script_data, "aw", %progbits @@ -6745,10 +6746,10 @@ Move_SEARING_SHOT: Move_TECHNO_BLAST: launchtask AnimTask_TechnoBlast 0x5 0x0 - jumpargeq 0x0, 10, TechnoBlastFire - jumpargeq 0x0, 11, TechnoBlastWater - jumpargeq 0x0, 13, TechnoBlastElectric - jumpargeq 0x0, 15, TechnoBlastIce + jumpargeq 0x0, TYPE_FIRE, TechnoBlastFire + jumpargeq 0x0, TYPE_WATER, TechnoBlastWater + jumpargeq 0x0, TYPE_ELECTRIC, TechnoBlastElectric + jumpargeq 0x0, TYPE_ICE, TechnoBlastIce TechnoBlastNormal: loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT @charge animation loadspritegfx ANIM_TAG_ORBS @circles @@ -6884,7 +6885,7 @@ TechnoBlastElectric: launchtemplate gTechnoBlastYellowSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x0 0x28 0x0 launchtemplate gTechnoBlastYellowSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x40 0x28 0x1 launchtemplate gTechnoBlastYellowSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x80 0x28 0x0 - launchtemplate gTechnoBlastYellowSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e SOUND_PAN_ATTACKER 0x28 0x2 + launchtemplate gTechnoBlastYellowSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x0 0x28 0x2 launchtemplate gTechnoBlastYellowSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x20 0x28 0x0 launchtemplate gTechnoBlastYellowSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x60 0x28 0x1 launchtemplate gTechnoBlastYellowSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0xa0 0x28 0x0 @@ -6893,20 +6894,20 @@ TechnoBlastElectric: playsewithpan SE_M_EMBER, SOUND_PAN_ATTACKER launchtask AnimTask_ShakeMon2 0x2 0x5 0x1 0x4 0x0 0x5 0x1 launchtemplate gTechnoBlastYellowSmokeTemplate 0x82, 0x4, 0x8 0x8 0x1 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0, ANIM_TARGET - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1 delay 0x2 launchtemplate gTechnoBlastYellowSmokeTemplate 0x82, 0x4, 0xfff8 0xfff8 0x1 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2, ANIM_TARGET - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0 delay 0x2 launchtemplate gTechnoBlastYellowSmokeTemplate 0x82, 0x4, 0x8 0xfff8 0x1 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1, ANIM_TARGET - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2 delay 0x2 launchtemplate gTechnoBlastYellowSmokeTemplate 0x82, 0x4, 0xfff8 0x8 0x1 0x0 - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0, ANIM_TARGET - launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1, ANIM_TARGET + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0 + launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1 waitforvisualfinish launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x1 0xC 0x0 0x0 waitforvisualfinish @@ -7018,7 +7019,7 @@ TechnoBlastWater: launchtemplate gTechnoBlastBlueSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x0 0x28 0x0 launchtemplate gTechnoBlastBlueSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x40 0x28 0x1 launchtemplate gTechnoBlastBlueSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x80 0x28 0x0 - launchtemplate gTechnoBlastBlueSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e SOUND_PAN_ATTACKER 0x28 0x2 + launchtemplate gTechnoBlastBlueSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x0 0x28 0x2 launchtemplate gTechnoBlastBlueSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x20 0x28 0x0 launchtemplate gTechnoBlastBlueSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x60 0x28 0x1 launchtemplate gTechnoBlastBlueSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0xa0 0x28 0x0 @@ -7071,7 +7072,7 @@ TechnoBlastFire: launchtemplate gTechnoBlastRedSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x0 0x28 0x0 launchtemplate gTechnoBlastRedSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x40 0x28 0x1 launchtemplate gTechnoBlastRedSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x80 0x28 0x0 - launchtemplate gTechnoBlastRedSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e SOUND_PAN_ATTACKER 0x28 0x2 + launchtemplate gTechnoBlastRedSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x0 0x28 0x2 launchtemplate gTechnoBlastRedSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x20 0x28 0x0 launchtemplate gTechnoBlastRedSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x60 0x28 0x1 launchtemplate gTechnoBlastRedSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0xa0 0x28 0x0 @@ -7080,13 +7081,13 @@ TechnoBlastFire: playsewithpan SE_M_EMBER, SOUND_PAN_ATTACKER launchtask AnimTask_ShakeMon2 0x2 0x5 0x1 0x4 0x0 0x5 0x1 launchtemplate gTechnoBlastRedSmokeTemplate 0x82, 0x4, 0x8 0x8 0x1 0x0 - launchtemplate gFireSpreadSpriteTemplate 0x81 0x5 0x0 0xa SOUND_PAN_ATTACKER 0xb0 0x28 - launchtemplate gFireSpreadSpriteTemplate 0x81 0x5 0x0 0xa 0xff40 0xf0 0x28 - launchtemplate gFireSpreadSpriteTemplate 0x81 0x5 0x0 0xa SOUND_PAN_ATTACKER 0xff60 0x28 - launchtemplate gFireSpreadSpriteTemplate 0x81 0x5 0x0 0xa 0xff40 0xff90 0x28 - launchtemplate gFireSpreadSpriteTemplate 0x81 0x5 0x0 0xa 0xa0 0x30 0x28 - launchtemplate gFireSpreadSpriteTemplate 0x81 0x5 0x0 0xa 0xff20 0xffe0 0x28 - launchtemplate gFireSpreadSpriteTemplate 0x81 0x5 0x0 0xa 0x70 0xff80 0x28 + createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 10, 192, 176, 40 + createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 10, -192, 240, 40 + createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 10, 192, -160, 40 + createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 10, -192, -112, 40 + createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 10, 160, 48, 40 + createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 10, -224, -32, 40 + createsprite gFireSpreadSpriteTemplate, ANIM_TARGET, 1, 0, 10, 112, -128, 40 delay 0x2 launchtemplate gTechnoBlastRedSmokeTemplate 0x82, 0x4, 0xfff8 0xfff8 0x1 0x0 delay 0x2 @@ -7155,7 +7156,7 @@ TechnoBlastIce: launchtemplate gTechnoBlastIceSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x0 0x28 0x0 launchtemplate gTechnoBlastIceSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x40 0x28 0x1 launchtemplate gTechnoBlastIceSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x80 0x28 0x0 - launchtemplate gTechnoBlastIceSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e SOUND_PAN_ATTACKER 0x28 0x2 + launchtemplate gTechnoBlastIceSparkTemplate 0x84 0x7 0xa 0x0 0x10 0x1e 0x0 0x28 0x2 launchtemplate gTechnoBlastIceSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x20 0x28 0x0 launchtemplate gTechnoBlastIceSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0x60 0x28 0x1 launchtemplate gTechnoBlastIceSparkTemplate 0x84 0x7 0xa 0x0 0x8 0x1e 0xa0 0x28 0x0 @@ -24428,4 +24429,3 @@ Special_CriticalCaptureBallThrow: createvisualtask AnimTask_IsBallBlockedByTrainer, 2 jumpreteq -1, BallThrowTrainerBlock goto BallThrowEnd - From 426ea191ad06b91604441c015fac671f6bc678cb Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 5 Dec 2020 21:04:12 -0700 Subject: [PATCH 06/12] 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 964ec53a65815aa28f3e63e42fa219b96ae10943 Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 8 Dec 2020 11:36:19 -0700 Subject: [PATCH 07/12] port cfru shadow sneak anim --- data/battle_anim_scripts.s | 52 ++++++++++++++++++++++++-------------- src/battle_anim_new.c | 12 +++++++++ 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index cf11f4d6a..df87c770e 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -2799,28 +2799,42 @@ Move_FIRE_FANG: end Move_SHADOW_SNEAK: - loadspritegfx ANIM_TAG_LICK - setalpha 0, 16 - delay 1 - createvisualtask AnimTask_InitMementoShadow, 2 - delay 1 - createvisualtask AnimTask_MoveAttackerMementoShadow, 5 - playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER - delay 48 - playsewithpan SE_M_PSYBEAM2, SOUND_PAN_ATTACKER + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_WHITE_SHADOW @Destiny Bond + loadspritegfx ANIM_TAG_QUICK_GUARD_HAND @Black Colour + loadspritegfx ANIM_TAG_POISON_BUBBLE @Poison + loadspritegfx ANIM_TAG_HANDS_AND_FEET + monbg ANIM_ATTACKER + launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x1 0x0 0x7 0x0000 waitforvisualfinish - createvisualtask sub_8114470, 2 - setalpha 0, 16 - delay 1 - playsewithpan SE_M_LICK, SOUND_PAN_TARGET - createsprite gLickSpriteTemplate, ANIM_TARGET, 2, 0, 0 - createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 16, 1 + playsewithpan SE_M_FAINT_ATTACK, SOUND_PAN_ATTACKER + launchtask AnimTask_TranslateMonEllipticalRespectSide 0x2 0x5 0x0 0x12 0x6 0x1 0x3 + launchtask AnimTask_AttackerFadeToInvisible 0x2 0x1 0x1 + waitforvisualfinish + clearmonbg ANIM_ATTACKER + invisible ANIM_ATTACKER + delay 0x1 + launchtask AnimTask_DestinyBondWhiteShadow 0x5 0x2 0x0 0x30 + delay 0x30 + launchtask AnimTask_BlendColorCycle 0x2 0x6 ANIM_PAL_DEF 0x2 0x2 0x0 0xF 0x0 + createsprite gShadowSneakImpactSpriteTemplate, ANIM_TARGET, 2, 0xfff6, 0xfff6, 0x0 + call ShadowSneakMovement + createsprite gShadowSneakImpactSpriteTemplate, ANIM_TARGET, 2, 0xa, 0x14, 0x0 + call ShadowSneakMovement + createsprite gShadowSneakImpactSpriteTemplate, ANIM_TARGET, 2, 0xfffb, 0xa, 0x0 + call ShadowSneakMovement + createsprite gShadowSneakImpactSpriteTemplate, ANIM_TARGET, 2, 0x11, 0xfff4, 0x0 + call ShadowSneakMovement + waitforvisualfinish + visible ANIM_ATTACKER + launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x1 0x7 0x0 0x0000 waitforvisualfinish - clearmonbg_23 ANIM_TARGET - delay 1 - blendoff - delay 1 end +ShadowSneakMovement: + playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET + launchtask AnimTask_ShakeMon 0x2 0x5 ANIM_TARGET 0x3 0x0 0x6 0x1 + delay 0x4 + return Move_MUD_BOMB: loadspritegfx ANIM_TAG_MUD_SAND diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 0b54b4c40..e7bb23d90 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -66,6 +66,18 @@ static const union AffineAnimCmd sSquishTargetAffineAnimCmds[] = }; //// GEN 4 +// shadow sneak +const struct SpriteTemplate gShadowSneakImpactSpriteTemplate = +{ + .tileTag = ANIM_TAG_IMPACT, + .paletteTag = ANIM_TAG_HANDS_AND_FEET, + .oam = &gOamData_AffineNormal_ObjBlend_32x32, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gAffineAnims_IceCrystalHit, + .callback = AnimIceEffectParticle +}; + // power trick const struct SpriteTemplate gPowerTrickSpriteTemplate = { From ee59fab143ee4ff79227c9848bfea3acc48cfdc5 Mon Sep 17 00:00:00 2001 From: NamNguyenUTSA <47985283+NamNguyenUTSA@users.noreply.github.com> Date: Fri, 11 Dec 2020 08:31:00 -0600 Subject: [PATCH 08/12] Allow player partner NPC's to mega evolve (i.e., Steven at Mossdeep) --- src/battle_controller_player_partner.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 9743e92e0..06a73beab 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -1526,7 +1526,10 @@ static void PlayerPartnerHandleChooseMove(void) gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); } - BtlController_EmitTwoReturnValues(1, 10, chosenMoveId | (gBattlerTarget << 8)); + if (CanMegaEvolve(gActiveBattler)) // If partner can mega evolve, do it. + BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (RET_MEGA_EVOLUTION) | (gBattlerTarget << 8)); + else + BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBattlerTarget << 8)); PlayerPartnerBufferExecCompleted(); } From 9ec2e44f4cebd66845247b2f2f1188a1442e7ded Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 11 Dec 2020 21:36:59 -0300 Subject: [PATCH 09/12] 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 10/12] 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 11/12] 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. From 785e23222bd3a8ae7b94fa635d846906fc2a4b2d Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sun, 13 Dec 2020 21:20:23 -0300 Subject: [PATCH 12/12] Review correction --- data/battle_anim_scripts.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 0e3862250..85e69da39 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -3,10 +3,10 @@ #include "constants/rgb.h" #include "constants/songs.h" #include "constants/moves.h" +#include "constants/pokemon.h" .include "asm/macros.inc" .include "asm/macros/battle_anim_script.inc" .include "constants/constants.inc" -#include "constants/pokemon.h" .section script_data, "aw", %progbits