aboutsummaryrefslogtreecommitdiffstats
path: root/engine/battle
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2022-09-11 23:34:59 -0500
committerdannye <33dannye@gmail.com>2022-09-12 00:53:37 -0500
commitecab35295aefb44227ba38f257dc40c8c10474e3 (patch)
treed04160bc19180ee50a941d121f90cc7071e7a672 /engine/battle
parentReplace Hard-Coded Number With Constant (diff)
parentAdd `UNUSED_TYPE`/`UNUSED_TYPE_END` constants (diff)
downloadpokeyellow-ecab35295aefb44227ba38f257dc40c8c10474e3.tar.gz
pokeyellow-ecab35295aefb44227ba38f257dc40c8c10474e3.tar.xz
pokeyellow-ecab35295aefb44227ba38f257dc40c8c10474e3.zip
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/core.asm42
-rw-r--r--engine/battle/end_of_battle.asm2
-rw-r--r--engine/battle/init_battle.asm6
3 files changed, 25 insertions, 25 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 27ed1093..8618cced 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -411,12 +411,12 @@ MainInBattleLoop:
cp USING_INTERNAL_CLOCK
jr z, .invertOutcome
call BattleRandom
- cp $80
+ cp 50 percent + 1
jr c, .playerMovesFirst
jr .enemyMovesFirst
.invertOutcome
call BattleRandom
- cp $80
+ cp 50 percent + 1
jr c, .enemyMovesFirst
jr .playerMovesFirst
.enemyMovesFirst
@@ -791,7 +791,7 @@ FaintEnemyPokemon:
ld a, SFX_FAINT_FALL
call PlaySoundWaitForCurrent
.sfxwait
- ld a, [wChannelSoundIDs + Ch5]
+ ld a, [wChannelSoundIDs + CHAN5]
cp SFX_FAINT_FALL
jr z, .sfxwait
ld a, SFX_FAINT_THUD
@@ -875,7 +875,7 @@ EndLowHealthAlarm:
; the low health alarm and prevents it from reactivating until the next battle.
xor a
ld [wLowHealthAlarm], a ; turn off low health alarm
- ld [wChannelSoundIDs + Ch5], a
+ ld [wChannelSoundIDs + CHAN5], a
inc a
ld [wLowHealthAlarmDisabled], a ; prevent it from reactivating
ret
@@ -1358,7 +1358,7 @@ EnemySendOutFirstMon:
ld [wWhichPokemon], a
jr .next3
.next
- ld b, $FF
+ ld b, $ff
.next2
inc b
ld a, [wEnemyMonPartyPos]
@@ -1411,7 +1411,7 @@ EnemySendOutFirstMon:
cp LINK_STATE_BATTLING
jr z, .next4
ld a, [wOptions]
- bit 6, a
+ bit BIT_BATTLE_SHIFT, a
jr nz, .next4
ld hl, TrainerAboutToUseText
call PrintText
@@ -1939,7 +1939,7 @@ DrawPlayerHUDAndHPBar:
ld [hl], $0
ret z
xor a
- ld [wChannelSoundIDs + Ch5], a
+ ld [wChannelSoundIDs + CHAN5], a
ret
.setLowHealthAlarm
ld hl, wLowHealthAlarm
@@ -2174,7 +2174,7 @@ DisplayBattleMenu::
ld [hli], a ; wMaxMenuItem
ld [hl], D_RIGHT | A_BUTTON ; wMenuWatchedKeys
call HandleMenuInput
- bit 4, a ; check if right was pressed
+ bit BIT_D_RIGHT, a
jr nz, .rightColumn
jr .AButtonPressed ; the A button was pressed
.rightColumn ; put cursor in right column of menu
@@ -2455,7 +2455,7 @@ PartyMenuOrRockOrRun:
xor a
ld [hl], a ; wLastMenuItem
call HandleMenuInput
- bit 1, a ; was A pressed?
+ bit BIT_B_BUTTON, a
jr nz, .partyMonDeselected ; if B was pressed, jump
; A was pressed
call PlaceUnfilledArrowMenuCursor
@@ -3131,19 +3131,19 @@ SelectEnemyMove:
.chooseRandomMove
push hl
call BattleRandom
- ld b, $1
- cp $3f ; select move 1, [0,3e] (63/256 chance)
+ ld b, 1 ; 25% chance to select move 1
+ cp 25 percent
jr c, .moveChosen
inc hl
- inc b
- cp $7f ; select move 2, [3f,7e] (64/256 chance)
+ inc b ; 25% chance to select move 2
+ cp 50 percent
jr c, .moveChosen
inc hl
- inc b
- cp $be ; select move 3, [7f,bd] (63/256 chance)
+ inc b ; 25% chance to select move 3
+ cp 75 percent - 1
jr c, .moveChosen
inc hl
- inc b ; select move 4, [be,ff] (66/256 chance)
+ inc b ; 25% chance to select move 4
.moveChosen
ld a, b
dec a
@@ -3583,7 +3583,7 @@ CheckPlayerStatusConditions:
ld a, CONF_ANIM - 1
call PlayMoveAnimation
call BattleRandom
- cp $80 ; 50% chance to hurt itself
+ cp 50 percent + 1 ; chance to hurt itself
jr c, .TriedToUseDisabledMoveCheck
ld hl, wPlayerBattleStatus1
ld a, [hl]
@@ -4792,7 +4792,7 @@ CriticalHitTest:
dec hl
ld c, [hl] ; read move id
ld a, [de]
- bit GETTING_PUMPED, a ; test for focus energy
+ bit GETTING_PUMPED, a ; test for focus energy
jr nz, .focusEnergyUsed ; bug: using focus energy causes a shift to the right instead of left,
; resulting in 1/4 the usual crit chance
sla b ; (effective (base speed/2)*2)
@@ -5548,10 +5548,10 @@ MoveHitTest:
.swiftCheck
ld a, [de]
cp SWIFT_EFFECT
- ret z ; Swift never misses (interestingly, Azure Heights lists this is a myth, but it appears to be true)
+ ret z ; Swift never misses (this was fixed from the Japanese versions)
call CheckTargetSubstitute ; substitute check (note that this overwrites a)
jr z, .checkForDigOrFlyStatus
-; This code is buggy. It's supposed to prevent HP draining moves from working on substitutes.
+; The fix for Swift broke this code. It's supposed to prevent HP draining moves from working on Substitutes.
; Since CheckTargetSubstitute overwrites a with either $00 or $01, it never works.
cp DRAIN_HP_EFFECT
jp z, .moveMissed
@@ -6129,7 +6129,7 @@ CheckEnemyStatusConditions:
bit PAR, [hl]
jr z, .checkIfUsingBide
call BattleRandom
- cp $3f ; 25% to be fully paralysed
+ cp 25 percent ; chance to be fully paralysed
jr nc, .checkIfUsingBide
ld hl, FullyParalyzedText
call PrintText
diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm
index e64f54e7..e07c243e 100644
--- a/engine/battle/end_of_battle.asm
+++ b/engine/battle/end_of_battle.asm
@@ -50,7 +50,7 @@ EndOfBattle:
.resetVariables
xor a
ld [wLowHealthAlarm], a ;disable low health alarm
- ld [wChannelSoundIDs + Ch5], a
+ ld [wChannelSoundIDs + CHAN5], a
ld [wIsInBattle], a
ld [wBattleType], a
ld [wMoveMissed], a
diff --git a/engine/battle/init_battle.asm b/engine/battle/init_battle.asm
index 680befda..e7be112c 100644
--- a/engine/battle/init_battle.asm
+++ b/engine/battle/init_battle.asm
@@ -12,11 +12,11 @@ InitOpponent:
DetermineWildOpponent:
ld a, [wd732]
bit 1, a
- jr z, .asm_3ef2f
+ jr z, .notDebug
ldh a, [hJoyHeld]
- bit 1, a ; B button pressed?
+ bit BIT_B_BUTTON, a
ret nz
-.asm_3ef2f
+.notDebug
ld a, [wNumberOfNoRandomBattleStepsLeft]
and a
ret nz