gods

# Gods

The mood of a god is always between 0 and 100. Initial mood of all gods is 50.

## Mood calculation

Mood of a god is calculated as:

• Coverage factor: the percentage of population that has access to temples. This calculated as:
100 * (500 * oracles + 750 * working small temples + 1500 * working large temples) / population
“Working” is defined as having employees. The percentage is always between 0 and 100.
• Festival factor: 12 - max(40, months since last festival to this god)
• Temple factor:
• The god with the most temples (sum of large and small temples to that god, working or not) is awarded 50 points. If multiple gods have the same amount of temples, no points are awarded
• The god with the least temples gets a penalty of 25 points. Again, if multiple gods have the same amount, none is awarded the penalty.
• Something of note: I think there's a bug here: Venus never gets a bonus/penalty here!

These factors are added for the god's mood and capped at 100. There's also a minimum value for the mood:

Population Minimum mood
0-99 50
100-199 40
200-299 30
300-399 20
400-499 10
500 and above 0

16 times per month (every “game day”), the moods are updated:

• Above calculate is for the target mood of the god. If the current mood is lower than the target mood, current mood increases by 1. If the current mood is higher than the target, current mood decreases by 1.
• Blessing flag is reset: if a god's happiness goes below 50, `blesssingDone` is set to 0 (more below)
• Small curse flag is reset: if a gods' happiness goes above 50, `smallCurseDone` is set to 0 (more below)
• A number between 0 and 7 is semi-randomly generated. If this number is between 0 and 4 (Ceres/Neptune/Mercury/Mars/Venus):
• If this god's mood is >= 50, the `wrathPoints` are set to zero
• If this god's mood is between 0 and 9: 5 `wrathPoints` are added
• If this god's mood is between 10 and 19: 2 `wrathPoints` are added
• If this god's mood is between 20 and 39: 1 `wrathPoints` is added
• `wrathPoints` have a maximum of 50

Once per month, additional logic is performed.

We continue with the random god from the daily update; if the random number was a 5, 6, or 7, we calculate the least happy god and use that one. The least happy god is:

• The god with the most `wrathPoints`. In case of a tie, the first god is picked
• If no god has `wrathPoints`, the one with the lowest mood below 40 is chosen
• If no god has a mood below 40, none is 'least happy'

For the chosen god:

• If the current mood is 100 and `blessingDone` is 0 we perform a blessing and set `blessingDone` to 1. This is only ever set to 0 if the god's mood drops below 50, as shown above.
• Else: if the god has >= 20 `wrathPoints` and `smallCurseDone` is 0 and it's >3 months since the last festival to that god: we perform a small curse, set `smallCurseDone` to 1, reset the `wrathPoints` to 0 and increase the mood of the god by 12
• Else: if the good has 50 `wrathPoints` and it's >3 months since the last festival to that god: we perform a large curse, reset the `wrathPoints` to 0 and increase the mood of the god by 30

If the current mood of a god goes below 30, the player gets a message that the gods are angry (mood between 10 and 29) or wrathful (below 10).