Skip to content

Commit 34aae0d

Browse files
Added bug fix for: "Cautious" AI may fail to discourage residual moves (#1178)
1 parent a15a297 commit 34aae0d

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

docs/bugs_and_glitches.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Fixes in the [multi-player battle engine](#multi-player-battle-engine) category
5252
- ["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)
5353
- ["Smart" AI discourages Conversion2 after the first turn](#smart-ai-discourages-conversion2-after-the-first-turn)
5454
- ["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)
55+
- ["Cautious" AI may fail to discourage residual moves](#cautious-ai-may-fail-to-discourage-residual-moves)
5556
- [AI does not discourage Future Sight when it's already been used](#ai-does-not-discourage-future-sight-when-its-already-been-used)
5657
- [AI makes a false assumption about `CheckTypeMatchup`](#ai-makes-a-false-assumption-about-checktypematchup)
5758
- [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
12891290
```
12901291

12911292

1293+
### "Cautious" AI may fail to discourage residual moves
1294+
1295+
**Fix:** Edit `AI_Cautious` in [engine/battle/ai/scoring.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/ai/scoring.asm):
1296+
1297+
```diff
1298+
AI_Cautious:
1299+
; 90% chance to discourage moves with residual effects after the first turn.
1300+
1301+
...
1302+
1303+
pop bc
1304+
pop de
1305+
pop hl
1306+
jr nc, .loop
1307+
1308+
-; BUG: "Cautious" AI may fail to discourage residual moves (see docs/bugs_and_glitches.md)
1309+
call Random
1310+
cp 90 percent + 1
1311+
- ret nc
1312+
+ jr nc, .loop
1313+
1314+
inc [hl]
1315+
jr .loop
1316+
```
1317+
1318+
12921319
### AI does not discourage Future Sight when it's already been used
12931320

12941321
**Fix:** Edit `AI_Redundant` in [engine/battle/ai/redundant.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/ai/redundant.asm):

engine/battle/ai/scoring.asm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3086,6 +3086,7 @@ AI_Cautious:
30863086
pop hl
30873087
jr nc, .loop
30883088

3089+
; BUG: "Cautious" AI may fail to discourage residual moves (see docs/bugs_and_glitches.md)
30893090
call Random
30903091
cp 90 percent + 1
30913092
ret nc

0 commit comments

Comments
 (0)