From 7a5c6d4d869b314ce748fe2ccff493c468fa0a91 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 25 Mar 2021 13:26:22 -0400 Subject: [PATCH] Standardize Friendship/Happiness --- asm/macros/battle_script.inc | 2 +- data/battle_scripts_1.s | 2 +- include/constants/hold_effects.h | 2 +- include/constants/vars.h | 2 +- src/battle_script_commands.c | 6 +++--- src/data/items.h | 2 +- src/field_control_avatar.c | 13 +++++++------ src/pokemon.c | 4 ++-- 8 files changed, 17 insertions(+), 16 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 8f3d9faa5..f3664a1c4 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -941,7 +941,7 @@ .byte 0xb5 .endm - .macro happinesstodamagecalculation + .macro friendshiptodamagecalculation .byte 0xb6 .endm diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 6e0476182..ad9576a62 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1678,7 +1678,7 @@ BattleScript_EffectReturn:: BattleScript_EffectFrustration:: attackcanceler accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - happinesstodamagecalculation + friendshiptodamagecalculation goto BattleScript_HitFromAtkString BattleScript_EffectPresent:: diff --git a/include/constants/hold_effects.h b/include/constants/hold_effects.h index b653f5a92..5853f1708 100644 --- a/include/constants/hold_effects.h +++ b/include/constants/hold_effects.h @@ -28,7 +28,7 @@ #define HOLD_EFFECT_MACHO_BRACE 24 #define HOLD_EFFECT_EXP_SHARE 25 #define HOLD_EFFECT_QUICK_CLAW 26 -#define HOLD_EFFECT_HAPPINESS_UP 27 +#define HOLD_EFFECT_FRIENDSHIP_UP 27 #define HOLD_EFFECT_CURE_ATTRACT 28 #define HOLD_EFFECT_CHOICE_BAND 29 #define HOLD_EFFECT_FLINCH 30 diff --git a/include/constants/vars.h b/include/constants/vars.h index 625c37aa9..d3d1aba87 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -56,7 +56,7 @@ #define VAR_CYCLING_ROAD_RECORD_COLLISIONS 0x4027 #define VAR_CYCLING_ROAD_RECORD_TIME_L 0x4028 #define VAR_CYCLING_ROAD_RECORD_TIME_H 0x4029 -#define VAR_HAPPINESS_STEP_COUNTER 0x402A +#define VAR_FRIENDSHIP_STEP_COUNTER 0x402A #define VAR_POISON_STEP_COUNTER 0x402B #define VAR_RESET_RTC_ENABLE 0x402C #define VAR_ENIGMA_BERRY_AVAILABLE 0x402D diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 43c554e88..96c849cbc 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -258,7 +258,7 @@ static void Cmd_trysetperishsong(void); static void Cmd_rolloutdamagecalculation(void); static void Cmd_jumpifconfusedandstatmaxed(void); static void Cmd_furycuttercalc(void); -static void Cmd_happinesstodamagecalculation(void); +static void Cmd_friendshiptodamagecalculation(void); static void Cmd_presentdamagecalculation(void); static void Cmd_setsafeguard(void); static void Cmd_magnitudedamagecalculation(void); @@ -510,7 +510,7 @@ void (* const gBattleScriptingCommandsTable[])(void) = Cmd_rolloutdamagecalculation, //0xB3 Cmd_jumpifconfusedandstatmaxed, //0xB4 Cmd_furycuttercalc, //0xB5 - Cmd_happinesstodamagecalculation, //0xB6 + Cmd_friendshiptodamagecalculation, //0xB6 Cmd_presentdamagecalculation, //0xB7 Cmd_setsafeguard, //0xB8 Cmd_magnitudedamagecalculation, //0xB9 @@ -8471,7 +8471,7 @@ static void Cmd_furycuttercalc(void) } } -static void Cmd_happinesstodamagecalculation(void) +static void Cmd_friendshiptodamagecalculation(void) { if (gBattleMoves[gCurrentMove].effect == EFFECT_RETURN) gDynamicBasePower = 10 * (gBattleMons[gBattlerAttacker].friendship) / 25; diff --git a/src/data/items.h b/src/data/items.h index e4e7e0fbc..fc7792186 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -2250,7 +2250,7 @@ const struct Item gItems[] = .name = _("SOOTHE BELL"), .itemId = ITEM_SOOTHE_BELL, .price = 100, - .holdEffect = HOLD_EFFECT_HAPPINESS_UP, + .holdEffect = HOLD_EFFECT_FRIENDSHIP_UP, .description = sSootheBellDesc, .pocket = POCKET_ITEMS, .type = ITEM_USE_BAG_MENU, diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index a811901a9..6ec280fd0 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -67,7 +67,7 @@ static bool8 TryStartCoordEventScript(struct MapPosition *); static bool8 TryStartWarpEventScript(struct MapPosition *, u16); static bool8 TryStartMiscWalkingScripts(u16); static bool8 TryStartStepCountScript(u16); -static void UpdateHappinessStepCounter(void); +static void UpdateFriendshipStepCounter(void); static bool8 UpdatePoisonStepCounter(void); void FieldClearPlayerInput(struct FieldInput *input) @@ -542,7 +542,7 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior) } IncrementRematchStepCounter(); - UpdateHappinessStepCounter(); + UpdateFriendshipStepCounter(); UpdateFarawayIslandStepCounter(); if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FORCED_MOVE) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior)) @@ -607,14 +607,15 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior) return FALSE; } -void Unref_ClearHappinessStepCounter(void) +// Unused +static void ClearFriendshipStepCounter(void) { - VarSet(VAR_HAPPINESS_STEP_COUNTER, 0); + VarSet(VAR_FRIENDSHIP_STEP_COUNTER, 0); } -static void UpdateHappinessStepCounter(void) +static void UpdateFriendshipStepCounter(void) { - u16 *ptr = GetVarPointer(VAR_HAPPINESS_STEP_COUNTER); + u16 *ptr = GetVarPointer(VAR_FRIENDSHIP_STEP_COUNTER); int i; (*ptr)++; diff --git a/src/pokemon.c b/src/pokemon.c index 2abf9cb56..5b683584b 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4649,7 +4649,7 @@ bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, { \ friendshipChange = itemEffect[itemEffectParam]; \ friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); \ - if (friendshipChange > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP) \ + if (friendshipChange > 0 && holdEffect == HOLD_EFFECT_FRIENDSHIP_UP) \ friendship += 150 * friendshipChange / 100; \ else \ friendship += friendshipChange; \ @@ -5828,7 +5828,7 @@ void AdjustFriendship(struct Pokemon *mon, u8 event) && (event != FRIENDSHIP_EVENT_LEAGUE_BATTLE || IS_LEAGUE_BATTLE)) { s8 mod = sFriendshipEventModifiers[event][friendshipLevel]; - if (mod > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP) + if (mod > 0 && holdEffect == HOLD_EFFECT_FRIENDSHIP_UP) mod = (150 * mod) / 100; friendship += mod; if (mod > 0)