diff options
| -rw-r--r-- | src/constants/duel_constants.asm | 8 | ||||
| -rwxr-xr-x | src/engine/bank1.asm | 149 | ||||
| -rwxr-xr-x | src/engine/home.asm | 22 | ||||
| -rwxr-xr-x | src/wram.asm | 22 | 
4 files changed, 154 insertions, 47 deletions
| diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index 0eb4b5b..84749fc 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -23,3 +23,11 @@ DUELVARS_NUMBER_OF_CARDS_IN_HAND         EQUS "wPlayerNumberOfCardsInHand & $ff"  DUELVARS_NUMBER_OF_POKEMON_IN_PLAY       EQUS "wPlayerNumberOfPokemonInPlay & $ff"      ; ef  DUELVARS_ARENA_CARD_STATUS               EQUS "wPlayerArenaCardStatus & $ff"            ; f0  DUELVARS_DUELIST_TYPE                    EQUS "wPlayerDuelistType & $ff"                ; f1 + + +; status condition constants +CARD_NOSTATUS  EQU $00 +;TODO - ???      EQU $01 +CARD_ASLEEP    EQU $02 +CARD_PARALYZED EQU $03 +;TODO - beyond
\ No newline at end of file diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm index 7752b08..f38e551 100755 --- a/src/engine/bank1.asm +++ b/src/engine/bank1.asm @@ -478,28 +478,28 @@ INCBIN "baserom.gbc",$458e, $46fc - $458e  OpenBattleAttackMenu: ; 46fc (1:46fc) -	call Func_33c1 -	jr c, .asm_4706 -	call $4918 -	jr nc, .asm_470c - -.asm_4706 +	call CheckIfCantAttackDueToAttackEffect +	jr c, .alertCantAttackAndCancelMenu +	call CheckIfActiveCardParalyzedOrAsleep +	jr nc, .clearSubMenuSelection +	 +.alertCantAttackAndCancelMenu  	call DrawWideTextBox_WaitForInput -	jp Func_4295 - -.asm_470c +	jp $4295 +	 +.clearSubMenuSelection  	xor a  	ld [wSelectedDuelSubMenuItem], a - -Func_4710: ; 4710 (1:4710) -	call $4823 +	 +.tryOpenAttackMenu +	call $4823   	or a -	jr nz, Func_471f -	ld hl, $003c +	jr nz, .asm_471f +	ld hl, $003c   	call DrawWideTextBox_WaitForInput -	jp Func_4295 +	jp $4295 -Func_471f: ; 471f (1:471f) +.asm_471f  	push af  	ld a, [wSelectedDuelSubMenuItem]  	ld hl, $47e4 @@ -508,26 +508,27 @@ Func_471f: ; 471f (1:471f)  	ld [wNumMenuItems], a  	ldh a, [hWhoseTurn]  	ld h, a -	ld l, DUELVARS_ARENA_CARD +	ld l, $bb  	ld a, [hl] -	call Func_1376 +	call $1376 +  .asm_4736  	call DoFrame  	ldh a, [hButtonsPressed]  	and a, $08 -	jr nz, Func_4782 +	jr nz, .asm_4782  	call Func_264b  	jr nc, .asm_4736  	cp a, $ff -	jp z, Func_4295 +	jp z, $4295  	ld [wSelectedDuelSubMenuItem], a  	call $488f -	jr nc, Func_4759 +	jr nc, .asm_4759  	ld hl, $00c0  	call DrawWideTextBox_WaitForInput -	jr Func_4710 +	jr .tryOpenAttackMenu -Func_4759: ; 4759 (1:4759) +.asm_4759  	ldh a, [hCurrentMenuItem]  	add a  	ld e, a @@ -537,27 +538,109 @@ Func_4759: ; 4759 (1:4759)  	ld d, [hl]  	inc hl  	ld e, [hl] -	call Func_16c0 -	call Func_33e1 -	jr c, Func_477d +	call $16c0 +	call $33e1 +	jr c, .asm_477d  	ld a, $07  	call $51e7  	jp c, Func_4268 -	call Func_1730 +	call $1730  	jp c, Func_426d  	ret -Func_477d: ; 477d (1:477d) +.asm_477d ; 477d (1:477d)  	call DrawWideTextBox_WaitForInput -	jr Func_4710 - -Func_4782: ; 4782 (1:4782) +	jr .tryOpenAttackMenu +	 +.asm_4782 ; 4782 (1:4782)  	call $478b  	call $4f9d -	jp Func_4710 +	jp .tryOpenAttackMenu +	 + +INCBIN "baserom.gbc",$478b, $4823 - $478b + +Func_4823: ; 4823 (1:4823) +	call DrawWideTextBox +	ld a, $bb +	call GetTurnDuelistVariable +	ldh [$ff98], a +	call $1376 +	ld c, $00 +	ld b, $0d +	ld hl, $c510 +	xor a +	ld [$cbc7], a +	ld de, $cc34 +	call $4872 +	jr c, .asm_4856 +	ldh a, [$ff98] +	ld [hli], a +	xor a +	ld [hli], a +	inc c +	push hl +	push bc +	ld e, b +	ld hl, $cc34 +	call $5c33 +	pop bc +	pop hl +	inc b +	inc b +	 +.asm_4856 +	ld de, $cc47 +	call $4872 +	jr c, .asm_4870 +	ldh a, [$ff98] +	ld [hli], a +	ld a, $01 +	ld [hli], a +	inc c +	push hl +	push bc +	ld e, b +	ld hl, $cc47 +	call $5c33 +	pop bc +	pop hl +	 +.asm_4870 +	ld a, c +	ret + +INCBIN "baserom.gbc",$4872, $4918 - $4872 + + + + +CheckIfActiveCardParalyzedOrAsleep: ; 4918 (1:4918) +	ld a, $f0 +	call GetTurnDuelistVariable +	and $0f +	cp CARD_PARALYZED +	jr z, .paralyzed +	cp CARD_ASLEEP +	jr z, .asleep +	or a +	ret + +.paralyzed: +	ld hl, $0025 +	jr .returnWithStatusCondition +	 +.asleep: +	ld hl, $0024 +	 +.returnWithStatusCondition: +	scf +	ret + + -INCBIN "baserom.gbc",$478b, $5aeb - $478b +INCBIN "baserom.gbc",$4933, $5aeb - $4933  Func_5aeb: ; 5aeb (1:5aeb) diff --git a/src/engine/home.asm b/src/engine/home.asm index 296ca2b..f864282 100755 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -5872,23 +5872,23 @@ Func_3269: ; 3269 (0:3269)  INCBIN "baserom.gbc",$32f7,$33c1 - $32f7 -Func_33c1: ; 33c1 (0:33c1) +CheckIfCantAttackDueToAttackEffect:: ; 33c1 (0:33c1)  	ld a, $e8  	call GetTurnDuelistVariable  	or a  	ret z -	ld hl, $0100 -	cp $5 -	jr z, .asm_33df -	ld hl, $0101 -	cp $6 -	jr z, .asm_33df -	ld hl, $0102 -	cp $b -	jr z, .asm_33df +	ld hl, $0100 ;tail wag +	cp $05 +	jr z, .returnWithCantAttack +	ld hl, $0101 ;leer +	cp $06 +	jr z, .returnWithCantAttack +	ld hl, $0102 ;bone attack +	cp $0b +	jr z, .returnWithCantAttack  	or a  	ret -.asm_33df +.returnWithCantAttack  	scf  	ret diff --git a/src/wram.asm b/src/wram.asm index da98d0d..5ec4410 100755 --- a/src/wram.asm +++ b/src/wram.asm @@ -62,7 +62,15 @@ wPlayerBench4CardHP:: ; c2cc  	ds $1  wPlayerBench5CardHP:: ; c2cd  	ds $1 -	ds $1e +	ds $1a +	 +;The only known use of this is to store +;when an attack causes a pokemon +;to not be able to attack the following turn +;for example: tail wag, leer +wPlayerCantAttackStatus:: ; c2e8 +	ds $1 +	ds $3  ; Each bit represents a prize (1 = not taken ; 0 = taken)  wPlayerPrizes:: ; c2ec @@ -122,7 +130,15 @@ wOpponentBench4CardHP:: ; c3cc  	ds $1  wOpponentBench5CardHP:: ; c3cd  	ds $1 -	ds $1e +	ds $1a +	 +;The only known use of this is to store +;when an attack causes a pokemon +;to not be able to attack the following turn +;for example: tail wag, leer +wOpponentCantAttackStatus:: ; c3e8 +	ds $1 +	ds $3  wOpponentPrizes:: ; c3ec  	ds $1 @@ -769,4 +785,4 @@ wMusicE4:: ; ddea  	ds $9  wMusicReturnAddress:: ; ddf3 -	ds $8 +	ds $8
\ No newline at end of file | 
