import { Component, ComponentId } from "./Tactic" export type PlayerId = string export enum PlayerTeam { Allies = "allies", Opponents = "opponents", } export interface Player extends PlayerInfo, Component<"player"> { readonly id: PlayerId } /** * All information about a player */ export interface PlayerInfo { readonly id: string /** * the player's team * */ readonly team: PlayerTeam /** * player's role * */ readonly role: string /** * True if the player has a basketball */ readonly ballState: BallState /** * Percentage of the player's position to the bottom (0 means top, 1 means bottom, 0.5 means middle) */ readonly bottomRatio: number /** * Percentage of the player's position to the right (0 means left, 1 means right, 0.5 means middle) */ readonly rightRatio: number } export enum BallState { NONE, HOLDS, SHOOTED, } export interface Player extends Component<"player">, PlayerInfo { /** * True if the player has a basketball */ readonly ballState: BallState readonly path: MovementPath | null } export interface MovementPath { readonly items: ComponentId[] } /** * A player phantom is a kind of component that represents the future state of a player * according to the court's step information */ export interface PlayerPhantom extends Component<"phantom"> { readonly originPlayerId: ComponentId readonly ballState: BallState }