shithub: pokecrystal

Download patch

ref: 4ef556cbc83659683454f0bf4415af52e4371d56
parent: b1d04e4ed1bf25ac8316f54c42cc07bacfdcccd4
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Mon Dec 7 08:13:03 EST 2020

Document AI_Smart_Conversion2 bug (resolves #786)

--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -49,6 +49,7 @@
   - [Heavy Ball uses wrong weight value for three Pokémon](#heavy-ball-uses-wrong-weight-value-for-three-pokémon)
   - [Glacier Badge may not boost Special Defense depending on the value of Special Attack](#glacier-badge-may-not-boost-special-defense-depending-on-the-value-of-special-attack)
   - ["Smart" AI encourages Mean Look if its own Pokémon is badly poisoned](#smart-ai-encourages-mean-look-if-its-own-pokémon-is-badly-poisoned)
+  - ["Smart" AI discourages Conversion2 after the first turn](#smart-ai-discourages-conversion2-after-the-first-turn)
   - [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 does not cure confusion status](#ai-use-of-full-heal-does-not-cure-confusion-status)
@@ -1051,6 +1052,19 @@
 +	ld a, [wPlayerSubStatus5]
  	bit SUBSTATUS_TOXIC, a
  	jr nz, .asm_38e26
+```
+
+
+### "Smart" AI discourages Conversion2 after the first turn
+
+**Fix:** Edit `AI_Smart_Conversion2` in [engine/battle/ai/scoring.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/ai/scoring.asm):
+
+```diff
+ AI_Smart_Conversion2:
+ 	ld a, [wLastPlayerMove]
+ 	and a
+-	jr nz, .discourage ; should be jr z
++	jr z, .discourage
 ```
 
 
--- a/engine/battle/ai/scoring.asm
+++ b/engine/battle/ai/scoring.asm
@@ -1667,7 +1667,7 @@
 AI_Smart_Conversion2:
 	ld a, [wLastPlayerMove]
 	and a
-	jr nz, .discourage
+	jr nz, .discourage ; should be jr z
 
 	push hl
 	dec a