Skip to content
Draft
Changes from 3 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
29 changes: 17 additions & 12 deletions src/microbe_stage/MicrobeInternalCalculations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ public static void GetBindingAndSignalling(IReadOnlyList<OrganelleTemplate> orga
public static float CalculateSpecializationBonus(IReadOnlyList<IReadOnlyOrganelleTemplate> organelles,
Dictionary<OrganelleDefinition, int> tempWorkMemory)
{
int totalOrganelles = 0;
int totalHexCount = 0;
tempWorkMemory.Clear();

var count = organelles.Count;
Expand All @@ -846,33 +846,38 @@ public static float CalculateSpecializationBonus(IReadOnlyList<IReadOnlyOrganell

var definition = organelle.Definition;

// Don't count the nucleus, because of its omnipresence and large size
if (definition.InternalName == "nucleus")
{
continue;
}

var hexCount = definition.HexCount;

tempWorkMemory.TryGetValue(definition, out var existingCount);
tempWorkMemory[definition] = existingCount + 1;
tempWorkMemory[definition] = existingCount + hexCount;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Updating this count like this will break the tooltip (just commenting to remember about this as you said you didn't touch the tooltip side yet for this PR) as the tooltip will claim the player has way more organelles than they actually do.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Very true! I was planning to either count the organelles themselves separately for the tooltip, or actually referring to organelle hexes (or size in some way) in the tooltip, since that would also inform the player of what is going on.

That makes me realise that in Master, the tooltip is now already a little bit off because it counts for example thylakoids in the number of chloroplasts. When I work on the tooltip, that's probably worth an "(or simpler equivalent)", or something like that.

Copy link
Copy Markdown
Member

@hhyyrylainen hhyyrylainen Mar 19, 2026

Choose a reason for hiding this comment

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

Not counting the organelle / part tooltips, this is already one of the longest tooltips in the game... so I think we are quickly reaching the point where any player seeing the tooltip will mentally give up before managing to read it.

Edit: just wanted to say why I didn't change it. The advice is still right that you should be adding more of the most common organelle even when it is said to be the eukaryotic equivalent.


++totalOrganelles;
totalHexCount += hexCount;
}

if (totalOrganelles < 1)
return 1;

if (totalOrganelles < Constants.CELL_SPECIALIZATION_APPLIES_AFTER_SIZE)
if (totalHexCount < 1)
return 1;

int maxOrganelleCount = 0;
int maxHexCount = 0;

foreach (var entry in tempWorkMemory)
{
if (entry.Value > maxOrganelleCount)
if (entry.Value > maxHexCount)
{
maxOrganelleCount = entry.Value;
maxHexCount = entry.Value;
}
}

// The raw bonus is just the ratio of the main organelle type
var bonus = (float)maxOrganelleCount / totalOrganelles;
var bonus = (float)maxHexCount / totalHexCount;

// Calculate a strength factor that adjusts things
var strength = Math.Min((float)totalOrganelles / Constants.CELL_SPECIALIZATION_STRENGTH_FULL_AT, 1);
var strength = Math.Min((float)totalHexCount / Constants.CELL_SPECIALIZATION_STRENGTH_FULL_AT, 1);
strength *= Constants.CELL_SPECIALIZATION_STRENGTH_MULTIPLIER;

// Then return the final result as the bonus being anything above 1
Expand Down