A suggestion to solve the defense "bug" (off-type degradation)
from
GalCiv2 Forums
I got an idea on how to modify the way defense is accounted in combat that would solve the defense bug. Since I found the solution not totally trivial, I'm posting it in case CodeCritter hadn't got the same idea already.
The goals of my solution are :
- Against only 1 type of weapon, X on-type defense is exactly equal to X^2 off-type defense (like in DL).
- Against 2 or 3 types of weapon, no defense has to be degraded twice. A consequence of that is with only one defense, there won't be any difference between if the enemy has 2 different off-type weapons or have only one kind. (Again, like in DL.) So against shield, 5 guns + 5 missiles is the same as 10 missiles.
The solution :
At the beginning of each round, for each ship, calculate these 4 quantities :
Shield Protection = Shield - sqrt(Shield)
Armor Protection = Armor - sqrt(Armor)
Missile Protection = Missile - sqrt(Missile)
Off-type Protection = sqrt(Shield) + sqrt(Armor) + sqrt(Missile)
When the ship is getting attacked with a particular weapon, its defense is the sum of the appropriate on-type protection and the off-type protection.
The value of the on-type protection is then reduced by the attack value. If the on-type protection is empty, the left-over is removed from the off-type protection. (This order could be reversed.)
The goals of my solution are :
- Against only 1 type of weapon, X on-type defense is exactly equal to X^2 off-type defense (like in DL).
- Against 2 or 3 types of weapon, no defense has to be degraded twice. A consequence of that is with only one defense, there won't be any difference between if the enemy has 2 different off-type weapons or have only one kind. (Again, like in DL.) So against shield, 5 guns + 5 missiles is the same as 10 missiles.
The solution :
At the beginning of each round, for each ship, calculate these 4 quantities :
Shield Protection = Shield - sqrt(Shield)
Armor Protection = Armor - sqrt(Armor)
Missile Protection = Missile - sqrt(Missile)
Off-type Protection = sqrt(Shield) + sqrt(Armor) + sqrt(Missile)
When the ship is getting attacked with a particular weapon, its defense is the sum of the appropriate on-type protection and the off-type protection.
The value of the on-type protection is then reduced by the attack value. If the on-type protection is empty, the left-over is removed from the off-type protection. (This order could be reversed.)