Skip to content

Commit

Permalink
Fix Commanders showing the wrong attack preview.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: c95173a8ef90db0a65d9922e851312522edf34af
  • Loading branch information
cpojer committed Nov 15, 2024
1 parent ff2257f commit 343a8ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions athena/lib/getAttackStatusEffect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export default function getAttackStatusEffect(
for (const adjacent of vector.adjacent()) {
const unit = map.units.get(adjacent);
if (
unit &&
unit.info.hasAbility(Ability.Morale) &&
unit?.info.hasAbility(Ability.Morale) &&
map.matchesPlayer(unit, player)
) {
unitEffect += MoraleStatusEffect;
Expand Down
10 changes: 8 additions & 2 deletions hera/behavior/attack/AttackSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,18 @@ export default function AttackSelector({
if (entities.building || entities.unit) {
const isShortRange = selectedUnit.info.isShortRange();
const targetPosition = origin || selectedPosition;
const futureMap =
targetPosition === selectedPosition
? map
: map.copy({
units: map.units.delete(selectedPosition),
});
const unitDamage =
entities.unit &&
getDamageInformation(
selectedUnit,
entities.unit,
map,
futureMap,
targetPosition,
position,
);
Expand All @@ -116,7 +122,7 @@ export default function AttackSelector({
getDamageInformation(
selectedUnit,
entities.building,
map,
futureMap,
targetPosition,
position,
);
Expand Down

0 comments on commit 343a8ba

Please sign in to comment.