@@ -713,6 +721,8 @@ export class PlayerPanel extends LitElement implements Layer {
return html``;
}
const other = owner as PlayerView;
+ const myGoldNum = my.gold();
+ const myTroopsNum = Number(my.troops());
return html`
+ `;
+ }
+
+ render() {
+ if (!this.open) return html``;
+
+ const percent = this.percentOfBasis(this.sendAmount);
+ const allowed = this.limitAmount(this.sendAmount);
+
+ return html`
+
+
this.closeModal()}
+ >
+
+
+
e.stopPropagation()}
+ >
+ ${this.renderHeader()} ${this.renderAvailable()}
+ ${!this.isTargetAlive() ? this.renderDeadNote() : html``}
+ ${this.renderPresets(percent)} ${this.renderSlider(percent)}
+ ${this.mode === "troops"
+ ? this.renderCapacityNote(allowed)
+ : html``}
+ ${this.renderSummary(allowed)} ${this.renderActions()}
+ ${this.renderSliderStyles()}
+
+
+
+ `;
+ }
+}
diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts
index cb395cc1a..d2287d886 100644
--- a/src/core/game/PlayerImpl.ts
+++ b/src/core/game/PlayerImpl.ts
@@ -576,7 +576,11 @@ export class PlayerImpl implements Player {
}
canDonateGold(recipient: Player): boolean {
- if (!this.isFriendly(recipient)) {
+ if (
+ !this.isAlive() ||
+ !recipient.isAlive() ||
+ !this.isFriendly(recipient)
+ ) {
return false;
}
if (
@@ -599,7 +603,11 @@ export class PlayerImpl implements Player {
}
canDonateTroops(recipient: Player): boolean {
- if (!this.isFriendly(recipient)) {
+ if (
+ !this.isAlive() ||
+ !recipient.isAlive() ||
+ !this.isFriendly(recipient)
+ ) {
return false;
}
if (