Game hacks for CivWin-1.2.0. Part 3. Corruption

Antal1987

Warlord
Joined
Sep 4, 2013
Messages
160
Location
Karelia, Russia
After first publication about my trainer, I decided to share info about very cool game hacks I've implemented in it.
Currently there are:
  1. Zero unhappiness
  2. Zerro pollution
  3. Zero corruption
  4. Grassland fix / Terraforming fix. Grassland terrain produce shields even if it has no special mark (green shield on the map square). Settlers' jobs can be made in one turn regardless on terrain type. Every terrain type can be configured to be able to change into any other terrain type using orders (I) instead of irrigation and (M) instead of mining.

Part 3. Corruption.

City corruption can be computed using the following formula:
City_Corruption = City.Trade * City.Capital_Distance * n0 / ((n1 + Governments[City.Civ]) * n2)​
Where:
  1. City.Capital_Distance = Min(32, min(DX, DY) / 2 + max(DX, DY));
  2. DX = Min(Abs(City.X - Capital.X), 80 - Abs(City.X - Capital.X));
  3. DY = Abs(City.Y - Capital.Y);
  4. Capital - a city, that has a Palace (Capital.Civ is the same as City.civ)
  5. Governments[City.Civ] - City's civ government code value (0 - Anarchy,..., 5 - Democracy)
  6. n0 - hardly coded constant = 3
  7. n1 - hardly coded constant = 4
  8. n2 - hardly coded constant = 20

This formula is located in 2 diffenet places, so there are 2 separate values for each variable n0, n1 and n2.

Variable n0 is the part of the following command:
imul ax, 3​
It has a pattern in exe-file: [6B C0 03]

That command is located at the addresses: 0x1182E and 0x1199D
n0 must be signed 8-bit integer, so -128 <= n1 <= 127.

Variable n1 is the part of the following command:
add bx, 4​
It has a pattern in exe-file: [83 C3 04]

That command is located at the addresses: 0x11815 and 0x11984
n1 must be signed 8-bit integer, so -128 <= n1 <= 127.

Variable n2 is the part of the following command:
imul bx, 14h​
It has a pattern in exe-file: [6B DB 14]

That command is located at the addresses: 0x11818 and 0x11987
n1 must be signed 8-bit integer, so -128 <= n1 <= 127.

To reduce city corruption to zero it is enough to change n0 to 0 or change both n1 and n2 to 100 (0x64).

Therefore, here is the patch:
  1. Locate both patterns [6B C0 03] at 0x1182E and 0x1199D
  2. Change byte 03 to 00
  3. Enjoy

To be continued...
 
Back
Top Bottom