BattleCommand_DamageVariation: ; 34cfd ; damagevariation ; Modify the damage spread between 85% and 100%. ; Because of the method of division the probability distribution ; is not consistent. This makes the highest damage multipliers ; rarer than normal. ; No point in reducing 1 or 0 damage. ld hl, CurDamage ld a, [hli] and a jr nz, .go ld a, [hl] cp 2 ret c .go ; Start with the maximum damage. xor a ld [hMultiplicand + 0], a dec hl ld a, [hli] ld [hMultiplicand + 1], a ld a, [hl] ld [hMultiplicand + 2], a ; Multiply by 85-100%... .loop call BattleRandom rrca cp $d9 ; 85% jr c, .loop ld [hMultiplier], a call Multiply ; ...divide by 100%... ld a, $ff ; 100% ld [hDivisor], a ld b, $4 call Divide ; ...to get .85-1.00x damage. ; wolfboyft ; If the target is holding a Stick... ld a, [hBattleTurn] and a ld a, [EnemyMonItem] jr z, .got_item ld a, [BattleMonItem] .got_item cp STICK jr nz, .NoFurtherReduction ; Reduce damage by 17% (resulting damage is 83 percent after previous random reduction) ld a, 83 percent ld [hMultiplier], a call Multiply ld a, $ff ld [hDivisor], a ld b, $4 call Divide .NoFurtherReduction ld a, [hQuotient + 1] ld hl, CurDamage ld [hli], a ld a, [hQuotient + 2] ld [hl], a ret ; 34d32401
Comments
0 B
|👍
/👎
0 B
|👍
/👎