mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
commit
6d7043c0c6
@ -9328,72 +9328,102 @@ BattleCommand50: ; 37492
|
|||||||
|
|
||||||
ld a, [hBattleTurn]
|
ld a, [hBattleTurn]
|
||||||
and a
|
and a
|
||||||
jr nz, .asm_374ce ; 37495 $37
|
jr nz, .enemy
|
||||||
call .asm_37501
|
|
||||||
|
; The player needs to be able to steal an item.
|
||||||
|
|
||||||
|
call .playeritem
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and a
|
and a
|
||||||
ret nz
|
ret nz
|
||||||
call .asm_3750c
|
|
||||||
|
; The enemy needs to have an item to steal.
|
||||||
|
|
||||||
|
call .enemyitem
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
|
; Can't steal mail.
|
||||||
|
|
||||||
ld [$d265], a
|
ld [$d265], a
|
||||||
ld d, a
|
ld d, a
|
||||||
ld a, $2e
|
callba ItemIsMail
|
||||||
ld hl, $5e76
|
|
||||||
rst FarCall
|
|
||||||
ret c
|
ret c
|
||||||
|
|
||||||
ld a, [EffectFailed]
|
ld a, [EffectFailed]
|
||||||
and a
|
and a
|
||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
ld a, [InLinkBattle]
|
ld a, [InLinkBattle]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_374be ; 374b7 $5
|
jr z, .stealenemyitem
|
||||||
|
|
||||||
ld a, [IsInBattle]
|
ld a, [IsInBattle]
|
||||||
dec a
|
dec a
|
||||||
ret z
|
ret z
|
||||||
.asm_374be
|
|
||||||
call .asm_3750c
|
.stealenemyitem
|
||||||
|
call .enemyitem
|
||||||
xor a
|
xor a
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld [de], a
|
ld [de], a
|
||||||
call .asm_37501
|
|
||||||
|
call .playeritem
|
||||||
ld a, [$d265]
|
ld a, [$d265]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld [de], a
|
ld [de], a
|
||||||
jr .asm_374f8 ; 374cc $2a
|
jr .stole
|
||||||
.asm_374ce
|
|
||||||
call .asm_3750c
|
|
||||||
|
.enemy
|
||||||
|
|
||||||
|
; The enemy can't already have an item.
|
||||||
|
|
||||||
|
call .enemyitem
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and a
|
and a
|
||||||
ret nz
|
ret nz
|
||||||
call .asm_37501
|
|
||||||
|
; The player must have an item to steal.
|
||||||
|
|
||||||
|
call .playeritem
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
|
; Can't steal mail!
|
||||||
|
|
||||||
ld [$d265], a
|
ld [$d265], a
|
||||||
ld d, a
|
ld d, a
|
||||||
ld a, $2e
|
callba ItemIsMail
|
||||||
ld hl, $5e76
|
|
||||||
rst FarCall
|
|
||||||
ret c
|
ret c
|
||||||
|
|
||||||
ld a, [EffectFailed]
|
ld a, [EffectFailed]
|
||||||
and a
|
and a
|
||||||
ret nz
|
ret nz
|
||||||
call .asm_37501
|
|
||||||
|
; If the enemy steals your item,
|
||||||
|
; it's gone for good if you don't get it back.
|
||||||
|
|
||||||
|
call .playeritem
|
||||||
xor a
|
xor a
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld [de], a
|
ld [de], a
|
||||||
call .asm_3750c
|
|
||||||
|
call .enemyitem
|
||||||
ld a, [$d265]
|
ld a, [$d265]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld [de], a
|
ld [de], a
|
||||||
.asm_374f8
|
|
||||||
|
|
||||||
|
.stole
|
||||||
call GetItemName
|
call GetItemName
|
||||||
ld hl, StoleText
|
ld hl, StoleText
|
||||||
jp StdBattleTextBox
|
jp StdBattleTextBox
|
||||||
|
|
||||||
.asm_37501
|
|
||||||
|
.playeritem
|
||||||
ld a, 1
|
ld a, 1
|
||||||
call BattlePartyAttr
|
call BattlePartyAttr
|
||||||
ld d, h
|
ld d, h
|
||||||
@ -9401,9 +9431,9 @@ BattleCommand50: ; 37492
|
|||||||
ld hl, BattleMonItem
|
ld hl, BattleMonItem
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.asm_3750c
|
.enemyitem
|
||||||
ld a, 1
|
ld a, 1
|
||||||
call $396d ; GetOTStat_Battle
|
call OTPartyAttr
|
||||||
ld d, h
|
ld d, h
|
||||||
ld e, l
|
ld e, l
|
||||||
ld hl, EnemyMonItem
|
ld hl, EnemyMonItem
|
||||||
@ -9413,17 +9443,27 @@ BattleCommand50: ; 37492
|
|||||||
|
|
||||||
BattleCommand51: ; 37517
|
BattleCommand51: ; 37517
|
||||||
; arenatrap
|
; arenatrap
|
||||||
|
|
||||||
|
; Doesn't work on an absent opponent.
|
||||||
|
|
||||||
call CheckHiddenOpponent
|
call CheckHiddenOpponent
|
||||||
jr nz, .asm_37530 ; 3751a $14
|
jr nz, .failed
|
||||||
|
|
||||||
|
; Don't trap if the opponent is already trapped.
|
||||||
|
|
||||||
ld a, BATTLE_VARS_SUBSTATUS5
|
ld a, BATTLE_VARS_SUBSTATUS5
|
||||||
call GetBattleVarPair
|
call GetBattleVarPair
|
||||||
bit 7, [hl]
|
bit SUBSTATUS_CANT_RUN, [hl]
|
||||||
jr nz, .asm_37530 ; 37523 $b
|
jr nz, .failed
|
||||||
set 7, [hl]
|
|
||||||
|
; Otherwise trap the opponent.
|
||||||
|
|
||||||
|
set SUBSTATUS_CANT_RUN, [hl]
|
||||||
call Function0x37e01
|
call Function0x37e01
|
||||||
ld hl, CantEscapeNowText
|
ld hl, CantEscapeNowText
|
||||||
jp StdBattleTextBox
|
jp StdBattleTextBox
|
||||||
.asm_37530
|
|
||||||
|
.failed
|
||||||
call Function0x37e77
|
call Function0x37e77
|
||||||
jp PrintButItFailed
|
jp PrintButItFailed
|
||||||
; 37536
|
; 37536
|
||||||
@ -9432,23 +9472,38 @@ BattleCommand51: ; 37517
|
|||||||
BattleCommand52: ; 37536
|
BattleCommand52: ; 37536
|
||||||
; nightmare
|
; nightmare
|
||||||
|
|
||||||
|
; Can't hit an absent opponent.
|
||||||
|
|
||||||
call CheckHiddenOpponent
|
call CheckHiddenOpponent
|
||||||
jr nz, .asm_3755d ; 37539 $22
|
jr nz, .failed
|
||||||
|
|
||||||
|
; Can't hit a substitute.
|
||||||
|
|
||||||
call CheckSubstituteOpp
|
call CheckSubstituteOpp
|
||||||
jr nz, .asm_3755d ; 3753e $1d
|
jr nz, .failed
|
||||||
|
|
||||||
|
; Only works on a sleeping opponent.
|
||||||
|
|
||||||
ld a, BATTLE_VARS_STATUS_OPP
|
ld a, BATTLE_VARS_STATUS_OPP
|
||||||
call GetBattleVarPair
|
call GetBattleVarPair
|
||||||
and $7
|
and SLP
|
||||||
jr z, .asm_3755d ; 37547 $14
|
jr z, .failed
|
||||||
|
|
||||||
|
; Bail if the opponent is already having a nightmare.
|
||||||
|
|
||||||
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
||||||
call GetBattleVarPair
|
call GetBattleVarPair
|
||||||
bit 0, [hl]
|
bit SUBSTATUS_NIGHTMARE, [hl]
|
||||||
jr nz, .asm_3755d ; 37550 $b
|
jr nz, .failed
|
||||||
set 0, [hl]
|
|
||||||
|
; Otherwise give the opponent a nightmare.
|
||||||
|
|
||||||
|
set SUBSTATUS_NIGHTMARE, [hl]
|
||||||
call Function0x37e01
|
call Function0x37e01
|
||||||
ld hl, StartedNightmareText
|
ld hl, StartedNightmareText
|
||||||
jp StdBattleTextBox
|
jp StdBattleTextBox
|
||||||
.asm_3755d
|
|
||||||
|
.failed
|
||||||
call Function0x37e77
|
call Function0x37e77
|
||||||
jp PrintButItFailed
|
jp PrintButItFailed
|
||||||
; 37563
|
; 37563
|
||||||
@ -9457,22 +9512,30 @@ BattleCommand52: ; 37536
|
|||||||
BattleCommand53: ; 37563
|
BattleCommand53: ; 37563
|
||||||
; defrost
|
; defrost
|
||||||
|
|
||||||
|
; Thaw the user.
|
||||||
|
|
||||||
ld a, BATTLE_VARS_STATUS
|
ld a, BATTLE_VARS_STATUS
|
||||||
call GetBattleVarPair
|
call GetBattleVarPair
|
||||||
bit 5, [hl]
|
bit FRZ, [hl]
|
||||||
ret z
|
ret z
|
||||||
res 5, [hl]
|
res FRZ, [hl]
|
||||||
|
|
||||||
|
; Don't update the enemy's party struct in a wild battle.
|
||||||
|
|
||||||
ld a, [hBattleTurn]
|
ld a, [hBattleTurn]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_37578 ; 37570 $6
|
jr z, .party
|
||||||
|
|
||||||
ld a, [IsInBattle]
|
ld a, [IsInBattle]
|
||||||
dec a
|
dec a
|
||||||
jr z, .asm_3757f ; 37576 $7
|
jr z, .done
|
||||||
.asm_37578
|
|
||||||
ld a, $20
|
.party
|
||||||
|
ld a, PartyMon1Status - PartyMon1
|
||||||
call UserPartyAttr
|
call UserPartyAttr
|
||||||
res 5, [hl]
|
res FRZ, [hl]
|
||||||
.asm_3757f
|
|
||||||
|
.done
|
||||||
call RefreshBattleHuds
|
call RefreshBattleHuds
|
||||||
ld hl, WasDefrostedText
|
ld hl, WasDefrostedText
|
||||||
jp StdBattleTextBox
|
jp StdBattleTextBox
|
||||||
@ -9486,25 +9549,40 @@ BattleCommand54: ; 37588
|
|||||||
ld bc, PlayerStatLevels
|
ld bc, PlayerStatLevels
|
||||||
ld a, [hBattleTurn]
|
ld a, [hBattleTurn]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_37599 ; 37591 $6
|
jr z, .go
|
||||||
ld de, EnemyMonType1
|
ld de, EnemyMonType1
|
||||||
ld bc, EnemyStatLevels
|
ld bc, EnemyStatLevels
|
||||||
.asm_37599
|
|
||||||
|
.go
|
||||||
|
|
||||||
|
; Curse is different for Ghost-types.
|
||||||
|
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp $8
|
cp GHOST
|
||||||
jr z, .asm_375d7 ; 3759c $39
|
jr z, .ghost
|
||||||
inc de
|
inc de
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp $8
|
cp GHOST
|
||||||
jr z, .asm_375d7 ; 375a2 $33
|
jr z, .ghost
|
||||||
|
|
||||||
|
|
||||||
|
; If no stats can be increased, don't.
|
||||||
|
|
||||||
|
; Attack
|
||||||
ld a, [bc]
|
ld a, [bc]
|
||||||
cp $d
|
cp 13 ; max
|
||||||
jr c, .asm_375af ; 375a7 $6
|
jr c, .raise
|
||||||
|
|
||||||
|
; Defense
|
||||||
inc bc
|
inc bc
|
||||||
ld a, [bc]
|
ld a, [bc]
|
||||||
cp $d
|
cp 13 ; max
|
||||||
jr nc, .asm_3760a ; 375ad $5b
|
jr nc, .cantraise
|
||||||
.asm_375af
|
|
||||||
|
.raise
|
||||||
|
|
||||||
|
; Raise Attack and Defense, and lower Speed.
|
||||||
|
|
||||||
ld a, $1
|
ld a, $1
|
||||||
ld [$c689], a
|
ld [$c689], a
|
||||||
call Function0x37e01
|
call Function0x37e01
|
||||||
@ -9519,29 +9597,43 @@ BattleCommand54: ; 37588
|
|||||||
call ResetMiss
|
call ResetMiss
|
||||||
call BattleCommand71
|
call BattleCommand71
|
||||||
jp BattleCommand8c
|
jp BattleCommand8c
|
||||||
.asm_375d7
|
|
||||||
|
|
||||||
|
.ghost
|
||||||
|
|
||||||
|
; Cut HP in half and put a curse on the opponent.
|
||||||
|
|
||||||
call CheckHiddenOpponent
|
call CheckHiddenOpponent
|
||||||
jr nz, .asm_37604 ; 375da $28
|
jr nz, .failed
|
||||||
|
|
||||||
call CheckSubstituteOpp
|
call CheckSubstituteOpp
|
||||||
jr nz, .asm_37604 ; 375df $23
|
jr nz, .failed
|
||||||
|
|
||||||
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
||||||
call GetBattleVarPair
|
call GetBattleVarPair
|
||||||
bit 1, [hl]
|
bit 1, [hl]
|
||||||
jr nz, .asm_37604 ; 375e8 $1a
|
jr nz, .failed
|
||||||
|
|
||||||
set 1, [hl]
|
set 1, [hl]
|
||||||
call Function0x37e01
|
call Function0x37e01
|
||||||
ld hl, $4c9f
|
ld hl, GetHalfMaxHP
|
||||||
call CallBankF
|
call CallBankF
|
||||||
ld hl, $4c3f
|
ld hl, Function3cc3f
|
||||||
call CallBankF
|
call CallBankF
|
||||||
call UpdateUserInParty
|
call UpdateUserInParty
|
||||||
ld hl, PutACurseText
|
ld hl, PutACurseText
|
||||||
jp StdBattleTextBox
|
jp StdBattleTextBox
|
||||||
.asm_37604
|
|
||||||
|
.failed
|
||||||
call Function0x37e77
|
call Function0x37e77
|
||||||
jp PrintButItFailed
|
jp PrintButItFailed
|
||||||
.asm_3760a
|
|
||||||
ld b, $8
|
|
||||||
|
.cantraise
|
||||||
|
|
||||||
|
; Can't raise either stat.
|
||||||
|
|
||||||
|
ld b, $8 ; ABILITY
|
||||||
call GetStatName
|
call GetStatName
|
||||||
call Function0x37e77
|
call Function0x37e77
|
||||||
ld hl, WontRiseAnymoreText
|
ld hl, WontRiseAnymoreText
|
||||||
|
26
main.asm
26
main.asm
@ -30935,7 +30935,7 @@ Function16798: ; 16798
|
|||||||
ld a, [CurPartyMon]
|
ld a, [CurPartyMon]
|
||||||
call AddNTimes
|
call AddNTimes
|
||||||
ld d, [hl]
|
ld d, [hl]
|
||||||
callba Functionb9e76
|
callba ItemIsMail
|
||||||
jr c, .asm_167ed
|
jr c, .asm_167ed
|
||||||
ld hl, PartyMon1Nickname
|
ld hl, PartyMon1Nickname
|
||||||
ld a, [CurPartyMon]
|
ld a, [CurPartyMon]
|
||||||
@ -34050,7 +34050,7 @@ Function24dd4: ; 24dd4
|
|||||||
ld a, $1
|
ld a, $1
|
||||||
call GetPartyParamLocation
|
call GetPartyParamLocation
|
||||||
ld d, [hl]
|
ld d, [hl]
|
||||||
callba Functionb9e76
|
callba ItemIsMail
|
||||||
pop hl
|
pop hl
|
||||||
ld a, $14
|
ld a, $14
|
||||||
jr c, .asm_24e2c
|
jr c, .asm_24e2c
|
||||||
@ -37666,7 +37666,7 @@ Function29bfb: ; 29bfb
|
|||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
ld d, [hl]
|
ld d, [hl]
|
||||||
callba Functionb9e76
|
callba ItemIsMail
|
||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl
|
||||||
jr c, .asm_29c5e
|
jr c, .asm_29c5e
|
||||||
@ -72826,14 +72826,26 @@ Functionb92b8: ; b92b8
|
|||||||
INCBIN "baserom.gbc", $b92f7, $b9e76 - $b92f7
|
INCBIN "baserom.gbc", $b92f7, $b9e76 - $b92f7
|
||||||
|
|
||||||
|
|
||||||
Functionb9e76: ; b9e76
|
ItemIsMail: ; b9e76
|
||||||
ld a, d
|
ld a, d
|
||||||
ld hl, $5e80
|
ld hl, .items
|
||||||
ld de, $0001
|
ld de, 1
|
||||||
jp IsInArray
|
jp IsInArray
|
||||||
; b9e80
|
; b9e80
|
||||||
|
|
||||||
INCBIN "baserom.gbc", $b9e80, $b9e8b - $b9e80
|
.items
|
||||||
|
db FLOWER_MAIL
|
||||||
|
db SURF_MAIL
|
||||||
|
db LITEBLUEMAIL
|
||||||
|
db PORTRAITMAIL
|
||||||
|
db LOVELY_MAIL
|
||||||
|
db EON_MAIL
|
||||||
|
db MORPH_MAIL
|
||||||
|
db BLUESKY_MAIL
|
||||||
|
db MUSIC_MAIL
|
||||||
|
db MIRAGE_MAIL
|
||||||
|
db $ff
|
||||||
|
; b9e8b
|
||||||
|
|
||||||
|
|
||||||
SECTION "bank2F",ROMX,BANK[$2F]
|
SECTION "bank2F",ROMX,BANK[$2F]
|
||||||
|
Loading…
Reference in New Issue
Block a user