Adds two settings:
- nuke_pop_loss_pct [0,100] - percentage of population loss after nuke, instead of hard-coded 50%
- nuke_defender_survival_chance_pct [0,100] - percentage chance of a unit inside the city to survive a nuke, does not affect units in open
nuke_pop_loss_pct = 50
nuke_defender_survival_chance_pct = 0
replicates the existing behavior (and is the default setting)
#2 Updated by Marko Lindqvist 8 months ago
- Target version changed from 2.6.1 to 3.1.0
Not a bugfix - not for stable branches. Please make patch against master.
- Comments documenting new ruleset fields should be added to supplied rulesets
- Values should be saved in rulesave.c
- No C++-comments ("//") in C-code, use ("/*" ... "*/")
- Space between 'if' and brace
> "if (" Variables should be declared in the beginning of the block (before any code), not in the middle
- The old code never destroyed the city (integer math, size reduction by 1/2 -> 0). Are you sure no further changes are needed for the case nuke_pop_loss_pct = 100?
#5 Updated by 0xandr 0xandr 8 months ago
Now that I re-read your comment it seems you consider new behavior with city getting destroyed when nuke_pop_loss_pct > 50 to be undesirable. We can add special handling to make sure city never goes to size 0 to be consistent with old behavior, however I wonder what is a more playable option? We also could make it another configuration switch. Thoughts?
#6 Updated by Marko Lindqvist 8 months ago
I were worried only that the following code might not be prepared for the city having been disappeared, but if there's no problem then there's no problem. Let's not overcomplicate this patch (if really desired, further settings to adjust this can go to a new ticket)
#7 Updated by 0xandr 0xandr 8 months ago
Ok, I verified the following settings in 3.0.91-dev on top of what I checked before by bombing a city of size 20
1) nuke_pop_loss_pct = 75
20 -> 5 -> 2 -> 1 -> 1 -> 1 -> ....
2) nuke_pop_loss_pct = 100
20 -> destroyed (along with all units in it)
3) nuke_pop_loss_pct = 30
20 -> 14 -> 10 -> 7 -> 5 -> 4 -> 3 -> 3 -> 3 -> ...
One change we could do here is to decrease a city size by min(1, calculated_pop_loss) instead of just calculated_pop_loss, but that also needs to account for case when nuke_pop_loss_pct = 0. Probably better to just keep it simple and leave as is, so it's easier to understand from player's standpoint
#9 Updated by Marko Lindqvist 8 months ago
- File 0007-Add-nuke_pop_loss-and-nuke_defender_survival_chance_.patch 0007-Add-nuke_pop_loss-and-nuke_defender_survival_chance_.patch added
- Status changed from New to Resolved
Version that applies on top of Feature #804292