diff options
author | YamaArashi <shadow962@live.com> | 2015-07-24 20:27:59 -0700 |
---|---|---|
committer | YamaArashi <shadow962@live.com> | 2015-07-24 20:27:59 -0700 |
commit | 7f6d0d49b61a77cfba76057d99881634b882486b (patch) | |
tree | afb152986ff34039cb64e3101dd2b2b1e3293552 /engine/battle | |
parent | 12db77201f7ba50241331c3949241a420f43d660 (diff) |
more naming variables
Diffstat (limited to 'engine/battle')
-rwxr-xr-x | engine/battle/core.asm | 28 | ||||
-rwxr-xr-x | engine/battle/end_of_battle.asm | 2 | ||||
-rwxr-xr-x | engine/battle/read_trainer_party.asm | 2 | ||||
-rw-r--r-- | engine/battle/trainer_ai.asm | 26 |
4 files changed, 30 insertions, 28 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 0406fe7b..b3d82f8c 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -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 diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index 8264e49c..c642d206 100755 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -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 diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index 4f72aea1..0976c7c7 100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -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 diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index c803a870..fb932035 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -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 |