in progress

This commit is contained in:
evanpelle
2024-12-04 16:46:27 -08:00
parent e068a9afc7
commit 22b877e85c
4 changed files with 78 additions and 61 deletions
+4 -2
View File
@@ -208,7 +208,8 @@
* bugfix: gameStop not found error DONE 12/3/2024
* log stack traces & display them on screen DONE 12/3/2024
* add radiation from nuke DONE 12/4/2024
* add cities
* add cities DONE 12/4/2024
* max price for units
* record and replay games for debugging purposes
* bugfix: destroyers can't find path to dst and freeze
* record single player game stats
@@ -232,4 +233,5 @@
* improve front page (make map larger?)
* REFACTOR: give terranullius an ID, game.player() returns terranullius
* REFACTOR: ocean is considered TerraNullius ?
* REFACTOR: ocean is considered TerraNullius ?
+1
View File
@@ -64,6 +64,7 @@ export interface Config {
defensePostRange(): number
defensePostDefenseBonus(): number
falloutDefenseModifier(): number
maxUnitCost(): number
}
export interface Theme {
+69 -58
View File
@@ -8,6 +8,10 @@ import { pastelTheme } from "./PastelTheme";
export class DefaultConfig implements Config {
maxUnitCost(): number {
return 99_999_999
}
cityPopulationIncrease(): number {
return 250_000
}
@@ -32,66 +36,73 @@ export class DefaultConfig implements Config {
tradeShipSpawnRate(): number {
return 500
}
unitInfo(type: UnitType): UnitInfo {
switch (type) {
case UnitType.TransportShip:
return {
cost: () => 0,
territoryBound: false
}
case UnitType.Destroyer:
return {
cost: (p: Player) => (p.units(UnitType.Destroyer).length + 1) * 250_000,
territoryBound: false
}
case UnitType.Battleship:
return {
cost: (p: Player) => (p.units(UnitType.Battleship).length + 1) * 500_000,
territoryBound: false
}
case UnitType.Shell:
return {
cost: (p: Player) => 0,
territoryBound: false
}
case UnitType.Port:
return {
cost: (p: Player) => Math.pow(2, p.units(UnitType.Port).length) * 250_000,
territoryBound: true
}
case UnitType.AtomBomb:
return {
cost: () => 1_000_000,
territoryBound: false
}
case UnitType.HydrogenBomb:
return {
cost: () => 5_000_000,
territoryBound: false
}
case UnitType.TradeShip:
return {
cost: () => 0,
territoryBound: false
}
case UnitType.MissileSilo:
return {
cost: () => 1_000_000,
territoryBound: true
}
case UnitType.DefensePost:
return {
cost: (p: Player) => Math.pow(2, p.units(UnitType.Port).length) * 100_000,
territoryBound: true
}
case UnitType.City:
return {
cost: (p: Player) => Math.pow(2, p.units(UnitType.Port).length) * 250_000,
territoryBound: true
}
default:
assertNever(type)
const fn = () => {
switch (type) {
case UnitType.TransportShip:
return {
cost: () => 0,
territoryBound: false
}
case UnitType.Destroyer:
return {
cost: (p: Player) => (p.units(UnitType.Destroyer).length + 1) * 250_000,
territoryBound: false
}
case UnitType.Battleship:
return {
cost: (p: Player) => (p.units(UnitType.Battleship).length + 1) * 500_000,
territoryBound: false
}
case UnitType.Shell:
return {
cost: (p: Player) => 0,
territoryBound: false
}
case UnitType.Port:
return {
cost: (p: Player) => Math.pow(2, p.units(UnitType.Port).length) * 250_000,
territoryBound: true
}
case UnitType.AtomBomb:
return {
cost: () => 1_000_000,
territoryBound: false
}
case UnitType.HydrogenBomb:
return {
cost: () => 5_000_000,
territoryBound: false
}
case UnitType.TradeShip:
return {
cost: () => 0,
territoryBound: false
}
case UnitType.MissileSilo:
return {
cost: () => 1_000_000,
territoryBound: true
}
case UnitType.DefensePost:
return {
cost: (p: Player) => Math.pow(2, p.units(UnitType.Port).length) * 100_000,
territoryBound: true
}
case UnitType.City:
return {
cost: (p: Player) => Math.pow(2, p.units(UnitType.Port).length) * 250_000,
territoryBound: true
}
default:
assertNever(type)
}
}
const ui = fn()
const oldCost = ui.cost
ui.cost = (p: Player) => Math.min(this.maxUnitCost(), oldCost(p))
return ui
}
defaultDonationAmount(sender: Player): number {
return Math.floor(sender.troops() / 3)
+4 -1
View File
@@ -5,9 +5,12 @@ export const devConfig = new class extends DefaultConfig {
unitInfo(type: UnitType): UnitInfo {
const info = super.unitInfo(type)
const oldCost = info.cost
info.cost = (p: Player) => oldCost(p) / 100000
info.cost = (p: Player) => oldCost(p) / 1000
return info
}
maxUnitCost(): number {
return 10000
}
percentageTilesOwnedToWin(): number {
return 95