This commit is contained in:
jude committed 2023-04-23 17:23:42 +01:00
1 parent 07269df66d
commit 88cf76f815
3 files changed
+50 -40

No files matched your search

+5 -6
View File
@@ -4,7 +4,7 @@ import { RsaPubKey } from "../crypto/rsa.js";
import { PaillierPubKey, ReadOnlyCiphertext } from "../crypto/paillier.js";
import { Region } from "./map.js";
import { showDefenseDom } from "./dom.js";
import { proveRegions, verifyRegions } from "./proofs.js";
import { proveRange, proveRegions, verifyRegions } from "./proofs.js";
// Timeout to consider a player disconnected
const TIMEOUT = 30_000;
@@ -306,10 +306,9 @@ export class Player {
// Handle region loss
} else {
// Prove we still control the region
let proof = proveRange(defender.strength.cipherText, 2n ** 32n);
}
}
if (this === game.us) {
} else if (this === game.us) {
if (defender.strength.assumedStrength === 0n) {
// Handle region gain
defender.owner = this;
@@ -318,10 +317,10 @@ export class Player {
defender.name
);
}
} else {
await defender.resolveConflict();
}
await defender.resolveConflict();
// Reset the promises in case they attack again.
defender.owner.defenderPromise = null;
defender.owner.defenderAmount = null;