can create alliance between humans

This commit is contained in:
evanpelle
2024-09-20 14:54:04 -07:00
parent 37ea4973a0
commit c55532ab4b
4 changed files with 30 additions and 7 deletions
@@ -1,6 +1,6 @@
import {AllianceRequest, Execution, MutableGame, MutablePlayer, Player, PlayerID} from "../game/Game";
export class AllianceRequestExecutionReply implements Execution {
export class AllianceRequestReplyExecution implements Execution {
private active = true
private mg: MutableGame = null
private requestor: MutablePlayer;
+6 -2
View File
@@ -1,4 +1,4 @@
import {Cell, Execution, MutableGame, Game, MutablePlayer, PlayerInfo, TerraNullius, Tile, PlayerType, Alliance} from "../game/Game";
import {Cell, Execution, MutableGame, Game, MutablePlayer, PlayerInfo, TerraNullius, Tile, PlayerType, Alliance, AllianceRequestReplyEvent} from "../game/Game";
import {AttackIntent, BoatAttackIntentSchema, GameID, Intent, Turn} from "../Schemas";
import {AttackExecution} from "./AttackExecution";
import {SpawnExecution} from "./SpawnExecution";
@@ -10,6 +10,7 @@ import {FakeHumanExecution} from "./FakeHumanExecution";
import Usernames from '../../../resources/Usernames.txt'
import {simpleHash} from "../Util";
import {AllianceRequestExecution} from "./AllianceRequestExecution";
import {AllianceRequestReplyExecution} from "./AllianceRequestReplyExecution";
@@ -58,7 +59,10 @@ export class Executor {
)
} else if (intent.type == "allianceRequest") {
return new AllianceRequestExecution(intent.requestor, intent.recipient)
} else {
} else if (intent.type == "allianceRequestReply") {
return new AllianceRequestReplyExecution(intent.requestor, intent.recipient, intent.accept)
}
else {
throw new Error(`intent type ${intent} not found`)
}
}