Skip to content

Commit

Permalink
Merge branch '_RHH/master' into _RHH/upcoming
Browse files Browse the repository at this point in the history
  • Loading branch information
AsparagusEduardo committed Oct 24, 2024
2 parents 83439a7 + b892ad4 commit afa7ab9
Show file tree
Hide file tree
Showing 14 changed files with 3,451 additions and 45 deletions.
50 changes: 25 additions & 25 deletions data/battle_anim_scripts.s
Original file line number Diff line number Diff line change
Expand Up @@ -9280,8 +9280,8 @@ gBattleAnimMove_ThousandArrows::
playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER
waitforvisualfinish
delay 0x30
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 0x32
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 0x32
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 10, 0x32
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 10, 0x32
call ThousandArrowsDown
call ThousandArrowsDown
call ThousandArrowsDown
Expand Down Expand Up @@ -9481,8 +9481,8 @@ gBattleAnimMove_LandsWrath::
fadetobg BG_FISSURE
waitbgfadeout
playsewithpan SE_M_EARTHQUAKE, 0x0
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 0x32
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 0x32
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 10, 0x32
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 10, 0x32
createvisualtask AnimTask_PositionFissureBgOnBattler, 5, ANIM_TARGET, 5, -1
waitbgfadein
waitforvisualfinish
Expand Down Expand Up @@ -9649,8 +9649,8 @@ gBattleAnimMove_PrecipiceBlades::
fadetobg 0x15
waitbgfadeout
createvisualtask AnimTask_PositionFissureBgOnBattler, 5, ANIM_TARGET, 5, -1
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 0x5
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 0x5
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 10, 0x5
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 10, 0x5
playsewithpan SE_M_EARTHQUAKE, 0x0
createvisualtask AnimTask_IsTargetPlayerSide, 0x2
jumpargeq 0x7, ANIM_TARGET, PrecipiceBladesOpponent
Expand Down Expand Up @@ -11761,8 +11761,8 @@ gBattleAnimMove_StompingTantrum::
monbg ANIM_TARGET
createvisualtask AnimTask_Splash, 2, ANIM_ATTACKER, 3
delay 0x5
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 0x5
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 0x5
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 10, 0x5
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 10, 0x5
createsprite gStompingTantrumRockTemplate, ANIM_ATTACKER, 2, 0x0, 0x0
createsprite gStompingTantrumRockTemplate, ANIM_ATTACKER, 2, 0x0, 0x1
createsprite gStompingTantrumRockTemplate, ANIM_ATTACKER, 2, 0x0, 0x2
Expand Down Expand Up @@ -11897,8 +11897,8 @@ gBattleAnimMove_PrismaticLaser::
unloadspritegfx ANIM_TAG_ICE_CHUNK
unloadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT
delay 0x1E
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 0x32
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 0x32
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 10, 0x32
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 10, 0x32
playsewithpan SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER
call PrismaticLaserRain
call PrismaticLaserRain
Expand Down Expand Up @@ -16579,8 +16579,8 @@ gBattleAnimMove_GigatonHammer::
delay 18
createvisualtask AnimTask_SquishTarget, 0x2
delay 6
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 50
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 50
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 10, 50
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 10, 50
call GigatonHammerImpact
waitforvisualfinish
end
Expand Down Expand Up @@ -20282,8 +20282,8 @@ gBattleAnimMove_LowKick::
end

gBattleAnimMove_Earthquake::
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 10, 50
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 10, 50
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 10, 50
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 10, 50
playsewithpan SE_M_EARTHQUAKE, 0
delay 10
createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14
Expand All @@ -20293,8 +20293,8 @@ gBattleAnimMove_Earthquake::

gBattleAnimMove_Fissure::
loadspritegfx ANIM_TAG_MUD_SAND
createvisualtask AnimTask_HorizontalShake, 3, ANIM_PLAYER_RIGHT, 10, 50
createvisualtask AnimTask_HorizontalShake, 3, ANIM_TARGET, 10, 50
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 10, 50
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 10, 50
playsewithpan SE_M_EARTHQUAKE, SOUND_PAN_TARGET
delay 8
call FissureDirtPlumeFar
Expand Down Expand Up @@ -21020,13 +21020,13 @@ gBattleAnimMove_Magnitude::
MagnitudeEnd:
end
MagnitudeRegular:
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 0, 50
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 0, 50
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 0, 50
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 0, 50
loopsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET, 8, 10
goto MagnitudeEnd
MagnitudeIntense:
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 0, 50
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 0, 50
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 0, 50
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 0, 50
loopsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET, 8, 10
delay 10
createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14
Expand Down Expand Up @@ -21499,8 +21499,8 @@ gBattleAnimMove_Eruption::
createsprite gEruptionFallingRockSpriteTemplate, ANIM_ATTACKER, 40, 110, -32, 64, 50, 0
createsprite gEruptionFallingRockSpriteTemplate, ANIM_ATTACKER, 40, 60, -32, 80, 70, 1
delay 22
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 8, 60
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 8, 60
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 8, 60
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 8, 60
loopsewithpan SE_M_ROCK_THROW, SOUND_PAN_TARGET, 16, 12
delay 80
createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 40, F_PAL_BG | F_PAL_BATTLERS, 4, 4, 0, RGB_RED
Expand Down Expand Up @@ -21530,7 +21530,7 @@ gBattleAnimMove_Imprison::
waitforvisualfinish
delay 4
createsprite gRedXSpriteTemplate, ANIM_ATTACKER, 5, ANIM_ATTACKER, 40
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 1, 10
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 1, 10
playsewithpan SE_M_HYPER_BEAM, SOUND_PAN_ATTACKER
clearmonbg ANIM_DEF_PARTNER
call UnsetPsychicBg
Expand Down Expand Up @@ -29004,8 +29004,8 @@ gBattleAnimMove_BreakneckBlitz::
loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT
loadspritegfx ANIM_TAG_METEOR
loadspritegfx ANIM_TAG_FLAT_ROCK
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_RIGHT, 5, 32 @ shake screen
createvisualtask AnimTask_HorizontalShake, 5, ANIM_PLAYER_LEFT, 5, 32 @ shake banks
createvisualtask AnimTask_HorizontalShake, 5, (MAX_BATTLERS_COUNT + 1), 5, 32 @ shake screen
createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 5, 32 @ shake banks
playsewithpan SE_M_EARTHQUAKE, 0x0
monbg ANIM_ATTACKER
splitbgprio ANIM_ATTACKER
Expand Down
1 change: 1 addition & 0 deletions include/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ void SE12PanpotControl(s8 pan);
bool8 IsSEPlaying(void);
bool8 IsBGMPlaying(void);
bool8 IsSpecialSEPlaying(void);
void Task_DuckBGMForPokemonCry(u8 taskId);

#endif // GUARD_SOUND_H
3 changes: 2 additions & 1 deletion src/battle_anim_flying.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,14 @@ const struct SpriteTemplate gSkyAttackBirdSpriteTemplate =
.callback = AnimSkyAttackBird,
};

// same as AnimEllipticalGust but centered on targets
// same as AnimEllipticalGust but centered on targets in a double battle
static void AnimEllipticalGustCentered(struct Sprite *sprite)
{
if (IsDoubleBattle())
InitSpritePosToAnimTargetsCentre(sprite, FALSE);
else
InitSpritePosToAnimTarget(sprite, FALSE);

sprite->y += 20;
sprite->data[1] = 191;
sprite->callback = AnimEllipticalGust_Step;
Expand Down
13 changes: 13 additions & 0 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,20 @@ void CB2_QuitRecordedBattle(void)
m4aMPlayStop(&gMPlayInfo_SE1);
m4aMPlayStop(&gMPlayInfo_SE2);
if (gTestRunnerEnabled)
{
// Clean up potentially-leaking tasks.
// I think these leak when the battle ends soon after a
// battler is fainted.
u8 taskId;
taskId = FindTaskIdByFunc(Task_PlayerController_RestoreBgmAfterCry);
if (taskId != TASK_NONE)
DestroyTask(taskId);
taskId = FindTaskIdByFunc(Task_DuckBGMForPokemonCry);
if (taskId != TASK_NONE)
DestroyTask(taskId);

TestRunner_Battle_AfterLastTurn();
}
FreeRestoreBattleData();
FreeAllWindowBuffers();
SetMainCallback2(gMain.savedCallback);
Expand Down
2 changes: 1 addition & 1 deletion src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -5132,7 +5132,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
break;
case ABILITY_SHED_SKIN:
if ((gBattleMons[battler].status1 & STATUS1_ANY)
&& (B_ABILITY_TRIGGER_CHANCE >= GEN_4 ? RandomPercentage(RNG_SHED_SKIN, 30) : RandomChance(RNG_SHED_SKIN, 1, 3)))
&& (B_ABILITY_TRIGGER_CHANCE == GEN_4 ? RandomPercentage(RNG_SHED_SKIN, 30) : RandomChance(RNG_SHED_SKIN, 1, 3)))
{
ABILITY_HEAL_MON_STATUS:
if (gBattleMons[battler].status1 & (STATUS1_POISON | STATUS1_TOXIC_POISON))
Expand Down
2 changes: 1 addition & 1 deletion src/data/moves_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -18792,7 +18792,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_DYNAMAX] =
.type = TYPE_FAIRY,
.accuracy = 80,
.pp = 5,
.target = MOVE_TARGET_SELECTED,
.target = MOVE_TARGET_BOTH,
.priority = 0,
.category = DAMAGE_CATEGORY_SPECIAL,
.windMove = TRUE,
Expand Down
17 changes: 16 additions & 1 deletion src/pokedex_plus_hgss.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ struct PokedexView
u16 maxScrollTimer;
u16 scrollSpeed;
u16 unkArr1[4]; // Cleared, never read
u8 filler[8];
u16 originalSearchSelectionNum;
u8 filler[6];
u8 currentPage;
u8 currentPageBackup;
bool8 isSearchResults:1;
Expand Down Expand Up @@ -2139,6 +2140,7 @@ static void ResetPokedexView(struct PokedexView *pokedexView)
pokedexView->unkArr2[i] = 0;
for (i = 0; i < ARRAY_COUNT(pokedexView->unkArr3); i++)
pokedexView->unkArr3[i] = 0;
pokedexView->originalSearchSelectionNum = 0;
}

static void VBlankCB_Pokedex(void)
Expand Down Expand Up @@ -2438,6 +2440,13 @@ static bool8 LoadPokedexListPage(u8 page)
case 3:
if (page == PAGE_MAIN)
CreatePokedexList(sPokedexView->dexMode, sPokedexView->dexOrder);
if (sPokedexView->originalSearchSelectionNum != 0)
{
// when returning to search results after selecting an evo, we have to restore
// the original dexNum because the search results page doesn't rebuild the list
sPokedexListItem->dexNum = sPokedexView->originalSearchSelectionNum;
sPokedexView->originalSearchSelectionNum = 0;
}
CreateMonSpritesAtPos(sPokedexView->selectedPokemon, 0xE);
sPokedexView->statBarsSpriteId = 0xFF; //stat bars
CreateStatBars(&sPokedexView->pokedexList[sPokedexView->selectedPokemon]); //stat bars
Expand Down Expand Up @@ -6146,6 +6155,9 @@ static void Task_HandleEvolutionScreenInput(u8 taskId)
{
u16 targetSpecies = sPokedexView->sEvoScreenData.targetSpecies[sPokedexView->sEvoScreenData.menuPos];
u16 dexNum = SpeciesToNationalPokedexNum(targetSpecies);
if (sPokedexView->isSearchResults && sPokedexView->originalSearchSelectionNum == 0)
sPokedexView->originalSearchSelectionNum = sPokedexListItem->dexNum;

sPokedexListItem->dexNum = dexNum;
sPokedexListItem->seen = GetSetPokedexFlag(dexNum, FLAG_GET_SEEN);
sPokedexListItem->owned = GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT);
Expand Down Expand Up @@ -6881,6 +6893,9 @@ static void Task_HandleFormsScreenInput(u8 taskId)
{
u8 formId = sPokedexView->sFormScreenData.formIds[menuPos];
u16 formSpecies = GetFormSpeciesId(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), formId);
if (sPokedexView->isSearchResults && sPokedexView->originalSearchSelectionNum == 0)
sPokedexView->originalSearchSelectionNum = sPokedexListItem->dexNum;

if (formSpecies == GetFormSpeciesId(formSpecies, 0))
sPokedexView->formSpecies = 0;
else
Expand Down
3 changes: 1 addition & 2 deletions src/sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ extern struct ToneData gCryTable_Reverse[];

static void Task_Fanfare(u8 taskId);
static void CreateFanfareTask(void);
static void Task_DuckBGMForPokemonCry(u8 taskId);
static void RestoreBGMVolumeAfterPokemonCry(void);

static const struct Fanfare sFanfares[] = {
Expand Down Expand Up @@ -513,7 +512,7 @@ bool8 IsCryPlaying(void)
return FALSE;
}

static void Task_DuckBGMForPokemonCry(u8 taskId)
void Task_DuckBGMForPokemonCry(u8 taskId)
{
if (gPokemonCryBGMDuckingCounter)
{
Expand Down
28 changes: 28 additions & 0 deletions test/battle/ability/guard_dog.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "global.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Guard Dog raises Attack when intimidated", s16 damage)
{
u32 ability;
PARAMETRIZE { ability = ABILITY_INTIMIDATE; }
PARAMETRIZE { ability = ABILITY_SHED_SKIN; }
GIVEN {
PLAYER(SPECIES_OKIDOGI) { Ability(ABILITY_GUARD_DOG); }
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_ARBOK) { Ability(ability); }
} WHEN {
TURN { SWITCH(opponent, 1); }
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
if (ability == ABILITY_INTIMIDATE)
{
ABILITY_POPUP(opponent, ABILITY_INTIMIDATE);
ABILITY_POPUP(player, ABILITY_GUARD_DOG);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Okidogi's Attack rose!");
}
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_MUL_EQ(results[1].damage, Q_4_12(1.5), results[0].damage);
}
}
8 changes: 5 additions & 3 deletions test/battle/ability/shed_skin.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#include "global.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Shed Skin triggers 30% of the time")
SINGLE_BATTLE_TEST("Shed Skin triggers 33% of the time")
{
PASSES_RANDOMLY(3, 10, RNG_SHED_SKIN);
if (B_ABILITY_TRIGGER_CHANCE == GEN_4)
PASSES_RANDOMLY(30, 100, RNG_SHED_SKIN);
else
PASSES_RANDOMLY(33, 100, RNG_SHED_SKIN);
GIVEN {
ASSUME(B_ABILITY_TRIGGER_CHANCE >= GEN_4);
ASSUME(gMovesInfo[MOVE_TACKLE].makesContact);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_ARBOK) { Status1(STATUS1_POISON); Ability(ABILITY_SHED_SKIN); }
Expand Down
23 changes: 23 additions & 0 deletions test/battle/ability/steam_engine.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "global.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Steam Engine raises speed when hit by a Fire or Water move")
{
u16 move;

PARAMETRIZE { move = MOVE_EMBER; }
PARAMETRIZE { move = MOVE_WATER_GUN; }

GIVEN {
PLAYER(SPECIES_COALOSSAL) { Ability(ABILITY_STEAM_ENGINE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
ABILITY_POPUP(player, ABILITY_STEAM_ENGINE);
MESSAGE("Coalossal's Speed drastically rose!");
} THEN {
EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE + 6);
}
}
Loading

0 comments on commit afa7ab9

Please sign in to comment.