mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-04 22:02:00 +00:00
must build port before destroyer
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Cell, Execution, Items, MutableGame, MutablePlayer, PlayerID, Tile } from "../game/Game";
|
||||
import { Cell, Execution, BuildItems, MutableGame, MutablePlayer, PlayerID, Tile } from "../game/Game";
|
||||
import { PseudoRandom } from "../PseudoRandom";
|
||||
import { bfs, dist, euclideanDist, manhattanDist } from "../Util";
|
||||
|
||||
@@ -26,12 +26,12 @@ export class NukeExecution implements Execution {
|
||||
}
|
||||
|
||||
tick(ticks: number): void {
|
||||
if (this.sender.gold() < Items.Nuke.cost) {
|
||||
if (this.sender.gold() < BuildItems.Nuke.cost) {
|
||||
console.warn(`player ${this.sender} insufficient gold for nuke`)
|
||||
this.active = false
|
||||
return
|
||||
}
|
||||
this.sender.removeGold(Items.Nuke.cost)
|
||||
this.sender.removeGold(BuildItems.Nuke.cost)
|
||||
|
||||
const rand = new PseudoRandom(this.mg.ticks())
|
||||
const tile = this.mg.tile(this.cell)
|
||||
|
||||
+11
-8
@@ -26,19 +26,22 @@ export enum GameMap {
|
||||
}
|
||||
|
||||
export enum UnitType {
|
||||
TransportShip,
|
||||
Destroyer,
|
||||
Port
|
||||
TransportShip = "Transport",
|
||||
Destroyer = "Destroyer",
|
||||
Port = "Port",
|
||||
Nuke = "Nuke",
|
||||
}
|
||||
|
||||
export class Item {
|
||||
constructor(public readonly name: string, public readonly cost: Gold) { }
|
||||
constructor(public readonly type: UnitType,
|
||||
public readonly cost: Gold
|
||||
) { }
|
||||
}
|
||||
|
||||
export const Items = {
|
||||
Nuke: new Item("Nuke", 1_000_000),
|
||||
Destroyer: new Item("Destroyer", 10),
|
||||
Port: new Item("Port", 0)
|
||||
export const BuildItems = {
|
||||
Nuke: new Item(UnitType.Nuke, 1_000_000),
|
||||
Destroyer: new Item(UnitType.Destroyer, 10),
|
||||
Port: new Item(UnitType.Port, 0)
|
||||
} as const;
|
||||
|
||||
export class Nation {
|
||||
|
||||
Reference in New Issue
Block a user