Support for AA Attacks
I know it is possible for units to be set to give negative and positive support to enemy units' attack and defence dice, but is it possible to have a unit affect other units' AA stats? (I guess not, and I guess this has probably been debated before But here I go anyway...)
If not, I think it would be a sweet idea that could open up for a lot of opportunities. It should of course be configurable to affect specific types of AA attacks, both allied, enemy, positive and negative.
Maybe if this was implemented, the code could be something similar to this: (????)
<attachment name="supportAttachmentShield-Bearers" attachTo="Shield-Bearer" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType"> <option name="unitType" value="Archers:Chariots:Heroes:Towers"/> <option name="faction" value="enemy"/> <option name="side" value=" offence:defence"/> <option name="dice" value="AA"/> <option name="affectedAA" value="Arrows:Stones"/> <option name="bonus" value="-1"/> <option name="number" value="1"/> <option name="bonusType" value="Shielding"/> <option name="players" value="???????????"/> </attachment>
(The following has no typeAA meantioned, so the affected AA type should just be the normal “AA” that units have if no typeAA is given)
<attachment name="supportAttachmentRadar-Station" attachTo="Radar-Station" javaClass="games.strategy.triplea.attachments.UnitSupportAttachment" type="unitType"> <option name="unitType" value="AA-Gun"/> <option name="faction" value="allied"/> <option name="side" value="defence"/> <option name="dice" value="AA"/> <option name="bonus" value="1"/> <option name="number" value="1"/> <option name="bonusType" value="Radar"/> <option name="players" value="??????????"/> </attachment>
I know that there are very many AA attributes that could potentially be made to be affected, but this is just what I could come up with. Could something like this not open up for a lot of possibilities in regards to how AA could be used?
@frostion My name is Guardian and I fully support this message!
@frostion There is no need to specify typeAA, at least until units can have multiple AA attacks. You already define the unit types the support can target, and then the type of the AA must be the only AA attack the unit has.
But before this feature is even worth debating, we need another feature: AA attack values that do not divide into dice sides. Because to the best of my knowledge we can't have an AA attack with e.g. a 4/6 chance to hit, because 6 is not divisible by 4. If you specify 4/6, it will revert back to 3, without throwing errors.
@alkexr Because of Low Luck errors? LL is not a mandatory feature in a map. LL can just not be enabled, at least until the error issue gets resolved.
And a unit should just be allowed to have multiple and different AA attacks. Why should a unit be limited to only have and use one type of AA attack?
I think positive and negative support for AA should be possible
Because of Low Luck errors?
No, even in "High Luck" attacks of 4 and 5 on a 6 sided dice revert to an attack of 3. I tested it not so long ago. Also, multiple AA attacks per unit... yes, in theory, but unless you ask for baby steps, nothing will happen.
So I think the first priority should be to resolve this issue with this pointless number theoretical condition. Next the AA attacks should get their separate attachments (which would specify properties which have to be the same for all AA attacks across a type, like targetsAA and dicesides), changing only how the xml is read without changes to gameplay. Then you could ask for multiple AA per unit. And only after that is it worth talking about support to AA.
You should also consider the issue with the assignment of support. In battle, you have to distribute the support among possible targets, but you want to assign it in a way that
- you don't waste support, i.e. attack power doesn't go above dicesides or below 0 if not necessary
- you want to give support to units with more rolls first
- generally, after all support has been assigned, you don't want to say "I would rather want this unit to support that one instead of what it is currently supporting, because that would result in a better outome of the battle"
Now, this is not possible. I mean, mathematically speaking, there is no algorithm of assigning support that has the desired properties above, not even after the most ridiculous constraints (only allied support, no enemy; only one target unit type per support type, no potential to go above dicesides or below 0). Maybe I'll write more about this at some point. And I think we need to come to a solution before we expand the capabilities of support attachments.
obviously more difficult than I had hoped for. But we can still dream and hope.
Maybe a part of the solution could be to remove all the AA options/capabilities from the unit attachments and make AA have their own attachments, just like the support attachments? I mean if this could simplify things a bit before expanding the AA possibilities?
Maybe a part of the solution could be to remove all the AA options/capabilities from the unit attachments and make AA have their own attachments, just like the support attachments?
This logic is part of the reason I had to create scripts for xml management. Because ideally, if I decide to change the properties of a unit, the only thing I have to modify is the unit attachment. Currently if I want to modify a unit, I have to edit that unit, possibly other units (because of targetsAA), many support attachments and territory effects. If what you're saying was implemented, then I would also have to edit AA attachments. But whatever, with the power of TagX I no longer care.
Some good ideas here.
@alkexr So the AA attack being limited to half the dice sides does appear to be a hard check in the engine. I read through a good bit of code but didn't find a clear reason to why that is so for now I'm proposing to remove the hard check and if a map maker wants to try AA attack greater than half the dice sides then we can do some testing to see if there are any bugs: https://github.com/triplea-game/triplea/pull/3489
@redrum If it is a problem for LL only, then dice should not be impacted too (the limit should exist only when LL is true). Anyways, of course, better solving it for both dice and LL.
One thing I can say is that I tried having AA autohits (roll = dicesides) and it worked. I wanted to ask if this was intended, as I wanted to have AA autohits, and it currently works. So, if that was intended because of the remainder, pos2 should have been clearer in telling that autohits were allowed too, not only half or less the dice side.
@cernel I think the only way that should work looking at the code is to set the dice sides = 1 and then the AA attack = 1. Otherwise I think the engine would prevent it.
@redrum Correct, that way. Of course, setting it via the "attackAAmaxDieSides" for that unit. Well, I was saying that is not in line with the explanation. If this matter would not be solved, can you confirm that I'm fine using it (autohit at 1 diceside is meant to be supported)? Whatever ways this thing go, I suppose pos2 will need updating.
@cernel Yeah, that's fine and should continue to work regardless. For now there is gonna be no check on AA attack limit so anything should at least be able to be tested and creating some crazy map with lots of different AA units and units to fire at would be an interesting test to see if you can find situations where the remainder breaks something.
If we do find issues with LL and remainders that can't be easily resolved then I'll add a check back in that instead of checking:
- attack > dice_sides / 2 && dice_sides > 1 (this is really an incomplete check probably based on only 6 sided dice and even then 6d6 should be allowed)
To something like:
- dice_sides % attack > 0 (% is the remainder operation that divides the numbers and the result is any remainder)
@redrum I am creating a new map and had planned to use AA extensively. But atm. units are limited to just being able to possess and use only 1 kind of AA attack? Right? And no plans to support support positive and negative support?
When I created LME, I wanted formation to reduce/negate charge. Instead now we have a counter-aa-attack against charging units, because AA support isn't possible. It would also be interesting if horsearchers could flank and have anti-air attack at the same time.
I think the question is not if, but when all this will be possible. The two points against implementing these systems is that it's a lot of work, and that it would probably break compatibility (which equals a lot of work plus a lot of work for RogerCooper).
Multiple AA attacks per unit type would mean having separate aaAttachments similar to supportAttachments. Then either having to convert existing AA unit options to generate an aaAttachment in the engine (like isArtillery generates a supportAttachment) or having to mass convert maps so that the existing AA unit options could be removed. Both of these options are pretty painful.
AA support is probably a bit simpler and would just need some options in the support attachment to indicate its for AA instead of normal attack. Then logic added to check and apply support attachments to AA attacks. I don't think this change would impact compatibility since they would just be new options.
I don't think it matters that much the order they are implemented in as you could come back to add a supportAttachment option later on to indicate which AA attack per unit type if you did #2 first. I definitely lean towards tackling #2 first as its significantly easier (probably days vs weeks).
These also probably initially would not be taken into account by the default battle calc casualty selection though it already doesn't handle AA attacks and limited handling of support attachments.
So coming back to this.
Should support for AA attacks only be able to affect the strength or also the number of rolls?
@Frostion's example looks to re-use the dice parameter to specify it influences AA strength rather than regular strength or rolls.
<option name="dice" value="AA"/>
Should we consider allowing it to change the rolls as well? So something like:
<option name="dice" value="AAstrength"/> <option name="dice" value="AAroll"/>
Would the answer to the question not be a matter of "the more options the merrier"? I think that I initially just thought about strength to the dice, but adding dice could of course also be wanted in some situations.
If a unit was to have more than one AA attachment, then of course it would also be necessary to specify what AA type should be boosted/nerfed.
@frostion Probably. Just wondering if map makers would want to change number of rolls for AA attacks but generally its probably a good option to have.
I'm planning to bundle the type of AA with the addition of multiple AA attack per unit with the other feature request. Figure no need to put it in prematurely.