triplea icon indicating copy to clipboard operation
triplea copied to clipboard

Possible 2.6 bug in buildAaCombatValue()

Open asvitkine opened this issue 2 years ago • 0 comments

Possible 2.6 bug in buildAaCombatValue().

The code is as follows:

    return side == BattleState.Side.DEFENSE
        ? AaDefenseCombatValue.builder()
            .strengthSupportFromFriends(
                supportFromFriends.filter(UnitSupportAttachment::getAaStrength))
            .strengthSupportFromEnemies(
                supportFromEnemies.filter(UnitSupportAttachment::getAaStrength))
            .rollSupportFromFriends(supportFromFriends.filter(UnitSupportAttachment::getAaRoll))
            .rollSupportFromEnemies(supportFromEnemies.filter(UnitSupportAttachment::getAaRoll))
            .friendUnits(friendlyUnits)
            .enemyUnits(enemyUnits)
            .build()
        : AaOffenseCombatValue.builder()
            .strengthSupportFromFriends(
                supportFromFriends.filter(UnitSupportAttachment::getAaStrength))
            .strengthSupportFromEnemies(
                supportFromEnemies.filter(UnitSupportAttachment::getAaStrength))
            .rollSupportFromFriends(supportFromFriends.filter(UnitSupportAttachment::getRoll))
            .rollSupportFromEnemies(supportFromEnemies.filter(UnitSupportAttachment::getRoll))
            .friendUnits(friendlyUnits)
            .enemyUnits(enemyUnits)
            .build();

Defense uses getAaRoll() while offense uses getRoll(). There is no comment, so it looks like a bug.

@trevan Is it?

asvitkine avatar Jun 16 '22 17:06 asvitkine