mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
recomment hidden power calculation
This commit is contained in:
parent
ea01721284
commit
4e9102f249
@ -10077,7 +10077,7 @@ BattleCommand6d: ; 37be8
|
|||||||
ld a, [AttackMissed]
|
ld a, [AttackMissed]
|
||||||
and a
|
and a
|
||||||
ret nz
|
ret nz
|
||||||
callba GetHiddenPower
|
callba HiddenPowerDamage
|
||||||
ret
|
ret
|
||||||
; 37bf4
|
; 37bf4
|
||||||
|
|
||||||
|
@ -1,75 +1,76 @@
|
|||||||
GetHiddenPower: ; fbced
|
HiddenPowerDamage: ; fbced
|
||||||
; Override Hidden Power's type and power based on the actor's DVs.
|
; Override Hidden Power's type and power based on the user's DVs.
|
||||||
|
|
||||||
ld hl, BattleMonDVs
|
ld hl, BattleMonDVs
|
||||||
ld a, [hBattleTurn]
|
ld a, [hBattleTurn]
|
||||||
and a
|
and a
|
||||||
jr z, .GotDVs
|
jr z, .got_dvs
|
||||||
ld hl, EnemyMonDVs
|
ld hl, EnemyMonDVs
|
||||||
.GotDVs
|
.got_dvs
|
||||||
|
|
||||||
|
|
||||||
; Power:
|
; Power:
|
||||||
|
|
||||||
; Take the top bit from...
|
; Take the top bit from each stat
|
||||||
|
|
||||||
; Atk
|
; Attack
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
swap a
|
swap a
|
||||||
and 8
|
and 8
|
||||||
|
|
||||||
|
; Defense
|
||||||
ld b, a
|
ld b, a
|
||||||
; Def
|
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
and 8
|
and 8
|
||||||
srl a
|
srl a
|
||||||
or b
|
or b
|
||||||
|
|
||||||
|
; Speed
|
||||||
ld b, a
|
ld b, a
|
||||||
; Spd
|
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
swap a
|
swap a
|
||||||
and 8
|
and 8
|
||||||
srl a
|
srl a
|
||||||
srl a
|
srl a
|
||||||
or b
|
or b
|
||||||
|
|
||||||
|
; Special
|
||||||
ld b, a
|
ld b, a
|
||||||
; Spc
|
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and 8
|
and 8
|
||||||
srl a
|
srl a
|
||||||
srl a
|
srl a
|
||||||
srl a
|
srl a
|
||||||
or b
|
or b
|
||||||
ld b, a
|
|
||||||
|
|
||||||
; * 5
|
; Multiply by 5
|
||||||
|
ld b, a
|
||||||
add a
|
add a
|
||||||
add a
|
add a
|
||||||
add b
|
add b
|
||||||
ld b, a
|
|
||||||
|
|
||||||
; + (Spc & 3)
|
; Add Special & 3
|
||||||
|
ld b, a
|
||||||
ld a, [hld]
|
ld a, [hld]
|
||||||
and 3
|
and 3
|
||||||
add b
|
add b
|
||||||
|
|
||||||
; / 2
|
; Divide by 2 and add 30 + 1
|
||||||
srl a
|
srl a
|
||||||
|
|
||||||
; + 30
|
|
||||||
add 30
|
add 30
|
||||||
; + 1
|
|
||||||
inc a
|
inc a
|
||||||
|
|
||||||
ld d, a
|
ld d, a
|
||||||
|
|
||||||
|
|
||||||
; Type:
|
; Type:
|
||||||
|
|
||||||
; Def & 3
|
; Def & 3
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and 3
|
and 3
|
||||||
ld b, a
|
ld b, a
|
||||||
|
|
||||||
; + (Atk & 3) << 2
|
; + (Atk & 3) << 2
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and 3 << 4
|
and 3 << 4
|
||||||
swap a
|
swap a
|
||||||
@ -80,27 +81,30 @@ GetHiddenPower: ; fbced
|
|||||||
; Skip Normal
|
; Skip Normal
|
||||||
inc a
|
inc a
|
||||||
|
|
||||||
; Skip type 6 (unused)
|
; Skip Bird
|
||||||
cp 6
|
cp BIRD
|
||||||
jr c, .GotType
|
jr c, .done
|
||||||
inc a
|
inc a
|
||||||
|
|
||||||
; Skip unused types between Steel and Fire
|
; Skip unused types between Steel and Fire
|
||||||
cp STEEL + 1
|
cp STEEL + 1
|
||||||
jr c, .GotType
|
jr c, .done
|
||||||
add FIRE - (STEEL + 1)
|
add FIRE - (STEEL + 1)
|
||||||
|
|
||||||
|
.done
|
||||||
|
|
||||||
.GotType
|
; Overwrite the current move type.
|
||||||
push af
|
push af
|
||||||
ld a, BATTLE_VARS_MOVE_TYPE
|
ld a, BATTLE_VARS_MOVE_TYPE
|
||||||
call _GetBattleVar
|
call _GetBattleVar
|
||||||
pop af
|
pop af
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
|
||||||
|
; Get the rest of the damage formula variables
|
||||||
|
; based on the new type, but keep base power.
|
||||||
ld a, d
|
ld a, d
|
||||||
push af
|
push af
|
||||||
callba BattleCommand06
|
callba BattleCommand06 ; damagestats
|
||||||
pop af
|
pop af
|
||||||
ld d, a
|
ld d, a
|
||||||
ret
|
ret
|
||||||
|
Loading…
Reference in New Issue
Block a user