use newer attack, delete existing attack (#1134)

## Description:
Also when a new attack is sent when there's an existing attack, have the
new attack delete the existing attack. This causes attack to "reset" and
use the entire border when a new attack is sent.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

<DISCORD USERNAME>
This commit is contained in:
evanpelle
2025-06-10 10:01:46 -07:00
committed by evanpelle
parent 8c12c572a4
commit bd58b28e43
+4 -6
View File
@@ -140,13 +140,11 @@ export class AttackExecution implements Execution {
if (
outgoing !== this.attack &&
outgoing.target() === this.attack.target() &&
outgoing.sourceTile() === this.attack.sourceTile()
// Boat attacks (sourceTile is not null) are not combined with other attacks
this.attack.sourceTile() === null
) {
// Existing attack on same target, add troops
outgoing.setTroops(outgoing.troops() + this.attack.troops());
this.active = false;
this.attack.delete();
return;
this.attack.setTroops(this.attack.troops() + outgoing.troops());
outgoing.delete();
}
}