Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Glaive Rush, fixes for Plasma Fists and Relic Song #3476

Merged
merged 13 commits into from
Nov 18, 2023
6 changes: 5 additions & 1 deletion asm/macros/battle_script.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,10 @@
.4byte \failInstr
.endm

.macro setglaiverush
callnative BS_SetGlaiveRush
.endm

.macro setzeffect
callnative BS_SetZEffect
.endm
Expand Down Expand Up @@ -1500,7 +1504,7 @@
callnative BS_TryRecycleBerry
.4byte \ptr
.endm

.macro updatedynamax
callnative BS_UpdateDynamax
.endm
Expand Down
7 changes: 6 additions & 1 deletion data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,11 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectSyrupBomb @ EFFECT_SYRUP_BOMB
.4byte BattleScript_EffectHit @ EFFECT_IVY_CUDGEL
.4byte BattleScript_EffectMaxMove @ EFFECT_MAX_MOVE
.4byte BattleScript_EffectGlaiveRush @ EFFECT_GLAIVE_RUSH

BattleScript_EffectGlaiveRush::
setglaiverush
AlexOn1ine marked this conversation as resolved.
Show resolved Hide resolved
goto BattleScript_EffectHit

BattleScript_EffectSyrupBomb::
setmoveeffect MOVE_EFFECT_SYRUP_BOMB
Expand Down Expand Up @@ -7344,7 +7349,7 @@ BattleScript_StealthRockFree::
printstring STRINGID_PKMNBLEWAWAYSTEALTHROCK
waitmessage B_WAIT_TIME_LONG
return

BattleScript_SteelsurgeFree::
printstring STRINGID_PKMNBLEWAWAYSHARPSTEEL
waitmessage B_WAIT_TIME_LONG
Expand Down
1 change: 1 addition & 0 deletions include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
#define STATUS4_INFINITE_CONFUSION (1 << 4) // Used for Berserk Gene
#define STATUS4_SALT_CURE (1 << 5)
#define STATUS4_SYRUP_BOMB (1 << 6)
#define STATUS4_GLEIVE_RUSH (1 << 7)
AlexOn1ine marked this conversation as resolved.
Show resolved Hide resolved

#define HITMARKER_WAKE_UP_CLEAR (1 << 4) // Cleared when waking up. Never set or checked.
#define HITMARKER_SKIP_DMG_TRACK (1 << 5)
Expand Down
3 changes: 2 additions & 1 deletion include/constants/battle_move_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@
#define EFFECT_SYRUP_BOMB 411
#define EFFECT_IVY_CUDGEL 412
#define EFFECT_MAX_MOVE 413
#define EFFECT_GLAIVE_RUSH 414

#define NUM_BATTLE_MOVE_EFFECTS 414
#define NUM_BATTLE_MOVE_EFFECTS 415

#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H
1 change: 1 addition & 0 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4975,6 +4975,7 @@ static void TurnValuesCleanUp(bool8 var0)
gBattleMons[i].status2 &= ~STATUS2_SUBSTITUTE;

gSpecialStatuses[i].parentalBondState = PARENTAL_BOND_OFF;
gStatuses4[i] &= ~STATUS4_GLEIVE_RUSH;
AlexOn1ine marked this conversation as resolved.
Show resolved Hide resolved
}

gSideStatuses[B_SIDE_PLAYER] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK);
Expand Down
17 changes: 11 additions & 6 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1531,12 +1531,9 @@ static bool8 JumpIfMoveAffectedByProtect(u16 move)

static bool32 AccuracyCalcHelper(u16 move)
{
if (gStatuses3[gBattlerTarget] & STATUS3_ALWAYS_HITS && gDisableStructs[gBattlerTarget].battlerWithSureHit == gBattlerAttacker)
{
JumpIfMoveFailed(7, move);
return TRUE;
}
else if (B_TOXIC_NEVER_MISS >= GEN_6 && gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON))
if ((gStatuses3[gBattlerTarget] & STATUS3_ALWAYS_HITS && gDisableStructs[gBattlerTarget].battlerWithSureHit == gBattlerAttacker)
|| (B_TOXIC_NEVER_MISS >= GEN_6 && gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON))
|| gStatuses4[gBattlerTarget] & STATUS4_GLEIVE_RUSH)
{
JumpIfMoveFailed(7, move);
return TRUE;
Expand Down Expand Up @@ -16279,3 +16276,11 @@ void BS_TrySetOctolock(void)
gBattlescriptCurrInstr = cmd->nextInstr;
}
}

void BS_SetGlaiveRush(void)
{
NATIVE_ARGS();

gStatuses4[gBattlerAttacker] |= STATUS4_GLEIVE_RUSH;
gBattlescriptCurrInstr = cmd->nextInstr;
}
11 changes: 9 additions & 2 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ void HandleAction_UseMove(void)
gCurrentMove = gBattleStruct->zmove.toBeUsed[gBattlerAttacker];
}


if (gBattleMons[gBattlerAttacker].hp != 0)
{
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
Expand Down Expand Up @@ -9512,6 +9511,13 @@ static inline uq4_12_t GetCriticalModifier(bool32 isCrit)
return UQ_4_12(1.0);
}

static inline uq4_12_t GetGlaiveRushModifier(u32 battlerDef)
{
if (gStatuses4[battlerDef] & STATUS4_GLEIVE_RUSH)
return UQ_4_12(2.0);
return UQ_4_12(1.0);
}

static inline uq4_12_t GetZMaxMoveAgainstProtectionModifier(u32 battlerDef, u32 move)
{
if ((gBattleStruct->zmove.active || IsMaxMove(move)) && IS_BATTLER_PROTECTED(battlerDef))
Expand Down Expand Up @@ -9747,7 +9753,8 @@ static inline s32 DoMoveDamageCalcVars(u32 move, u32 battlerAtk, u32 battlerDef,
DAMAGE_APPLY_MODIFIER(GetParentalBondModifier(battlerAtk));
DAMAGE_APPLY_MODIFIER(GetWeatherDamageModifier(battlerAtk, move, moveType, holdEffectAtk, holdEffectDef, weather));
DAMAGE_APPLY_MODIFIER(GetCriticalModifier(isCrit));
// TODO: Glaive Rush (Gen IX effect)
DAMAGE_APPLY_MODIFIER(GetGlaiveRushModifier(battlerDef));

if (randomFactor)
{
dmg *= 100 - RandomUniform(RNG_DAMAGE_MODIFIER, 0, 15);
Expand Down
Loading
Loading