You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
Local labels starting with capital letters are now decorated with a trailing colon; remove trailing whitespace; globally correct line endings to UNIX style
This commit is contained in:
@@ -318,7 +318,7 @@ AI_Items: ; 39196
|
||||
jp c, .Use
|
||||
jp .DontUse
|
||||
|
||||
.StatusCheckContext
|
||||
.StatusCheckContext:
|
||||
ld a, [EnemySubStatus5]
|
||||
bit SUBSTATUS_TOXIC, a
|
||||
jr z, .FailToxicCheck
|
||||
@@ -328,7 +328,7 @@ AI_Items: ; 39196
|
||||
call Random
|
||||
cp 1 + 50 percent
|
||||
jp c, .Use
|
||||
.FailToxicCheck
|
||||
.FailToxicCheck:
|
||||
ld a, [EnemyMonStatus]
|
||||
and 1 << FRZ | SLP
|
||||
jp z, .DontUse
|
||||
@@ -344,7 +344,7 @@ AI_Items: ; 39196
|
||||
call .Status
|
||||
jp c, .DontUse
|
||||
|
||||
.UseFullRestore
|
||||
.UseFullRestore:
|
||||
call EnemyUsedFullRestore
|
||||
jp .Use
|
||||
; 38220
|
||||
@@ -676,7 +676,7 @@ AI_TrySwitch: ; 3844b
|
||||
ld c, a
|
||||
ld hl, OTPartyMon1HP
|
||||
ld d, 0
|
||||
.SwitchLoop
|
||||
.SwitchLoop:
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld a, [hld]
|
||||
|
||||
@@ -31,24 +31,24 @@ endr
|
||||
|
||||
ld hl, EnemyMonMoves
|
||||
ld c, 0
|
||||
.CheckDisabledMove
|
||||
.CheckDisabledMove:
|
||||
cp [hl]
|
||||
jr z, .ScoreDisabledMove
|
||||
inc c
|
||||
inc hl
|
||||
jr .CheckDisabledMove
|
||||
.ScoreDisabledMove
|
||||
.ScoreDisabledMove:
|
||||
ld hl, Buffer1
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld [hl], 80
|
||||
|
||||
; Don't pick moves with 0 PP.
|
||||
.CheckPP
|
||||
.CheckPP:
|
||||
ld hl, Buffer1 - 1
|
||||
ld de, EnemyMonPP
|
||||
ld b, 0
|
||||
.CheckMovePP
|
||||
.CheckMovePP:
|
||||
inc b
|
||||
ld a, b
|
||||
cp EnemyMonMovesEnd - EnemyMonMoves + 1
|
||||
@@ -63,7 +63,7 @@ endr
|
||||
|
||||
|
||||
; Apply AI scoring layers depending on the trainer class.
|
||||
.ApplyLayers
|
||||
.ApplyLayers:
|
||||
ld hl, TrainerClassAttributes + TRNATTR_AI_MOVE_WEIGHTS
|
||||
|
||||
; If we have a battle in BattleTower just load the Attributes of the first TrainerClass (Falkner)
|
||||
@@ -82,7 +82,7 @@ endr
|
||||
push bc
|
||||
push hl
|
||||
|
||||
.CheckLayer
|
||||
.CheckLayer:
|
||||
pop hl
|
||||
pop bc
|
||||
|
||||
@@ -119,12 +119,12 @@ endr
|
||||
jr .CheckLayer
|
||||
|
||||
; Decrement the scores of all moves one by one until one reaches 0.
|
||||
.DecrementScores
|
||||
.DecrementScores:
|
||||
ld hl, Buffer1
|
||||
ld de, EnemyMonMoves
|
||||
ld c, EnemyMonMovesEnd - EnemyMonMoves
|
||||
|
||||
.DecrementNextScore
|
||||
.DecrementNextScore:
|
||||
; If the enemy has no moves, this will infinite.
|
||||
ld a, [de]
|
||||
inc de
|
||||
@@ -145,7 +145,7 @@ endr
|
||||
; In order to avoid bias towards the moves located first in memory, increment the scores
|
||||
; that were decremented one more time than the rest (in case there was a tie).
|
||||
; This means that the minimum score will be 1.
|
||||
.PickLowestScoreMoves
|
||||
.PickLowestScoreMoves:
|
||||
ld a, c
|
||||
|
||||
.move_loop
|
||||
@@ -159,14 +159,14 @@ endr
|
||||
ld de, EnemyMonMoves
|
||||
ld c, NUM_MOVES
|
||||
|
||||
; Give a score of 0 to a blank move
|
||||
; Give a score of 0 to a blank move
|
||||
.loop2
|
||||
ld a, [de]
|
||||
and a
|
||||
jr nz, .skip_load
|
||||
ld [hl], a
|
||||
|
||||
; Disregard the move if its score is not 1
|
||||
; Disregard the move if its score is not 1
|
||||
.skip_load
|
||||
ld a, [hl]
|
||||
dec a
|
||||
@@ -183,8 +183,8 @@ endr
|
||||
dec c
|
||||
jr nz, .loop2
|
||||
|
||||
; Randomly choose one of the moves with a score of 1
|
||||
.ChooseMove
|
||||
; Randomly choose one of the moves with a score of 1
|
||||
.ChooseMove:
|
||||
ld hl, Buffer1
|
||||
call Random
|
||||
and 3
|
||||
|
||||
@@ -23,7 +23,7 @@ AI_Basic: ; 38591
|
||||
|
||||
; Dismiss moves with special effects if they are
|
||||
; useless or not a good choice right now.
|
||||
; For example, healing moves, weather moves, Dream Eater...
|
||||
; For example, healing moves, weather moves, Dream Eater...
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -33,7 +33,7 @@ AI_Basic: ; 38591
|
||||
pop hl
|
||||
jr nz, .discourage
|
||||
|
||||
; Dismiss status-only moves if the player can't be statused.
|
||||
; Dismiss status-only moves if the player can't be statused.
|
||||
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
|
||||
push hl
|
||||
push de
|
||||
@@ -680,7 +680,7 @@ rept 2
|
||||
inc [hl]
|
||||
endr
|
||||
|
||||
; 30% chance to end up here if enemy's HP is full and player is not badly poisoned.
|
||||
; 30% chance to end up here if enemy's HP is full and player is not badly poisoned.
|
||||
; 77% chance to end up here if enemy's HP is above 50% but not full.
|
||||
; 96% chance to end up here if enemy's HP is between 25% and 50%.
|
||||
; 100% chance to end up here if enemy's HP is below 25%.
|
||||
@@ -771,7 +771,7 @@ AI_Smart_MirrorMove: ; 3895b
|
||||
jr nz, .asm_38968
|
||||
|
||||
; ...do nothing if enemy is slower than player
|
||||
call AICompareSpeed
|
||||
call AICompareSpeed
|
||||
ret nc
|
||||
|
||||
; ...or dismiss this move if enemy is faster than player.
|
||||
@@ -784,7 +784,7 @@ AI_Smart_MirrorMove: ; 3895b
|
||||
ld de, 1
|
||||
call IsInArray
|
||||
pop hl
|
||||
|
||||
|
||||
; ...do nothing if he didn't use a useful move.
|
||||
ret nc
|
||||
|
||||
@@ -813,11 +813,11 @@ AI_Smart_AccuracyDown: ; 38985
|
||||
call AICheckPlayerMaxHP
|
||||
jr nc, .asm_389a0
|
||||
|
||||
; ...and enemy's HP is above 50%...
|
||||
; ...and enemy's HP is above 50%...
|
||||
call AICheckEnemyHalfHP
|
||||
jr nc, .asm_389a0
|
||||
|
||||
; ...greatly encourage this move if player is badly poisoned.
|
||||
; ...greatly encourage this move if player is badly poisoned.
|
||||
ld a, [PlayerSubStatus5]
|
||||
bit SUBSTATUS_TOXIC, a
|
||||
jr nz, .asm_3899d
|
||||
@@ -839,21 +839,21 @@ endr
|
||||
call AICheckPlayerQuarterHP
|
||||
jr nc, .asm_389bd
|
||||
|
||||
; If player's HP is above 25% but not full, 4% chance to greatly encourage this move.
|
||||
; If player's HP is above 25% but not full, 4% chance to greatly encourage this move.
|
||||
call Random
|
||||
cp $a
|
||||
jr c, .asm_3899d
|
||||
|
||||
; If player's HP is between 25% and 50%,...
|
||||
; If player's HP is between 25% and 50%,...
|
||||
call AICheckPlayerHalfHP
|
||||
jr nc, .asm_389b8
|
||||
|
||||
; If player's HP is above 50% but not full, 20% chance to greatly encourage this move.
|
||||
; If player's HP is above 50% but not full, 20% chance to greatly encourage this move.
|
||||
call AI_80_20
|
||||
jr c, .asm_3899d
|
||||
jr .asm_389bf
|
||||
|
||||
; ...50% chance to greatly discourage this move.
|
||||
; ...50% chance to greatly discourage this move.
|
||||
.asm_389b8
|
||||
call AI_50_50
|
||||
jr c, .asm_389bf
|
||||
@@ -863,7 +863,7 @@ rept 2
|
||||
inc [hl]
|
||||
endr
|
||||
|
||||
; We only end up here if the move has not been already encouraged.
|
||||
; We only end up here if the move has not been already encouraged.
|
||||
.asm_389bf
|
||||
ld a, [PlayerSubStatus5]
|
||||
bit SUBSTATUS_TOXIC, a
|
||||
@@ -873,14 +873,14 @@ endr
|
||||
bit SUBSTATUS_LEECH_SEED, a
|
||||
jr nz, .asm_389ef
|
||||
|
||||
; Discourage this move if enemy's evasion level is higher than player's accuracy level.
|
||||
; Discourage this move if enemy's evasion level is higher than player's accuracy level.
|
||||
ld a, [EnemyEvaLevel]
|
||||
ld b, a
|
||||
ld a, [PlayerAccLevel]
|
||||
cp b
|
||||
jr c, .asm_389e4
|
||||
|
||||
; Greatly encourage this move if the player is in the middle of Fury Cutter or Rollout.
|
||||
; Greatly encourage this move if the player is in the middle of Fury Cutter or Rollout.
|
||||
ld a, [PlayerFuryCutterCount]
|
||||
and a
|
||||
jr nz, .asm_3899d
|
||||
@@ -895,7 +895,7 @@ endr
|
||||
|
||||
; Player is badly poisoned.
|
||||
; 80% chance to greatly encourage this move.
|
||||
; This would counter any previous discouragement.
|
||||
; This would counter any previous discouragement.
|
||||
.asm_389e6
|
||||
call Random
|
||||
cp $50
|
||||
@@ -907,7 +907,7 @@ endr
|
||||
|
||||
; Player is seeded.
|
||||
; 50% chance to encourage this move.
|
||||
; This would partly counter any previous discouragement.
|
||||
; This would partly counter any previous discouragement.
|
||||
.asm_389ef
|
||||
call AI_50_50
|
||||
ret c
|
||||
@@ -931,7 +931,7 @@ AI_Smart_Haze: ; 389f5
|
||||
jr c, .asm_38a12
|
||||
jr .asm_389fb
|
||||
|
||||
; 85% chance to encourage this move if any of player's stat levels is higher than +2.
|
||||
; 85% chance to encourage this move if any of player's stat levels is higher than +2.
|
||||
.asm_38a05
|
||||
ld hl, PlayerAtkLevel
|
||||
ld c, $8
|
||||
@@ -1164,7 +1164,7 @@ AI_Smart_Confuse: ; 38adb
|
||||
cp $19
|
||||
jr c, .asm_38ae7
|
||||
inc [hl]
|
||||
|
||||
|
||||
.asm_38ae7
|
||||
; Discourage again if player's HP is below 25%.
|
||||
call AICheckPlayerQuarterHP
|
||||
@@ -1220,10 +1220,10 @@ AI_Smart_Fly: ; 38b12
|
||||
ld a, [PlayerSubStatus3]
|
||||
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
|
||||
ret z
|
||||
|
||||
|
||||
call AICompareSpeed
|
||||
ret nc
|
||||
|
||||
|
||||
rept 3
|
||||
dec [hl]
|
||||
endr
|
||||
@@ -1246,9 +1246,9 @@ AI_Smart_Paralyze: ; 38b26
|
||||
; 50% chance to discourage this move if player's HP is below 25%.
|
||||
call AICheckPlayerQuarterHP
|
||||
jr nc, .asm_38b3a
|
||||
|
||||
|
||||
; 80% chance to greatly encourage this move
|
||||
; if enemy is slower than player and its HP is above 25%.
|
||||
; if enemy is slower than player and its HP is above 25%.
|
||||
call AICompareSpeed
|
||||
ret c
|
||||
call AICheckEnemyQuarterHP
|
||||
@@ -1308,8 +1308,8 @@ AI_Smart_Substitute: ; 38b5c
|
||||
AI_Smart_HyperBeam: ; 38b63
|
||||
call AICheckEnemyHalfHP
|
||||
jr c, .asm_38b72
|
||||
|
||||
; 50% chance to encourage this move if enemy's HP is below 25%.
|
||||
|
||||
; 50% chance to encourage this move if enemy's HP is below 25%.
|
||||
call AICheckEnemyQuarterHP
|
||||
ret c
|
||||
call AI_50_50
|
||||
@@ -1335,13 +1335,13 @@ AI_Smart_Rage: ; 38b7f
|
||||
bit SUBSTATUS_RAGE, a
|
||||
jr z, .asm_38b9b
|
||||
|
||||
; If enemy's Rage is building, 50% chance to encourage this move.
|
||||
; If enemy's Rage is building, 50% chance to encourage this move.
|
||||
call AI_50_50
|
||||
jr c, .asm_38b8c
|
||||
|
||||
dec [hl]
|
||||
|
||||
; Encourage this move based on Rage's counter.
|
||||
; Encourage this move based on Rage's counter.
|
||||
.asm_38b8c
|
||||
ld a, [wEnemyRageCounter]
|
||||
cp $2
|
||||
@@ -1773,12 +1773,12 @@ AI_Smart_PriorityHit: ; 38d5a
|
||||
call AICompareSpeed
|
||||
ret c
|
||||
|
||||
; Dismiss this move if the player is flying or underground.
|
||||
; Dismiss this move if the player is flying or underground.
|
||||
ld a, [PlayerSubStatus3]
|
||||
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
|
||||
jp nz, AIDiscourageMove
|
||||
|
||||
; Greatly encourage this move if it will KO the player.
|
||||
; Greatly encourage this move if it will KO the player.
|
||||
ld a, $1
|
||||
ld [hBattleTurn], a
|
||||
push hl
|
||||
@@ -1895,18 +1895,18 @@ AI_Smart_MeanLook: ; 38dfb
|
||||
pop hl
|
||||
jp z, AIDiscourageMove
|
||||
|
||||
; 80% chance to greatly encourage this move if the enemy is badly poisoned (weird).
|
||||
; 80% chance to greatly encourage this move if the enemy is badly poisoned (weird).
|
||||
ld a, [EnemySubStatus5]
|
||||
bit SUBSTATUS_TOXIC, a
|
||||
jr nz, .asm_38e26
|
||||
|
||||
; 80% chance to greatly encourage this move if the player is either
|
||||
; in love, identified, stuck in Rollout, or has a Nightmare.
|
||||
; in love, identified, stuck in Rollout, or has a Nightmare.
|
||||
ld a, [PlayerSubStatus1]
|
||||
and 1<<SUBSTATUS_IN_LOVE | 1<<SUBSTATUS_ROLLOUT | 1<<SUBSTATUS_IDENTIFIED | 1<<SUBSTATUS_NIGHTMARE
|
||||
jr nz, .asm_38e26
|
||||
|
||||
; Otherwise, discourage this move unless the player only has not very effective moves against the enemy.
|
||||
; Otherwise, discourage this move unless the player only has not very effective moves against the enemy.
|
||||
push hl
|
||||
callab CheckPlayerMoveTypeMatchups
|
||||
ld a, [wEnemyAISwitchScore]
|
||||
@@ -2233,7 +2233,7 @@ AI_Smart_Sandstorm: ; 38f7a
|
||||
inc [hl]
|
||||
ret
|
||||
|
||||
.SandstormImmuneTypes
|
||||
.SandstormImmuneTypes:
|
||||
db ROCK
|
||||
db GROUND
|
||||
db STEEL
|
||||
@@ -2493,7 +2493,7 @@ AI_Smart_HiddenPower: ; 3909e
|
||||
push hl
|
||||
ld a, 1
|
||||
ld [hBattleTurn], a
|
||||
|
||||
|
||||
; Calculate Hidden Power's type and base power based on enemy's DVs.
|
||||
callab HiddenPowerDamage
|
||||
callab BattleCheckTypeMatchup
|
||||
@@ -2697,7 +2697,7 @@ AI_Smart_PsychUp: ; 39152
|
||||
jr nz, .asm_3915a
|
||||
|
||||
; Calculate the sum of all player's stat level modifiers. Add 100 first to prevent underflow.
|
||||
; Put the result in d. d will range between 58 and 142.
|
||||
; Put the result in d. d will range between 58 and 142.
|
||||
ld hl, PlayerAtkLevel
|
||||
ld b, $8
|
||||
ld d, 100
|
||||
@@ -2716,12 +2716,12 @@ AI_Smart_PsychUp: ; 39152
|
||||
pop hl
|
||||
jr nc, .asm_39188
|
||||
|
||||
; Else, 80% chance to encourage this move unless player's accuracy level is lower than -1...
|
||||
; Else, 80% chance to encourage this move unless player's accuracy level is lower than -1...
|
||||
ld a, [PlayerAccLevel]
|
||||
cp $6
|
||||
ret c
|
||||
|
||||
; ...or enemy's evasion level is higher than +0.
|
||||
|
||||
; ...or enemy's evasion level is higher than +0.
|
||||
ld a, [EnemyEvaLevel]
|
||||
cp $8
|
||||
ret nc
|
||||
@@ -2825,7 +2825,7 @@ rept 2
|
||||
endr
|
||||
ret
|
||||
|
||||
; Try to predict if the player will use Fly this turn.
|
||||
; Try to predict if the player will use Fly this turn.
|
||||
.couldFly
|
||||
|
||||
; 50% chance to encourage this move if the enemy is slower than the player.
|
||||
@@ -3175,10 +3175,10 @@ AI_Opportunist: ; 39315
|
||||
call AICheckEnemyHalfHP
|
||||
ret c
|
||||
|
||||
; Discourage stall moves if enemy's HP is below 25%.
|
||||
; Discourage stall moves if enemy's HP is below 25%.
|
||||
call AICheckEnemyQuarterHP
|
||||
jr nc, .asm_39322
|
||||
|
||||
|
||||
; 50% chance to discourage stall moves if enemy's HP is between 25% and 50%.
|
||||
call AI_50_50
|
||||
ret c
|
||||
@@ -3333,12 +3333,12 @@ AI_Aggressive: ; 39369
|
||||
|
||||
; Ignore this move if its power is 0 or 1.
|
||||
; Moves such as Seismic Toss, Hidden Power,
|
||||
; Counter and Fissure have a base power of 1.
|
||||
; Counter and Fissure have a base power of 1.
|
||||
ld a, [wEnemyMoveStruct + MOVE_POWER]
|
||||
cp 2
|
||||
jr c, .checkmove2
|
||||
|
||||
; Ignore this move if it is reckless.
|
||||
; Ignore this move if it is reckless.
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -3351,7 +3351,7 @@ AI_Aggressive: ; 39369
|
||||
pop hl
|
||||
jr c, .checkmove2
|
||||
|
||||
; If we made it this far, discourage this move.
|
||||
; If we made it this far, discourage this move.
|
||||
inc [hl]
|
||||
jr .checkmove2
|
||||
|
||||
@@ -3384,7 +3384,7 @@ AIDamageCalc: ; 393e7
|
||||
callab BattleCommand_Stab
|
||||
ret
|
||||
|
||||
.ConstantDamageEffects
|
||||
.ConstantDamageEffects:
|
||||
db EFFECT_SUPER_FANG
|
||||
db EFFECT_STATIC_DAMAGE
|
||||
db EFFECT_LEVEL_DAMAGE
|
||||
@@ -3550,7 +3550,7 @@ AI_Risky: ; 394a9
|
||||
call AICheckEnemyMaxHP
|
||||
jr c, .nextmove
|
||||
|
||||
; Else, 80% chance to exclude them.
|
||||
; Else, 80% chance to exclude them.
|
||||
call Random
|
||||
cp 200 ; 1/5
|
||||
jr c, .nextmove
|
||||
|
||||
@@ -161,7 +161,7 @@ endr
|
||||
|
||||
.doubledown
|
||||
call .DecreaseScore
|
||||
|
||||
|
||||
; fallthrough
|
||||
; 34931
|
||||
|
||||
|
||||
Reference in New Issue
Block a user