Added bug fix for: "Cautious" AI may fail to discourage residual moves (#1178)

This commit is contained in:
Hannabart Pekopon
2025-05-31 12:07:23 -07:00
committed by GitHub
parent a15a2970a1
commit 34aae0d20f
2 changed files with 28 additions and 0 deletions

View File

@@ -52,6 +52,7 @@ Fixes in the [multi-player battle engine](#multi-player-battle-engine) category
- ["Smart" AI encourages Mean Look if its own Pokémon is badly poisoned](#smart-ai-encourages-mean-look-if-its-own-pok%C3%A9mon-is-badly-poisoned) - ["Smart" AI encourages Mean Look if its own Pokémon is badly poisoned](#smart-ai-encourages-mean-look-if-its-own-pok%C3%A9mon-is-badly-poisoned)
- ["Smart" AI discourages Conversion2 after the first turn](#smart-ai-discourages-conversion2-after-the-first-turn) - ["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) - ["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 Future Sight when it's already been used](#ai-does-not-discourage-future-sight-when-its-already-been-used) - [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 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) - [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)
@@ -1289,6 +1290,32 @@ Pryce's dialog ("That BADGE will raise the SPECIAL stats of POKéMON.") implies
``` ```
### "Cautious" AI may fail to discourage residual moves
**Fix:** Edit `AI_Cautious` in [engine/battle/ai/scoring.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/ai/scoring.asm):
```diff
AI_Cautious:
; 90% chance to discourage moves with residual effects after the first turn.
...
pop bc
pop de
pop hl
jr nc, .loop
-; BUG: "Cautious" AI may fail to discourage residual moves (see docs/bugs_and_glitches.md)
call Random
cp 90 percent + 1
- ret nc
+ jr nc, .loop
inc [hl]
jr .loop
```
### AI does not discourage Future Sight when it's already been used ### 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` in [engine/battle/ai/redundant.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/ai/redundant.asm):

View File

@@ -3086,6 +3086,7 @@ AI_Cautious:
pop hl pop hl
jr nc, .loop jr nc, .loop
; BUG: "Cautious" AI may fail to discourage residual moves (see docs/bugs_and_glitches.md)
call Random call Random
cp 90 percent + 1 cp 90 percent + 1
ret nc ret nc