From 8bd7103b9d7a39c04775d63c3cc1307ab4b2252f Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 25 Aug 2022 17:29:02 -0300 Subject: [PATCH] Even more review corrections --- data/battle_scripts_1.s | 4 +--- include/battle.h | 2 +- src/battle_anim_new.c | 18 +----------------- src/battle_util.c | 14 ++++++++------ 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5cdb44597..4ba190c5c 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -421,8 +421,7 @@ BattleScript_AffectionBasedEndurance:: return BattleScript_AffectionBasedStatusHeal:: - jumpifstatus BS_ATTACKER, STATUS1_POISON, BattleScript_AffectionBasedStatus_HealPoisonString - jumpifstatus BS_ATTACKER, STATUS1_TOXIC_POISON, BattleScript_AffectionBasedStatus_HealPoisonString + jumpifstatus BS_ATTACKER, STATUS1_POISON | STATUS1_TOXIC_POISON, BattleScript_AffectionBasedStatus_HealPoisonString jumpifstatus BS_ATTACKER, STATUS1_SLEEP, BattleScript_AffectionBasedStatus_HealSleepString jumpifstatus BS_ATTACKER, STATUS1_PARALYSIS, BattleScript_AffectionBasedStatus_HealParalysisString jumpifstatus BS_ATTACKER, STATUS1_BURN, BattleScript_AffectionBasedStatus_HealBurnString @@ -442,7 +441,6 @@ BattleScript_AffectionBasedStatus_HealBurnString: goto BattleScript_AffectionBasedStatusHeal_Continue BattleScript_AffectionBasedStatus_HealFreezeString: printstring STRINGID_ATTACKERMELTEDTHEICE - goto BattleScript_AffectionBasedStatusHeal_Continue BattleScript_AffectionBasedStatusHeal_Continue: waitmessage B_WAIT_TIME_LONG clearstatus BS_ATTACKER diff --git a/include/battle.h b/include/battle.h index 7176b7378..ed77992ab 100644 --- a/include/battle.h +++ b/include/battle.h @@ -178,13 +178,13 @@ struct SpecialStatus u8 dancerOriginalTarget:3; u8 announceNeutralizingGas:1; // See Cmd_switchineffects u8 neutralizingGasRemoved:1; // See VARIOUS_TRY_END_NEUTRALIZING_GAS + u8 affectionEndured:1; s32 dmg; s32 physicalDmg; s32 specialDmg; u8 physicalBattlerId; u8 specialBattlerId; u8 changedStatsBattlerId; // Battler that was responsible for the latest stat change. Can be self. - bool8 affectionEndured:1; }; struct SideTimer diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 4e47def93..b6cc48b91 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -7902,22 +7902,6 @@ 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_200_TO_254: - gBattleAnimArgs[0] = FRIENDSHIP_200_TO_254; - break; - case FRIENDSHIP_150_TO_199: - gBattleAnimArgs[0] = FRIENDSHIP_150_TO_199; - break; - case FRIENDSHIP_100_TO_149: - gBattleAnimArgs[0] = FRIENDSHIP_100_TO_149; - break; - default: - break; - } + gBattleAnimArgs[0] = GetMonFriendshipScore(&party[gBattlerPartyIndexes[gBattleAnimTarget]]); DestroyAnimVisualTask(taskId); } diff --git a/src/battle_util.c b/src/battle_util.c index 74893a709..dbdecfb17 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2087,17 +2087,19 @@ void TryToRevertMimicry(void) u32 GetMonFriendshipScore(struct Pokemon *pokemon) { - if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == MAX_FRIENDSHIP) + u32 friendshipScore = GetMonData(pokemon, MON_DATA_FRIENDSHIP); + + if (friendshipScore == MAX_FRIENDSHIP) return FRIENDSHIP_MAX; - if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 200) + if (friendshipScore >= 200) return FRIENDSHIP_200_TO_254; - if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 150) + if (friendshipScore >= 150) return FRIENDSHIP_150_TO_199; - if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 100) + if (friendshipScore >= 100) return FRIENDSHIP_100_TO_149; - if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 50) + if (friendshipScore >= 50) return FRIENDSHIP_50_TO_99; - if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 1) + if (friendshipScore >= 1) return FRIENDSHIP_1_TO_49; return FRIENDSHIP_NONE;