As explained above, the massively flawed raiding code falsifies system defense values and therewith effective raiding percentages (after system defense), underlying system credit outputs, raiding amounts & messages and it disables the '% raiding' building bonus and a system blockade feature.
'% raiding' Building Output Type Fix (empire wide bonus for all fleets)
Note that
- when powering on/off displayed percentages will be updated next turn (just cosmetics, it's the same phenomenon as with the ground defense bonus)
- as a side effect this fixes missing % raiding crew experience and task force size bonuses for minor races (with the minor base value loaded via empire pointer index 5)
- this broken building bonus fix is technically independent from this topic
Code: Select all
1.) trek.exe at 0x39DD5 change 7 bytes to: 33 C9 89 4C 10 02 90
2.) at 0x68BBE new code 0x1B bytes:
0F B6 40 34 3C 05 72 04 B0 05 EB 0F 69 D0 BC 01 00 00 0F B7 92 92 1B 5B 00 03 EA
-asm changes:
0043A9D5 33C9 XOR ECX, ECX
0043A9D7 894C10 02 MOV [EAX+EDX+2], ECX // clear empsInfo % raid area
0043A9DB 90 NOP
sub_469760:
004697BE 0FB640 34 MOVZX EAX, BYTE [EAX+34] // TF owner
004697C2 3C 05 CMP AL, 5
004697C4 72 04 JB 4697CA
004697C6 B0 05 MOV AL, 5 // set minor index 5
004697C8 EB 0F JMP 4697D9
004697CA 69D0 BC010000 IMUL EDX, EAX, 1BC
004697D0 0FB792 921B5B00 MOVZX EDX, WORD [EDX+5B1B92] // empsInfo+0xFA
004697D7 03EA ADD EBP, EDX
The following fixes 1-4 are to apply together.
1. Systems Defense Bug + Shiels Message Overflow Fix (sub_469470)
Code: Select all
UPDATED no pseudo-conflict with 'Raid fix wrt bankrupt empires'
>> 0x000688b9 8a 58 0e 84 db 0f 85 b4 00 00 00
>> 0x000689f3 29 c6
>> 0x00068a05 ee
>> 0x00068a17 0c
>> 0x00068a1e ee
>> 0x00068a33 29 d6
>> 0x00068ac2 89 d1 39 f2
>> 0x00068ac7 8d 81
>> 0x00068ae2 29 c8
>> 0x00068ae7 0c
>> 0x00068b3b ff 42
<< 0x000688b9 8b 40 0c c1 c0 10 89 44 24 3c 90
<< 0x000689f3 8b e8
<< 0x00068a05 c5
<< 0x00068a17 08
<< 0x00068a1e c5
<< 0x00068a33 03 ea
<< 0x00068ac2 03 ea 2b f5
<< 0x00068ac7 8e a3
<< 0x00068ae2 90 90
<< 0x00068ae7 3e
<< 0x00068b3b d1 62
-asm changes:
004694B9 8B40 0C MOV EAX, [EAX+C]
004694BC C1C0 10 ROL EAX, 10
004694BF 894424 3C MOV [ESP+3C], EAX
004694C3 90 NOP
004695F3 8BE8 MOV EBP, EAX
00469604 83C5 14 ADD EBP, 14
00469616 74 08 JE 469620 // clear shields marker fix
0046961D 83C5 0F ADD EBP, 0F
00469633 03EA ADD EBP, EDX
004696C2 03EA ADD EBP,EDX // system defense + random 0-99
004696C4 2BF5 SUB ESI, EBP
004696C6 ^0F8E A3FEFFFF JLE 46956F // exit
004696E2 9090 NOP
004696E4 8B5424 3E MOV EDX, [ESP+3E] // TF sector ID
0046973B D162 3C SHL DWORD [EDX+3C], 1 // SH message fix
System defense values subtracted from the raiding percentage: (unchanged)
Code: Select all
004695F3 8BE8 MOV EBP, EAX // active orbitals
00469604 83C5 14 ADD EBP, 14 // outpost/starbase
0046961D 83C5 0F ADD EBP, 0F // shield generator
00469630 8D1440 LEA EDX, [EAX+EAX*2] // scanner output *3 (minor race bug)
004696B8 B9 64000000 MOV ECX, 64 // random system defense bonus 0-99
2. Stolen Credits Calculation Fix
Features:
- corrected underlying system credit outputs including trade routes & trade goods, thus rich systems/races are more profitable than just populous but poor systems - assumed income of minor races is pop/4 (equal to the ferengi default 0.25) +16 credits per incoming trade route
- stolen credits = ([system credit output * effective raiding percentage] / 256), effect limit at 256% raiding (after system defense/s) for the whole system credit output, albeit greater percentages are still useful when raiding more than one system
- enabled broken 'system blockade' feature (task force sector) - skips benefit of all trade routes(outgoing & incoming) and trade goods(even the forced due to 'credit deficit') maximizing economic damage for system owner but with potentially lower raiding amounts
Code: Select all
trek.exe at 0x5EC48 - 0x5ED46 new code 0xFF bytes:
0F B7 5F 0E B8 28 03 00 00 0F AF D8 03 1D C8 36 5A 00 33 F6 89 77 4C 8D 2C 18 8B 53 40 85 D2 75 20 89 C8 E8 30 BF 0B 00 89 C1 85 C0 75 C8 8B 44 24 20 E8 51 97 FF FF 83 C4 28 5D 5F 5E 5A 59 5B C3 80 7B 4C 05 72 0E C1 EA 02 0F B6 45 E0 D0 E0 8D 2C C2 EB 2F 8B 03 66 3B 47 28 75 05 FE 45 F4 EB 13 80 BB 80 00 00 00 05 75 0A 8B 45 9C E8 55 10 00 00 8B F0 8B 03 33 D2 42 E8 09 2F FE FF 8B 6D 94 03 EE 8B 47 48 84 E4 74 07 83 E0 07 03 E8 EB 0E 0F AF E8 C1 ED 08 75 06 83 E0 03 8D 68 01 85 F6 74 09 3B EE 7C 0D 33 C0 89 47 28 80 7B 4C 05 73 40 90 90 31 C0 8A 43 4C 69 C0 BC 01 00 00 05 98 1A 5B 00 01 A8 B8 01 00 00 66 8B 59 04 66 83 FB 05 73 16 31 C0 66 89 D8 69 C0 BC 01 00 00 05 98 1A 5B 00 01 A8 98 00 00 00 89 6F 4C E9 2E FF FF FF 80 79 04 05 73 F2 80 7B 30 0A 74 CC
-code changes:
0045F848 0FB75F 0E MOVZX EBX, WORD [EDI+E] // system ID
0045F84C B8 28030000 MOV EAX, 328
0045F851 0FAFD8 IMUL EBX, EAX
0045F854 031D C8365A00 ADD EBX, [5A36C8] // systInfo
0045F85A 33F6 XOR ESI, ESI
0045F85C 8977 4C MOV [EDI+4C], ESI
0045F85F 8D2C18 LEA EBP, [EAX+EBX]
0045F889 807B 4C 05 CMP BYTE [EBX+4C], 5
0045F88D 72 0E JB 45F89D
0045F88F C1EA 02 SHR EDX, 2 // pop/4
0045F892 0FB645 E0 MOVZX EAX, BYTE [EBP-20] // systInfo+308
0045F896 D0E0 SHL AL, 1
0045F898 8D2CC2 LEA EBP, [EDX+EAX*8] // + incoming trade routes *16
0045F89B EB 2F JMP 45F8CC
0045F89D 8B03 MOV EAX, [EBX] // system ID
0045F89F 66:3B47 28 CMP AX, [EDI+28] // taskforce position system ID
0045F8A3 75 05 JNZ 45F8AA
0045F8A5 FE45 F4 INC BYTE [EBP-C] // systInfo+31C system blockade marker
0045F8A8 EB 13 JMP 45F8BD
0045F8AA 80BB 80000000 05 CMP BYTE [EBX+80], 5 // trade goods ?
0045F8B1 75 0A JNZ 45F8BD
0045F8B3 8B45 9C MOV EAX, [EBP-64] // systInfo+2C4 industry output
0045F8B6 E8 55100000 CALL 460910 // trade goods calculation
0045F8BB 8BF0 MOV ESI, EAX
0045F8BD 8B03 MOV EAX, [EBX] // system ID
0045F8BF 33D2 XOR EDX, EDX
0045F8C1 42 INC EDX
0045F8C2 E8 092FFEFF CALL 4427D0 // system credits calculation (no trade goods)
0045F8C7 8B6D 94 MOV EBP, DWORD [EBP-6C] // systInfo+2BC system credits
0045F8CA 03EE ADD EBP, ESI
0045F8CC 8B47 48 MOV EAX, [EDI+48] // taskforce raiding %
0045F8CF 84E4 TEST AH, AH // effect limit 256 %
0045F8D1 74 07 JE 45F8DA
0045F8D3 83E0 07 AND EAX, 7 // random bonus 0-7 credits
0045F8D6 03E8 ADD EBP, EAX // system credits + 0-7 random
0045F8D8 EB 0E JMP 45F8E8
0045F8DA 0FAFE8 IMUL EBP, EAX
0045F8DD C1ED 08 SHR EBP, 8 // divide by 256
0045F8E0 75 06 JNZ 45F8E8
0045F8E2 83E0 03 AND EAX, 3 // random 0-3
0045F8E5 8D68 01 LEA EBP, [EAX+1] // minimum 1-4 credits
0045F8E8 85F6 TEST ESI, ESI
0045F8EA 74 09 JE 45F8F5
0045F8EC 3BEE CMP EBP, ESI
0045F8EE 7C 0D JL 45F8FD
0045F8F0 33C0 XOR EAX, EAX
0045F8F2 8947 28 MOV [EDI+28], EAX // 0 = trade goods message
0045F8F5 807B 4C 05 CMP BYTE [EBX+4C], 5
0045F8F9 73 40 JNB 45F93B
0045F8FB 9090 NOP
0045F93B 8079 04 05 CMP BYTE [ECX+4], 5
0045F93F ^73 F2 JNB 45F933
0045F941 807B 30 0A CMP BYTE [EBX+30], 0A
0045F945 ^74 CC JE 45F913
2.b
Option to set the effect limit to 128 % (advantage for attackers)
Code: Select all
after main fix in trek.exe at 0x5ECCF change 0x11 bytes to:
83 F8 7F 7E 06 83 E0 07 83 C0 7F 0F AF E8 C1 ED 07
0045F8CF 83F8 7F CMP EAX, 7F // effect limit 127 %
0045F8D2 7E 06 JLE 45F8DA
0045F8D4 83E0 07 AND EAX, 7 // random 0-7
0045F8D7 83C0 7F ADD EAX, 7F // limit 127 + 0-7 random
0045F8DD C1ED 07 SHR EBP, 7 // divide by 128
3. Clear Blockade Marker Fix [systInfo+31C]
Code: Select all
trek.exe at 0x43C19 new code 0x10 bytes:
33 D2 89 93 1C 03 00 00 B2 C0 D3 E2 8B C3 90 90
-asm-
00444819 33D2 XOR EDX, EDX
0044481B 8993 1C030000 MOV [EBX+31C], EDX
00444821 B2 C0 MOV DL, C0
00444823 D3E2 SHL EDX, CL
00444825 8BC3 MOV EAX, EBX
00444827 9090 NOP
4. Raid Message Fixes (lexicon.dic entries 499, 500, 509 & 510; trade income, shield generator [and scanners])
First reset 0x6CCFB to 75 23 and lexicon.dic entry 510 back to default if changed.
Code: Select all
at 0x6CD3C change 90 13 -> 20 15
at 0x6CDEE & 0x6CF18 change BB 80 00 00 00 05 to -> 7D 28 00 90 90 90
-asm changes:
0046D939 8D8424 20150000 LEA EAX, [ESP+1520]
0046D9ED 837D 28 00 CMP DWORD [EBP+28], 0 // trade goods message
0046D9F1 909090 NOP
0046DB17 837D 28 00 CMP DWORD [EBP+28], 0 // trade goods message
0046DB1B 909090 NOP
Current computer tech level requirements for raiding info messages on:
Number of Active OBs:
Code: Select all
00469721 cmp ecx, 5 // greater check i.e. computer tech 6+
Active Scanners:
Code: Select all
0046972D cmp dword ptr [esp+30h], 6 // greater check i.e. computer tech 7+
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.