fix(game): small reconciliation fixes (science, generation, dismantle, report)
A bundle of small rules-vs-engine corrections: - Science proportions: accept a sum that equals 1 only up to float rounding (was an exact != 1 comparison); the rules example is reworded so it is unambiguous that proportions are fractions summing to 1. - Generation: super-big planets get a resource strictly above 0 (minimum 0.001, was a hard 0.1); the rules table is fixed for big planets (1-10, not 0.1-10) and the false "0.1-20 / average 1.5" resource claim removed. - Dismantle over a neutral planet now unloads the colonists and settles it (the planet becomes the race's); over a foreign planet they are still lost. The rules clause is clarified for own / neutral / foreign. - Report: ship-production entries are written at the compacted report index (was the planet's map index, which could write past the grown slice and panic); the incoming-group "remaining distance" is measured from the group's current hyperspace position, not its origin planet (matching OtherGroup). - validator: the cargo-value error now carries the cargo value, not the shields value. Tests added for each behavioural fix; rules.txt updated in the same patch.
This commit is contained in:
@@ -567,3 +567,20 @@ func TestUnsafeDeleteShipGroup(t *testing.T) {
|
||||
assert.Equal(t, uint(3), c.ShipGroup(0).Number)
|
||||
assert.Equal(t, uint(7), c.ShipGroup(1).Number)
|
||||
}
|
||||
|
||||
// TestShipGroupDismantleColonizesNeutralPlanet checks that dismantling a
|
||||
// colonist-laden group over an uninhabited planet settles it: the planet
|
||||
// becomes the race's and the colonists join its population.
|
||||
func TestShipGroupDismantleColonizesNeutralPlanet(t *testing.T) {
|
||||
c, g := newCache()
|
||||
gi := c.CreateShipsUnsafe_T(Race_0_idx, c.MustShipClass(Race_0_idx, Race_0_Freighter).ID, Uninhabited_Planet_4_num, 10)
|
||||
c.ShipGroup(gi).CargoType = game.CargoColonist.Ref()
|
||||
c.ShipGroup(gi).Load = 10.0
|
||||
assert.False(t, c.MustPlanet(Uninhabited_Planet_4_num).Owned())
|
||||
|
||||
assert.NoError(t, g.ShipGroupDismantle(Race_0.Name, c.ShipGroup(gi).ID))
|
||||
|
||||
p := c.MustPlanet(Uninhabited_Planet_4_num)
|
||||
assert.True(t, p.OwnedBy(Race_0_ID))
|
||||
assert.Equal(t, 80., p.Population.F()) // 10 colonists * 8
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user