Document bug: AI does not discourage Nightmare if the player has any status condition (#1242)
Some checks failed
CI / build (push) Has been cancelled
CI / build-macos (push) Has been cancelled

This commit is contained in:
MichailTalReborn 2026-03-12 16:44:29 +01:00 committed by GitHub
parent 9b69c36897
commit 983c33b5c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -54,6 +54,7 @@ Fixes in the [multi-player battle engine](#multi-player-battle-engine) category
- ["Smart" AI discourages Conversion2 after the first turn](#smart-ai-discourages-conversion2-after-the-first-turn)
- ["Smart" AI does not encourage Solar Beam, Flame Wheel, or Moonlight during Sunny Day](#smart-ai-does-not-encourage-solar-beam-flame-wheel-or-moonlight-during-sunny-day)
- ["Cautious" AI may fail to discourage residual moves](#cautious-ai-may-fail-to-discourage-residual-moves)
- [AI does not discourage Nightmare if the player has any status condition](#ai-does-not-discourage-nightmare-if-the-player-has-any-status-condition)
- [AI does not discourage Future Sight when it's already been used](#ai-does-not-discourage-future-sight-when-its-already-been-used)
- [AI makes a false assumption about `CheckTypeMatchup`](#ai-makes-a-false-assumption-about-checktypematchup)
- [AI use of Full Heal or Full Restore does not cure Nightmare status](#ai-use-of-full-heal-or-full-restore-does-not-cure-nightmare-status)
@ -1355,9 +1356,26 @@ AI_Cautious:
```
### AI does not discourage Nightmare if the player has any status condition
**Fix** Edit `AI_Redundant.Nightmare` in [engine/battle/ai/redundant.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/ai/redundant.asm):
```diff
.Nightmare:
-; BUG: AI does not discourage Nightmare if the player has any status condition (see docs/bugs_and_glitches.md)
ld a, [wBattleMonStatus]
- and a
+ and SLP_MASK
jr z, .Redundant
ld a, [wPlayerSubStatus1]
bit SUBSTATUS_NIGHTMARE, a
ret
```
### AI does not discourage Future Sight when it's already been used
**Fix:** Edit `AI_Redundant` in [engine/battle/ai/redundant.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/ai/redundant.asm):
**Fix:** Edit `AI_Redundant.FutureSight` in [engine/battle/ai/redundant.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/ai/redundant.asm):
```diff
.FutureSight:
@ -1480,6 +1498,7 @@ AI_Cautious:
ret
```
### AI might use its base reward value as an item
In the `AI_TryItem` routine, an item pointer is set to `wEnemyTrainerItem1` and then increments to `wEnemyTrainerItem2` to see if either of the AI's items are in the `AI_Items` list. However, if the AI has used its first item (or its first one is `ITEM_NONE`) and hasn't used its second item, the item pointer can increment from `wEnemyTrainerItem2` to `wEnemyTrainerBaseReward`. If the value at this address then matches an item in the `AI_Items` list, the AI could mistakenly use it.

View File

@ -112,6 +112,7 @@ AI_Redundant:
ret
.Nightmare:
; BUG: AI does not discourage Nightmare if the player has any status condition (see docs/bugs_and_glitches.md)
ld a, [wBattleMonStatus]
and a
jr z, .Redundant