From 360d8eade0332f2c1aa5c205ca772cd506c35b26 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Tue, 13 Jun 2017 20:35:30 +0100 Subject: FastRandom rewrite (#3754) --- src/Entities/Entity.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index db70044b4..5d26f501b 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -495,12 +495,11 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) { int Chance = static_cast(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); -- cgit v1.2.3