mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-14 09:29:09 +00:00
test: ms_time
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "Playerbots.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "Timer.h"
|
||||
#include <string>
|
||||
|
||||
bool LowManaTrigger::IsActive()
|
||||
@@ -224,16 +225,16 @@ bool SpellNoCooldownTrigger::IsActive()
|
||||
return !bot->HasSpellCooldown(spellId);
|
||||
}
|
||||
|
||||
RandomTrigger::RandomTrigger(PlayerbotAI* botAI, std::string const name, int32 probability) : Trigger(botAI, name), probability(probability), lastCheck(time(nullptr))
|
||||
RandomTrigger::RandomTrigger(PlayerbotAI* botAI, std::string const name, int32 probability) : Trigger(botAI, name), probability(probability), lastCheck(getMSTime())
|
||||
{
|
||||
}
|
||||
|
||||
bool RandomTrigger::IsActive()
|
||||
{
|
||||
if (time(nullptr) - lastCheck < sPlayerbotAIConfig->repeatDelay / 1000)
|
||||
if (getMSTime() - lastCheck < sPlayerbotAIConfig->repeatDelay)
|
||||
return false;
|
||||
|
||||
lastCheck = time(nullptr);
|
||||
lastCheck = getMSTime();
|
||||
int32 k = (int32)(probability / sPlayerbotAIConfig->randomChangeMultiplier);
|
||||
if (k < 1)
|
||||
k = 1;
|
||||
|
||||
Reference in New Issue
Block a user