Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool __fastcall calcIsCrit(unsigned int stage, int affectionAmp)
- {
- unsigned int chance; // r1
- bool isCrit; // r0
- if ( stage >= 4 ) // bad, out of range for table
- {
- (gfl2::debug::GFLassert)(0, 0, 0, 0);
- isCrit = 0;
- }
- else // good
- {
- chance = (critChanceTable[stage] / affectionAmp);
- if ( !chance ) // 0
- chance = 1; // ensure >0 for so we don't % by 0 in the event of 255 affection
- isCrit = gfl2::math::SFMTRandom::Next(dword_313B9C4, chance) == 0; // crit if (rand % n == 0)
- }
- return isCrit;
- }
- // Battle.rodata:~~~ critChanceTable DCB 24, 8, 2, 1 // with 0xFF affection, divide by 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement