mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
more naming variables
This commit is contained in:
parent
12db77201f
commit
7f6d0d49b6
57 changed files with 374 additions and 294 deletions
|
|
@ -225,7 +225,7 @@ StartBattle: ; 3c11e (f:411e)
|
|||
ld [wPartyFoughtCurrentEnemyFlags], a
|
||||
ld [wActionResultOrTookBattleTurn], a
|
||||
inc a
|
||||
ld [wd11d], a
|
||||
ld [wFirstMonsNotOutYet], a
|
||||
ld hl, wEnemyMon1HP
|
||||
ld bc, wEnemyMon2 - wEnemyMon1 - 1
|
||||
ld d, $3
|
||||
|
|
@ -379,7 +379,7 @@ MainInBattleLoop: ; 3c233 (f:4233)
|
|||
jp z, HandleEnemyMonFainted ; if enemy mon HP is 0, jump
|
||||
call SaveScreenTilesToBuffer1
|
||||
xor a
|
||||
ld [wd11d], a
|
||||
ld [wFirstMonsNotOutYet], a
|
||||
ld a, [W_PLAYERBATTSTATUS2]
|
||||
and (1 << NeedsToRecharge) | (1 << UsingRage) ; check if the player is using Rage or needs to recharge
|
||||
jr nz, .selectEnemyMove
|
||||
|
|
@ -1434,7 +1434,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
|
|||
ld [wLastSwitchInEnemyMonHP + 1],a
|
||||
ld a,1
|
||||
ld [wCurrentMenuItem],a
|
||||
ld a,[wd11d]
|
||||
ld a,[wFirstMonsNotOutYet]
|
||||
dec a
|
||||
jr z,.next4
|
||||
ld a,[wPartyCount]
|
||||
|
|
@ -1549,7 +1549,7 @@ HasMonFainted: ; 3ca97 (f:4a97)
|
|||
ld a, [hli]
|
||||
or [hl]
|
||||
ret nz
|
||||
ld a, [wd11d]
|
||||
ld a, [wFirstMonsNotOutYet]
|
||||
and a
|
||||
jr nz, .done
|
||||
ld hl, NoWillText
|
||||
|
|
@ -1647,8 +1647,8 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)
|
|||
ld hl, NoRunningText
|
||||
.printCantEscapeOrNoRunningText
|
||||
call PrintText
|
||||
ld a, $1
|
||||
ld [wd11f], a
|
||||
ld a, 1
|
||||
ld [wForcePlayerToChooseMon], a
|
||||
call SaveScreenTilesToBuffer1
|
||||
and a ; reset carry
|
||||
ret
|
||||
|
|
@ -2334,7 +2334,7 @@ UseBagItem:
|
|||
res UsingTrappingMove, [hl] ; not using multi-turn move any more
|
||||
|
||||
.checkIfMonCaptured
|
||||
ld a, [wd11c]
|
||||
ld a, [wCapturedMonSpecies]
|
||||
and a ; was the enemy mon captured with a ball?
|
||||
jr nz, .returnAfterCapturingMon
|
||||
|
||||
|
|
@ -2354,7 +2354,7 @@ UseBagItem:
|
|||
.returnAfterCapturingMon
|
||||
call GBPalNormal
|
||||
xor a
|
||||
ld [wd11c], a
|
||||
ld [wCapturedMonSpecies], a
|
||||
ld a, $2
|
||||
ld [wBattleResult], a
|
||||
scf ; set carry
|
||||
|
|
@ -2516,8 +2516,8 @@ BattleMenu_RunWasSelected: ; 3d1fa (f:51fa)
|
|||
ld hl, wBattleMonSpeed
|
||||
ld de, wEnemyMonSpeed
|
||||
call TryRunningFromBattle
|
||||
ld a, $0
|
||||
ld [wd11f], a
|
||||
ld a, 0
|
||||
ld [wForcePlayerToChooseMon], a
|
||||
ret c
|
||||
ld a, [wActionResultOrTookBattleTurn]
|
||||
and a
|
||||
|
|
@ -3035,18 +3035,18 @@ SelectEnemyMove: ; 3d564 (f:5564)
|
|||
push hl
|
||||
call BattleRandom
|
||||
ld b, $1
|
||||
cp $3f ; select move 1 in [0,3e] (63/256 chance)
|
||||
cp $3f ; select move 1, [0,3e] (63/256 chance)
|
||||
jr c, .moveChosen
|
||||
inc hl
|
||||
inc b
|
||||
cp $7f ; select move 1 in [3f,7e] (64/256 chance)
|
||||
cp $7f ; select move 2, [3f,7e] (64/256 chance)
|
||||
jr c, .moveChosen
|
||||
inc hl
|
||||
inc b
|
||||
cp $be ; select move 1 in [7f,bd] (63/256 chance)
|
||||
cp $be ; select move 3, [7f,bd] (63/256 chance)
|
||||
jr c, .moveChosen
|
||||
inc hl
|
||||
inc b ; select move 4 in [be,ff] (66/256 chance)
|
||||
inc b ; select move 4, [be,ff] (66/256 chance)
|
||||
.moveChosen
|
||||
ld a, b
|
||||
dec a
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ EndOfBattle: ; 137aa (4:77aa)
|
|||
ld [W_BATTLETYPE], a
|
||||
ld [W_MOVEMISSED], a
|
||||
ld [W_CUROPPONENT], a
|
||||
ld [wd11f], a
|
||||
ld [wForcePlayerToChooseMon], a
|
||||
ld [wNumRunAttempts], a
|
||||
ld [wEscapedFromBattle], a
|
||||
ld hl, wPartyAndBillsPCSavedMenuItem
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ ReadTrainer: ; 39c53 (e:5c53)
|
|||
ld b,a
|
||||
.LastLoop
|
||||
; update wAmountMoneyWon addresses (money to win) based on enemy's level
|
||||
ld hl,wd047
|
||||
ld hl,wTrainerBaseMoney + 1
|
||||
ld c,2 ; wAmountMoneyWon is a 3-byte number
|
||||
push bc
|
||||
predef AddBCDPredef
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
; unused slots are filled with 0, all used slots may be chosen with equal probability
|
||||
AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
|
||||
ld a, $a
|
||||
ld hl, wHPBarMaxHP ; init temporary move selection array. Only the moves with the lowest numbers are chosen in the end
|
||||
ld hl, wBuffer ; init temporary move selection array. Only the moves with the lowest numbers are chosen in the end
|
||||
ld [hli], a ; move 1
|
||||
ld [hli], a ; move 2
|
||||
ld [hli], a ; move 3
|
||||
|
|
@ -11,14 +11,14 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
|
|||
swap a
|
||||
and $f
|
||||
jr z, .noMoveDisabled
|
||||
ld hl, wHPBarMaxHP
|
||||
ld hl, wBuffer
|
||||
dec a
|
||||
ld c, a
|
||||
ld b, $0
|
||||
add hl, bc ; advance pointer to forbidden move
|
||||
ld [hl], $50 ; forbid (highly discourage) disabled move
|
||||
.noMoveDisabled
|
||||
ld hl, TrainerClassMoveChoiceModifications ; 589B
|
||||
ld hl, TrainerClassMoveChoiceModifications
|
||||
ld a, [W_TRAINERCLASS]
|
||||
ld b, a
|
||||
.loopTrainerClasses
|
||||
|
|
@ -44,7 +44,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
|
|||
dec a
|
||||
add a
|
||||
ld c, a
|
||||
ld b, $0
|
||||
ld b, 0
|
||||
add hl, bc ; skip to pointer
|
||||
ld a, [hli] ; read pointer into hl
|
||||
ld h, [hl]
|
||||
|
|
@ -53,9 +53,9 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
|
|||
push de
|
||||
jp [hl] ; execute modification function
|
||||
.loopFindMinimumEntries ; all entries will be decremented sequentially until one of them is zero
|
||||
ld hl, wHPBarMaxHP ; temp move selection array
|
||||
ld hl, wBuffer ; temp move selection array
|
||||
ld de, wEnemyMonMoves ; enemy moves
|
||||
ld c, $4
|
||||
ld c, NUM_MOVES
|
||||
.loopDecrementEntries
|
||||
ld a, [de]
|
||||
inc de
|
||||
|
|
@ -73,11 +73,11 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
|
|||
inc [hl]
|
||||
dec hl
|
||||
inc a
|
||||
cp $5
|
||||
cp NUM_MOVES + 1
|
||||
jr nz, .loopUndoPartialIteration
|
||||
ld hl, wHPBarMaxHP ; temp move selection array
|
||||
ld hl, wBuffer ; temp move selection array
|
||||
ld de, wEnemyMonMoves ; enemy moves
|
||||
ld c, $4
|
||||
ld c, NUM_MOVES
|
||||
.filterMinimalEntries ; all minimal entries now have value 1. All other slots will be disabled (move set to 0)
|
||||
ld a, [de]
|
||||
and a
|
||||
|
|
@ -97,7 +97,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
|
|||
inc de
|
||||
dec c
|
||||
jr nz, .filterMinimalEntries
|
||||
ld hl, wHPBarMaxHP ; use created temporary array as move set
|
||||
ld hl, wBuffer ; use created temporary array as move set
|
||||
ret
|
||||
.useOriginalMoveSet
|
||||
ld hl, wEnemyMonMoves ; use original move set
|
||||
|
|
@ -694,11 +694,13 @@ SwitchEnemyMon: ; 3a74b (e:674b)
|
|||
ld hl, AIBattleWithdrawText
|
||||
call PrintText
|
||||
|
||||
; This wFirstMonsNotOutYet variable is abused to prevent the player from
|
||||
; switching in a new mon in response to this switch.
|
||||
ld a,1
|
||||
ld [wd11d],a
|
||||
ld [wFirstMonsNotOutYet],a
|
||||
callab EnemySendOut
|
||||
xor a
|
||||
ld [wd11d],a
|
||||
ld [wFirstMonsNotOutYet],a
|
||||
|
||||
ld a,[wLinkState]
|
||||
cp LINK_STATE_BATTLING
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue