Combine Unit & MutableUnit

This commit is contained in:
evanpelle
2025-01-23 11:14:08 -08:00
committed by Evan
parent de1dbff570
commit 75fe718f16
13 changed files with 49 additions and 44 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { Cell, Execution, Game, Player, MutableUnit, PlayerID, TerrainType, Unit, UnitType } from "../game/Game";
import { Cell, Execution, Game, Player, Unit, PlayerID, TerrainType, UnitType } from "../game/Game";
import { PathFinder } from "../pathfinding/PathFinding";
import { PathFindResultType } from "../pathfinding/AStar";
import { PseudoRandom } from "../PseudoRandom";
@@ -12,7 +12,7 @@ export class BattleshipExecution implements Execution {
private _owner: Player
private active = true
private battleship: MutableUnit = null
private battleship: Unit = null
private mg: Game = null
private pathfinder: PathFinder
+2 -2
View File
@@ -1,12 +1,12 @@
import { consolex } from "../Consolex";
import { Execution, Game, Player, MutableUnit, PlayerID, UnitType } from "../game/Game";
import { Execution, Game, Player, Unit, PlayerID, UnitType } from "../game/Game";
import { TileRef } from "../game/GameMap";
export class CityExecution implements Execution {
private player: Player
private mg: Game
private city: MutableUnit
private city: Unit
private active: boolean = true
constructor(private ownerId: PlayerID, private tile: TileRef) { }
+2 -2
View File
@@ -1,12 +1,12 @@
import { consolex } from "../Consolex";
import { Cell, DefenseBonus, Execution, Game, Player, MutableUnit, PlayerID, UnitType } from "../game/Game";
import { Cell, DefenseBonus, Execution, Game, Player, Unit, PlayerID, UnitType } from "../game/Game";
import { manhattanDistFN, TileRef } from "../game/GameMap";
export class DefensePostExecution implements Execution {
private player: Player
private mg: Game
private post: MutableUnit
private post: Unit
private active: boolean = true
private defenseBonuses: DefenseBonus[] = []
+3 -3
View File
@@ -1,4 +1,4 @@
import { Cell, Execution, Game, Player, MutableUnit, PlayerID, TerrainType, UnitType } from "../game/Game";
import { Cell, Execution, Game, Player, Unit, PlayerID, TerrainType, UnitType } from "../game/Game";
import { PathFinder } from "../pathfinding/PathFinding";
import { PathFindResultType } from "../pathfinding/AStar";
import { PseudoRandom } from "../PseudoRandom";
@@ -11,10 +11,10 @@ export class DestroyerExecution implements Execution {
private _owner: Player
private active = true
private destroyer: MutableUnit = null
private destroyer: Unit = null
private mg: Game = null
private target: MutableUnit = null
private target: Unit = null
private pathfinder: PathFinder
private patrolTile: TileRef;
+2 -2
View File
@@ -1,5 +1,5 @@
import { consolex } from "../Consolex";
import { Cell, Execution, Game, Player, MutableUnit, PlayerID, UnitType } from "../game/Game";
import { Cell, Execution, Game, Player, Unit, PlayerID, UnitType } from "../game/Game";
import { TileRef } from "../game/GameMap";
export class MissileSiloExecution implements Execution {
@@ -7,7 +7,7 @@ export class MissileSiloExecution implements Execution {
private active = true
private mg: Game
private player: Player
private silo: MutableUnit
private silo: Unit
constructor(
private _owner: PlayerID,
+2 -2
View File
@@ -1,5 +1,5 @@
import { nextTick } from "process";
import { Cell, Execution, Game, Player, PlayerID, MutableUnit, UnitType, TerraNullius } from "../game/Game";
import { Cell, Execution, Game, Player, PlayerID, Unit, UnitType, TerraNullius } from "../game/Game";
import { PathFinder } from "../pathfinding/PathFinding";
import { PathFindResultType } from "../pathfinding/AStar";
import { PseudoRandom } from "../PseudoRandom";
@@ -14,7 +14,7 @@ export class NukeExecution implements Execution {
private mg: Game
private nuke: MutableUnit
private nuke: Unit
private pathFinder: PathFinder
constructor(
+4 -4
View File
@@ -1,4 +1,4 @@
import { AllPlayers, Cell, Execution, Game, Player, MutableUnit, PlayerID, TerrainType, UnitType } from "../game/Game";
import { AllPlayers, Cell, Execution, Game, Player, Unit, PlayerID, TerrainType, UnitType } from "../game/Game";
import { PathFinder } from "../pathfinding/PathFinding";
import { PathFindResultType } from "../pathfinding/AStar";
import { PseudoRandom } from "../PseudoRandom";
@@ -11,10 +11,10 @@ export class PortExecution implements Execution {
private active = true
private mg: Game
private port: MutableUnit
private port: Unit
private random: PseudoRandom
private portPaths = new Map<MutableUnit, TileRef[]>()
private computingPaths = new Map<MutableUnit, MiniAStar>()
private portPaths = new Map<Unit, TileRef[]>()
private computingPaths = new Map<Unit, MiniAStar>()
constructor(
private _owner: PlayerID,
+3 -3
View File
@@ -1,4 +1,4 @@
import { Execution, Game, Player, MutableUnit, Unit, UnitType } from "../game/Game";
import { Execution, Game, Player, Unit, UnitType } from "../game/Game";
import { PathFinder } from "../pathfinding/PathFinding";
import { PathFindResultType } from "../pathfinding/AStar";
import { consolex } from "../Consolex";
@@ -8,9 +8,9 @@ export class ShellExecution implements Execution {
private active = true
private pathFinder: PathFinder
private shell: MutableUnit
private shell: Unit
constructor(private spawn: TileRef, private _owner: Player, private ownerUnit: Unit, private target: MutableUnit) {
constructor(private spawn: TileRef, private _owner: Player, private ownerUnit: Unit, private target: Unit) {
}
+4 -4
View File
@@ -1,6 +1,6 @@
import { MessageType } from '../game/Game';
import { renderNumber } from "../../client/Utils";
import { AllPlayers, Cell, Execution, Game, MutableUnit, Player, PlayerID, UnitType } from "../game/Game";
import { AllPlayers, Cell, Execution, Game, Unit, Player, PlayerID, UnitType } from "../game/Game";
import { PathFinder } from "../pathfinding/PathFinding";
import { PathFindResultType } from "../pathfinding/AStar";
import { distSortUnit } from "../Util";
@@ -12,14 +12,14 @@ export class TradeShipExecution implements Execution {
private active = true
private mg: Game
private origOwner: Player
private tradeShip: MutableUnit
private tradeShip: Unit
private index = 0
private wasCaptured = false
constructor(
private _owner: PlayerID,
private srcPort: MutableUnit,
private dstPort: MutableUnit,
private srcPort: Unit,
private dstPort: Unit,
private pathFinder: PathFinder,
// don't modify
private path: TileRef[]
+2 -2
View File
@@ -1,4 +1,4 @@
import { Unit, Cell, Execution, MutableUnit, Game, Player, PlayerID, TerraNullius, UnitType, TerrainType } from "../game/Game";
import { Unit, Cell, Execution, Game, Player, PlayerID, TerraNullius, UnitType, TerrainType } from "../game/Game";
import { AttackExecution } from "./AttackExecution";
import { MessageType } from '../game/Game';
import { PathFinder } from "../pathfinding/PathFinding";
@@ -26,7 +26,7 @@ export class TransportShipExecution implements Execution {
private dst: TileRef | null
private boat: MutableUnit
private boat: Unit
private pathFinder: PathFinder