bugfix: destroys not capturing tradeships

This commit is contained in:
Evan
2024-11-25 09:19:22 -08:00
parent 0b062179ac
commit 146a7ef657
2 changed files with 8 additions and 5 deletions
+2
View File
@@ -192,6 +192,8 @@
* BUG: fix matchmaking DONE 11/22/2024
* destroyer can capture trade ships DONE 11/22/2024
* have bots recapture after nuclear blast DONE 11/24/2022
* BUG: destroys destroy trade ships instead of capturing them DONE 11/25/2024
* nukes break alliance
* don't capture trade ships if allied with either port
* make ports cost more for more ports
* BUG: Destroyers destroy instead of capture trade ships
+6 -5
View File
@@ -44,17 +44,18 @@ export class TradeShipExecution implements Execution {
this.active = false
return
}
if (!this.dstPort.isActive() || !this.tradeShip.owner().isAlliedWith(this.dstPort.owner())) {
this.tradeShip.delete()
this.active = false
return
}
if (this.origOwner != this.tradeShip.owner()) {
// Store as vairable in case ship is recaptured by previous owner
this.wasCaptured = true
}
if (!this.wasCaptured && (!this.dstPort.isActive() || !this.tradeShip.owner().isAlliedWith(this.dstPort.owner()))) {
this.tradeShip.delete()
this.active = false
return
}
if (this.wasCaptured) {
const ports = this.tradeShip.owner().units(UnitType.Port).sort(distSortUnit(this.tradeShip))
if (ports.length == 0) {