You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
More AI commentary/labels
This commit is contained in:
@@ -97,7 +97,7 @@ AIScoring_RedStatMods: ; 385e0
|
|||||||
jr c, .statup
|
jr c, .statup
|
||||||
|
|
||||||
; cp EFFECT_ATTACK_DOWN - 1
|
; cp EFFECT_ATTACK_DOWN - 1
|
||||||
jr z, .checkmove
|
jr z, .checkmove ; ignore EFFECT_ALWAYS_HIT
|
||||||
cp EFFECT_EVASION_DOWN + 1
|
cp EFFECT_EVASION_DOWN + 1
|
||||||
jr c, .statdown
|
jr c, .statdown
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ AIScoring_RedStatMods: ; 385e0
|
|||||||
jr c, .statup
|
jr c, .statup
|
||||||
|
|
||||||
; cp EFFECT_ATTACK_DOWN_2 - 1
|
; cp EFFECT_ATTACK_DOWN_2 - 1
|
||||||
jr z, .checkmove
|
jr z, .checkmove ; ignore EFFECT_TRANSFROM
|
||||||
cp EFFECT_EVASION_DOWN_2 + 1
|
cp EFFECT_EVASION_DOWN_2 + 1
|
||||||
jr c, .statdown
|
jr c, .statdown
|
||||||
|
|
||||||
@@ -438,7 +438,7 @@ AIScoring_LeechHit: ; 387f7
|
|||||||
call AICheckEnemyMaxHP
|
call AICheckEnemyMaxHP
|
||||||
ret c
|
ret c
|
||||||
|
|
||||||
; 80% chance to encourage this move otherwise.
|
; 80% chance to encourage this move otherwise.
|
||||||
call Function39521
|
call Function39521
|
||||||
ret c
|
ret c
|
||||||
dec [hl]
|
dec [hl]
|
||||||
@@ -703,12 +703,12 @@ AIScoring_EvasionUp: ; 388d4
|
|||||||
AIScoring_AlwaysHit: ; 38947
|
AIScoring_AlwaysHit: ; 38947
|
||||||
; 80% chance to greatly encourage this move if either...
|
; 80% chance to greatly encourage this move if either...
|
||||||
|
|
||||||
; ...enemy's accuracy level has been lowered three or more stages...
|
; ...enemy's accuracy level has been lowered three or more stages
|
||||||
ld a, [EnemyAccLevel]
|
ld a, [EnemyAccLevel]
|
||||||
cp $5
|
cp $5
|
||||||
jr c, .asm_38954
|
jr c, .asm_38954
|
||||||
|
|
||||||
; ...or player's evasion level has been rasied three or more stages.
|
; ...or player's evasion level has been raised three or more stages.
|
||||||
ld a, [PlayerEvaLevel]
|
ld a, [PlayerEvaLevel]
|
||||||
cp $a
|
cp $a
|
||||||
ret c
|
ret c
|
||||||
@@ -724,27 +724,36 @@ AIScoring_AlwaysHit: ; 38947
|
|||||||
|
|
||||||
|
|
||||||
AIScoring_MirrorMove: ; 3895b
|
AIScoring_MirrorMove: ; 3895b
|
||||||
|
|
||||||
|
; If the player did not use any move last turn...
|
||||||
ld a, [LastEnemyCounterMove]
|
ld a, [LastEnemyCounterMove]
|
||||||
and a
|
and a
|
||||||
jr nz, .asm_38968
|
jr nz, .asm_38968
|
||||||
|
|
||||||
call AICompareSpeed
|
; ...do nothing if enemy is slower than player
|
||||||
|
call AICompareSpeed
|
||||||
ret nc
|
ret nc
|
||||||
|
|
||||||
|
; ...or dismiss this move if enemy is faster than player.
|
||||||
jp AIDiscourageMove
|
jp AIDiscourageMove
|
||||||
|
|
||||||
|
; If the player did use a move last turn...
|
||||||
.asm_38968
|
.asm_38968
|
||||||
push hl
|
push hl
|
||||||
ld hl, Table_0x39301
|
ld hl, UsefulMoves
|
||||||
ld de, 1
|
ld de, 1
|
||||||
call IsInArray
|
call IsInArray
|
||||||
pop hl
|
pop hl
|
||||||
|
|
||||||
|
; ...do nothing if he didn't use a useful move.
|
||||||
ret nc
|
ret nc
|
||||||
|
|
||||||
|
; If he did, 50% chance to encourage this move...
|
||||||
call Function39527
|
call Function39527
|
||||||
ret c
|
ret c
|
||||||
|
|
||||||
dec [hl]
|
dec [hl]
|
||||||
|
|
||||||
|
; ...and 90% chance to encourage this move again if the enemy is faster.
|
||||||
call AICompareSpeed
|
call AICompareSpeed
|
||||||
ret nc
|
ret nc
|
||||||
|
|
||||||
@@ -910,6 +919,10 @@ AIScoring_Heal:
|
|||||||
AIScoring_MorningSun:
|
AIScoring_MorningSun:
|
||||||
AIScoring_Synthesis:
|
AIScoring_Synthesis:
|
||||||
AIScoring_Moonlight: ; 38a3a
|
AIScoring_Moonlight: ; 38a3a
|
||||||
|
; 90% chance to greatly encourage this move if enemy's HP is below 25%.
|
||||||
|
; Discourage this move if enemy's HP is higher than 50%.
|
||||||
|
; Do nothing otherwise.
|
||||||
|
|
||||||
call AICheckEnemyQuarterHP
|
call AICheckEnemyQuarterHP
|
||||||
jr nc, .asm_38a45
|
jr nc, .asm_38a45
|
||||||
call AICheckEnemyHalfHP
|
call AICheckEnemyHalfHP
|
||||||
@@ -953,6 +966,9 @@ AIScoring_Reflect: ; 38a54
|
|||||||
|
|
||||||
|
|
||||||
AIScoring_Ohko: ; 38a60
|
AIScoring_Ohko: ; 38a60
|
||||||
|
; Dismiss this move if player's level is higher than enemy's level
|
||||||
|
; Otherwise, discourage this move is player's HP is below 50%.
|
||||||
|
|
||||||
ld a, [BattleMonLevel]
|
ld a, [BattleMonLevel]
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, [EnemyMonLevel]
|
ld a, [EnemyMonLevel]
|
||||||
@@ -1055,13 +1071,17 @@ AIScoring_Unused2B: ; 38a9c
|
|||||||
|
|
||||||
|
|
||||||
AIScoring_Confuse: ; 38adb
|
AIScoring_Confuse: ; 38adb
|
||||||
|
|
||||||
|
; 90% chance to discourage this move if player's HP is between 25% and 50%.
|
||||||
call AICheckPlayerHalfHP
|
call AICheckPlayerHalfHP
|
||||||
ret c
|
ret c
|
||||||
call Random
|
call Random
|
||||||
cp $19
|
cp $19
|
||||||
jr c, .asm_38ae7
|
jr c, .asm_38ae7
|
||||||
inc [hl]
|
inc [hl]
|
||||||
|
|
||||||
.asm_38ae7
|
.asm_38ae7
|
||||||
|
; Discourage again if player's HP is below 25%.
|
||||||
call AICheckPlayerQuarterHP
|
call AICheckPlayerQuarterHP
|
||||||
ret c
|
ret c
|
||||||
inc [hl]
|
inc [hl]
|
||||||
@@ -1100,6 +1120,9 @@ AIScoring_SpDefenseUp2: ; 38aed
|
|||||||
|
|
||||||
|
|
||||||
AIScoring_Fly: ; 38b12
|
AIScoring_Fly: ; 38b12
|
||||||
|
; Greatly encourage this move if the player is
|
||||||
|
; flying or underground, and slower than the enemy.
|
||||||
|
|
||||||
ld a, [PlayerSubStatus3]
|
ld a, [PlayerSubStatus3]
|
||||||
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
|
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
|
||||||
ret z
|
ret z
|
||||||
@@ -1113,6 +1136,8 @@ AIScoring_Fly: ; 38b12
|
|||||||
|
|
||||||
|
|
||||||
AIScoring_SuperFang: ; 38b20
|
AIScoring_SuperFang: ; 38b20
|
||||||
|
; Discourage this move if player's HP is below 25%.
|
||||||
|
|
||||||
call AICheckPlayerQuarterHP
|
call AICheckPlayerQuarterHP
|
||||||
ret c
|
ret c
|
||||||
inc [hl]
|
inc [hl]
|
||||||
@@ -1121,8 +1146,13 @@ AIScoring_SuperFang: ; 38b20
|
|||||||
|
|
||||||
|
|
||||||
AIScoring_Paralyze: ; 38b26
|
AIScoring_Paralyze: ; 38b26
|
||||||
|
|
||||||
|
; 50% chance to discourage this move if player's HP is below 25%.
|
||||||
call AICheckPlayerQuarterHP
|
call AICheckPlayerQuarterHP
|
||||||
jr nc, .asm_38b3a
|
jr nc, .asm_38b3a
|
||||||
|
|
||||||
|
; 80% chance to greatly encourage this move
|
||||||
|
; if enemy is slower than player and its HP is above 25%.
|
||||||
call AICompareSpeed
|
call AICompareSpeed
|
||||||
ret c
|
ret c
|
||||||
call AICheckEnemyQuarterHP
|
call AICheckEnemyQuarterHP
|
||||||
@@ -1162,6 +1192,8 @@ AIScoring_SpeedDownHit: ; 38b40
|
|||||||
|
|
||||||
|
|
||||||
AIScoring_Substitute: ; 38b5c
|
AIScoring_Substitute: ; 38b5c
|
||||||
|
; Dismiss this move if enemy's HP is below 50%.
|
||||||
|
|
||||||
call AICheckEnemyHalfHP
|
call AICheckEnemyHalfHP
|
||||||
ret c
|
ret c
|
||||||
jp AIDiscourageMove
|
jp AIDiscourageMove
|
||||||
@@ -1171,6 +1203,8 @@ AIScoring_Substitute: ; 38b5c
|
|||||||
AIScoring_HyperBeam: ; 38b63
|
AIScoring_HyperBeam: ; 38b63
|
||||||
call AICheckEnemyHalfHP
|
call AICheckEnemyHalfHP
|
||||||
jr c, .asm_38b72
|
jr c, .asm_38b72
|
||||||
|
|
||||||
|
; 50% chance to encourage this move if enemy's HP is below 25%.
|
||||||
call AICheckEnemyQuarterHP
|
call AICheckEnemyQuarterHP
|
||||||
ret c
|
ret c
|
||||||
call Function39527
|
call Function39527
|
||||||
@@ -1179,6 +1213,7 @@ AIScoring_HyperBeam: ; 38b63
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.asm_38b72
|
.asm_38b72
|
||||||
|
; If enemy's HP is above 50%, discourage this move at random
|
||||||
call Random
|
call Random
|
||||||
cp 40
|
cp 40
|
||||||
ret c
|
ret c
|
||||||
@@ -1256,7 +1291,7 @@ AIScoring_Mimic: ; 38ba8
|
|||||||
.asm_38bd4
|
.asm_38bd4
|
||||||
ld a, [LastEnemyCounterMove]
|
ld a, [LastEnemyCounterMove]
|
||||||
push hl
|
push hl
|
||||||
ld hl, Table_0x39301
|
ld hl, UsefulMoves
|
||||||
ld de, 1
|
ld de, 1
|
||||||
call IsInArray
|
call IsInArray
|
||||||
|
|
||||||
@@ -1640,6 +1675,7 @@ AIScoring_PriorityHit: ; 38d5a
|
|||||||
|
|
||||||
AIScoring_Thief: ; 38d93
|
AIScoring_Thief: ; 38d93
|
||||||
; Don't use Thief unless it's the only move available.
|
; Don't use Thief unless it's the only move available.
|
||||||
|
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
add $1e
|
add $1e
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
@@ -1695,7 +1731,7 @@ AIScoring_Disable: ; 38dd1
|
|||||||
|
|
||||||
push hl
|
push hl
|
||||||
ld a, [LastEnemyCounterMove]
|
ld a, [LastEnemyCounterMove]
|
||||||
ld hl, Table_0x39301
|
ld hl, UsefulMoves
|
||||||
ld de, 1
|
ld de, 1
|
||||||
call IsInArray
|
call IsInArray
|
||||||
|
|
||||||
@@ -2641,6 +2677,8 @@ AIScoring_Solarbeam: ; 3920b
|
|||||||
|
|
||||||
|
|
||||||
AIScoring_Thunder: ; 39225
|
AIScoring_Thunder: ; 39225
|
||||||
|
; 90% chance to discourage this move when it's raining.
|
||||||
|
|
||||||
ld a, [Weather]
|
ld a, [Weather]
|
||||||
cp WEATHER_SUN
|
cp WEATHER_SUN
|
||||||
ret nz
|
ret nz
|
||||||
@@ -2655,6 +2693,8 @@ AIScoring_Thunder: ; 39225
|
|||||||
|
|
||||||
|
|
||||||
AICompareSpeed: ; 39233
|
AICompareSpeed: ; 39233
|
||||||
|
; Return carry if enemy is faster than player
|
||||||
|
|
||||||
push bc
|
push bc
|
||||||
ld a, [EnemyMonSpeed + 1]
|
ld a, [EnemyMonSpeed + 1]
|
||||||
ld b, a
|
ld b, a
|
||||||
@@ -2873,7 +2913,7 @@ AIHasMoveInArray: ; 392e6
|
|||||||
; 39301
|
; 39301
|
||||||
|
|
||||||
|
|
||||||
Table_0x39301: ; 39301
|
UsefulMoves: ; 39301
|
||||||
db DOUBLE_EDGE
|
db DOUBLE_EDGE
|
||||||
db SING
|
db SING
|
||||||
db FLAMETHROWER
|
db FLAMETHROWER
|
||||||
@@ -3034,12 +3074,13 @@ AIScoring_Aggressive: ; 39369
|
|||||||
jr .checkmove
|
jr .checkmove
|
||||||
|
|
||||||
.gotstrongestmove
|
.gotstrongestmove
|
||||||
|
; Discourage moves that do less damage unless they're reckless too.
|
||||||
|
|
||||||
; Nothing we can do if no attacks did damage.
|
; Nothing we can do if no attacks did damage.
|
||||||
ld a, c
|
ld a, c
|
||||||
and a
|
and a
|
||||||
jr z, .done
|
jr z, .done
|
||||||
|
|
||||||
; Discourage moves that do less damage unless they're reckless too.
|
|
||||||
ld hl, Buffer1 - 1
|
ld hl, Buffer1 - 1
|
||||||
ld de, EnemyMonMoves
|
ld de, EnemyMonMoves
|
||||||
ld b, 0
|
ld b, 0
|
||||||
@@ -3121,7 +3162,7 @@ AIDamageCalc: ; 393e7
|
|||||||
|
|
||||||
|
|
||||||
AIScoring_Cautious: ; 39418
|
AIScoring_Cautious: ; 39418
|
||||||
; Don't use moves with residual effects after turn 1.
|
; 90% chance to discourage moves with residual effects after enemy's turn 1.
|
||||||
|
|
||||||
ld a, [EnemyTurnsTaken]
|
ld a, [EnemyTurnsTaken]
|
||||||
and a
|
and a
|
||||||
@@ -3178,7 +3219,7 @@ AIScoring_Cautious: ; 39418
|
|||||||
|
|
||||||
|
|
||||||
AIScoring_StatusImmunity: ; 39453
|
AIScoring_StatusImmunity: ; 39453
|
||||||
; Don't use status moves that don't affect the player.
|
; Dismiss status moves that don't affect the player.
|
||||||
|
|
||||||
ld hl, Buffer1 - 1
|
ld hl, Buffer1 - 1
|
||||||
ld de, EnemyMonMoves
|
ld de, EnemyMonMoves
|
||||||
@@ -3242,7 +3283,8 @@ AIScoring_StatusImmunity: ; 39453
|
|||||||
|
|
||||||
|
|
||||||
AIScoring_Risky: ; 394a9
|
AIScoring_Risky: ; 394a9
|
||||||
; Use any move that will KO the opponent.
|
; Use any move that will KO the target.
|
||||||
|
; Risky moves will often be an exception (see below).
|
||||||
|
|
||||||
ld hl, Buffer1 - 1
|
ld hl, Buffer1 - 1
|
||||||
ld de, EnemyMonMoves
|
ld de, EnemyMonMoves
|
||||||
@@ -3265,19 +3307,20 @@ AIScoring_Risky: ; 394a9
|
|||||||
ld a, [wEnemyMoveStruct + MOVE_POWER]
|
ld a, [wEnemyMoveStruct + MOVE_POWER]
|
||||||
and a
|
and a
|
||||||
jr z, .nextmove
|
jr z, .nextmove
|
||||||
|
|
||||||
; Don't use risky moves at max hp.
|
|
||||||
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
|
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
|
||||||
ld de, 1
|
ld de, 1
|
||||||
ld hl, .riskymoves
|
ld hl, .riskymoves
|
||||||
call IsInArray
|
call IsInArray
|
||||||
jr nc, .checkko
|
jr nc, .checkko
|
||||||
|
|
||||||
|
; Exclude risky moves if enemy's HP is full.
|
||||||
call AICheckEnemyMaxHP
|
call AICheckEnemyMaxHP
|
||||||
jr c, .nextmove
|
jr c, .nextmove
|
||||||
|
|
||||||
|
; Otherwise, 80% chance to exclude them.
|
||||||
call Random
|
call Random
|
||||||
cp 200 ; 1/5
|
cp 200
|
||||||
jr c, .nextmove
|
jr c, .nextmove
|
||||||
|
|
||||||
.checkko
|
.checkko
|
||||||
|
Reference in New Issue
Block a user