Skip to content

Commit

Permalink
HeldItemHoldEffectGet already accounts for Klutz
Browse files Browse the repository at this point in the history
and fix a typo from the statbuffchange modifications
  • Loading branch information
BluRosie committed Jan 8, 2025
1 parent 5dc9851 commit 2cc925f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -3592,8 +3592,6 @@ void LONG_CALL SortRawSpeedNonRNGArray(struct BattleSystem *bsys, struct BattleS

BOOL LONG_CALL CanActivateDamageReductionBerry(struct BattleSystem *bsys, struct BattleStruct *ctx, int defender);

#define GET_HELD_ITEM_HOLD_EFFECT_ACCOUNTING_KLUTZ(ctx, client) (GetBattlerAbility(ctx, client) != ABILITY_KLUTZ ? HeldItemHoldEffectGet(ctx, client) : 0)

BOOL IsPureType(struct BattleStruct *ctx, int battlerId, int type);

#endif // BATTLE_H
2 changes: 1 addition & 1 deletion include/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@
//#define DEBUG_BEFORE_MOVE_LOGIC

// NOCASH_GBA_PRINT swaps from desmume prints with the syscall to NO$GBA-style prints for use with i.e. melonDS
//#define NOCASH_GBA_PRINT
#define NOCASH_GBA_PRINT

#endif // DEBUG_H
4 changes: 2 additions & 2 deletions src/battle/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -3304,7 +3304,7 @@ BOOL BtlCmd_SetMultiHit(struct BattleSystem *bsys, struct BattleStruct *ctx) {

// If it rolled 4 or 5 Loaded Dice doesn't do anything,
// otherwise it rolls the number of hits as 5 minus a random integer from 0 to 1 inclusive.
if (GET_HELD_ITEM_HOLD_EFFECT_ACCOUNTING_KLUTZ(ctx, ctx->attack_client) == HOLD_EFFECT_INCREASE_MULTI_STRIKE_MINIMUM) {
if (HeldItemHoldEffectGet(ctx, ctx->attack_client) == HOLD_EFFECT_INCREASE_MULTI_STRIKE_MINIMUM) {
if (cnt != 4 && cnt != 5) {
cnt = 5 - (BattleRand(bsys) % 2); // 5 - (0 or 1)
}
Expand All @@ -3314,7 +3314,7 @@ BOOL BtlCmd_SetMultiHit(struct BattleSystem *bsys, struct BattleStruct *ctx) {

// Population Bomb checks accuracy for each hit, like Triple Kick and Triple Axel.
// Loaded Dice causes it to only run the first accuracy check, and rolls the number of hits as 10 minus a random integer from 0 to 6 inclusive.
if (cnt == 10 && GET_HELD_ITEM_HOLD_EFFECT_ACCOUNTING_KLUTZ(ctx, ctx->attack_client) == HOLD_EFFECT_INCREASE_MULTI_STRIKE_MINIMUM) {
if (cnt == 10 && HeldItemHoldEffectGet(ctx, ctx->attack_client) == HOLD_EFFECT_INCREASE_MULTI_STRIKE_MINIMUM) {
cnt = 10 - (BattleRand(bsys) % 7); // 10 - (0 to 6)
}

Expand Down
2 changes: 1 addition & 1 deletion src/battle/other_battle_calculators.c
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ void LONG_CALL CalcPriorityAndQuickClawCustapBerry(void *bsys, struct BattleStru
}
}

hold_effect = GET_HELD_ITEM_HOLD_EFFECT_ACCOUNTING_KLUTZ(ctx, client);
hold_effect = HeldItemHoldEffectGet(ctx, client);
hold_atk = HeldItemAtkGet(ctx, client, 0);

if (hold_effect == HOLD_EFFECT_SOMETIMES_PRIORITY) {
Expand Down
4 changes: 2 additions & 2 deletions src/individual/btl_scr_cmd_33_statbuffchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ BOOL btl_scr_cmd_33_statbuffchange(void *bw, struct BattleStruct *sp)
sp->temp_work = STATUS_EFF_UP;
}
//1 step down
else if (sp->addeffect_param >= ADD_STATUS_EFF_BOOST_STATS_ATTACK_UP)
else if (sp->addeffect_param >= ADD_STATUS_EFF_BOOST_STATS_ATTACK_DOWN)
{
stattochange = sp->addeffect_param - ADD_STATUS_EFF_BOOST_STATS_ATTACK_UP;
stattochange = sp->addeffect_param - ADD_STATUS_EFF_BOOST_STATS_ATTACK_DOWN;
statchange = -1;
sp->temp_work = STATUS_EFF_DOWN;
}
Expand Down

0 comments on commit 2cc925f

Please sign in to comment.