Skip to content

Commit

Permalink
Adds Glaive Rush, fixes for Plasma Fists and Relic Song (#3476)
Browse files Browse the repository at this point in the history
* Adds Glaive Rush

* Fixes: Glaive Rush status is removed until users next turn

* Glaive Rush no affect

* simplify glaive rush script

* simlify script further

* leftover

* Fix Plasma Fists and Relic Song + tests

* Callnative for Plasma Fists

* Use Status Field Ion Deludge for Plasma Fists

* add assumes for flinch_status

---------

Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
  • Loading branch information
AlexOn1ine and Bassoonian authored Nov 18, 2023
1 parent efe4929 commit 5fa1bff
Show file tree
Hide file tree
Showing 14 changed files with 603 additions and 126 deletions.
14 changes: 9 additions & 5 deletions asm/macros/battle_script.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,14 @@
.4byte \failInstr
.endm

.macro setglaiverush
callnative BS_SetGlaiveRush
.endm

.macro tryrelicsong
callnative BS_TryRelicSong
.endm

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

.macro updatedynamax
callnative BS_UpdateDynamax
.endm
Expand Down Expand Up @@ -2053,10 +2061,6 @@
.4byte \jumpInstr
.endm

.macro applyplasmafists
various BS_ATTACKER, VARIOUS_APPLY_PLASMA_FISTS
.endm

.macro jumpifweatheraffected battler:req, flags:req, jumpInstr:req
various \battler, VARIOUS_JUMP_IF_WEATHER_AFFECTED
.4byte \flags
Expand Down
26 changes: 15 additions & 11 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,17 @@ 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::
call BattleScript_EffectHit_Ret
jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_TryFaintMon
setglaiverush
goto BattleScript_TryFaintMon

BattleScript_EffectSyrupBomb::
setmoveeffect MOVE_EFFECT_SYRUP_BOMB
call BattleScript_EffectHit_Ret
seteffectwithchance
tryfaintmon BS_TARGET
goto BattleScript_MoveEnd

Expand Down Expand Up @@ -529,7 +535,6 @@ BattleScript_EffectMakeItRain:
BattleScript_MakeItRainContinuous:
setmoveeffect MOVE_EFFECT_PAYDAY
call BattleScript_EffectHit_Ret
seteffectwithchance
tryfaintmon BS_TARGET
setmoveeffect MOVE_EFFECT_SP_ATK_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
seteffectprimary
Expand Down Expand Up @@ -1167,9 +1172,8 @@ BattleScript_HyperspaceFuryRemoveProtect::

BattleScript_EffectPlasmaFists:
call BattleScript_EffectHit_Ret
seteffectwithchance
tryfaintmon BS_TARGET
applyplasmafists
orword gFieldStatuses, STATUS_FIELD_ION_DELUGE
printstring STRINGID_IONDELUGEON
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
Expand Down Expand Up @@ -1345,12 +1349,12 @@ BattleScript_NoMoveEffect:
goto BattleScript_EffectHit

BattleScript_EffectRelicSong:
setmoveeffect MOVE_EFFECT_RELIC_SONG | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
setmoveeffect MOVE_EFFECT_SLEEP
call BattleScript_EffectHit_Ret
seteffectwithchance
argumentstatuseffect
tryfaintmon BS_TARGET
goto BattleScript_MoveEnd
moveendall
tryrelicsong
end

BattleScript_EffectAllySwitch:
attackcanceler
Expand Down Expand Up @@ -3135,6 +3139,7 @@ BattleScript_HitFromAtkAnimation::
resultmessage
waitmessage B_WAIT_TIME_LONG
seteffectwithchance
BattleScript_TryFaintMon::
tryfaintmon BS_TARGET
BattleScript_MoveEnd::
moveendall
Expand All @@ -3159,6 +3164,7 @@ BattleScript_EffectHit_Ret::
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
seteffectwithchance
return

BattleScript_EffectNaturalGift:
Expand Down Expand Up @@ -3353,7 +3359,6 @@ BattleScript_EffectPoisonHit:

BattleScript_EffectAbsorb::
call BattleScript_EffectHit_Ret
seteffectwithchance
jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_AbsorbHealBlock
setdrainedhp
manipulatedamage DMG_BIG_ROOT
Expand Down Expand Up @@ -3788,7 +3793,6 @@ BattleScript_EffectFlinchHit::
BattleScript_EffectFlinchStatus:
setmoveeffect MOVE_EFFECT_FLINCH
call BattleScript_EffectHit_Ret
seteffectwithchance
argumentstatuseffect
tryfaintmon BS_TARGET
goto BattleScript_MoveEnd
Expand Down Expand Up @@ -7827,7 +7831,7 @@ BattleScript_AttackerFormChangeMoveEffect::
printstring STRINGID_PKMNTRANSFORMED
waitmessage B_WAIT_TIME_LONG
handleformchange BS_ATTACKER, 2
end3
return

BattleScript_BallFetch::
call BattleScript_AbilityPopUp
Expand Down
2 changes: 1 addition & 1 deletion include/battle_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ bool32 CanBattlerEscape(u32 battler); // no ability check
void BattleScriptExecute(const u8 *BS_ptr);
void BattleScriptPushCursorAndCallback(const u8 *BS_ptr);
u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn);
void ClearFuryCutterDestinyBondGrudge(u32 battler);
void ClearVariousBattlerFlags(u32 battler);
void HandleAction_RunBattleScript(void);
u32 SetRandomTarget(u32 battler);
u32 GetMoveTarget(u16 move, u8 setTarget);
Expand Down
35 changes: 17 additions & 18 deletions include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@
#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER | STATUS3_PHANTOM_FORCE)

#define STATUS4_ELECTRIFIED (1 << 0)
#define STATUS4_PLASMA_FISTS (1 << 1)
#define STATUS4_MUD_SPORT (1 << 2) // Only used if B_SPORT_TURNS < GEN_6
#define STATUS4_WATER_SPORT (1 << 3) // Only used if B_SPORT_TURNS < GEN_6
#define STATUS4_INFINITE_CONFUSION (1 << 4) // Used for Berserk Gene
#define STATUS4_SALT_CURE (1 << 5)
#define STATUS4_SYRUP_BOMB (1 << 6)
#define STATUS4_MUD_SPORT (1 << 1) // Only used if B_SPORT_TURNS < GEN_6
#define STATUS4_WATER_SPORT (1 << 2) // Only used if B_SPORT_TURNS < GEN_6
#define STATUS4_INFINITE_CONFUSION (1 << 3) // Used for Berserk Gene
#define STATUS4_SALT_CURE (1 << 4)
#define STATUS4_SYRUP_BOMB (1 << 5)
#define STATUS4_GLAIVE_RUSH (1 << 6)

#define HITMARKER_WAKE_UP_CLEAR (1 << 4) // Cleared when waking up. Never set or checked.
#define HITMARKER_SKIP_DMG_TRACK (1 << 5)
Expand Down Expand Up @@ -378,18 +378,17 @@
#define MOVE_EFFECT_INCINERATE 67
#define MOVE_EFFECT_BUG_BITE 68
#define MOVE_EFFECT_RECOIL_HP_25 69
#define MOVE_EFFECT_RELIC_SONG 70
#define MOVE_EFFECT_TRAP_BOTH 71
#define MOVE_EFFECT_DOUBLE_SHOCK 72
#define MOVE_EFFECT_ROUND 73
#define MOVE_EFFECT_STOCKPILE_WORE_OFF 74
#define MOVE_EFFECT_DIRE_CLAW 75
#define MOVE_EFFECT_STEALTH_ROCK 76
#define MOVE_EFFECT_SPIKES 77
#define MOVE_EFFECT_TRIPLE_ARROWS 78
#define MOVE_EFFECT_SYRUP_BOMB 79

#define NUM_MOVE_EFFECTS 80
#define MOVE_EFFECT_TRAP_BOTH 70
#define MOVE_EFFECT_DOUBLE_SHOCK 71
#define MOVE_EFFECT_ROUND 72
#define MOVE_EFFECT_STOCKPILE_WORE_OFF 73
#define MOVE_EFFECT_DIRE_CLAW 74
#define MOVE_EFFECT_STEALTH_ROCK 75
#define MOVE_EFFECT_SPIKES 76
#define MOVE_EFFECT_TRIPLE_ARROWS 77
#define MOVE_EFFECT_SYRUP_BOMB 78

#define NUM_MOVE_EFFECTS 79

#define MOVE_EFFECT_AFFECTS_USER 0x4000
#define MOVE_EFFECT_CERTAIN 0x8000
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
77 changes: 38 additions & 39 deletions include/constants/battle_script_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,45 +209,44 @@
#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 116
#define VARIOUS_CONSUME_BERRY 117
#define VARIOUS_JUMP_IF_CANT_REVERT_TO_PRIMAL 118
#define VARIOUS_APPLY_PLASMA_FISTS 119
#define VARIOUS_JUMP_IF_SPECIES 120
#define VARIOUS_UPDATE_ABILITY_POPUP 121
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 122
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 123
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 124
#define VARIOUS_PHOTON_GEYSER_CHECK 125
#define VARIOUS_SHELL_SIDE_ARM_CHECK 126
#define VARIOUS_TRY_NO_RETREAT 127
#define VARIOUS_TRY_TAR_SHOT 128
#define VARIOUS_CAN_TAR_SHOT_WORK 129
#define VARIOUS_CHECK_POLTERGEIST 130
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 131
#define VARIOUS_TRY_END_NEUTRALIZING_GAS 132
#define VARIOUS_JUMP_IF_UNDER_200 133
#define VARIOUS_SET_SKY_DROP 134
#define VARIOUS_CLEAR_SKY_DROP 135
#define VARIOUS_SKY_DROP_YAWN 136
#define VARIOUS_JUMP_IF_HOLD_EFFECT 137
#define VARIOUS_CURE_CERTAIN_STATUSES 138
#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 139
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 140
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 141
#define VARIOUS_SAVE_BATTLER_ITEM 142
#define VARIOUS_RESTORE_BATTLER_ITEM 143
#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 144
#define VARIOUS_SET_BEAK_BLAST 145
#define VARIOUS_SWAP_SIDE_STATUSES 146
#define VARIOUS_SWAP_STATS 147
#define VARIOUS_TEATIME_INVUL 148
#define VARIOUS_TEATIME_TARGETS 149
#define VARIOUS_TRY_WIND_RIDER_POWER 150
#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 151
#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 152
#define VARIOUS_STORE_HEALING_WISH 153
#define VARIOUS_HIT_SWITCH_TARGET_FAILED 154
#define VARIOUS_TRY_REVIVAL_BLESSING 155
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE 156
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION 157
#define VARIOUS_JUMP_IF_SPECIES 119
#define VARIOUS_UPDATE_ABILITY_POPUP 120
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 121
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 122
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 123
#define VARIOUS_PHOTON_GEYSER_CHECK 124
#define VARIOUS_SHELL_SIDE_ARM_CHECK 125
#define VARIOUS_TRY_NO_RETREAT 126
#define VARIOUS_TRY_TAR_SHOT 127
#define VARIOUS_CAN_TAR_SHOT_WORK 128
#define VARIOUS_CHECK_POLTERGEIST 129
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 130
#define VARIOUS_TRY_END_NEUTRALIZING_GAS 131
#define VARIOUS_JUMP_IF_UNDER_200 132
#define VARIOUS_SET_SKY_DROP 133
#define VARIOUS_CLEAR_SKY_DROP 134
#define VARIOUS_SKY_DROP_YAWN 135
#define VARIOUS_JUMP_IF_HOLD_EFFECT 136
#define VARIOUS_CURE_CERTAIN_STATUSES 137
#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 138
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 139
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 140
#define VARIOUS_SAVE_BATTLER_ITEM 141
#define VARIOUS_RESTORE_BATTLER_ITEM 142
#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 143
#define VARIOUS_SET_BEAK_BLAST 144
#define VARIOUS_SWAP_SIDE_STATUSES 145
#define VARIOUS_SWAP_STATS 146
#define VARIOUS_TEATIME_INVUL 147
#define VARIOUS_TEATIME_TARGETS 148
#define VARIOUS_TRY_WIND_RIDER_POWER 149
#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 150
#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 151
#define VARIOUS_STORE_HEALING_WISH 152
#define VARIOUS_HIT_SWITCH_TARGET_FAILED 153
#define VARIOUS_TRY_REVIVAL_BLESSING 154
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_Z_MOVE 155
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_MEGA_EVOLUTION 156

// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0
Expand Down
18 changes: 7 additions & 11 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5671,13 +5671,8 @@ void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk)
}

attackerAbility = GetBattlerAbility(battlerAtk);
GET_MOVE_TYPE(move, moveType);
if ((gFieldStatuses & STATUS_FIELD_ION_DELUGE && moveType == TYPE_NORMAL)
|| gStatuses4[battlerAtk] & STATUS4_ELECTRIFIED)
{
gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | F_DYNAMIC_TYPE_2;
}
else if (gBattleMoves[move].type == TYPE_NORMAL

if (gBattleMoves[move].type == TYPE_NORMAL
&& gBattleMoves[move].effect != EFFECT_HIDDEN_POWER
&& gBattleMoves[move].effect != EFFECT_WEATHER_BALL
&& gBattleMoves[move].effect != EFFECT_CHANGE_TYPE_ON_ITEM
Expand Down Expand Up @@ -5706,15 +5701,16 @@ void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk)
{
gBattleStruct->dynamicMoveType = TYPE_WATER | F_DYNAMIC_TYPE_2;
}
else if (gStatuses4[battlerAtk] & STATUS4_PLASMA_FISTS && moveType == TYPE_NORMAL)
{
gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | F_DYNAMIC_TYPE_2;
}
else if (move == MOVE_AURA_WHEEL && gBattleMons[battlerAtk].species == SPECIES_MORPEKO_HANGRY)
{
gBattleStruct->dynamicMoveType = TYPE_DARK | F_DYNAMIC_TYPE_2;
}

GET_MOVE_TYPE(move, moveType);
if ((gFieldStatuses & STATUS_FIELD_ION_DELUGE && moveType == TYPE_NORMAL)
|| gStatuses4[battlerAtk] & STATUS4_ELECTRIFIED)
gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | F_DYNAMIC_TYPE_2;

// Check if a gem should activate.
GET_MOVE_TYPE(move, moveType);
if (holdEffect == HOLD_EFFECT_GEMS
Expand Down
Loading

0 comments on commit 5fa1bff

Please sign in to comment.