strstr etc

This commit is contained in:
2026-06-01 19:40:20 +02:00
parent 379e9da6c2
commit 7540b6f1ce
2 changed files with 96 additions and 9 deletions
@@ -6138,19 +6138,38 @@ void StructCreature::checkAdditionalItemEffect()
// Fraun Sky Accessories 7/12/2025
// Fix: the bonus is stored as (bitset, base, per-level) triples - the same layout the
// engine uses for EF_PARAMETER_INC (see _applyEffectForState: incParameter(fValue[k],
// fValue[k+1] + fValue[k+2]*level, ...)) and the client tooltip
// (ReplaceAdditionalItemEffectOptionTooltip walks value[n]/[n+1]/[n+2], stride 3).
// The old loop walked the triples but always read fValue[1]/[2] of triple 0, passing
// the *amount* as the stat selector bitset and the *per-level* term (normally 0) as the
// value -> worn sky accessories granted nothing even though the tooltip advertised a
// bonus. Apply each non-empty triple the same way the engine does instead.
if (pEquipment->GetItemAdditionalEffect() > 0)
{
const std::vector<EffectInfo* >* Effect = GameContent::GetEffectInfoVector(pEquipment->GetItemAdditionalEffect());
if (Effect->size() > 0)
{
for (int eff = 0; eff < 20; )
EffectInfo * pSkyEffect = Effect->at(0);
// 6 triples fit in fValue[NUMBER_OF_VALUE(=20)]; stop at eff+2 < NUMBER_OF_VALUE
// so fValue[eff+1] / fValue[eff+2] stay in bounds.
for (int eff = 0; eff + 2 < EffectInfo::NUMBER_OF_VALUE; eff += 3)
{
if (Effect->at(0)->fValue[eff] != 0)
{
incParameter(Effect->at(0)->fValue[1], Effect->at(0)->fValue[2], true);
}
eff += 3;
if (pSkyEffect->fValue[eff] == 0)
continue;
const c_fixed10 fAmount = pSkyEffect->fValue[eff + 1] + pSkyEffect->fValue[eff + 2] * pSkyEffect->nEffectLevel;
// fValue[eff] is the stat/attribute selector bitset. Apply it both as a base
// stat (STR/VIT/... under bStat=true) and as an attribute (attack/defence/...
// under bStat=false): the two branches of incParameter() test disjoint flag
// sets, so whichever the effect row encodes is applied exactly once and the
// result matches what the client tooltip shows.
incParameter(pSkyEffect->fValue[eff], fAmount, true);
incParameter(pSkyEffect->fValue[eff], fAmount, false);
}
}
}