Formats Code
This commit is contained in:
@@ -2,8 +2,7 @@ export type RoleDefinition = {
|
|||||||
name: string;
|
name: string;
|
||||||
body: BodyPartConstant[];
|
body: BodyPartConstant[];
|
||||||
priority: number;
|
priority: number;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
export const CreepRoles = {
|
export const CreepRoles = {
|
||||||
harvester: {
|
harvester: {
|
||||||
@@ -23,9 +22,6 @@ export const CreepRoles = {
|
|||||||
}
|
}
|
||||||
} satisfies Record<string, RoleDefinition>;
|
} satisfies Record<string, RoleDefinition>;
|
||||||
|
|
||||||
|
|
||||||
export type CreepRole = keyof typeof CreepRoles;
|
export type CreepRole = keyof typeof CreepRoles;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type CreepRequisition = Record<CreepRole, number>;
|
export type CreepRequisition = Record<CreepRole, number>;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import { CreepRequisition } from "./creeps";
|
import { CreepRequisition } from "./creeps";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration for the game, defining limits and minimum requirements for creeps.
|
* Configuration for the game, defining limits and minimum requirements for creeps.
|
||||||
* Used to manage the overall game state and ensure proper role distribution.
|
* Used to manage the overall game state and ensure proper role distribution.
|
||||||
@@ -17,7 +15,6 @@ export type GameConfig = {
|
|||||||
minCreepsPerRole: CreepRequisition;
|
minCreepsPerRole: CreepRequisition;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default game configuration with maximum creeps and minimum creeps per role.
|
* Default game configuration with maximum creeps and minimum creeps per role.
|
||||||
* This configuration is used to initialize the game state and ensure that the game runs smoothly.
|
* This configuration is used to initialize the game state and ensure that the game runs smoothly.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { RoleDefinition } from "types/creeps"
|
import { RoleDefinition } from "types/creeps";
|
||||||
|
|
||||||
export const get_role_const = (role: RoleDefinition) => {
|
export const get_role_const = (role: RoleDefinition) => {
|
||||||
return role.body.reduce((cost, part) => {
|
return role.body.reduce((cost, part) => {
|
||||||
cost += BODYPART_COST[part] || 0;
|
cost += BODYPART_COST[part] || 0;
|
||||||
return cost;
|
return cost;
|
||||||
}, 0)
|
}, 0);
|
||||||
}
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user