mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-22 15:12:18 +13:00
Port PureRGB AI
Short tests showed positive results. Revert if it fucks up anything. PureRGB enhances Gen 1 AI in various ways, fixing notorious glitches and making it not do completely stupid things. I would use shin pokered's, but it may be too difficult for unfamiliar players, and has a bunch of outdated markers I'd have to spruce up. Relevant changes: - Burn effect calls have been replaced with Fire Blast's effect, replicating the burn spread use-case of Fire Blast - Teleport references removed because pureRGB uses a unique version - Any straggler references to effects not used in pureRGB - Mist properly referred to as we only have one move that provides stat drop immunity. Updated the sprite gallery too!!
This commit is contained in:
parent
8bd3b8a703
commit
0af5bd126b
11 changed files with 654 additions and 168 deletions
|
|
@ -1,4 +1,37 @@
|
|||
; does nothing since no stats are ever selected (barring glitches)
|
||||
; Used by the pureRGB AI
|
||||
;shinpokerednote: ADDED: doubles attack if burned or quadruples speed if paralyzed.
|
||||
;It's meant to be run right before healing paralysis or burn so as to
|
||||
;undo the stat changes.
|
||||
UndoBurnParStats:
|
||||
ld hl, wBattleMonStatus
|
||||
ld de, wPlayerStatsToDouble
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .checkburn
|
||||
ld hl, wEnemyMonStatus
|
||||
ld de, wEnemyStatsToDouble
|
||||
.checkburn
|
||||
ld a, [hl] ;load statuses
|
||||
and 1 << BRN ;test for burn
|
||||
jr z, .checkpar
|
||||
ld a, $01
|
||||
ld [de], a ;set attack to be doubled to undo the stat change of BRN
|
||||
call DoubleSelectedStats
|
||||
jr .return
|
||||
.checkpar
|
||||
ld a, [hl] ;load statuses
|
||||
and 1 << PAR ;test for paralyze
|
||||
jr z, .return
|
||||
ld a, $04
|
||||
ld [de], a ;set speed to be doubled (done twice) to undo the stat change of BRN
|
||||
call DoubleSelectedStats
|
||||
call DoubleSelectedStats
|
||||
.return
|
||||
xor a
|
||||
ld [de], a ;reset the stat change bits
|
||||
ret
|
||||
|
||||
; Reused for pureRGB AI
|
||||
DoubleSelectedStats:
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
|
|
@ -18,7 +51,6 @@ DoubleSelectedStats:
|
|||
dec c
|
||||
ret z
|
||||
jr .loop
|
||||
|
||||
.doubleStat
|
||||
ld a, [hl]
|
||||
add a
|
||||
|
|
@ -29,34 +61,34 @@ DoubleSelectedStats:
|
|||
ret
|
||||
|
||||
; does nothing since no stats are ever selected (barring glitches)
|
||||
HalveSelectedStats:
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerStatsToHalve]
|
||||
ld hl, wBattleMonAttack
|
||||
jr z, .notEnemyTurn
|
||||
ld a, [wEnemyStatsToHalve]
|
||||
ld hl, wEnemyMonAttack
|
||||
.notEnemyTurn
|
||||
ld c, 4
|
||||
ld b, a
|
||||
.loop
|
||||
srl b
|
||||
call c, .halveStat
|
||||
inc hl
|
||||
inc hl
|
||||
dec c
|
||||
ret z
|
||||
jr .loop
|
||||
;HalveSelectedStats:
|
||||
; ldh a, [hWhoseTurn]
|
||||
; and a
|
||||
; ld a, [wPlayerStatsToHalve]
|
||||
; ld hl, wBattleMonAttack
|
||||
; jr z, .notEnemyTurn
|
||||
; ld a, [wEnemyStatsToHalve]
|
||||
; ld hl, wEnemyMonAttack
|
||||
;.notEnemyTurn
|
||||
; ld c, 4
|
||||
; ld b, a
|
||||
;.loop
|
||||
; srl b
|
||||
; call c, .halveStat
|
||||
; inc hl
|
||||
; inc hl
|
||||
; dec c
|
||||
; ret z
|
||||
; jr .loop
|
||||
|
||||
.halveStat
|
||||
ld a, [hl]
|
||||
srl a
|
||||
ld [hli], a
|
||||
rr [hl]
|
||||
or [hl]
|
||||
jr nz, .nonzeroStat
|
||||
ld [hl], 1
|
||||
.nonzeroStat
|
||||
dec hl
|
||||
ret
|
||||
;.halveStat
|
||||
; ld a, [hl]
|
||||
; srl a
|
||||
; ld [hli], a
|
||||
; rr [hl]
|
||||
; or [hl]
|
||||
; jr nz, .nonzeroStat
|
||||
; ld [hl], 1
|
||||
;.nonzeroStat
|
||||
;dec hl
|
||||
; ret
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue