Standardize Friendship/Happiness

This commit is contained in:
GriffinR 2021-03-25 13:26:22 -04:00 committed by huderlem
parent 0f869fb266
commit 7a5c6d4d86
8 changed files with 17 additions and 16 deletions

View File

@ -941,7 +941,7 @@
.byte 0xb5 .byte 0xb5
.endm .endm
.macro happinesstodamagecalculation .macro friendshiptodamagecalculation
.byte 0xb6 .byte 0xb6
.endm .endm

View File

@ -1678,7 +1678,7 @@ BattleScript_EffectReturn::
BattleScript_EffectFrustration:: BattleScript_EffectFrustration::
attackcanceler attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
happinesstodamagecalculation friendshiptodamagecalculation
goto BattleScript_HitFromAtkString goto BattleScript_HitFromAtkString
BattleScript_EffectPresent:: BattleScript_EffectPresent::

View File

@ -28,7 +28,7 @@
#define HOLD_EFFECT_MACHO_BRACE 24 #define HOLD_EFFECT_MACHO_BRACE 24
#define HOLD_EFFECT_EXP_SHARE 25 #define HOLD_EFFECT_EXP_SHARE 25
#define HOLD_EFFECT_QUICK_CLAW 26 #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_CURE_ATTRACT 28
#define HOLD_EFFECT_CHOICE_BAND 29 #define HOLD_EFFECT_CHOICE_BAND 29
#define HOLD_EFFECT_FLINCH 30 #define HOLD_EFFECT_FLINCH 30

View File

@ -56,7 +56,7 @@
#define VAR_CYCLING_ROAD_RECORD_COLLISIONS 0x4027 #define VAR_CYCLING_ROAD_RECORD_COLLISIONS 0x4027
#define VAR_CYCLING_ROAD_RECORD_TIME_L 0x4028 #define VAR_CYCLING_ROAD_RECORD_TIME_L 0x4028
#define VAR_CYCLING_ROAD_RECORD_TIME_H 0x4029 #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_POISON_STEP_COUNTER 0x402B
#define VAR_RESET_RTC_ENABLE 0x402C #define VAR_RESET_RTC_ENABLE 0x402C
#define VAR_ENIGMA_BERRY_AVAILABLE 0x402D #define VAR_ENIGMA_BERRY_AVAILABLE 0x402D

View File

@ -258,7 +258,7 @@ static void Cmd_trysetperishsong(void);
static void Cmd_rolloutdamagecalculation(void); static void Cmd_rolloutdamagecalculation(void);
static void Cmd_jumpifconfusedandstatmaxed(void); static void Cmd_jumpifconfusedandstatmaxed(void);
static void Cmd_furycuttercalc(void); static void Cmd_furycuttercalc(void);
static void Cmd_happinesstodamagecalculation(void); static void Cmd_friendshiptodamagecalculation(void);
static void Cmd_presentdamagecalculation(void); static void Cmd_presentdamagecalculation(void);
static void Cmd_setsafeguard(void); static void Cmd_setsafeguard(void);
static void Cmd_magnitudedamagecalculation(void); static void Cmd_magnitudedamagecalculation(void);
@ -510,7 +510,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
Cmd_rolloutdamagecalculation, //0xB3 Cmd_rolloutdamagecalculation, //0xB3
Cmd_jumpifconfusedandstatmaxed, //0xB4 Cmd_jumpifconfusedandstatmaxed, //0xB4
Cmd_furycuttercalc, //0xB5 Cmd_furycuttercalc, //0xB5
Cmd_happinesstodamagecalculation, //0xB6 Cmd_friendshiptodamagecalculation, //0xB6
Cmd_presentdamagecalculation, //0xB7 Cmd_presentdamagecalculation, //0xB7
Cmd_setsafeguard, //0xB8 Cmd_setsafeguard, //0xB8
Cmd_magnitudedamagecalculation, //0xB9 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) if (gBattleMoves[gCurrentMove].effect == EFFECT_RETURN)
gDynamicBasePower = 10 * (gBattleMons[gBattlerAttacker].friendship) / 25; gDynamicBasePower = 10 * (gBattleMons[gBattlerAttacker].friendship) / 25;

View File

@ -2250,7 +2250,7 @@ const struct Item gItems[] =
.name = _("SOOTHE BELL"), .name = _("SOOTHE BELL"),
.itemId = ITEM_SOOTHE_BELL, .itemId = ITEM_SOOTHE_BELL,
.price = 100, .price = 100,
.holdEffect = HOLD_EFFECT_HAPPINESS_UP, .holdEffect = HOLD_EFFECT_FRIENDSHIP_UP,
.description = sSootheBellDesc, .description = sSootheBellDesc,
.pocket = POCKET_ITEMS, .pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU, .type = ITEM_USE_BAG_MENU,

View File

@ -67,7 +67,7 @@ static bool8 TryStartCoordEventScript(struct MapPosition *);
static bool8 TryStartWarpEventScript(struct MapPosition *, u16); static bool8 TryStartWarpEventScript(struct MapPosition *, u16);
static bool8 TryStartMiscWalkingScripts(u16); static bool8 TryStartMiscWalkingScripts(u16);
static bool8 TryStartStepCountScript(u16); static bool8 TryStartStepCountScript(u16);
static void UpdateHappinessStepCounter(void); static void UpdateFriendshipStepCounter(void);
static bool8 UpdatePoisonStepCounter(void); static bool8 UpdatePoisonStepCounter(void);
void FieldClearPlayerInput(struct FieldInput *input) void FieldClearPlayerInput(struct FieldInput *input)
@ -542,7 +542,7 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
} }
IncrementRematchStepCounter(); IncrementRematchStepCounter();
UpdateHappinessStepCounter(); UpdateFriendshipStepCounter();
UpdateFarawayIslandStepCounter(); UpdateFarawayIslandStepCounter();
if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FORCED_MOVE) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior)) if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FORCED_MOVE) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior))
@ -607,14 +607,15 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
return FALSE; 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; int i;
(*ptr)++; (*ptr)++;

View File

@ -4649,7 +4649,7 @@ bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex,
{ \ { \
friendshipChange = itemEffect[itemEffectParam]; \ friendshipChange = itemEffect[itemEffectParam]; \
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); \ 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; \ friendship += 150 * friendshipChange / 100; \
else \ else \
friendship += friendshipChange; \ friendship += friendshipChange; \
@ -5828,7 +5828,7 @@ void AdjustFriendship(struct Pokemon *mon, u8 event)
&& (event != FRIENDSHIP_EVENT_LEAGUE_BATTLE || IS_LEAGUE_BATTLE)) && (event != FRIENDSHIP_EVENT_LEAGUE_BATTLE || IS_LEAGUE_BATTLE))
{ {
s8 mod = sFriendshipEventModifiers[event][friendshipLevel]; 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; mod = (150 * mod) / 100;
friendship += mod; friendship += mod;
if (mod > 0) if (mod > 0)