diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index a84796cc5..b00cd0aaf 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -24890,6 +24890,13 @@ General_AffectionHangedOn:: loopsewithpan SE_M_CHARM, SOUND_PAN_ATTACKER, 12, 3 createvisualtask AnimTask_SwayMon, 5, 0, 12, 4096, 4, ANIM_ATTACKER delay 15 + launchtask AnimTask_AffectionHangedOn 0x5 0x0 + jumpargeq 0x0, FRIENDSHIP_MAX, General_AffectionHangedOn_6Hearts + jumpargeq 0x0, FRIENDSHIP_GE_200, General_AffectionHangedOn_5Hearts + jumpargeq 0x0, FRIENDSHIP_GE_150, General_AffectionHangedOn_4Hearts + jumpargeq 0x0, FRIENDSHIP_GE_100, General_AffectionHangedOn_3Hearts + end +General_AffectionHangedOn_6Hearts: createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, 160, -32 createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, -256, -40 createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, 128, -16 @@ -24898,6 +24905,27 @@ General_AffectionHangedOn:: createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, -384, -31 waitforvisualfinish end +General_AffectionHangedOn_5Hearts: + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, 160, -32 + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, -256, -40 + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, 128, -16 + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, 416, -38 + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, -128, -22 + waitforvisualfinish + end +General_AffectionHangedOn_4Hearts: + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, 160, -32 + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, -256, -40 + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, 128, -16 + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, 416, -38 + waitforvisualfinish + end +General_AffectionHangedOn_3Hearts: + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, 160, -32 + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, -256, -40 + createsprite gRedHeartBurstSpriteTemplate, ANIM_ATTACKER, 3, 128, -16 + waitforvisualfinish + end SnatchMoveTrySwapFromSubstitute: createvisualtask AnimTask_IsAttackerBehindSubstitute, 2 diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 96faf23dd..6079889d1 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -18,6 +18,7 @@ #include "constants/moves.h" #include "constants/hold_effects.h" #include "constants/items.h" +#include "constants/pokemon.h" // function declarations static void SpriteCB_SpriteToCentreOfSide(struct Sprite* sprite); @@ -7895,3 +7896,28 @@ void AnimTask_TerrainPulse(u8 taskId) } DestroyAnimVisualTask(taskId); } + +void AnimTask_AffectionHangedOn(u8 taskId) +{ + int side = GetBattlerSide(gBattleAnimTarget); + struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty; + + switch (GetMonFriendshipScore(&party[gBattlerPartyIndexes[gBattleAnimTarget]])) + { + case FRIENDSHIP_MAX: + gBattleAnimArgs[0] = FRIENDSHIP_MAX; + break; + case FRIENDSHIP_GE_200: + gBattleAnimArgs[0] = FRIENDSHIP_GE_200; + break; + case FRIENDSHIP_GE_150: + gBattleAnimArgs[0] = FRIENDSHIP_GE_150; + break; + case FRIENDSHIP_GE_100: + gBattleAnimArgs[0] = FRIENDSHIP_GE_100; + break; + default: + break; + } + DestroyAnimVisualTask(taskId); +}