#### 0.10.2.1 Background corruption

Areas with no corruption flag set:
- Small Cave before day 90
- Uninteresting Dungeon
- Dusty Dungeon lvls 1-2
- Village Dungeon
- Druid Dungeon
- Puppy Cave
- Caverns of Chaos lvls 1-9
- Infinite Dungeon lvls 1-9
- Wilderness
- Gremlin Cave
- Dwarven graveyard
- Water dragon cave
- Greater White Unicorn Glade
- Terinyo
- Lawenilothehl
- High Mountain Village
- Old Barbarian's Glade
- Mad Minstrel's clearing

Otherwise, the corruption points (CP's) gained depend on a Danger
Level (DL) in particular area. Refer to section 0.13.15 for the list
of areas and their DL's.
Thanks to Vladimir Panteleev for the following information.

No other corruption occurs if:

- the current level has the NoCorruption flag set (see the list above)
- DL < 10
- the chaos gate is closed.

The background corruption is applied once every N turns. If the PC is
doomed, that's TWICE every N turns:
if (TurnNumber mod N=0) or (Doomed and (TurnNumber mod N=1)) then

(this is how mathematicians/programmers say once normally and twice with
doomed intrinsic per N turns)

N is calculated based on the DL the PC is on.

- ID: N=CorruptionSpeed[ Max(Min(90,CurrentIDLevel)-10,0)/20 ]
- ID 67: N=20
- Levels with Danger Level>40: N=CorruptionSpeed[ (DangerLevel-5)/10 ]
- Other N=CorruptionSpeed[ (DangerLevel-10)/10 ]

CorruptionSpeed is a 5-element array

- CorruptionSpeed[0]=20
- CorruptionSpeed[1]=15
- CorruptionSpeed[2]=10
- CorruptionSpeed[3]= 5
- CorruptionSpeed[4]= 2

Put in words, N can be 2, 5, 10, 15 or 20. The smaller N, the faster the corruption.
In the Infinite dungeon, N is 20 for
levels 10-29, 15 for levels 30-49, 10 for levels 50-69, 5 for levels 70-89, and 2
for levels 90 and above. The exception is level I: 67 (the special level with MaLaKaI)
where N is 20. For other areas, N is 20 for DL 10-19, 15 for DL 20-29, 10 for DL 30-39,
5 for DL 40-44, and 2 for DL 45 and above.
If the background corruption is to be applied on this turn:

- 1 CP is always applied
- if the current level is in the CoC and DL > 45, +2 CP
- ChAoS Plane: +Random(100) CP's
- emperor moloch's level: +Random(33) CP's

Function Random(max) generates a whole random number between 1 and max.
Now, there's a bug in the corrupting code. This is how it SHOULD have
worked.

- +1 CP if it's beyond day 90.
- +2 CP if it's beyond day 180. (cumulative with previous)
- +3 CP if it's beyond day 270. (cumulative with previous)
- +4 CP if it's beyond day 360. (cumulative with previous)

However, only the first line is executed - the 90-day limit.

Being L+ decreases corruption by -20%, C- enhances corruption by +30%,
lawful Unicorn-borns get another -10%.

Note that since background corruption is applied only by 1-2 points, the
above do not affect its speed, but major corruptions, such as eating
chaotic corpses etc. The "crowned as champion" status does not affect corruption speed.
By the way, 1 corruption = 1000 CP's.