testing
This commit is contained in:
parent
3dd86fa224
commit
01153a1db3
@ -38,7 +38,7 @@
|
||||
</div>
|
||||
|
||||
<div class="ui-section">
|
||||
<div>📦 Verbrauch:</div>
|
||||
<div>🍽️ Verbrauch:</div>
|
||||
<ul>
|
||||
@for (item of consumedItems; track $index) {
|
||||
<li>{{ item.type }}: {{ item.demandRate * planet.population | number:'0.0-1' }}/s</li>
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
@if (goodsInTransit.length > 0) {
|
||||
<div class="ui-section">
|
||||
<div>📦 In Lieferung:</div>
|
||||
<div>⏱️ In Lieferung:</div>
|
||||
<ul>
|
||||
@for (item of goodsInTransit; track $index) {
|
||||
<li>{{ item.type }}: {{ item.amount | number:'0.0-1' }}</li>
|
||||
|
||||
@ -63,8 +63,20 @@ export class PlanetDialogComponent {
|
||||
this.gameService.showPlanetInfo = undefined;
|
||||
}
|
||||
|
||||
get goodsInTransit(): TradeInstance[] {
|
||||
return this.planet.goodsInTransit;
|
||||
get goodsInTransit(): { type: GoodType, amount: number}[] {
|
||||
const res: { type: GoodType, amount: number}[] = [];
|
||||
this.planet.goodsInTransit.forEach(item => {
|
||||
const ex = res.find(r => r.type == item.type);
|
||||
if (ex) {
|
||||
ex.amount += item.amount;
|
||||
} else {
|
||||
res.push({
|
||||
type: item.type,
|
||||
amount: item.amount
|
||||
})
|
||||
}
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
upgradeHarbour() {
|
||||
|
||||
@ -19,39 +19,39 @@ export class BuyComponent {
|
||||
selectedPlanets: Planet[] = [];
|
||||
config: ShipConfig = {
|
||||
name: 'Pioneer-01',
|
||||
acceleration: 500,
|
||||
cargoSize: 20,
|
||||
acceleration: 428,
|
||||
cargoSize: 25,
|
||||
cost: 0.6,
|
||||
loadingSpeed: 15,
|
||||
maxSpeed: 300,
|
||||
planetRoute: [],
|
||||
buyCost: 2000,
|
||||
buyCost: 3000,
|
||||
desciption: 'Ein kleines, schnelles Schiff. Es hat wenig Platz für Ladung, lädt aber schnell und ist sehr wendig.',
|
||||
texture: 'swift-hauler'
|
||||
}
|
||||
|
||||
config2: ShipConfig = {
|
||||
name: 'Colony Carrier',
|
||||
acceleration: 200,
|
||||
cargoSize: 50,
|
||||
acceleration: 63,
|
||||
cargoSize: 70,
|
||||
cost: 1.6,
|
||||
loadingSpeed: 20,
|
||||
maxSpeed: 200,
|
||||
planetRoute: [],
|
||||
buyCost: 4000,
|
||||
buyCost: 8000,
|
||||
desciption: 'Eine größere Version von der Pioneer-01. Der größere Frachtraum geht zu Lasten der Beschleunigung und Maximalgeschwindigkeit.',
|
||||
texture: 'colony-carrier'
|
||||
}
|
||||
|
||||
config3: ShipConfig = {
|
||||
name: 'Industrial Tanker',
|
||||
acceleration: 5,
|
||||
acceleration: 8,
|
||||
cargoSize: 300,
|
||||
cost: 3.8,
|
||||
loadingSpeed: 5,
|
||||
loadingSpeed: 11,
|
||||
maxSpeed: 600,
|
||||
planetRoute: [],
|
||||
buyCost: 8000,
|
||||
buyCost: 14000,
|
||||
desciption: 'Ein großes behäbiges Schiff. Es wird durchaus schnell, beschleunigt aber sehr langsam und erreicht die Spitzengeschwindigkeit nur selten.',
|
||||
texture: 'industrial-tanker'
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ export const PLANETCONFIGS: { x: number, y: number, texture: string, config: Pla
|
||||
name: 'Terra Nova',
|
||||
initialGoods: [
|
||||
{ type: GoodType.Wasser, amount: 10 },
|
||||
{ type: GoodType.Nahrung, amount: 10, productionBonus: 1.3 },
|
||||
{ type: GoodType.Nahrung, amount: 10, productionBonus: 2.6 },
|
||||
]
|
||||
}
|
||||
},
|
||||
@ -23,7 +23,7 @@ export const PLANETCONFIGS: { x: number, y: number, texture: string, config: Pla
|
||||
initialGoods: [
|
||||
{ type: GoodType.Wasser, amount: 10 },
|
||||
{ type: GoodType.Nahrung, amount: 10 },
|
||||
{ type: GoodType.Metall, amount: 10, productionBonus: 1.5 },
|
||||
{ type: GoodType.Metall, amount: 10, productionBonus: 3 },
|
||||
{ type: GoodType.Bauteile, amount: 10, productionBonus: 1.3 },
|
||||
{ type: GoodType.Elektronik, amount: 10 }
|
||||
]
|
||||
@ -36,7 +36,7 @@ export const PLANETCONFIGS: { x: number, y: number, texture: string, config: Pla
|
||||
config: {
|
||||
name: 'Aqualis',
|
||||
initialGoods: [
|
||||
{ type: GoodType.Wasser, amount: 200, productionBonus: 2.0 },
|
||||
{ type: GoodType.Wasser, amount: 200, productionBonus: 4 },
|
||||
{ type: GoodType.Nahrung, amount: 10 },
|
||||
{ type: GoodType.Treibstoff, amount: 10 }
|
||||
]
|
||||
@ -79,7 +79,7 @@ export const PLANETCONFIGS: { x: number, y: number, texture: string, config: Pla
|
||||
name: 'Volaris',
|
||||
initialGoods: [
|
||||
{ type: GoodType.Nahrung, amount: 10 },
|
||||
{ type: GoodType.Wasser, amount: 10, productionBonus: 1.1 },
|
||||
{ type: GoodType.Wasser, amount: 10, productionBonus: 1.9 },
|
||||
{ type: GoodType.Bauteile, amount: 10 }
|
||||
]
|
||||
}
|
||||
|
||||
@ -8,11 +8,11 @@ export interface GoodConfig {
|
||||
}
|
||||
|
||||
export const GOODS_DATA: Record<GoodType, GoodConfig> = {
|
||||
[GoodType.Erz]: { baseProduction: 1.0, baseDemand: 0.001, storageLimit: 500, isRawResource: true },
|
||||
[GoodType.Wasser]: { baseProduction: 1, baseDemand: 0.0015, storageLimit: 300, isRawResource: true },
|
||||
[GoodType.Nahrung]: { baseProduction: 1, baseDemand: 0.001, storageLimit: 200, isRawResource: true },
|
||||
[GoodType.Metall]: { baseProduction: 1, baseDemand: 0.001, storageLimit: 300, isRawResource: false },
|
||||
[GoodType.Treibstoff]: { baseProduction: 1, baseDemand: 0, storageLimit: 150, isRawResource: false },
|
||||
[GoodType.Elektronik]: { baseProduction: 1, baseDemand: 0.001, storageLimit: 100, isRawResource: false },
|
||||
[GoodType.Bauteile]: { baseProduction: 1, baseDemand: 0.001, storageLimit: 100, isRawResource: false }
|
||||
[GoodType.Erz]: { baseProduction: 1.0, baseDemand: 0.005, storageLimit: 200, isRawResource: true },
|
||||
[GoodType.Wasser]: { baseProduction: 1, baseDemand: 0.0075, storageLimit: 500, isRawResource: true },
|
||||
[GoodType.Nahrung]: { baseProduction: 1, baseDemand: 0.005, storageLimit: 300, isRawResource: true },
|
||||
[GoodType.Metall]: { baseProduction: 1, baseDemand: 0.005, storageLimit: 300, isRawResource: false },
|
||||
[GoodType.Treibstoff]: { baseProduction: 1, baseDemand: 0.002, storageLimit: 150, isRawResource: false },
|
||||
[GoodType.Elektronik]: { baseProduction: 1, baseDemand: 0.005, storageLimit: 100, isRawResource: false },
|
||||
[GoodType.Bauteile]: { baseProduction: 1, baseDemand: 0.005, storageLimit: 100, isRawResource: false }
|
||||
};
|
||||
@ -16,7 +16,7 @@ export class Planet {
|
||||
public isGrowing: boolean = false;
|
||||
private populationGrowthRate = 0.002; // Basiswachstum pro Tick (%)
|
||||
private populationDeclineRate = 0.005; // Basisrückgang bei Mangel (%)
|
||||
public demandSecondsBuffer = 150; // Anfrage immer mindestens 30 Sekunden überleben
|
||||
public demandSecondsBuffer = 160; // Anfrage immer mindestens 30 Sekunden überleben
|
||||
|
||||
private productionLevel: Map<GoodType, number> = new Map();
|
||||
private dockedShips: Ship[] = [];
|
||||
@ -204,11 +204,13 @@ export class Planet {
|
||||
private updatePopulation(seconds: number): void {
|
||||
const demands = this.calculateNaturalDemand(seconds);
|
||||
let allSupplied = true;
|
||||
let notSupplied = 0;
|
||||
|
||||
demands.forEach((amountNeeded, goodType) => {
|
||||
const available = this.goods.get(goodType)?.amount ?? 0;
|
||||
if (available < amountNeeded) {
|
||||
allSupplied = false;
|
||||
notSupplied++;
|
||||
}
|
||||
});
|
||||
|
||||
@ -217,10 +219,13 @@ export class Planet {
|
||||
this.isGrowing = true;
|
||||
} else {
|
||||
this.isGrowing = false;
|
||||
if (notSupplied > 1) {
|
||||
this.population -= this.population * this.populationDeclineRate * seconds;
|
||||
this.population = Math.max(this.population, 100);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if (this.isGrowing) {
|
||||
// console.log(`[${this.name}] Growing population: ${this.population.toFixed(2)}`);
|
||||
// } else {
|
||||
@ -328,7 +333,7 @@ export class Planet {
|
||||
|
||||
buildHarbour() {
|
||||
this.hasHarbour = true;
|
||||
this.gameService.money -= 3000;
|
||||
this.gameService.money -= 30000;
|
||||
}
|
||||
|
||||
upgradeProduction() {
|
||||
|
||||
@ -15,7 +15,7 @@ export class GameService {
|
||||
|
||||
showTutorial = true;
|
||||
|
||||
public money = 12500;
|
||||
public money = 100000;
|
||||
|
||||
onShipCreate: EventEmitter<Ship> = new EventEmitter();
|
||||
onShipDestroy: EventEmitter<Ship> = new EventEmitter();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user