life time check for debuff spell & cast time spell

This commit is contained in:
Yunfan Li
2023-09-04 17:04:59 +08:00
parent 9575ca222b
commit 7e1de0b9cf
9 changed files with 138 additions and 25 deletions

View 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;
}