Fix buffs applying to non-COMBAT, non-ROAMING mobs

This commit is contained in:
dongresource 2023-09-13 03:01:18 +02:00
parent c113ea4a6c
commit 1800334bb7
2 changed files with 5 additions and 2 deletions

View File

@ -123,7 +123,7 @@ static SkillResult handleSkillBuff(SkillData* skill, int power, ICombatant* sour
int combatLifetime = 0; int combatLifetime = 0;
if(!target->addBuff(timeBuffId, if(!target->addBuff(timeBuffId,
[drainType](EntityRef self, Buff* buff, int status, BuffStack* stack) { [drainType](EntityRef self, Buff* buff, int status, BuffStack* stack) {
if(buff->id == ECSB_BOUNDINGBALL) { if(buff->id == ECSB_BOUNDINGBALL && status == ETBU_ADD) {
// drain // drain
ICombatant* combatant = dynamic_cast<ICombatant*>(self.getEntity()); ICombatant* combatant = dynamic_cast<ICombatant*>(self.getEntity());
combatant->takeDamage(buff->getLastSource(), 0); // aggro combatant->takeDamage(buff->getLastSource(), 0); // aggro
@ -138,7 +138,7 @@ static SkillResult handleSkillBuff(SkillData* skill, int power, ICombatant* sour
Buffs::tickDrain(self, buff, COMBAT_TICKS_PER_DRAIN_PROC); // drain Buffs::tickDrain(self, buff, COMBAT_TICKS_PER_DRAIN_PROC); // drain
combatLifetime++; combatLifetime++;
}, },
&passiveBuff)) return SkillResult(); // no result if already buffed &passiveBuff)) return SkillResult();
sSkillResult_Buff result{}; sSkillResult_Buff result{};
result.eCT = target->getCharType(); result.eCT = target->getCharType();

View File

@ -179,6 +179,9 @@ bool CombatNPC::addBuff(int buffId, BuffCallback<int, BuffStack*> onUpdate, Buff
if(!isAlive()) if(!isAlive())
return false; return false;
if (this->state != AIState::COMBAT && this->state != AIState::ROAMING)
return false;
if(!hasBuff(buffId)) { if(!hasBuff(buffId)) {
buffs[buffId] = new Buff(buffId, getRef(), onUpdate, onTick, stack); buffs[buffId] = new Buff(buffId, getRef(), onUpdate, onTick, stack);
return true; return true;