mirror of
https://github.com/thornAvery/jep-hack.git
synced 2026-02-07 00:25:24 +13:00
First Commit
Upload literally everything from the pokecrystal16 expand-move-ID branch
This commit is contained in:
commit
2f8a41f833
4618 changed files with 480386 additions and 0 deletions
70
engine/battle/move_effects/metronome.asm
Normal file
70
engine/battle/move_effects/metronome.asm
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
BattleCommand_Metronome:
|
||||
call ClearLastMove
|
||||
call CheckUserIsCharging
|
||||
jr nz, .charging
|
||||
|
||||
ld a, [wBattleAnimParam]
|
||||
push af
|
||||
call BattleCommand_LowerSub
|
||||
pop af
|
||||
ld [wBattleAnimParam], a
|
||||
|
||||
.charging
|
||||
call LoadMoveAnim
|
||||
|
||||
.GetMove:
|
||||
call ChooseRandomMove
|
||||
|
||||
; None of the moves in MetronomeExcepts.
|
||||
ld de, 2
|
||||
ld hl, MetronomeExcepts
|
||||
call IsInWordArray
|
||||
jr c, .GetMove
|
||||
ld h, b
|
||||
ld l, c
|
||||
call GetMoveIDFromIndex
|
||||
|
||||
; No moves the user already has.
|
||||
ld b, a
|
||||
call CheckUserMove
|
||||
jr z, .GetMove
|
||||
|
||||
ld a, BATTLE_VARS_MOVE
|
||||
call GetBattleVarAddr
|
||||
ld [hl], b
|
||||
call UpdateMoveData
|
||||
jp ResetTurn
|
||||
|
||||
ChooseRandomMove:
|
||||
; chooses a random valid move and returns it in bc
|
||||
call BattleRandom
|
||||
if HIGH(NUM_ATTACKS)
|
||||
maskbits HIGH(NUM_ATTACKS) + 1
|
||||
if HIGH(NUM_ATTACKS) & (HIGH(NUM_ATTACKS) + 1)
|
||||
; if HIGH(NUM_ATTACKS) is not one less than a power of two
|
||||
cp HIGH(NUM_ATTACKS) + 1
|
||||
jr nc, ChooseRandomMove
|
||||
endc
|
||||
ld b, a
|
||||
call BattleRandom
|
||||
ld c, a
|
||||
or b
|
||||
jr z, ChooseRandomMove
|
||||
if LOW(NUM_ATTACKS) != $ff
|
||||
ld a, b
|
||||
cp HIGH(NUM_ATTACKS)
|
||||
ret nz
|
||||
ld a, c
|
||||
cp LOW(NUM_ATTACKS) + 1
|
||||
jr nc, ChooseRandomMove
|
||||
endc
|
||||
else
|
||||
cp NUM_ATTACKS
|
||||
jr nc, ChooseRandomMove
|
||||
inc a
|
||||
ld c, a
|
||||
ld b, 0
|
||||
endc
|
||||
ret
|
||||
|
||||
INCLUDE "data/moves/metronome_exception_moves.asm"
|
||||
Loading…
Add table
Add a link
Reference in a new issue