mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-01 20:42:10 +00:00
ports increase in price, NPC attack more frequently, tradeship destroyed if dst port destroyed or captured
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user