fix npe in radial menu when clicked right after spawn phase, rebalance weaken attacks to make up for expanded attack bonus range from previous commit

This commit is contained in:
evanpelle
2024-12-31 10:45:58 -08:00
parent b7af94ec47
commit 6e8a3b6f40
2 changed files with 4 additions and 2 deletions
@@ -409,7 +409,9 @@ export class RadialMenu implements Layer {
} else {
if (clicked.owner().clientID() != this.clientID) {
const myPlayer = this.game.players().find(p => p.clientID() == this.clientID)
this.eventBus.emit(new SendAttackIntentEvent(clicked.owner().id(), this.uiState.attackRatio * myPlayer.troops()))
if (myPlayer != null) {
this.eventBus.emit(new SendAttackIntentEvent(clicked.owner().id(), this.uiState.attackRatio * myPlayer.troops()))
}
}
}
this.hideRadialMenu();