Pnompenb 141 Posted January 6, 2025 What is the AttackRange setting responsible for in units? Quote Share this post Link to post Share on other sites More sharing options...
0 11:59 Development Team 253 Posted February 16, 2025 It affects in battle combat (src/aoc/kingdoms/lukasz/map/battles/Battle.class): public final void updateAttack(BattleLine nAttacking, int iRoundID, int iDefense) { for(int i = 0; i < GameValues.battle.BATTLE_MAX_BATTLE_WIDTH; ++i) { if (this.firstLine.get(i) != null) { ((BattleRegiment)this.firstLine.get(i)).cL = 0; } } int generalExtraCasualties = 0; if (nAttacking.armyGeneral != null) { if (this.armyGeneral != null) { generalExtraCasualties = Math.max(0, nAttacking.armyGeneral.getAttack() - this.armyGeneral.getDefense() - iDefense); } else { generalExtraCasualties = Math.max(0, nAttacking.armyGeneral.getAttack() - iDefense); } } for(int i = 0; i < GameValues.battle.BATTLE_MAX_BATTLE_WIDTH; ++i) { if (nAttacking.firstLine.get(i) != null) { float fArmyPercLeft = (float)((BattleRegiment)nAttacking.firstLine.get(i)).aR.num / (float)((Game_Ages.Data_Ages)Game.gameAges.lAges.get(Game_Calendar.CURRENT_AGEID)).REGIMENT_SIZE; if (this.firstLine.get(i) != null && ((BattleRegiment)this.firstLine.get(i)).aR.num > 0) { BattleRegiment var13 = (BattleRegiment)this.firstLine.get(i); var13.cL += this.getAttackCasualties(iRoundID, generalExtraCasualties, fArmyPercLeft, (float)((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)nAttacking.firstLine.get(i)).aR.uID)).get(((BattleRegiment)nAttacking.firstLine.get(i)).aR.aID)).getAttack(((BattleRegiment)nAttacking.firstLine.get(i)).c) / (float)(((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)this.firstLine.get(i)).aR.uID)).get(((BattleRegiment)this.firstLine.get(i)).aR.aID)).getDefense(((BattleRegiment)this.firstLine.get(i)).c) + iDefense), ((BattleRegiment)nAttacking.firstLine.get(i)).c); this.iLastAttackRoundID = iRoundID; } else { for(int j = 1; j < ((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)nAttacking.firstLine.get(i)).aR.uID)).get(((BattleRegiment)nAttacking.firstLine.get(i)).aR.aID)).AttackRange + 1; ++j) { if (i + j < GameValues.battle.BATTLE_MAX_BATTLE_WIDTH && this.firstLine.get(i + j) != null && ((BattleRegiment)this.firstLine.get(i + j)).aR.num > 0) { BattleRegiment var12 = (BattleRegiment)this.firstLine.get(i + j); var12.cL += this.getAttackCasualties(iRoundID, generalExtraCasualties, fArmyPercLeft, (float)((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)nAttacking.firstLine.get(i)).aR.uID)).get(((BattleRegiment)nAttacking.firstLine.get(i)).aR.aID)).getAttack(((BattleRegiment)nAttacking.firstLine.get(i)).c) / (float)(((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)this.firstLine.get(i + j)).aR.uID)).get(((BattleRegiment)this.firstLine.get(i + j)).aR.aID)).getDefense(((BattleRegiment)this.firstLine.get(i + j)).c) + iDefense), ((BattleRegiment)nAttacking.firstLine.get(i)).c); this.iLastAttackRoundID = iRoundID; break; } if (i - j >= 0 && this.firstLine.get(i - j) != null && ((BattleRegiment)this.firstLine.get(i - j)).aR.num > 0) { BattleRegiment var10000 = (BattleRegiment)this.firstLine.get(i - j); var10000.cL += this.getAttackCasualties(iRoundID, generalExtraCasualties, fArmyPercLeft, (float)((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)nAttacking.firstLine.get(i)).aR.uID)).get(((BattleRegiment)nAttacking.firstLine.get(i)).aR.aID)).getAttack(((BattleRegiment)nAttacking.firstLine.get(i)).c) / (float)(((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)this.firstLine.get(i - j)).aR.uID)).get(((BattleRegiment)this.firstLine.get(i - j)).aR.aID)).getDefense(((BattleRegiment)this.firstLine.get(i - j)).c) + iDefense), ((BattleRegiment)nAttacking.firstLine.get(i)).c); this.iLastAttackRoundID = iRoundID; break; } } } } } for(int i = 0; i < GameValues.battle.BATTLE_MAX_BATTLE_WIDTH; ++i) { if (nAttacking.secondLine.get(i) != null && ((ArmyManager.Data_UnitTypes)ArmyManager.lUnitsTypes.get(((BattleRegiment)nAttacking.secondLine.get(i)).aR.uID)).Line >= 2) { float fArmyPercLeft = (float)((BattleRegiment)nAttacking.secondLine.get(i)).aR.num / (float)((Game_Ages.Data_Ages)Game.gameAges.lAges.get(Game_Calendar.CURRENT_AGEID)).REGIMENT_SIZE; if (this.firstLine.get(i) != null && ((BattleRegiment)this.firstLine.get(i)).aR.num > 0) { BattleRegiment var16 = (BattleRegiment)this.firstLine.get(i); var16.cL += this.getAttackCasualties(iRoundID, generalExtraCasualties, fArmyPercLeft, (float)((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)nAttacking.secondLine.get(i)).aR.uID)).get(((BattleRegiment)nAttacking.secondLine.get(i)).aR.aID)).getAttack(((BattleRegiment)nAttacking.secondLine.get(i)).c) / (float)(((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)this.firstLine.get(i)).aR.uID)).get(((BattleRegiment)this.firstLine.get(i)).aR.aID)).getDefense(((BattleRegiment)this.firstLine.get(i)).c) + iDefense), ((BattleRegiment)nAttacking.secondLine.get(i)).c); this.iLastAttackRoundID = iRoundID; } else { for(int j = 1; j < ((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)nAttacking.secondLine.get(i)).aR.uID)).get(((BattleRegiment)nAttacking.secondLine.get(i)).aR.aID)).AttackRange + 1; ++j) { if (i + j < GameValues.battle.BATTLE_MAX_BATTLE_WIDTH && this.firstLine.get(i + j) != null && ((BattleRegiment)this.firstLine.get(i + j)).aR.num > 0) { BattleRegiment var15 = (BattleRegiment)this.firstLine.get(i + j); var15.cL += this.getAttackCasualties(iRoundID, generalExtraCasualties, fArmyPercLeft, (float)((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)nAttacking.secondLine.get(i)).aR.uID)).get(((BattleRegiment)nAttacking.secondLine.get(i)).aR.aID)).getAttack(((BattleRegiment)nAttacking.secondLine.get(i)).c) / (float)(((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)this.firstLine.get(i + j)).aR.uID)).get(((BattleRegiment)this.firstLine.get(i + j)).aR.aID)).getDefense(((BattleRegiment)this.firstLine.get(i + j)).c) + iDefense), ((BattleRegiment)nAttacking.secondLine.get(i)).c); this.iLastAttackRoundID = iRoundID; break; } if (i - j >= 0 && this.firstLine.get(i - j) != null && ((BattleRegiment)this.firstLine.get(i - j)).aR.num > 0) { BattleRegiment var14 = (BattleRegiment)this.firstLine.get(i - j); var14.cL += this.getAttackCasualties(iRoundID, generalExtraCasualties, fArmyPercLeft, (float)((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)nAttacking.secondLine.get(i)).aR.uID)).get(((BattleRegiment)nAttacking.secondLine.get(i)).aR.aID)).getAttack(((BattleRegiment)nAttacking.secondLine.get(i)).c) / (float)(((ArmyManager.Data_Army)((ArrayList)ArmyManager.lArmy.get(((BattleRegiment)this.firstLine.get(i - j)).aR.uID)).get(((BattleRegiment)this.firstLine.get(i - j)).aR.aID)).getDefense(((BattleRegiment)this.firstLine.get(i - j)).c) + iDefense), ((BattleRegiment)nAttacking.secondLine.get(i)).c); this.iLastAttackRoundID = iRoundID; break; } } } } } } Here, .aR is the abbreviation for AttackRange, and this is precisely what it does. The actual code is quite verbose, but the TLDR is that it looks in all directions up to AttackRange (radiating outwards), and inflicts damage this way. More surprising is that it doesn't appear to just affect backline/frontline combat (it iterates left and right with i + j and i - j), but also flanking units; though I could be wrong on this one. AttackRange does not determine Province AttackRange, only in-province battles. Quote Share this post Link to post Share on other sites More sharing options...
What is the AttackRange setting responsible for in units?
Share this post
Link to post
Share on other sites