fix debuff trigger

This commit is contained in:
Yunfan Li
2023-09-05 09:58:21 +08:00
parent 93b32ce398
commit 63048f2405
3 changed files with 16 additions and 3 deletions

View File

@@ -294,5 +294,9 @@ Value<Unit*>* BuffOnMainTankAction::GetTargetValue()
bool CastDebuffSpellAction::isUseful() bool CastDebuffSpellAction::isUseful()
{ {
return CastAuraSpellAction::isUseful() && GetTarget() && (GetTarget()->GetHealth() / AI_VALUE(float, "expected group dps")) >= needLifeTime; Unit* target = GetTarget();
if (!target || !target->IsAlive() || !target->IsInWorld()) {
return false;
}
return CastAuraSpellAction::isUseful() && (target->GetHealth() / AI_VALUE(float, "expected group dps")) >= needLifeTime;
} }

View File

@@ -38,7 +38,12 @@ float CastTimeMultiplier::GetValue(Action* action)
castTime += duration; castTime += duration;
} }
if (castTime > (1000 * action->GetTarget()->GetHealth() / AI_VALUE(float, "expected group dps"))) { Unit* target = action->GetTarget();
if (!target || !target->IsAlive() || !target->IsInWorld()) {
return false;
}
if (castTime > (1000 * target->GetHealth() / AI_VALUE(float, "expected group dps"))) {
return 0.0f; return 0.0f;
} }
} }

View File

@@ -207,7 +207,11 @@ bool TargetInSightTrigger::IsActive()
bool DebuffTrigger::IsActive() bool DebuffTrigger::IsActive()
{ {
return BuffTrigger::IsActive() && GetTarget() && (GetTarget()->GetHealth() / AI_VALUE(float, "expected group dps")) >= needLifeTime; Unit* target = GetTarget();
if (!target || !target->IsAlive() || !target->IsInWorld()) {
return false;
}
return BuffTrigger::IsActive() && (target->GetHealth() / AI_VALUE(float, "expected group dps")) >= needLifeTime;
} }
bool DebuffOnBossTrigger::IsActive() bool DebuffOnBossTrigger::IsActive()