feat: move warship (#196)

This commit is contained in:
Ilan Schemoul
2025-03-14 16:30:30 -07:00
committed by GitHub
parent baf91db288
commit 275de50fcd
8 changed files with 182 additions and 52 deletions
+11 -1
View File
@@ -24,7 +24,8 @@ export type Intent =
| DonateIntent
| TargetTroopRatioIntent
| BuildUnitIntent
| EmbargoIntent;
| EmbargoIntent
| MoveWarshipIntent;
export type AttackIntent = z.infer<typeof AttackIntentSchema>;
export type CancelAttackIntent = z.infer<typeof CancelAttackIntentSchema>;
@@ -43,6 +44,7 @@ export type TargetTroopRatioIntent = z.infer<
typeof TargetTroopRatioIntentSchema
>;
export type BuildUnitIntent = z.infer<typeof BuildUnitIntentSchema>;
export type MoveWarshipIntent = z.infer<typeof MoveWarshipIntentSchema>;
export type Turn = z.infer<typeof TurnSchema>;
export type GameConfig = z.infer<typeof GameConfigSchema>;
@@ -164,6 +166,7 @@ const BaseIntentSchema = z.object({
"troop_ratio",
"build_unit",
"embargo",
"move_warship",
]),
clientID: ID,
playerID: ID,
@@ -261,6 +264,12 @@ export const CancelAttackIntentSchema = BaseIntentSchema.extend({
attackID: z.string(),
});
export const MoveWarshipIntentSchema = BaseIntentSchema.extend({
type: z.literal("move_warship"),
unitId: z.number(),
tile: z.number(),
});
const IntentSchema = z.union([
AttackIntentSchema,
CancelAttackIntentSchema,
@@ -275,6 +284,7 @@ const IntentSchema = z.union([
TargetTroopRatioIntentSchema,
BuildUnitIntentSchema,
EmbargoIntentSchema,
MoveWarshipIntentSchema,
]);
export const TurnSchema = z.object({