Remove the 25% failure chance for AI status moves - pret/pokecrystal GitHub Wiki
When the AI uses stat-lowering or status-inflicting moves, like Screech or Sleep Powder, it has an additional 25% chance to fail on top of the usual accuracy and evasion modifiers. This is caused by four different clauses in engine/battle/effect_commands.asm, all of which will need deleting.
Contents
BattleCommand_StatDown
1. ; Sharply lower the stat if applicable.
ld a, [wLoweredStat]
and $f0
- jr z, .ComputerMiss
+ jr z, .GotAmountToLower
dec b
- jr nz, .ComputerMiss
+ jr nz, .GotAmountToLower
inc b
-.ComputerMiss:
-; Computer opponents have a 25% chance of failing.
- ldh a, [hBattleTurn]
- and a
- jr z, .DidntMiss
-
- ld a, [wLinkMode]
- and a
- jr nz, .DidntMiss
-
- ld a, [wInBattleTowerBattle]
- and a
- jr nz, .DidntMiss
-
-; Lock-On still always works.
- ld a, [wPlayerSubStatus5]
- bit SUBSTATUS_LOCK_ON, a
- jr nz, .DidntMiss
-
-; Attacking moves that also lower accuracy are unaffected.
- ld a, BATTLE_VARS_MOVE_EFFECT
- call GetBattleVar
- cp EFFECT_ACCURACY_DOWN_HIT
- jr z, .DidntMiss
-
- call BattleRandom
- cp 25 percent + 1 ; 25% chance AI fails
- jr c, .Failed
-.DidntMiss:
+.GotAmountToLower:
call CheckSubstituteOpp
jr nz, .Failed
...
BattleCommand_SleepTarget
2. ld hl, DidntAffect1Text
- call .CheckAIRandomFail
- jr c, .fail
...
-.CheckAIRandomFail:
- ; Enemy turn
- ldh a, [hBattleTurn]
- and a
- jr z, .dont_fail
-
- ; Not in link battle
- ld a, [wLinkMode]
- and a
- jr nz, .dont_fail
-
- ld a, [wInBattleTowerBattle]
- and a
- jr nz, .dont_fail
-
- ; Not locked-on by the enemy
- ld a, [wPlayerSubStatus5]
- bit SUBSTATUS_LOCK_ON, a
- jr nz, .dont_fail
-
- call BattleRandom
- cp 25 percent + 1 ; 25% chance AI fails
- ret c
-
-.dont_fail
- xor a
- ret
BattleCommand_Poison
3. - ldh a, [hBattleTurn]
- and a
- jr z, .dont_sample_failure
-
- ld a, [wLinkMode]
- and a
- jr nz, .dont_sample_failure
-
- ld a, [wInBattleTowerBattle]
- and a
- jr nz, .dont_sample_failure
-
- ld a, [wPlayerSubStatus5]
- bit SUBSTATUS_LOCK_ON, a
- jr nz, .dont_sample_failure
-
- call BattleRandom
- cp 25 percent + 1 ; 25% chance AI fails
- jr c, .failed
-
-.dont_sample_failure
...
BattleCommand_Paralyze
4. .no_item_protection
- ldh a, [hBattleTurn]
- and a
- jr z, .dont_sample_failure
-
- ld a, [wLinkMode]
- and a
- jr nz, .dont_sample_failure
-
- ld a, [wInBattleTowerBattle]
- and a
- jr nz, .dont_sample_failure
-
- ld a, [wPlayerSubStatus5]
- bit SUBSTATUS_LOCK_ON, a
- jr nz, .dont_sample_failure
-
- call BattleRandom
- cp 25 percent + 1 ; 25% chance AI fails
- jr c, .failed
-
-.dont_sample_failure
...
That's it! Note that there is no BattleCommand_Burn
or BattleCommand_Freeze
.