1
0

FastRandom rewrite (#3754)

This commit is contained in:
peterbell10
2017-06-13 20:35:30 +01:00
committed by Lukas Pioch
parent 9b0eb118b3
commit 360d8eade0
63 changed files with 467 additions and 417 deletions

View File

@@ -495,12 +495,11 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
{
int Chance = static_cast<int>(ThornsLevel * 15);
cFastRandom Random;
int RandomValue = Random.GenerateRandomInteger(0, 100);
auto & Random = GetRandomProvider();
if (RandomValue <= Chance)
if (Random.RandBool(Chance / 100.0))
{
a_TDI.Attacker->TakeDamage(dtAttack, this, 0, Random.GenerateRandomInteger(1, 4), 0);
a_TDI.Attacker->TakeDamage(dtAttack, this, 0, Random.RandInt(1, 4), 0);
}
}
@@ -574,8 +573,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
TotalEPF = 25;
}
cFastRandom Random;
float RandomValue = Random.GenerateRandomInteger(50, 100) * 0.01f;
float RandomValue = GetRandomProvider().RandReal(0.5f, 1.0f);
TotalEPF = ceil(TotalEPF * RandomValue);