Skip to content

2024-August-04 - 2.7.14851

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 04 Aug 19:27
4505bce
battleCalculator #1 (#12816)

issue 12688 (battle calc on own territory shows own player as attacker and defender)
Desired:
1. Attacker: Current player always, except when only allied units present (then next enemy)
2. Defender: As enemy to attacker with most units (fallback: whomever is at war and has the next turn)

AttackerAndDefenderSelectorTest.java
- simplification of method getAttackerAndDefender()
- new methods getBestAttacker() and getBestAttacker()
- removed now unused methods getOpponentWithPriorityList, playersAtWarWith, neutralPlayersTowards, getEnemyWithMostUnits

UnitCollection.java
- rename method getPlayersByUnitCount to getPlayersSortedByUnitCount

BattleCalculatorDialog.java
- extract common logic from method addAttackers and addDefenders to new method adjustBattleCalculatorPanel
- extract static attribute modifications from instance method dispose into new static method disposeInstance (especially pack also for adding attacker)

BattleCalculatorPanel.java
- introduce new methods setAttackerWithUnits and setDefenderWithUnits to limit attacker/defender change to own instance
- make setter of attribute attacker/defender private
- rename methods hasAttackingUnitsAdded and hasDefendingUnitsAdded to hasAttackingUnits and hasDefendingUnits
- rename attribute attackerUnitsTotalHitpoints to attackerUnitsTotalHitPoints