Skip to content

Commit

Permalink
Fixed ISB starbase discount error (sirgwain#548)
Browse files Browse the repository at this point in the history
* Fixed ISB starbase discount error in race.go

IDK if I need to edit `generated.go` or not, but I did it anyways to shut up VS code's error messages.
If need be I'll revert it.

* Fixed race.go

Shfhrkelwlafht
  • Loading branch information
Bertie690 authored Oct 25, 2024
1 parent 41270d0 commit 1ac0482
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion cs/race.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,9 @@ func computeRaceSpec(race *Race, rules *Rules) RaceSpec {
spec.ScrapResourcesOffsetStarbase += lrtSpec.ScrapResourcesOffsetStarbase
spec.StartingPopulationFactor += lrtSpec.StartingPopulationFactorDelta
spec.StarbaseBuiltInCloakUnits += lrtSpec.StarbaseBuiltInCloakUnits
spec.StarbaseCostFactor = math.Max(spec.StarbaseCostFactor, lrtSpec.StarbaseCostFactorOffset) // this isn't cumulative
if lrtSpec.StarbaseCostFactor > 0 {
spec.StarbaseCostFactor = math.Min(spec.StarbaseCostFactor, lrtSpec.StarbaseCostFactor) // this isn't cumulative
}
spec.ResearchFactor += lrtSpec.ResearchFactorOffset
spec.ResearchSplashDamage += lrtSpec.ResearchSplashDamage
spec.ShieldStrengthFactor += lrtSpec.ShieldStrengthFactorOffset
Expand Down
4 changes: 2 additions & 2 deletions cs/traits.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type LRTSpec struct {
ScrapResourcesOffsetStarbase float64 `json:"scrapResourcesOffsetStarbase,omitempty"`
StartingPopulationFactorDelta float64 `json:"startingPopulationFactorDelta,omitempty"`
StarbaseBuiltInCloakUnits int `json:"starbaseBuiltInCloakUnits,omitempty"`
StarbaseCostFactorOffset float64 `json:"starbaseCostFactorOffset,omitempty"`
StarbaseCostFactor float64 `json:"starbaseCostFactor,omitempty"`
ResearchFactorOffset float64 `json:"researchFactorOffset,omitempty"`
ResearchSplashDamage float64 `json:"researchSplashDamage,omitempty"`
ShieldStrengthFactorOffset float64 `json:"shieldStrengthFactorOffset,omitempty"`
Expand Down Expand Up @@ -543,7 +543,7 @@ func armSpec() LRTSpec {
func isbSpec() LRTSpec {
return LRTSpec{
StarbaseBuiltInCloakUnits: 40, // 20% built in cloaking
StarbaseCostFactorOffset: -.2, // starbases cost 20% less
StarbaseCostFactor: 0.8, // starbases cost 20% less (*0.8)
}
}

Expand Down
4 changes: 2 additions & 2 deletions wasm/wasm/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1ac0482

Please sign in to comment.