Clean up handling of extra effective status effects

This commit is contained in:
dannye 2021-02-21 11:43:38 -06:00
parent 95353fdefa
commit 5c9c7bf362

View file

@ -211,12 +211,13 @@ FreezeBurnParalyzeEffect:
cp b ; do target type 2 and move type match? cp b ; do target type 2 and move type match?
ret z ; return if they match ret z ; return if they match
ld a, [wPlayerMoveEffect] ld a, [wPlayerMoveEffect]
cp PARALYZE_SIDE_EFFECT1 + 1 ; 10% status effects are 04, 05, 06 so 07 will set carry for those cp PARALYZE_SIDE_EFFECT1 + 1
ld b, $1a ; 0x1A/0x100 or 26/256 = 10.2%~ chance ld b, 10 percent + 1
jr c, .next1 ; branch ahead if this is a 10% chance effect.. jr c, .regular_effectiveness
ld b, $4d ; else use 0x4D/0x100 or 77/256 = 30.1%~ chance ; extra effectiveness
sub $1e ; subtract $1E to map to equivalent 10% chance effects ld b, 30 percent + 1
.next1 sub BURN_SIDE_EFFECT2 - BURN_SIDE_EFFECT1 ; treat extra effective as regular from now on
.regular_effectiveness
push af push af
call BattleRandom ; get random 8bit value for probability test call BattleRandom ; get random 8bit value for probability test
cp b cp b
@ -264,11 +265,12 @@ FreezeBurnParalyzeEffect:
ret z ret z
ld a, [wEnemyMoveEffect] ld a, [wEnemyMoveEffect]
cp PARALYZE_SIDE_EFFECT1 + 1 cp PARALYZE_SIDE_EFFECT1 + 1
ld b, $1a ld b, 10 percent + 1
jr c, .next2 jr c, .regular_effectiveness2
ld b, $4d ; extra effectiveness
sub $1e ld b, 30 percent + 1
.next2 sub BURN_SIDE_EFFECT2 - BURN_SIDE_EFFECT1 ; treat extra effective as regular from now on
.regular_effectiveness2
push af push af
call BattleRandom call BattleRandom
cp b cp b