Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // switch case case 8: Nest Ball
- // moon: sub_701854
- // UM: sub_302DCEC
- // returns catch rate modifier value (x * 0x1000)
- int getRate(int v8)
- {
- int v9;
- float v10;
- if ( v8 >= 30u ) // this results in level 30 being less than the calculated value
- return 0x1000;
- v9 = (41 - v8); // diff
- if ( v9 <= 40 )
- {
- if ( v9 == 0 ) // only if lvl = 41, which is not realistically possible
- {
- v10 = -0.5f;
- goto LABEL_30;
- }
- }
- else
- {
- v9 = 40; // clamp to 40, this should never realistically happen, 41-[1,29] = [40-12]
- }
- v10 = (v9 << 12) + 0.5f; // v9*0x1000, add round-up bias
- LABEL_30:
- var result = (((long)(0x66666667L * v10) >> 32) >> 2) - (((long)(0x66666667L * v10) >> 32) >> 31); // divide by 10 with magic mult
- return (int)result;
- }
- // Output all rates for all equations (code, bulba g6, bulba g7-sm)
- void Main()
- {
- for (int i = 1; i <= 30; i++)
- {
- string g6 = $"{(41 - i)/10f:0.0}";
- string g7 = $"{(8 - (i-1)*0.2d):0.0}";
- int rate = getRate(i);
- Console.WriteLine($"LVL {i:00} = 0x{rate:X4} = {rate/(float)0x1000:0.0} || {g6} | {g7}");
- }
- }
- =======================================================
- LVL 01 = 0x4000 = 4.0 || 4.0 | 8.0
- LVL 02 = 0x3E66 = 3.9 || 3.9 | 7.8
- LVL 03 = 0x3CCC = 3.8 || 3.8 | 7.6
- LVL 04 = 0x3B33 = 3.7 || 3.7 | 7.4
- LVL 05 = 0x3999 = 3.6 || 3.6 | 7.2
- LVL 06 = 0x3800 = 3.5 || 3.5 | 7.0
- LVL 07 = 0x3666 = 3.4 || 3.4 | 6.8
- LVL 08 = 0x34CC = 3.3 || 3.3 | 6.6
- LVL 09 = 0x3333 = 3.2 || 3.2 | 6.4
- LVL 10 = 0x3199 = 3.1 || 3.1 | 6.2
- LVL 11 = 0x3000 = 3.0 || 3.0 | 6.0
- LVL 12 = 0x2E66 = 2.9 || 2.9 | 5.8
- LVL 13 = 0x2CCC = 2.8 || 2.8 | 5.6
- LVL 14 = 0x2B33 = 2.7 || 2.7 | 5.4
- LVL 15 = 0x2999 = 2.6 || 2.6 | 5.2
- LVL 16 = 0x2800 = 2.5 || 2.5 | 5.0
- LVL 17 = 0x2666 = 2.4 || 2.4 | 4.8
- LVL 18 = 0x24CC = 2.3 || 2.3 | 4.6
- LVL 19 = 0x2333 = 2.2 || 2.2 | 4.4
- LVL 20 = 0x2199 = 2.1 || 2.1 | 4.2
- LVL 21 = 0x2000 = 2.0 || 2.0 | 4.0
- LVL 22 = 0x1E66 = 1.9 || 1.9 | 3.8
- LVL 23 = 0x1CCC = 1.8 || 1.8 | 3.6
- LVL 24 = 0x1B33 = 1.7 || 1.7 | 3.4
- LVL 25 = 0x1999 = 1.6 || 1.6 | 3.2
- LVL 26 = 0x1800 = 1.5 || 1.5 | 3.0
- LVL 27 = 0x1666 = 1.4 || 1.4 | 2.8
- LVL 28 = 0x14CC = 1.3 || 1.3 | 2.6
- LVL 29 = 0x1333 = 1.2 || 1.2 | 2.4
- LVL 30 = 0x1000 = 1.0 || 1.1 | 2.2 // Due to the <= 30 check returning 0x1000, the is the only difference from the noted equation
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement