mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 17:09:08 +00:00
life time check for debuff spell & cast time spell
This commit is contained in:
43
src/strategy/values/ExpectedLifetimeValue.cpp
Normal file
43
src/strategy/values/ExpectedLifetimeValue.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "ExpectedLifetimeValue.h"
|
||||
#include "Playerbots.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
float ExpectedLifetimeValue::Calculate()
|
||||
{
|
||||
Unit* target = AI_VALUE(Unit*, qualifier);
|
||||
if (!target || !target->IsAlive()) {
|
||||
return 0.0f;
|
||||
}
|
||||
float dps = AI_VALUE(float, "expected group dps");
|
||||
float res = target->GetHealth() / dps * 1000;
|
||||
// bot->Say(target->GetName() + " lifetime: " + std::to_string(res), LANG_UNIVERSAL);
|
||||
return res;
|
||||
}
|
||||
float ExpectedGroupDpsValue::Calculate()
|
||||
{
|
||||
float dps_num;
|
||||
Group* group = bot->GetGroup();
|
||||
if (!group) {
|
||||
dps_num = 1;
|
||||
} else {
|
||||
dps_num = group->GetMembersCount() * 0.7;
|
||||
}
|
||||
// efficiency record based on rare gear level, is there better calculation method?
|
||||
float dps_efficiency = 1;
|
||||
if (bot->GetLevel() < 30) {
|
||||
dps_efficiency = 1.5;
|
||||
} else if (bot->GetLevel() < 40) {
|
||||
dps_efficiency = 2;
|
||||
} else if (bot->GetLevel() < 50) {
|
||||
dps_efficiency = 3;
|
||||
} else if (bot->GetLevel() < 60) {
|
||||
dps_efficiency = 4;
|
||||
} else if (bot->GetLevel() < 70) {
|
||||
dps_efficiency = 7;
|
||||
} else if (bot->GetLevel() < 80) {
|
||||
dps_efficiency = 12;
|
||||
} else {
|
||||
dps_efficiency = 30;
|
||||
}
|
||||
return dps_num * bot->GetLevel() * dps_efficiency;
|
||||
}
|
||||
Reference in New Issue
Block a user