mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Merge pull request #224 from yenatch/moves
Clean up the battle core and specify type categories
This commit is contained in:
commit
94c9f59f45
@ -162,7 +162,7 @@ AIScoring_RedSuperEffective: ; 38635
|
||||
push de
|
||||
ld a, 1
|
||||
ld [hBattleTurn], a
|
||||
callab Function0x347c8
|
||||
callab Function347c8
|
||||
pop de
|
||||
pop bc
|
||||
pop hl
|
||||
@ -412,7 +412,7 @@ AIScoring_LeechHit: ; 387f7
|
||||
push hl
|
||||
ld a, 1
|
||||
ld [hBattleTurn], a
|
||||
callab Function0x347c8
|
||||
callab Function347c8
|
||||
pop hl
|
||||
|
||||
ld a, [$d265]
|
||||
@ -559,7 +559,7 @@ AIScoring_LockOn: ; 3881d
|
||||
|
||||
AIScoring_Explosion: ; 388a6
|
||||
push hl
|
||||
callba Function0x349f4
|
||||
callba Function349f4
|
||||
pop hl
|
||||
jr nc, .asm_388b7
|
||||
|
||||
@ -904,7 +904,7 @@ AIScoring_Bide: ; 38a1e
|
||||
|
||||
AIScoring_Whirlwind: ; 38a2a
|
||||
push hl
|
||||
callab Function0x3484e
|
||||
callab Function3484e
|
||||
ld a, [$c716]
|
||||
cp $a
|
||||
pop hl
|
||||
@ -1760,7 +1760,7 @@ AIScoring_MeanLook: ; 38dfb
|
||||
jr nz, .asm_38e26
|
||||
|
||||
push hl
|
||||
callab Function0x3484e
|
||||
callab Function3484e
|
||||
ld a, [$c716]
|
||||
cp $b
|
||||
pop hl
|
||||
@ -1874,7 +1874,7 @@ AIScoring_Curse: ; 38e5c
|
||||
jp nz, AIDiscourageMove
|
||||
|
||||
push hl
|
||||
callba Function0x349f4
|
||||
callba Function349f4
|
||||
pop hl
|
||||
jr nc, .asm_38eb0
|
||||
|
||||
@ -2003,7 +2003,7 @@ AIScoring_Foresight: ; 38f1d
|
||||
|
||||
AIScoring_PerishSong: ; 38f4a
|
||||
push hl
|
||||
callab Function0x349f4
|
||||
callab Function349f4
|
||||
pop hl
|
||||
jr c, .asm_38f75
|
||||
|
||||
@ -2012,7 +2012,7 @@ AIScoring_PerishSong: ; 38f4a
|
||||
jr nz, .asm_38f6f
|
||||
|
||||
push hl
|
||||
callab Function0x3484e
|
||||
callab Function3484e
|
||||
ld a, [$c716]
|
||||
cp 10 ; 1.0
|
||||
pop hl
|
||||
@ -2242,7 +2242,7 @@ AIScoring_Earthquake: ; 39044
|
||||
|
||||
AIScoring_BatonPass: ; 39062
|
||||
push hl
|
||||
callab Function0x3484e
|
||||
callab Function3484e
|
||||
ld a, [$c716]
|
||||
cp 10 ; 1.0
|
||||
pop hl
|
||||
@ -2299,7 +2299,7 @@ AIScoring_HiddenPower: ; 3909e
|
||||
ld hl, $7ced
|
||||
ld a, $3e
|
||||
rst FarCall
|
||||
callab Function0x347c8
|
||||
callab Function347c8
|
||||
pop hl
|
||||
|
||||
ld a, [$d265]
|
||||
@ -3223,7 +3223,7 @@ AIScoring_StatusImmunity: ; 39453
|
||||
push de
|
||||
ld a, 1
|
||||
ld [hBattleTurn], a
|
||||
callab Function0x347c8
|
||||
callab Function347c8
|
||||
pop de
|
||||
pop bc
|
||||
pop hl
|
||||
|
@ -1430,7 +1430,7 @@ Functioncc8d3: ; cc8d3
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
ld hl, $506f
|
||||
ld hl, BattleAnimations
|
||||
add hl, de
|
||||
add hl, de
|
||||
call Function3ae1
|
||||
|
417
battle/core.asm
417
battle/core.asm
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -41,9 +41,9 @@ BattleCommand54: ; 37588
|
||||
|
||||
ld a, $1
|
||||
ld [$c689], a
|
||||
call Function0x37e01
|
||||
call AnimateCurrentMove
|
||||
ld a, $2
|
||||
call Function0x36532
|
||||
call Function36532
|
||||
call SwitchTurn
|
||||
call BattleCommand8d
|
||||
call ResetMiss
|
||||
@ -71,17 +71,17 @@ BattleCommand54: ; 37588
|
||||
jr nz, .failed
|
||||
|
||||
set 1, [hl]
|
||||
call Function0x37e01
|
||||
call AnimateCurrentMove
|
||||
ld hl, GetHalfMaxHP
|
||||
call CallBankF
|
||||
call CallBattleCore
|
||||
ld hl, Function3cc3f
|
||||
call CallBankF
|
||||
call CallBattleCore
|
||||
call UpdateUserInParty
|
||||
ld hl, PutACurseText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
call Function0x37e77
|
||||
call AnimateFailedMove
|
||||
jp PrintButItFailed
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ BattleCommand54: ; 37588
|
||||
|
||||
ld b, $8 ; ABILITY
|
||||
call GetStatName
|
||||
call Function0x37e77
|
||||
call AnimateFailedMove
|
||||
ld hl, WontRiseAnymoreText
|
||||
jp StdBattleTextBox
|
||||
; 37618
|
||||
|
@ -10,7 +10,7 @@ BattleCommand5a: ; 3766f
|
||||
call _GetBattleVar
|
||||
set SUBSTATUS_ENDURE, [hl]
|
||||
|
||||
call Function0x37e01
|
||||
call AnimateCurrentMove
|
||||
|
||||
ld hl, BracedItselfText
|
||||
jp StdBattleTextBox
|
||||
|
@ -14,11 +14,11 @@ BattleCommand57: ; 376a0
|
||||
jr nz, .failed
|
||||
|
||||
set SUBSTATUS_IDENTIFIED, [hl]
|
||||
call Function0x37e01
|
||||
call AnimateCurrentMove
|
||||
ld hl, IdentifiedText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
jp Function0x37354
|
||||
jp Function37354
|
||||
; 376c2
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
BattleCommand34: ; 37418
|
||||
; metronome
|
||||
|
||||
call Function0x372d8
|
||||
call Function0x34548
|
||||
call Function372d8
|
||||
call Function34548
|
||||
jr nz, .asm_3742b
|
||||
|
||||
ld a, [$c689]
|
||||
@ -12,7 +12,7 @@ BattleCommand34: ; 37418
|
||||
ld [$c689], a
|
||||
|
||||
.asm_3742b
|
||||
call Function0x37e36
|
||||
call Function37e36
|
||||
|
||||
.GetMove
|
||||
call BattleRandom
|
||||
|
@ -1,7 +1,7 @@
|
||||
BattleCommand1b: ; 373c9
|
||||
; mirrormove
|
||||
|
||||
call Function0x372d8
|
||||
call Function372d8
|
||||
|
||||
ld a, BATTLE_VARS_MOVE
|
||||
call _GetBattleVar
|
||||
@ -15,7 +15,7 @@ BattleCommand1b: ; 373c9
|
||||
jr nz, .use
|
||||
|
||||
.failed
|
||||
call Function0x37e77
|
||||
call AnimateFailedMove
|
||||
|
||||
ld hl, MirrorMoveFailedText
|
||||
call StdBattleTextBox
|
||||
@ -37,7 +37,7 @@ BattleCommand1b: ; 373c9
|
||||
call GetMoveData
|
||||
call GetMoveName
|
||||
call CopyName1
|
||||
call Function0x34548
|
||||
call Function34548
|
||||
jr nz, .done
|
||||
|
||||
ld a, [$c689]
|
||||
|
@ -28,12 +28,12 @@ BattleCommand52: ; 37536
|
||||
; Otherwise give the opponent a nightmare.
|
||||
|
||||
set SUBSTATUS_NIGHTMARE, [hl]
|
||||
call Function0x37e01
|
||||
call AnimateCurrentMove
|
||||
ld hl, StartedNightmareText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
call Function0x37e77
|
||||
call AnimateFailedMove
|
||||
jp PrintButItFailed
|
||||
; 37563
|
||||
|
||||
|
@ -30,12 +30,12 @@ BattleCommand58: ; 376c2
|
||||
ld [EnemyPerishCount], a
|
||||
|
||||
.done
|
||||
call Function0x37e01
|
||||
call AnimateCurrentMove
|
||||
ld hl, StartPerishText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
call Function0x37e77
|
||||
call AnimateFailedMove
|
||||
jp PrintButItFailed
|
||||
; 376f8
|
||||
|
||||
|
@ -7,7 +7,7 @@ BattleCommand55: ; 37618
|
||||
call _GetBattleVar
|
||||
set SUBSTATUS_PROTECT, [hl]
|
||||
|
||||
call Function0x37e01
|
||||
call AnimateCurrentMove
|
||||
|
||||
ld hl, ProtectedItselfText
|
||||
jp StdBattleTextBox
|
||||
@ -23,7 +23,7 @@ ProtectChance: ; 3762c
|
||||
ld de, EnemyProtectCount
|
||||
.asm_37637
|
||||
|
||||
call Function0x36abf
|
||||
call Function36abf
|
||||
jr nz, .failed
|
||||
|
||||
; Can't have a substitute.
|
||||
@ -73,7 +73,7 @@ ProtectChance: ; 3762c
|
||||
.failed
|
||||
xor a
|
||||
ld [de], a
|
||||
call Function0x37e77
|
||||
call AnimateFailedMove
|
||||
call PrintButItFailed
|
||||
scf
|
||||
ret
|
||||
|
@ -9,12 +9,12 @@ BattleCommand59: ; 376f8
|
||||
ld [Weather], a
|
||||
ld a, 5
|
||||
ld [WeatherCount], a
|
||||
call Function0x37e01
|
||||
call AnimateCurrentMove
|
||||
ld hl, SandstormBrewedText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
call Function0x37e77
|
||||
call AnimateFailedMove
|
||||
jp PrintButItFailed
|
||||
; 37718
|
||||
|
||||
|
@ -17,12 +17,12 @@ BattleCommand56: ; 37683
|
||||
|
||||
set SCREENS_SPIKES, [hl]
|
||||
|
||||
call Function0x37e01
|
||||
call AnimateCurrentMove
|
||||
|
||||
ld hl, SpikesText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
jp Function0x37354
|
||||
jp Function37354
|
||||
; 376a0
|
||||
|
||||
|
@ -1,75 +1,76 @@
|
||||
GetHiddenPower: ; fbced
|
||||
; Override Hidden Power's type and power based on the actor's DVs.
|
||||
HiddenPowerDamage: ; fbced
|
||||
; Override Hidden Power's type and power based on the user's DVs.
|
||||
|
||||
ld hl, BattleMonDVs
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .GotDVs
|
||||
jr z, .got_dvs
|
||||
ld hl, EnemyMonDVs
|
||||
.GotDVs
|
||||
.got_dvs
|
||||
|
||||
|
||||
; Power:
|
||||
|
||||
; Take the top bit from...
|
||||
; Take the top bit from each stat
|
||||
|
||||
; Atk
|
||||
; Attack
|
||||
ld a, [hl]
|
||||
swap a
|
||||
and 8
|
||||
|
||||
; Defense
|
||||
ld b, a
|
||||
; Def
|
||||
ld a, [hli]
|
||||
and 8
|
||||
srl a
|
||||
or b
|
||||
|
||||
; Speed
|
||||
ld b, a
|
||||
; Spd
|
||||
ld a, [hl]
|
||||
swap a
|
||||
and 8
|
||||
srl a
|
||||
srl a
|
||||
or b
|
||||
|
||||
; Special
|
||||
ld b, a
|
||||
; Spc
|
||||
ld a, [hl]
|
||||
and 8
|
||||
srl a
|
||||
srl a
|
||||
srl a
|
||||
or b
|
||||
ld b, a
|
||||
|
||||
; * 5
|
||||
; Multiply by 5
|
||||
ld b, a
|
||||
add a
|
||||
add a
|
||||
add b
|
||||
ld b, a
|
||||
|
||||
; + (Spc & 3)
|
||||
; Add Special & 3
|
||||
ld b, a
|
||||
ld a, [hld]
|
||||
and 3
|
||||
add b
|
||||
|
||||
; / 2
|
||||
; Divide by 2 and add 30 + 1
|
||||
srl a
|
||||
|
||||
; + 30
|
||||
add 30
|
||||
; + 1
|
||||
inc a
|
||||
|
||||
ld d, a
|
||||
|
||||
|
||||
; Type:
|
||||
|
||||
; Def & 3
|
||||
; Def & 3
|
||||
ld a, [hl]
|
||||
and 3
|
||||
ld b, a
|
||||
|
||||
; + (Atk & 3) << 2
|
||||
; + (Atk & 3) << 2
|
||||
ld a, [hl]
|
||||
and 3 << 4
|
||||
swap a
|
||||
@ -80,27 +81,30 @@ GetHiddenPower: ; fbced
|
||||
; Skip Normal
|
||||
inc a
|
||||
|
||||
; Skip type 6 (unused)
|
||||
cp 6
|
||||
jr c, .GotType
|
||||
; Skip Bird
|
||||
cp BIRD
|
||||
jr c, .done
|
||||
inc a
|
||||
|
||||
; Skip unused types between Steel and Fire
|
||||
cp STEEL + 1
|
||||
jr c, .GotType
|
||||
add FIRE - (STEEL + 1)
|
||||
; Skip unused types
|
||||
cp UNUSED_TYPES
|
||||
jr c, .done
|
||||
add SPECIAL - UNUSED_TYPES
|
||||
|
||||
.done
|
||||
|
||||
.GotType
|
||||
; Overwrite the current move type.
|
||||
push af
|
||||
ld a, BATTLE_VARS_MOVE_TYPE
|
||||
call _GetBattleVar
|
||||
pop af
|
||||
ld [hl], a
|
||||
|
||||
; Get the rest of the damage formula variables
|
||||
; based on the new type, but keep base power.
|
||||
ld a, d
|
||||
push af
|
||||
callba BattleCommand06
|
||||
callba BattleCommand06 ; damagestats
|
||||
pop af
|
||||
ld d, a
|
||||
ret
|
||||
|
@ -12,6 +12,7 @@ INCLUDE "hram.asm"
|
||||
INCLUDE "constants/wram_constants.asm"
|
||||
|
||||
INCLUDE "constants/pokemon_constants.asm"
|
||||
INCLUDE "constants/type_constants.asm"
|
||||
INCLUDE "constants/move_constants.asm"
|
||||
INCLUDE "constants/battle_constants.asm"
|
||||
INCLUDE "constants/map_constants.asm"
|
||||
@ -31,25 +32,6 @@ INCLUDE "constants/gfx_constants.asm"
|
||||
NONE EQU 0
|
||||
|
||||
|
||||
; types
|
||||
NORMAL EQU $00
|
||||
FIGHTING EQU $01
|
||||
FLYING EQU $02
|
||||
POISON EQU $03
|
||||
GROUND EQU $04
|
||||
ROCK EQU $05
|
||||
BUG EQU $07
|
||||
GHOST EQU $08
|
||||
STEEL EQU $09
|
||||
CURSE_T EQU $13
|
||||
FIRE EQU $14
|
||||
WATER EQU $15
|
||||
GRASS EQU $16
|
||||
ELECTRIC EQU $17
|
||||
PSYCHIC EQU $18
|
||||
ICE EQU $19
|
||||
DRAGON EQU $1A
|
||||
DARK EQU $1B
|
||||
|
||||
; egg group constants
|
||||
MONSTER EQU $01
|
||||
|
File diff suppressed because it is too large
Load Diff
39
constants/type_constants.asm
Normal file
39
constants/type_constants.asm
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
const_def
|
||||
|
||||
PHYSICAL EQU const_value
|
||||
const NORMAL
|
||||
const FIGHTING
|
||||
const FLYING
|
||||
const POISON
|
||||
const GROUND
|
||||
const ROCK
|
||||
const BIRD
|
||||
const BUG
|
||||
const GHOST
|
||||
const STEEL
|
||||
|
||||
|
||||
UNUSED_TYPES EQU const_value
|
||||
const TYPE_10
|
||||
const TYPE_11
|
||||
const TYPE_12
|
||||
const TYPE_13
|
||||
const TYPE_14
|
||||
const TYPE_15
|
||||
const TYPE_16
|
||||
const TYPE_17
|
||||
const TYPE_18
|
||||
const CURSE_T
|
||||
|
||||
|
||||
SPECIAL EQU const_value
|
||||
const FIRE
|
||||
const WATER
|
||||
const GRASS
|
||||
const ELECTRIC
|
||||
const PSYCHIC
|
||||
const ICE
|
||||
const DRAGON
|
||||
const DARK
|
||||
|
@ -1542,7 +1542,7 @@ Functionf030: ; f030 (3:7030)
|
||||
res 7, [hl]
|
||||
.asm_f04f
|
||||
push bc
|
||||
callba Function0x365d7
|
||||
callba Function365d7
|
||||
pop bc
|
||||
ret
|
||||
|
||||
@ -2343,7 +2343,7 @@ XSpecial: ; f4c5
|
||||
ld [hBattleTurn], a
|
||||
ld [AttackMissed], a
|
||||
ld [$c70d], a
|
||||
callba Function0x361ef
|
||||
callba Function361ef
|
||||
call WaitSFX
|
||||
|
||||
callba BattleCommand8c
|
||||
|
42
main.asm
42
main.asm
@ -5271,10 +5271,10 @@ Function6520: ; 6520
|
||||
push hl
|
||||
push de
|
||||
dec a
|
||||
ld hl, $5b00
|
||||
ld bc, $0007
|
||||
ld hl, Moves + MOVE_PP
|
||||
ld bc, Move2 - Move1
|
||||
call AddNTimes
|
||||
ld a, $10
|
||||
ld a, BANK(Moves)
|
||||
call GetFarByte
|
||||
pop de
|
||||
pop hl
|
||||
@ -7793,7 +7793,7 @@ PredefPointers: ; 856b
|
||||
dwb Function5108b, BANK(Function5108b)
|
||||
dwb Function5120d, BANK(Function5120d)
|
||||
dwb DecompressPredef, BANK(DecompressPredef) ; $40
|
||||
dwb Function0x347d3, BANK(Function0x347d3)
|
||||
dwb Function347d3, BANK(Function347d3)
|
||||
dwb Functionfb908, BANK(Functionfb908)
|
||||
dwb Functionfb877, BANK(Functionfb877)
|
||||
dwb Functiond0000, BANK(Functiond0000)
|
||||
@ -11050,7 +11050,7 @@ _CheckTossableItem: ; d427
|
||||
ld a, 4
|
||||
call GetItemAttr
|
||||
bit 7, a
|
||||
jr nz, Function0xd47f
|
||||
jr nz, Functiond47f
|
||||
and a
|
||||
ret
|
||||
; d432
|
||||
@ -11060,7 +11060,7 @@ CheckSelectableItem: ; d432
|
||||
ld a, 4
|
||||
call GetItemAttr
|
||||
bit 6, a
|
||||
jr nz, Function0xd47f
|
||||
jr nz, Functiond47f
|
||||
and a
|
||||
ret
|
||||
; d43d
|
||||
@ -11120,7 +11120,7 @@ GetItemAttr: ; d460
|
||||
ret
|
||||
; d47f
|
||||
|
||||
Function0xd47f: ; d47f
|
||||
Functiond47f: ; d47f
|
||||
ld a, 1
|
||||
ld [$d142], a
|
||||
scf
|
||||
@ -35591,7 +35591,7 @@ INCBIN "baserom.gbc",$2c4d7,$2c4e3 - $2c4d7
|
||||
cp $3
|
||||
jr z, .asm_2c541
|
||||
jr Function2c545
|
||||
callba Function0x377f5
|
||||
callba Function377f5
|
||||
jr c, .asm_2c541
|
||||
ld a, [PlayerSubStatus1] ; $c668
|
||||
bit 7, a
|
||||
@ -36789,7 +36789,7 @@ ClearBattleRAM: ; 2ef18
|
||||
xor a
|
||||
call ByteFill
|
||||
|
||||
callab Function3d867
|
||||
callab ResetEnemyStatLevels
|
||||
|
||||
call Function1fbf
|
||||
|
||||
@ -36913,7 +36913,7 @@ Function38041: ; 38041
|
||||
; 38045
|
||||
|
||||
Function38045: ; 38045
|
||||
callab Function0x34941
|
||||
callab Function34941
|
||||
ld a, [$c717]
|
||||
and $f0
|
||||
jp z, Function38041
|
||||
@ -36946,7 +36946,7 @@ Function38045: ; 38045
|
||||
; 38083
|
||||
|
||||
Function38083: ; 38083
|
||||
callab Function0x34941
|
||||
callab Function34941
|
||||
ld a, [$c717]
|
||||
and $f0
|
||||
jp z, Function38041
|
||||
@ -36979,7 +36979,7 @@ Function38083: ; 38083
|
||||
; 380c1
|
||||
|
||||
Function380c1: ; 380c1
|
||||
callab Function0x34941
|
||||
callab Function34941
|
||||
ld a, [$c717]
|
||||
and $f0
|
||||
jp z, Function38041
|
||||
@ -37438,8 +37438,8 @@ Function3846c: ; 3846c
|
||||
.asm_384a3
|
||||
ld a, $1
|
||||
ld [$d264], a
|
||||
callab Function3d834
|
||||
callab Function3d867
|
||||
callab NewEnemyMonStatus
|
||||
callab ResetEnemyStatLevels
|
||||
ld hl, PlayerSubStatus1
|
||||
res 7, [hl]
|
||||
callba Function3d4e1
|
||||
@ -37555,7 +37555,7 @@ Function38557
|
||||
push bc
|
||||
call Function38571
|
||||
pop bc
|
||||
callba Function0x361ef
|
||||
callba Function361ef
|
||||
jp Function38387
|
||||
; 38568
|
||||
|
||||
@ -37807,10 +37807,10 @@ Function39806: ; 39806
|
||||
push hl
|
||||
push bc
|
||||
dec a
|
||||
ld hl, $5b00
|
||||
ld bc, $0007
|
||||
ld hl, Moves + MOVE_PP
|
||||
ld bc, Move2 - Move1
|
||||
call AddNTimes
|
||||
ld a, $10
|
||||
ld a, BANK(Moves)
|
||||
call GetFarByte
|
||||
pop bc
|
||||
pop hl
|
||||
@ -83077,11 +83077,11 @@ Function100bc2: ; 100bc2
|
||||
ret
|
||||
|
||||
.asm_100c63
|
||||
ld hl, $4c5b
|
||||
ld hl, BattleText_0x80c5b
|
||||
jr .asm_100c6b
|
||||
|
||||
.asm_100c68
|
||||
ld hl, $4c39
|
||||
ld hl, BattleText_0x80c39
|
||||
|
||||
.asm_100c6b
|
||||
call StdBattleTextBox
|
||||
@ -86704,7 +86704,7 @@ UsedMoveText: ; 105db9
|
||||
|
||||
; check actor ????
|
||||
push hl
|
||||
callba Function0x34548
|
||||
callba Function34548
|
||||
pop hl
|
||||
jr nz, .grammar
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user