CoolTrainer♀ 10-20% HP switch chance coding flaw (Generation I)

CoolTrainer♀ 10-20% HP switch chance coding flaw (Generation I)

Subscribers:
17,700
Published on ● Video Link: https://www.youtube.com/watch?v=ibsyB-fb980



Duration: 0:32
1,257 views
60


Notes: This demonstration would be incomplete without a description, so recommend reading it. It was documented by invalio19 in January, and added as a comment in the disassembly project file https://github.com/pret/pokered/blob/master/engine/battle/trainer_ai.asm earlier today by Rangi42.
https://github.com/pret/pokered/issues/308


When a CoolTrainer♀ (specifically) has between 10-20% HP the (relative) chance of her switching is 100% rather than 25% because of faulty code (however, low HP does not guarantee it will happen because she can also use a Hyper Potion, I don't know sorry but perhaps that happens at 1/10 health so 10% and less). Adding a ret no carry flag will fix this.


CooltrainerFAI:
; The intended 25% chance to consider switching will not apply.
; Uncomment the line below to fix this.
cp 25 percent + 1
; ret nc
ld a, 10
call AICheckIfHPBelowFraction
jp c, AIUseHyperPotion
ld a, 5
call AICheckIfHPBelowFraction
ret nc
jp AISwitchIfEnoughMons




Other Videos By Evie (ChickasaurusGL) 🌺


2021-12-13The Pokédex rating for having 152 Pokémon actually runs arbitrary code execution ◕ᴗ◕✿ (Red/Green)
2021-12-12Replacing X's (エックス) "Nintendo presents" screen w/Pokémon Yellow cart swap arbitrary code execution
2021-12-12Game Boy Printer bad serial/opcode arbitrary/remote code proof of concept (Pokémon Yellow)
2021-12-04Randomly select your moves in battle save file (Pokémon Yellow)
2021-12-03Pokémon Yellow 'fusion Pokémon names' save file
2021-11-12Create your own glitch hedge maze puzzle ^-^ (Pokémon Yellow)
2021-11-12How to make unstable Yellow MissingNo. not freeze every time with arbitrary code execution ^-^
2021-11-11How to beat Pokémon Red without moving, without arbitrary code execution and no Trainer ID manip ^-^
2021-11-08Surf on an artificial water tile originating from glitch item text (Pokémon Red and Blue)
2021-11-04HiddenItemCoords's 0 x or y coordinate design flaw (Generation I)
2021-11-04CoolTrainer♀ 10-20% HP switch chance coding flaw (Generation I)
2021-11-02Turning Splash into a One-hit-KO move (exclamation point arbitrary code execution, Pokémon Red/Blue)
2021-10-31Using submerge glitch to encounter Mew in water-grass (no ACE challenge) (Red/Green) (ポケモン バグ)
2021-10-24How to glitch the Japanese GF Mew (ゲーフリミュウ 22796) in Red/Green (ポケットモンスター 赤・ 緑) (from start, no ACE)
2021-10-24Raising an Egg akin Pomeg glitch after the Randy mail over 0 HP on an Egg workaround (Generation II)
2021-10-24Small hybrid Pokémon display detail which was not in Generation I/four-types visible (Generation II)
2021-09-27(WiP Demo): Flying Pikachu minigame created w arbitrary code execution. ^-^ (Pokémon Yellow)
2021-09-25Sound bank arbitrary code execution (0A:58EA's stack corruption) - Save file modification (Red/Blue)
2021-09-25Another take on Rival LG with hex:7C item (0x50 sub-tile and previous encounter not needed) (Yellow)
2021-09-16Glitch subroutine (sound bank) 0E:6BF8 continuation; two applications (Pokémon Yellow EN VC)
2021-09-16Automatic walking caused by glitch subroutine at 0E:6BF8; sound bank 0x0E (Pokémon Yellow EN VC)