diff --git a/changelog.txt b/changelog.txt index 3c4bd52..9ab6726 100644 --- a/changelog.txt +++ b/changelog.txt @@ -12,6 +12,7 @@ Version: 3.2.0 - Fixed worm range scaler setting not adjusting prepareRange so worms could shoot without being out of the ground. (Thanks Garrotte) - When a faction is removed during play alignment table will default to the neutral faction to prevent alignment table being nil - Fixed settler groups not respecting expansion map setting for min and max time + - Fixed faction mutation mutating to an existing faction is no longer counted towards max number of mutations per base Optimizations: - Moved most constants out of global - Removed new enemy variations setting diff --git a/libs/BaseUtils.lua b/libs/BaseUtils.lua index 6c6d812..3d01ed7 100644 --- a/libs/BaseUtils.lua +++ b/libs/BaseUtils.lua @@ -339,28 +339,38 @@ local function pickMutationFromDamageType(universe, damageType, roll, base) local damageFactions = FACTIONS_BY_DAMAGE_TYPE[damageType] local mutation + local mutated = false - if (damageFactions and (#damageFactions > 0)) then + if damageFactions and (#damageFactions > 0) then mutation = damageFactions[universe.random(#damageFactions)] if baseAlignment[2] then + if (baseAlignment[1] ~= mutation) and (baseAlignment[2] ~= mutation) then + mutated = true + end if (roll < 0.05) then - baseAlignment[2] = nil baseAlignment[1] = mutation + baseAlignment[2] = nil elseif (roll < 0.25) then baseAlignment[1] = mutation else baseAlignment[2] = mutation end else + if (baseAlignment[1] ~= mutation) then + mutated = true + end if (roll < 0.85) then - base.alignment[1] = mutation + baseAlignment[1] = mutation else - base.alignment[2] = mutation + baseAlignment[2] = mutation end end else mutation = findBaseMutation(universe) if baseAlignment[2] then + if (baseAlignment[1] ~= mutation) and (baseAlignment[2] ~= mutation) then + mutated = true + end if (roll < 0.05) then baseAlignment[2] = nil baseAlignment[1] = mutation @@ -370,6 +380,9 @@ local function pickMutationFromDamageType(universe, damageType, roll, base) baseAlignment[2] = mutation end else + if (baseAlignment[1] ~= mutation) then + mutated = true + end if (roll < 0.85) then base.alignment[1] = mutation else @@ -377,7 +390,7 @@ local function pickMutationFromDamageType(universe, damageType, roll, base) end end end - if (universe.printBaseAdaptation) then + if mutated and universe.printBaseAdaptation then if baseAlignment[2] then game.print({"description.rampant--adaptation2DebugMessage", damageType, @@ -397,6 +410,7 @@ local function pickMutationFromDamageType(universe, damageType, roll, base) universe.MAX_BASE_MUTATIONS}) end end + return mutated end function baseUtils.upgradeBaseBasedOnDamage(universe, base) @@ -422,7 +436,7 @@ function baseUtils.upgradeBaseBasedOnDamage(universe, base) end end - pickMutationFromDamageType(universe, pickedDamage, roll, base) + return pickMutationFromDamageType(universe, pickedDamage, roll, base) end function baseUtils.processBaseMutation(chunk, map, base)