All pastes #476516 Raw Edit

Someone

public text v1 · immutable
·published 2007-05-08 04:03 UTC
rendered paste body
int CalcDamage(int nDamage, float fDistance, float fDiameter, float fMin = 20.0, float fMax = 100.0)
{
    float fRadius = fDiameter/2;
    if (fDistance < fRadius)
    {
        float fDamage = IntToFloat(nDamage);
        float fPercent = (100.0 - (fDistance / fRadius) * 100.0) + 10.0;
        if (fPercent < fMin) fPercent = fMin;
        if (fPercent > fMax) fPercent = fMax;

        nDamage = FloatToInt(fDamage * (fPercent / 100.0));
        return nDamage;
    }
    return 0;
}