Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make high fire-rate toxins consume less per shot #5967

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 20 additions & 1 deletion src/microbe_stage/systems/MicrobeEmissionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ private void EmitProjectile(in Entity entity, ref MicrobeControl control, ref Or
// aren't used per agent type)

// Emit as much as you have, but don't start if there's way too little toxin
float amountEmitted = Math.Min(amountAvailable, Constants.MAXIMUM_AGENT_EMISSION_AMOUNT);
float amountEmitted = Math.Min(amountAvailable,
EmissionAmountWithToxicity(organelles.AverageToxinToxicity));

if (amountEmitted < Constants.MINIMUM_AGENT_EMISSION_AMOUNT)
return;

Expand Down Expand Up @@ -285,6 +287,23 @@ private float ToxinCooldownWithToxicity(int vacuoleCount, float toxicity)
return Constants.AGENT_EMISSION_COOLDOWN / vacuoleCount;
}

private float EmissionAmountWithToxicity(float toxicity)
{
if (toxicity < 0)
{
// High-firerate, low emission amount
return Constants.MAXIMUM_AGENT_EMISSION_AMOUNT * (1.0f + toxicity * 0.5f);
}

if (toxicity > 0)
{
// Low-firerate, high emission amount
return Constants.MAXIMUM_AGENT_EMISSION_AMOUNT * (1.0f + toxicity);
}

return Constants.MAXIMUM_AGENT_EMISSION_AMOUNT;
}

private void HandleSlimeSecretion(in Entity entity, ref MicrobeControl control,
ref OrganelleContainer organelles, ref CellProperties cellProperties,
ref SoundEffectPlayer soundEffectPlayer, ref WorldPosition worldPosition,
Expand Down