comment statdown move command

This commit is contained in:
yenatch
2013-06-13 16:10:39 -04:00
parent eab37ef920
commit 8ae709be9f
3 changed files with 149 additions and 104 deletions

View File

@@ -130,7 +130,7 @@ BattleCommand01: ; 34084
xor a xor a
ld [AttackMissed], a ld [AttackMissed], a
ld [$c70d], a ld [EffectFailed], a
ld [$c689], a ld [$c689], a
ld [AlreadyDisobeyed], a ld [AlreadyDisobeyed], a
ld [AlreadyFailed], a ld [AlreadyFailed], a
@@ -2689,7 +2689,7 @@ BattleCommand90: ; 34ecc
; effectchance ; effectchance
xor a xor a
ld [$c70d], a ld [EffectFailed], a
call CheckSubstituteOpp call CheckSubstituteOpp
jr nz, .failed jr nz, .failed
@@ -2708,7 +2708,7 @@ BattleCommand90: ; 34ecc
.failed .failed
ld a, 1 ld a, 1
ld [$c70d], a ld [EffectFailed], a
and a and a
ret ret
; 34eee ; 34eee
@@ -3467,7 +3467,7 @@ PlayerAttackDamage: ; 352e2
ld a, [hli] ld a, [hli]
ld b, a ld b, a
ld c, [hl] ld c, [hl]
ld hl, $c6b6 ld hl, PlayerStats
jr .thickclub jr .thickclub
@@ -3728,7 +3728,7 @@ EnemyAttackDamage: ; 353f6
ld a, [hli] ld a, [hli]
ld b, a ld b, a
ld c, [hl] ld c, [hl]
ld hl, $c6c1 ld hl, EnemyStats
jr .thickclub jr .thickclub
@@ -5653,7 +5653,7 @@ BattleCommand13: ; 35eee
ld a, b ld a, b
cp $14 cp $14
ret z ret z
ld a, [$c70d] ld a, [EffectFailed]
and a and a
ret nz ret nz
call Function0x37962 call Function0x37962
@@ -5922,7 +5922,7 @@ BattleCommand17: ; 3608c
ld a, b ld a, b
cp $15 cp $15
ret z ret z
ld a, [$c70d] ld a, [EffectFailed]
and a and a
ret nz ret nz
call Function0x37962 call Function0x37962
@@ -5997,7 +5997,7 @@ BattleCommand18: ; 36102
ld a, b ld a, b
cp $16 cp $16
ret z ret z
ld a, [$c70d] ld a, [EffectFailed]
and a and a
ret nz ret nz
call Function0x37962 call Function0x37962
@@ -6048,7 +6048,7 @@ BattleCommand19: ; 36165
ld a, b ld a, b
cp $18 cp $18
ret z ret z
ld a, [$c70d] ld a, [EffectFailed]
and a and a
ret nz ret nz
call Function0x37962 call Function0x37962
@@ -6127,7 +6127,7 @@ BattleCommand7d: ; 361e0
BattleCommand1c: ; 361e4 BattleCommand1c: ; 361e4
; statup ; statup
call Function0x361ef call Function0x361ef
ld a, [$c70e] ld a, [FailedMessage]
and a and a
ret nz ret nz
jp Function0x36281 jp Function0x36281
@@ -6136,7 +6136,7 @@ BattleCommand1c: ; 361e4
Function0x361ef: ; 361ef Function0x361ef: ; 361ef
ld a, b ld a, b
ld [$c70c], a ld [LoweredStat], a
ld hl, PlayerStatLevels ld hl, PlayerStatLevels
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
@@ -6146,10 +6146,10 @@ Function0x361ef: ; 361ef
ld a, [AttackMissed] ld a, [AttackMissed]
and a and a
jp nz, Function0x3627b jp nz, Function0x3627b
ld a, [$c70d] ld a, [EffectFailed]
and a and a
jp nz, Function0x3627b jp nz, Function0x3627b
ld a, [$c70c] ld a, [LoweredStat]
and $f and $f
ld c, a ld c, a
ld b, $0 ld b, $0
@@ -6159,7 +6159,7 @@ Function0x361ef: ; 361ef
ld a, $d ld a, $d
cp b cp b
jp c, Function0x36270 jp c, Function0x36270
ld a, [$c70c] ld a, [LoweredStat]
and $f0 and $f0
jr z, .asm_3622b ; 0x36222 $7 jr z, .asm_3622b ; 0x36222 $7
inc b inc b
@@ -6174,12 +6174,12 @@ Function0x361ef: ; 361ef
cp $5 cp $5
jr nc, .asm_36268 ; 0x36230 $36 jr nc, .asm_36268 ; 0x36230 $36
ld hl, $c641 ld hl, $c641
ld de, $c6b6 ld de, PlayerStats
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_36243 ; 0x3623b $6 jr z, .asm_36243 ; 0x3623b $6
ld hl, $d21b ld hl, $d21b
ld de, $c6c1 ld de, EnemyStats
.asm_36243 .asm_36243
push bc push bc
sla c sla c
@@ -6209,7 +6209,7 @@ Function0x361ef: ; 361ef
.asm_36268 .asm_36268
pop hl pop hl
xor a xor a
ld [$c70e], a ld [FailedMessage], a
ret ret
; 3626e ; 3626e
@@ -6223,7 +6223,7 @@ Function0x3626e: ; 3626e
Function0x36270: ; 36270 Function0x36270: ; 36270
ld a, $2 ld a, $2
ld [$c70e], a ld [FailedMessage], a
ld a, $1 ld a, $1
ld [AttackMissed], a ld [AttackMissed], a
ret ret
@@ -6232,7 +6232,7 @@ Function0x36270: ; 36270
Function0x3627b: ; 3627b Function0x3627b: ; 3627b
ld a, $1 ld a, $1
ld [$c70e], a ld [FailedMessage], a
ret ret
; 36281 ; 36281
@@ -6320,100 +6320,123 @@ BattleCommand8b: ; 362e1
BattleCommand1d: ; 362e3 BattleCommand1d: ; 362e3
; statdown ; statdown
ld [$c70c], a
ld [LoweredStat], a
call Function0x36391 call Function0x36391
jp nz, Function0x36386 jp nz, .Mist
ld hl, EnemyStatLevels ld hl, EnemyStatLevels
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_362f7 ; 362f2 $3 jr z, .GetStatLevel
ld hl, PlayerStatLevels ld hl, PlayerStatLevels
.asm_362f7
ld a, [$c70c] .GetStatLevel
; Attempt to lower the stat.
ld a, [LoweredStat]
and $f and $f
ld c, a ld c, a
ld b, $0 ld b, 0
add hl, bc add hl, bc
ld b, [hl] ld b, [hl]
dec b dec b
jp z, .asm_36372 jp z, .CantLower
ld a, [$c70c]
; Sharply lower the stat if applicable.
ld a, [LoweredStat]
and $f0 and $f0
jr z, .asm_36310 ; 3630a $4 jr z, .ComputerMiss
dec b dec b
jr nz, .asm_36310 ; 3630d $1 jr nz, .ComputerMiss
inc b inc b
.asm_36310
.ComputerMiss
; Computer opponents have a 1/4 chance of failing.
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_36338 ; 36313 $23 jr z, .DidntMiss
ld a, [InLinkBattle] ld a, [InLinkBattle]
and a and a
jr nz, .asm_36338 ; 36319 $1d jr nz, .DidntMiss
ld a, [$cfc0] ld a, [$cfc0]
and a and a
jr nz, .asm_36338 ; 3631f $17 jr nz, .DidntMiss
; Lock-On still always works.
ld a, [PlayerSubStatus5] ld a, [PlayerSubStatus5]
bit 5, a bit SUBSTATUS_LOCK_ON, a
jr nz, .asm_36338 ; 36326 $10 jr nz, .DidntMiss
; Attacking moves that also lower accuracy are unaffected.
ld a, BATTLE_VARS_MOVE_EFFECT ld a, BATTLE_VARS_MOVE_EFFECT
call CleanGetBattleVarPair call CleanGetBattleVarPair
cp $49 cp EFFECT_ACCURACY_DOWN_HIT
jr z, .asm_36338 ; 3632f $7 jr z, .DidntMiss
call FarBattleRNG call FarBattleRNG
cp $40 cp $40
jr c, .asm_3637d ; 36336 $45 jr c, .Failed
.asm_36338
.DidntMiss
call CheckSubstituteOpp call CheckSubstituteOpp
jr nz, .asm_3637d ; 3633b $40 jr nz, .Failed
ld a, [AttackMissed] ld a, [AttackMissed]
and a and a
jr nz, .asm_3637d ; 36341 $3a jr nz, .Failed
ld a, [$c70d]
ld a, [EffectFailed]
and a and a
jr nz, .asm_3637d ; 36347 $34 jr nz, .Failed
call CheckHiddenOpponent call CheckHiddenOpponent
jr nz, .asm_3637d ; 3634c $2f jr nz, .Failed
; Accuracy/Evasion reduction don't involve stats.
ld [hl], b ld [hl], b
ld a, c ld a, c
cp $5 cp ACCURACY
jr nc, .asm_3636c ; 36352 $18 jr nc, .Hit
push hl push hl
ld hl, $d21b ld hl, EnemyMonAtk + 1
ld de, $c6c1 ld de, EnemyStats
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_36366 ; 3635e $6 jr z, .asm_36366
ld hl, $c641 ld hl, BattleMonAtk + 1
ld de, $c6b6 ld de, PlayerStats
.asm_36366 .asm_36366
call Function0x3641a call Function0x3641a
pop hl pop hl
jr z, .asm_36371 ; 3636a $5 jr z, .CouldntLower
.asm_3636c
.Hit
xor a xor a
ld [$c70e], a ld [FailedMessage], a
ret ret
.asm_36371
.CouldntLower
inc [hl] inc [hl]
.asm_36372 .CantLower
ld a, $3 ld a, 3
ld [$c70e], a ld [FailedMessage], a
ld a, $1 ld a, 1
ld [AttackMissed], a ld [AttackMissed], a
ret ret
.asm_3637d
ld a, $1 .Failed
ld [$c70e], a ld a, 1
ld [FailedMessage], a
ld [AttackMissed], a ld [AttackMissed], a
ret ret
; 36386
.Mist
Function0x36386: ; 36386 ld a, 2
ld a, $2 ld [FailedMessage], a
ld [$c70e], a ld a, 1
ld a, $1
ld [AttackMissed], a ld [AttackMissed], a
ret ret
; 36391 ; 36391
@@ -6446,10 +6469,10 @@ Function0x36391: ; 36391
BattleCommand8c: ; 363b8 BattleCommand8c: ; 363b8
ld a, [$c70e] ld a, [FailedMessage]
and a and a
ret nz ret nz
ld a, [$c70c] ld a, [LoweredStat]
and $f and $f
ld b, a ld b, a
inc b inc b
@@ -6462,7 +6485,7 @@ BattleCommand8c: ; 363b8
start_asm start_asm
ld hl, .up ld hl, .up
ld a, [$c70c] ld a, [LoweredStat]
and $f0 and $f0
ret z ret z
ld hl, .wayup ld hl, .wayup
@@ -6480,10 +6503,10 @@ BattleCommand8c: ; 363b8
BattleCommand8d: ; 363e9 BattleCommand8d: ; 363e9
ld a, [$c70e] ld a, [FailedMessage]
and a and a
ret nz ret nz
ld a, [$c70c] ld a, [LoweredStat]
and $f and $f
ld b, a ld b, a
inc b inc b
@@ -6496,7 +6519,7 @@ BattleCommand8d: ; 363e9
start_asm start_asm
ld hl, .fell ld hl, .fell
ld a, [$c70c] ld a, [LoweredStat]
and $f0 and $f0
ret z ret z
ld hl, .sharplyfell ld hl, .sharplyfell
@@ -6513,20 +6536,22 @@ BattleCommand8d: ; 363e9
Function0x3641a: ; 3641a Function0x3641a: ; 3641a
; selfdestruct ; Lower stat c from stat struct hl (buffer de).
push bc push bc
sla c sla c
ld b, 0 ld b, 0
add hl, bc add hl, bc
; add de, c
ld a, c ld a, c
add e add e
ld e, a ld e, a
jr nc, .asm_36426 jr nc, .asm_36426
inc d inc d
.asm_36426 .asm_36426
pop bc pop bc
; The lowest possible stat is 1.
ld a, [hld] ld a, [hld]
sub 1 sub 1
jr nz, .asm_3642f jr nz, .asm_3642f
@@ -6537,21 +6562,19 @@ Function0x3641a: ; 3641a
.asm_3642f .asm_3642f
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_3643f jr z, .Player
call SwitchTurn call SwitchTurn
call Function0x365d7 call Function0x365d7
call SwitchTurn call SwitchTurn
jr .end
jr .asm_36448 .Player
.asm_3643f
call SwitchTurn call SwitchTurn
call Function0x365fd call Function0x365fd
call SwitchTurn call SwitchTurn
.end
.asm_36448 ld a, 1
ld a, $1
and a and a
ret ret
; 3644c ; 3644c
@@ -6559,7 +6582,7 @@ Function0x3641a: ; 3641a
BattleCommand8e: ; 3644c BattleCommand8e: ; 3644c
; statupfailtext ; statupfailtext
ld a, [$c70e] ld a, [FailedMessage]
and a and a
ret z ret z
push af push af
@@ -6567,7 +6590,7 @@ BattleCommand8e: ; 3644c
pop af pop af
dec a dec a
jp z, TryPrintButItFailed jp z, TryPrintButItFailed
ld a, [$c70c] ld a, [LoweredStat]
and $f and $f
ld b, a ld b, a
inc b inc b
@@ -6579,7 +6602,7 @@ BattleCommand8e: ; 3644c
BattleCommand8f: ; 3646a BattleCommand8f: ; 3646a
; statdownfailtext ; statdownfailtext
ld a, [$c70e] ld a, [FailedMessage]
and a and a
ret z ret z
push af push af
@@ -6590,7 +6613,7 @@ BattleCommand8f: ; 3646a
dec a dec a
ld hl, ProtectedByMistText ld hl, ProtectedByMistText
jp z, FarBattleTextBox jp z, FarBattleTextBox
ld a, [$c70c] ld a, [LoweredStat]
and $f and $f
ld b, a ld b, a
inc b inc b
@@ -6687,7 +6710,7 @@ ResetMiss: ; 3652d
Function0x36532: ; 36532 Function0x36532: ; 36532
ld [$c70c], a ld [LoweredStat], a
ld hl, PlayerStatLevels ld hl, PlayerStatLevels
ld a, [hBattleTurn] ld a, [hBattleTurn]
@@ -6696,7 +6719,7 @@ Function0x36532: ; 36532
ld hl, EnemyStatLevels ld hl, EnemyStatLevels
.asm_36540 .asm_36540
ld a, [$c70c] ld a, [LoweredStat]
and $f and $f
ld c, a ld c, a
ld b, 0 ld b, 0
@@ -6705,7 +6728,7 @@ Function0x36532: ; 36532
dec b dec b
jr z, .asm_36589 jr z, .asm_36589
ld a, [$c70c] ld a, [LoweredStat]
and $f0 and $f0
jr z, .asm_36558 jr z, .asm_36558
dec b dec b
@@ -6720,12 +6743,12 @@ Function0x36532: ; 36532
push hl push hl
ld hl, $c641 ld hl, $c641
ld de, $c6b6 ld de, PlayerStats
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_36570 jr z, .asm_36570
ld hl, $d21b ld hl, $d21b
ld de, $c6c1 ld de, EnemyStats
.asm_36570 .asm_36570
call Function0x3641a call Function0x3641a
@@ -6746,7 +6769,7 @@ Function0x36532: ; 36532
.asm_36583 .asm_36583
xor a xor a
ld [$c70e], a ld [FailedMessage], a
ret ret
.asm_36588 .asm_36588
@@ -6754,7 +6777,7 @@ Function0x36532: ; 36532
.asm_36589 .asm_36589
ld a, 2 ld a, 2
ld [$c70e], a ld [FailedMessage], a
ret ret
; 3658f ; 3658f
@@ -6821,7 +6844,7 @@ BattleCommanda7: ; 365c3
Function0x365d7: ; 365d7 Function0x365d7: ; 365d7
ld hl, PlayerAtkLevel ld hl, PlayerAtkLevel
ld de, $c6b6 ld de, PlayerStats
ld bc, BattleMonAtk ld bc, BattleMonAtk
ld a, $5 ld a, $5
@@ -6844,7 +6867,7 @@ Function0x365d7: ; 365d7
Function0x365fd: ; 365fd Function0x365fd: ; 365fd
ld hl, EnemyAtkLevel ld hl, EnemyAtkLevel
ld de, $c6c1 ld de, EnemyStats
ld bc, EnemyMonAtk ld bc, EnemyMonAtk
ld a, $5 ld a, $5
@@ -7601,7 +7624,7 @@ BattleCommand25: ; 36aa0
ret nz ret nz
call Function0x36abf call Function0x36abf
ret nz ret nz
ld a, [$c70d] ld a, [EffectFailed]
and a and a
ret nz ret nz
@@ -8036,7 +8059,7 @@ BattleCommand2b: ; 36d1d
ld a, b ld a, b
cp $19 cp $19
ret z ret z
ld a, [$c70d] ld a, [EffectFailed]
and a and a
ret nz ret nz
call Function0x37962 call Function0x37962
@@ -8902,8 +8925,8 @@ BattleCommand2d: ; 371cd
ld a, [hl] ld a, [hl]
ld [$d265], a ld [$d265], a
call $343b call $343b
ld hl, $c6c1 ld hl, EnemyStats
ld de, $c6b6 ld de, PlayerStats
ld bc, $000a ld bc, $000a
call BattleSideCopy call BattleSideCopy
ld hl, EnemyStatLevels ld hl, EnemyStatLevels
@@ -9320,7 +9343,7 @@ BattleCommand50: ; 37492
ld hl, $5e76 ld hl, $5e76
rst FarCall rst FarCall
ret c ret c
ld a, [$c70d] ld a, [EffectFailed]
and a and a
ret nz ret nz
ld a, [InLinkBattle] ld a, [InLinkBattle]
@@ -9354,7 +9377,7 @@ BattleCommand50: ; 37492
ld hl, $5e76 ld hl, $5e76
rst FarCall rst FarCall
ret c ret c
ld a, [$c70d] ld a, [EffectFailed]
and a and a
ret nz ret nz
call .asm_37501 call .asm_37501

View File

@@ -1,6 +1,14 @@
MAX_LEVEL EQU 100 MAX_LEVEL EQU 100
NUM_MOVES EQU 4 NUM_MOVES EQU 4
ATTACK EQU 0
DEFENSE EQU 1
SPEED EQU 2
SP_ATTACK EQU 3
SP_DEFENSE EQU 4
ACCURACY EQU 5
EVASION EQU 6
; move struct ; move struct
MOVE_LENGTH EQU 7 MOVE_LENGTH EQU 7
MOVE_ANIM EQU 0 MOVE_ANIM EQU 0

View File

@@ -621,7 +621,14 @@ BattleScriptBuffer: ; c68a
BattleScriptBufferLoc: ; c6b2 BattleScriptBufferLoc: ; c6b2
ds 2 ds 2
ds 24 ds 2
PlayerStats: ; c6b6
ds 10
ds 1
EnemyStats: ; c6c1
ds 10
ds 1
PlayerStatLevels: ; c6cc PlayerStatLevels: ; c6cc
; 07 neutral ; 07 neutral
@@ -749,7 +756,14 @@ WeatherCount: ; c70b
; # turns remaining ; # turns remaining
ds 1 ds 1
ds 6 LoweredStat: ; c70c
ds 1
EffectFailed: ; c70d
ds 1
FailedMessage: ; c70e
ds 1
ds 3
PlayerUsedMoves: ; c712 PlayerUsedMoves: ; c712
; add a move that has been used once by the player ; add a move that has been used once by the player