Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/configuration/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export interface Config {
defensePostRange(): number;
SAMCooldown(): number;
SiloCooldown(): number;
defensePostDefenseBonus(): number;
defensePostDefenseBonus(level: number): number;
defensePostSpeedBonus(): number;
falloutDefenseModifier(percentOfFallout: number): number;
difficultyModifier(difficulty: Difficulty): number;
Expand Down
16 changes: 13 additions & 3 deletions src/core/configuration/DefaultConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,20 @@ export class DefaultConfig implements Config {
return 30;
}

defensePostDefenseBonus(): number {
return 5;
defensePostDefenseBonus(level: number): number {
if (level < 1) {
throw new Error(
`Invalid defense post level: ${level}. Level must be >= 1`,
);
}
const baseValue = 5;
const maxIncrease = 1.5;
const k = 2;
return baseValue + maxIncrease * ((level - 1) / (level - 1 + k));
}

defensePostSpeedBonus(): number {
// This bonus is currently a fixed value.
return 3;
}

Expand Down Expand Up @@ -496,6 +505,7 @@ export class DefaultConfig implements Config {
),
territoryBound: true,
constructionDuration: this.instantBuild() ? 0 : 5 * 10,
upgradable: true,
};
case UnitType.SAMLauncher:
return {
Expand Down Expand Up @@ -665,7 +675,7 @@ export class DefaultConfig implements Config {
UnitType.DefensePost,
)) {
if (dp.unit.owner() === defender) {
mag *= this.defensePostDefenseBonus();
mag *= this.defensePostDefenseBonus(dp.unit.level());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this only checks if we have a stacked defense post, but we should also reduce speed if multiple defense posts are nearby

speed *= this.defensePostSpeedBonus();
break;
}
Expand Down
Loading