AA and targets with multiple hit points, how many dice?



  • I'm looking at the AA dice code and the AA casualty code and I came across the following comment:

            // if allowMultipleHitsPerUnit, then because the number of rolls exactly equals the
            // hitpoints of all units,
            // we roll multiple times for any unit with multiple hitpoints
    

    (this is in AaCasualtySelector in three different places)

    That comment seems to imply that if there is an infinite AA that damages planes instead of insta-kills them and planes with multiple hit points, then the AA can roll a dice for each hit point that the plane has. So 2 planes with 2 HP each would cause 4 dice rolls.

    But looking at the DiceRoll code, I only see it roll 1 die for every plane, no matter if the AA can damage planes.

    Looking through the history, it looks like the comment and multiple hp code was added to AaCasualtySelector but DiceRoll never was changed.

    So, my question is: is the comment wrong? Or should infinite AA (that damages instead of insta-kills) be able to roll for each hp available on a multi hp plane?



  • @Trevan If you have a 2 hit and a 1 hit plane with a aaGun that can shoot up to 3 times, but only "once" per plane, I'd say the 2 hitter should get shot at twice. If only a 2 shot aaGun ,then twice at the two hitter or one each. If two 1 hitters, then only one each even if it's a 3 shot aaGun. If one 2 hitter, it'd get 2 shots.

    Or make an either or option, but that's how'd I play it.

    Edit
    Also the aaGun is used for a lot of units besides planes, so the either or option may make more sense in some situations. Currently you can only target and name stuff so many times without it overlapping. Preventing what one wants to do.

    For example, I can have a Tac Bmbr target subs and ships, but they have to be targeted the same with AA. Can't have multiple Tacs attack a sub and have only 1:1 attack on ships or have different attack values for subs and ships.

    Or is it unlimited AA shots per gun ? If so, yea, I'd say 2 shots at it. But ... option would be nice ūüôā



  • @beelee , I'm not trying to change functionality. I'm trying to figure out if the comment is wrong (and so the current functionality is correct) or if the comment is right (and the current functionality is wrong).

    Right now, if you have an infinite AA gun and 4 planes with 2HP attack, it will only roll 4 dice. The user can then choose to assign those hits as they choose. But the comment seems to indicate that the AA gun should actually roll 8 dice. Should the code be changed to follow the comment or should the comment just be removed because it is incorrect?



  • After more looking, it does look like the comment is correct and that the engine has a bug. If a map has "Roll AA Individually" enabled and it has multi-hp units that can be targeted by AA fire that is "damageable", then it is impossible to actually "Roll AA Individually". The code will always go into the "Random AA Casualties" flow. And this is because the "Roll AA Individually" requires that all available hit points to be targeted by one AA shot.

    Now, it maybe possible that the "Roll AA Individually" needs to be changed instead, but I don't know what it should do in the case of multi hp units.


  • Admin

    My initial thought is one AA shot per plane, regardless of hit points.



  • @LaFayette said in AA and targets with multiple hit points, how many dice?:

    My initial thought is one AA shot per plane, regardless of hit points.

    That would mean that "Roll AA Individually" is meaningless in a game that has AA units with the damageableAA property. It will always use the "Random AA Casualties" code. Though, I've been looking at the two code paths and I'm not exactly sure where there is a difference.

    I'm thinking that it should be one AA shot per hit point. Reason for that is say you have an AA unit that has maxAAattacks of 1, has damageableAA, and can not overstack. The opponent has 1 unit is targeted by the AA unit with 2 hit points. If you have 2 AA units, they will only be able to roll once because the target count is 1. The other AA unit will not be able to shoot at the second hit point. I think it would be better to allow the second AA unit to be able to fire. If you have 3 AA units, then only 2 would fire since there is only 2 hit points.

    If you have an infinite AA unit, then it can fire at every hit point, which might be a little odd but I don't see any infinite AA unit in a map that has damageableAA properties.



  • One example is the "another world" map. It has a nuclear_missle that has 9,999 maxAAattacks. If that fired at a bomber (which has 2 hitpoints) it would only be able to damage it. It would not be able to kill it, even though it can fire up to 9,999 times.


  • Admin

    I think you may have to look at which maps have the combination of properties set to see how it is used. I can imagine a few different variations of how such behavior would be used.

    Generally, if the intent were to be able to shoot down a multi-hit-point air unit, it would make more sense to me for the AA to do more than 1 damage.


Log in to reply