Identify more bit flags (#1153)

This commit is contained in:
Sylvie
2024-11-29 19:29:30 -05:00
committed by GitHub
parent 8894e29da2
commit 644bd42fb0
78 changed files with 539 additions and 472 deletions

View File

@@ -64,10 +64,11 @@ AIChooseMove:
.ApplyLayers:
ld hl, TrainerClassAttributes + TRNATTR_AI_MOVE_WEIGHTS
; If we have a battle in BattleTower just load the Attributes of the first trainer class in wTrainerClass (Falkner)
; so we have always the same AI, regardless of the loaded class of trainer
; If we have a battle in Battle Tower, just load the attributes of the first
; trainer class in TrainerClassAttributes (Falkner), so we have always the
; same AI, regardless of the loaded class of trainer.
ld a, [wInBattleTowerBattle]
bit 0, a
bit IN_BATTLE_TOWER_BATTLE_F, a
jr nz, .battle_tower_skip
ld a, [wTrainerClass]

View File

@@ -178,7 +178,7 @@ AI_Redundant:
.FutureSight:
; BUG: AI does not discourage Future Sight when it's already been used (see docs/bugs_and_glitches.md)
ld a, [wEnemyScreens]
bit 5, a
bit SCREENS_UNUSED, a
ret
.Heal:

View File

@@ -2365,7 +2365,7 @@ WinTrainerBattle:
ret nz
ld a, [wInBattleTowerBattle]
bit 0, a
bit IN_BATTLE_TOWER_BATTLE_F, a
jr nz, .battle_tower
call BattleWinSlideInEnemyTrainerFrontpic
@@ -2913,7 +2913,7 @@ LostBattle:
ld [wBattleEnded], a
ld a, [wInBattleTowerBattle]
bit 0, a
bit IN_BATTLE_TOWER_BATTLE_F, a
jr nz, .battle_tower
ld a, [wBattleType]
@@ -5972,9 +5972,9 @@ LoadEnemyMon:
and a
jp nz, InitEnemyMon
; and also not in a BattleTower-Battle
; and also not in a Battle Tower battle
ld a, [wInBattleTowerBattle]
bit 0, a
bit IN_BATTLE_TOWER_BATTLE_F, a
jp nz, InitEnemyMon
; Make sure everything knows what species we're working with
@@ -6982,7 +6982,7 @@ GiveExperiencePoints:
ret nz
ld a, [wInBattleTowerBattle]
bit 0, a
bit IN_BATTLE_TOWER_BATTLE_F, a
ret nz
call .EvenlyDivideExpAmongParticipants
@@ -8346,7 +8346,7 @@ CheckPayDay:
ld hl, BattleText_PlayerPickedUpPayDayMoney
call StdBattleTextbox
ld a, [wInBattleTowerBattle]
bit 0, a
bit IN_BATTLE_TOWER_BATTLE_F, a
ret z
call ClearTilemap
call ClearBGPalettes

View File

@@ -1285,7 +1285,7 @@ BattleCommand_Stab:
ld [wCurDamage + 1], a
ld hl, wTypeModifier
set 7, [hl]
set STAB_DAMAGE_F, [hl]
.SkipStab:
ld a, BATTLE_VARS_MOVE_TYPE
@@ -1324,7 +1324,7 @@ BattleCommand_Stab:
push bc
inc hl
ld a, [wTypeModifier]
and %10000000
and STAB_DAMAGE
ld b, a
; If the target is immune to the move, treat it as a miss and calculate the damage as 0
ld a, [hl]
@@ -1390,7 +1390,7 @@ BattleCommand_Stab:
ld a, [wTypeMatchup]
ld b, a
ld a, [wTypeModifier]
and %10000000
and STAB_DAMAGE
or b
ld [wTypeModifier], a
ret
@@ -2198,7 +2198,7 @@ GetFailureResultText:
ld hl, DoesntAffectText
ld de, DoesntAffectText
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
jr z, .got_text
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
@@ -2223,7 +2223,7 @@ GetFailureResultText:
ret nz
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
ret z
ld hl, wCurDamage
@@ -2268,7 +2268,7 @@ BattleCommand_BideFailText:
ret z
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
jp z, PrintDoesntAffect
jp PrintButItFailed
@@ -2323,7 +2323,7 @@ BattleCommand_SuperEffectiveLoopText:
BattleCommand_SuperEffectiveText:
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
cp EFFECTIVE
ret z
ld hl, SuperEffectiveText
@@ -3673,7 +3673,7 @@ BattleCommand_PoisonTarget:
and a
ret nz
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
ret z
call CheckIfTargetIsPoisonType
ret z
@@ -3701,7 +3701,7 @@ BattleCommand_PoisonTarget:
BattleCommand_Poison:
ld hl, DoesntAffectText
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
jp z, .failed
call CheckIfTargetIsPoisonType
@@ -3937,7 +3937,7 @@ BattleCommand_BurnTarget:
and a
jp nz, Defrost
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
ret z
call CheckMoveTypeMatchesTarget ; Don't burn a Fire-type
ret z
@@ -4001,7 +4001,7 @@ BattleCommand_FreezeTarget:
and a
ret nz
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
ret z
ld a, [wBattleWeather]
cp WEATHER_SUN
@@ -4052,7 +4052,7 @@ BattleCommand_ParalyzeTarget:
and a
ret nz
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
ret z
call GetOpponentItem
ld a, b
@@ -5420,7 +5420,7 @@ BattleCommand_HeldFlinch:
BattleCommand_OHKO:
call ResetDamage
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
jr z, .no_effect
ld hl, wEnemyMonLevel
ld de, wBattleMonLevel
@@ -5834,7 +5834,7 @@ BattleCommand_Paralyze:
bit PAR, a
jr nz, .paralyzed
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
jr z, .didnt_affect
call GetOpponentItem
ld a, b

View File

@@ -46,7 +46,7 @@ BattleCommand_RolloutPower:
ld a, BATTLE_VARS_SUBSTATUS1
call GetBattleVarAddr
res 6, [hl]
res SUBSTATUS_ROLLOUT, [hl]
ret
.hit

View File

@@ -1,6 +1,6 @@
ReadTrainerParty:
ld a, [wInBattleTowerBattle]
bit 0, a
bit IN_BATTLE_TOWER_BATTLE_F, a
ret nz
ld a, [wLinkMode]
@@ -323,7 +323,7 @@ ComputeTrainerReward:
Battle_GetTrainerName::
ld a, [wInBattleTowerBattle]
bit 0, a
bit IN_BATTLE_TOWER_BATTLE_F, a
ld hl, wOTPlayerName
jp nz, CopyTrainerName