link battle action constants

This commit is contained in:
YamaArashi 2016-10-29 01:44:13 -07:00
parent d1162fec71
commit bb1bf5e6a7
2 changed files with 19 additions and 15 deletions

View file

@ -200,3 +200,7 @@ LINK_STATE_START_BATTLE EQU $03 ; pre-battle initialisation
LINK_STATE_BATTLING EQU $04 ; in a link battle LINK_STATE_BATTLING EQU $04 ; in a link battle
LINK_STATE_RESET EQU $05 ; reset game (unused) LINK_STATE_RESET EQU $05 ; reset game (unused)
LINK_STATE_TRADING EQU $32 ; in a link trade LINK_STATE_TRADING EQU $32 ; in a link trade
LINKBATTLE_RUN EQU $F
LINKBATTLE_STRUGGLE EQU $E
LINKBATTLE_NO_ACTION EQU $D ; never sent

View file

@ -432,13 +432,13 @@ MainInBattleLoop:
jr nz, .noLinkBattle jr nz, .noLinkBattle
; link battle ; link battle
ld a, [wSerialExchangeNybbleReceiveData] ld a, [wSerialExchangeNybbleReceiveData]
cp $f cp LINKBATTLE_RUN
jp z, EnemyRan jp z, EnemyRan
cp $e cp LINKBATTLE_STRUGGLE
jr z, .noLinkBattle jr z, .noLinkBattle
cp $d cp LINKBATTLE_NO_ACTION
jr z, .noLinkBattle jr z, .noLinkBattle
sub $4 sub 4
jr c, .noLinkBattle jr c, .noLinkBattle
; the link battle enemy has switched mons ; the link battle enemy has switched mons
ld a, [wPlayerBattleStatus1] ld a, [wPlayerBattleStatus1]
@ -990,7 +990,7 @@ ReplaceFaintedEnemyMon:
; link battle ; link battle
call LinkBattleExchangeData call LinkBattleExchangeData
ld a, [wSerialExchangeNybbleReceiveData] ld a, [wSerialExchangeNybbleReceiveData]
cp $f cp LINKBATTLE_RUN
ret z ret z
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
.notLinkBattle .notLinkBattle
@ -1679,12 +1679,12 @@ TryRunningFromBattle:
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
xor a xor a
ld [wActionResultOrTookBattleTurn], a ld [wActionResultOrTookBattleTurn], a
ld a, $f ld a, LINKBATTLE_RUN
ld [wPlayerMoveListIndex], a ld [wPlayerMoveListIndex], a
call LinkBattleExchangeData call LinkBattleExchangeData
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
ld a, [wSerialExchangeNybbleReceiveData] ld a, [wSerialExchangeNybbleReceiveData]
cp $f cp LINKBATTLE_RUN
ld a, $2 ld a, $2
jr z, .playSound jr z, .playSound
dec a dec a
@ -2999,16 +2999,16 @@ SelectEnemyMove:
call LinkBattleExchangeData call LinkBattleExchangeData
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
ld a, [wSerialExchangeNybbleReceiveData] ld a, [wSerialExchangeNybbleReceiveData]
cp $e cp LINKBATTLE_STRUGGLE
jp z, .linkedOpponentUsedStruggle jp z, .linkedOpponentUsedStruggle
cp $d cp LINKBATTLE_NO_ACTION
jr z, .unableToSelectMove jr z, .unableToSelectMove
cp $4 cp 4
ret nc ret nc
ld [wEnemyMoveListIndex], a ld [wEnemyMoveListIndex], a
ld c, a ld c, a
ld hl, wEnemyMonMoves ld hl, wEnemyMonMoves
ld b, $0 ld b, 0
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
jr .done jr .done
@ -3087,7 +3087,7 @@ LinkBattleExchangeData:
ld a, $ff ld a, $ff
ld [wSerialExchangeNybbleReceiveData], a ld [wSerialExchangeNybbleReceiveData], a
ld a, [wPlayerMoveListIndex] ld a, [wPlayerMoveListIndex]
cp $f ; is the player running from battle? cp LINKBATTLE_RUN ; is the player running from battle?
jr z, .doExchange jr z, .doExchange
ld a, [wActionResultOrTookBattleTurn] ld a, [wActionResultOrTookBattleTurn]
and a ; is the player switching in another mon? and a ; is the player switching in another mon?
@ -3095,7 +3095,7 @@ LinkBattleExchangeData:
; the player used a move ; the player used a move
ld a, [wPlayerSelectedMove] ld a, [wPlayerSelectedMove]
cp STRUGGLE cp STRUGGLE
ld b, $e ld b, LINKBATTLE_STRUGGLE
jr z, .next jr z, .next
dec b dec b
inc a inc a
@ -5676,9 +5676,9 @@ ExecuteEnemyMove:
jr nz, .executeEnemyMove jr nz, .executeEnemyMove
ld b, $1 ld b, $1
ld a, [wSerialExchangeNybbleReceiveData] ld a, [wSerialExchangeNybbleReceiveData]
cp $e cp LINKBATTLE_STRUGGLE
jr z, .executeEnemyMove jr z, .executeEnemyMove
cp $4 cp 4
ret nc ret nc
.executeEnemyMove .executeEnemyMove
ld hl, wAILayer2Encouragement ld hl, wAILayer2Encouragement