pmotschmann / Evolve

An incremental game about evolving a civilization
Mozilla Public License 2.0
801 stars 344 forks source link

Fix backup save for Demonic Infusion reset (issue #1044) #1086

Open yarukishi opened 4 months ago

yarukishi commented 4 months ago

Currently, the Demonic Infusion technology charges its costs like normal, then immediately initiates the reset. The reset logic takes a backup save as usual.

This causes the backup save to be taken after subtracting 1000 population and the Demonic Essence. In particular, there isn't any way to get another Demonic Essence, so it is impossible to repeat the Demonic Infusion reset after restoring the backup save.

I tested the following with this patch:

It looks like the way that the DI reset is performed from inside the call stack for a technology button causes some errors for cost-checking functions in the JavaScript console, though the errors don't seem to cause any real issue. The errors are the same with and without this change.