Ket
Composite Of A Composite
@TheLopez
Did you take a look at lunarmongoose's work on interception and lethality tags.
These might make good inclusions...
Did you take a look at lunarmongoose's work on interception and lethality tags.
Spoiler :
Mongoose AirLethalityMod 1.3 (CvUnit.cpp, CvUnit.h, CvInfos.cpp, CvInfos.h, CyInfoInterface1.cpp, CvGameTextMgr.cpp)
This modifies how damage dealt on interception is calculated. Originally it used an internal lookup table, but that had to be configured for each mod it was used with and changing the values required recompiling the DLL. It also had some limitations in differentiating units with the same intercept chance.
So! The <iInterceptionLethality> XML tag is now supported. It comes right after the <iInterceptionProbability> tag. (I threw the schema file in with the zip; it also has the <bFlying> tag in it.) Acceptable values for this tag are (-99 to -1), 0, and (1 to 100). They all do different things. Using 0 makes a unit do no damage on interception (though it'll stop the thing it intercepted from completing its air mission as you'd expect). (1 to 100) specifies the chance an intercept will be lethal. Using negatives in the range (-1 to -99) tells it to be non-lethal, with the damage done capped at the percent the sign-flipped version of your number specifies. (-40 will mean non-lethal, with damage ranging from 1% to 40% of the target's max HP. Things like this can still kill the target if it was not at full health to begin with.) The function "int getInterceptionLethality()" is available to Python as a member of CvUnitInfo (not CvUnit).
One final note, I cannibalized the unused "DomainModifier vs Air" tag to specify a special condition, which is currently only used by the Zeppelin. That unit has a "-90% vs Air" effect, which in the SDK code translates into "of all the interceptions made against this unit which prove non-fatal, 90% are then made fatal anyway". Later I will either have to special-case the python, or make it its own XML tag, to get a unique text description for the effect in the UI mouseover, but this will do for now.
Now has support for displaying iInterceptionLethality functionality in the UI, specifically in a unit's Pedia entry and in its mouseover pane. When combined with the TXT_KEY entries from the top of the now-included xml file, will cause units with any iInterceptionProbability > 0 to display either "Intercepts Deal Up To 50% Damage" or "Intercepts Are Lethal (50% Chance)", depending on settings, directly below the "Can Intercept Aircraft (50% Chance)" line.
Mongoose AirCombatMod 1.0 (CvUnit.cpp)
This is subject to change due to being relatively un-playtested, but I'm optimistic it can be kept. There are two big things this does. The first is that individual units (both air and surface) can now perform intercepts an unlimited number of times per turn. Their interception strength is still reduced if they are damaged (though this only applies to air units as before), and they cannot intercept if they did anything else this turn (bomb, recon, rebase, etc) also as before. This change is meant to get rid of the vanilla mechanic whereby the objective is to, if possible, amass more bombers than the enemy has interceptors and attack with all of them in one place, in one turn. If the defender has 10 units defending air, for example, your first 10 bombers will be at some amount of risk, but all additional bombers you throw at it on the same turn will get through unopposed. No more.
To compensate for this, surface-unit intercept values have been kept lower than fighters, stealth values on aircraft that have them (like the B2) still allow you to go in and try to ninja-bomb, and a new, more effective fighter-clearing mechanism has been implemented. Previously, the only way to offensively clear defending jet fighters was to go in with your own jet fighters under the guise of a wimpy bombing run of some type, deal with the fact that you'll get damaged or killed ~70% of the time, and try to leverage your counterattacks (damage or kill the fighter that comes to intercept you), which happen exactly 14% of the time in vanilla (assuming you're using a jet). That's a roughly 5 to 1 ratio in favor of the defender, which makes trying pretty pointless.
NOW what happens is, if you go in on a bomb or strike mission with a fighter, and the enemy's best defending interceptor is an air unit, an air battle (probably) ensues. (The actual chance is max(yourIntercept, theirIntercept), which I did b/c intercept chances universally go up with the technology level of the plane, and it seems logical the one with the better plane, be it attacker or defender, would want to push the air fight to happen rather than try to avoid it.) In an air battle (which can only be some form of fighter on some form of fighter), if the planes are equal then the odds are equal; if not the better plane has a higher-than-50% chance, proportional to the intercept difference (and stealth difference, if any), of being the winner. The winner then acts like interceptions normally do: there's a chance it damages you and a chance it kills you.
I am modifying fighters to have attack AI as well as defense AI, so that hopefully the computer players will throw some of their jets at you offensively (they don't need as many to defend air attacks under this system anyway), and thus perform the new air-superiority pseudo-mission accidentally, but still almost as effectively as if they meant to do it.
This modifies how damage dealt on interception is calculated. Originally it used an internal lookup table, but that had to be configured for each mod it was used with and changing the values required recompiling the DLL. It also had some limitations in differentiating units with the same intercept chance.
So! The <iInterceptionLethality> XML tag is now supported. It comes right after the <iInterceptionProbability> tag. (I threw the schema file in with the zip; it also has the <bFlying> tag in it.) Acceptable values for this tag are (-99 to -1), 0, and (1 to 100). They all do different things. Using 0 makes a unit do no damage on interception (though it'll stop the thing it intercepted from completing its air mission as you'd expect). (1 to 100) specifies the chance an intercept will be lethal. Using negatives in the range (-1 to -99) tells it to be non-lethal, with the damage done capped at the percent the sign-flipped version of your number specifies. (-40 will mean non-lethal, with damage ranging from 1% to 40% of the target's max HP. Things like this can still kill the target if it was not at full health to begin with.) The function "int getInterceptionLethality()" is available to Python as a member of CvUnitInfo (not CvUnit).
One final note, I cannibalized the unused "DomainModifier vs Air" tag to specify a special condition, which is currently only used by the Zeppelin. That unit has a "-90% vs Air" effect, which in the SDK code translates into "of all the interceptions made against this unit which prove non-fatal, 90% are then made fatal anyway". Later I will either have to special-case the python, or make it its own XML tag, to get a unique text description for the effect in the UI mouseover, but this will do for now.
Now has support for displaying iInterceptionLethality functionality in the UI, specifically in a unit's Pedia entry and in its mouseover pane. When combined with the TXT_KEY entries from the top of the now-included xml file, will cause units with any iInterceptionProbability > 0 to display either "Intercepts Deal Up To 50% Damage" or "Intercepts Are Lethal (50% Chance)", depending on settings, directly below the "Can Intercept Aircraft (50% Chance)" line.
Mongoose AirCombatMod 1.0 (CvUnit.cpp)
This is subject to change due to being relatively un-playtested, but I'm optimistic it can be kept. There are two big things this does. The first is that individual units (both air and surface) can now perform intercepts an unlimited number of times per turn. Their interception strength is still reduced if they are damaged (though this only applies to air units as before), and they cannot intercept if they did anything else this turn (bomb, recon, rebase, etc) also as before. This change is meant to get rid of the vanilla mechanic whereby the objective is to, if possible, amass more bombers than the enemy has interceptors and attack with all of them in one place, in one turn. If the defender has 10 units defending air, for example, your first 10 bombers will be at some amount of risk, but all additional bombers you throw at it on the same turn will get through unopposed. No more.
To compensate for this, surface-unit intercept values have been kept lower than fighters, stealth values on aircraft that have them (like the B2) still allow you to go in and try to ninja-bomb, and a new, more effective fighter-clearing mechanism has been implemented. Previously, the only way to offensively clear defending jet fighters was to go in with your own jet fighters under the guise of a wimpy bombing run of some type, deal with the fact that you'll get damaged or killed ~70% of the time, and try to leverage your counterattacks (damage or kill the fighter that comes to intercept you), which happen exactly 14% of the time in vanilla (assuming you're using a jet). That's a roughly 5 to 1 ratio in favor of the defender, which makes trying pretty pointless.
NOW what happens is, if you go in on a bomb or strike mission with a fighter, and the enemy's best defending interceptor is an air unit, an air battle (probably) ensues. (The actual chance is max(yourIntercept, theirIntercept), which I did b/c intercept chances universally go up with the technology level of the plane, and it seems logical the one with the better plane, be it attacker or defender, would want to push the air fight to happen rather than try to avoid it.) In an air battle (which can only be some form of fighter on some form of fighter), if the planes are equal then the odds are equal; if not the better plane has a higher-than-50% chance, proportional to the intercept difference (and stealth difference, if any), of being the winner. The winner then acts like interceptions normally do: there's a chance it damages you and a chance it kills you.
I am modifying fighters to have attack AI as well as defense AI, so that hopefully the computer players will throw some of their jets at you offensively (they don't need as many to defend air attacks under this system anyway), and thus perform the new air-superiority pseudo-mission accidentally, but still almost as effectively as if they meant to do it.
These might make good inclusions...