ports increase in price, NPC attack more frequently, tradeship destroyed if dst port destroyed or captured

This commit is contained in:
Evan
2024-11-24 21:03:09 -08:00
parent 5431aff30c
commit 0b062179ac
10 changed files with 35 additions and 52 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ export enum GameMap {
}
export interface UnitInfo {
cost: Gold
cost: (player: Player) => Gold
// Determines if its owner changes when its tile is conquered.
territoryBound: boolean
}
+2 -2
View File
@@ -334,7 +334,7 @@ export class PlayerImpl implements MutablePlayer {
buildUnit(type: UnitType, troops: number, spawnTile: Tile): UnitImpl {
const b = new UnitImpl(type, this.gs, spawnTile, troops, this);
this._units.push(b);
this.removeGold(this.gs.unitInfo(type).cost)
this.removeGold(this.gs.unitInfo(type).cost(this))
this.removeTroops(troops)
this.gs.fireUnitUpdateEvent(b, b.tile());
return b;
@@ -342,7 +342,7 @@ export class PlayerImpl implements MutablePlayer {
canBuild(unitType: UnitType, targetTile: Tile): Tile | false {
const cost = this.gs.unitInfo(unitType).cost
const cost = this.gs.unitInfo(unitType).cost(this)
if (!this.isAlive() || this.gold() < cost) {
return false
}