Skip to content

Commit

Permalink
ChaosMod/EffectDispatcher: Use exponential effect weight multiplier
Browse files Browse the repository at this point in the history
Intensifies the difference between the different weight multiplier levels

Also fix still broken effect group weighting logic lol
  • Loading branch information
pongo1231 committed Feb 14, 2025
1 parent 0a2c4e2 commit 03b7504
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ChaosMod/Components/EffectDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ static void _DispatchEffect(EffectDispatcher *effectDispatcher, const EffectDisp
// Increase weight for all effects first
for (auto &[effectId, enabledEffectData] : g_EnabledEffects)
if (!enabledEffectData.IsMeta())
enabledEffectData.Weight += enabledEffectData.WeightMult;
enabledEffectData.Weight += enabledEffectData.WeightMult * enabledEffectData.WeightMult;

// Reset weight of this effect (or every effect in group) to reduce chance of same effect (group) happening multiple
// times in a row
if (effectData.GroupType.empty())
effectData.Weight = effectData.WeightMult;
effectData.Weight = effectData.WeightMult * effectData.WeightMult;
else
{
for (auto &[effectId, enabledEffectData] : g_EnabledEffects)
if (enabledEffectData.GroupType == effectData.GroupType)
effectData.Weight = effectData.WeightMult;
enabledEffectData.Weight = enabledEffectData.WeightMult * enabledEffectData.WeightMult;
}

auto playEffectDispatchSound = [&](EffectDispatcher::ActiveEffect &activeEffect)
Expand Down

0 comments on commit 03b7504

Please sign in to comment.