Make sure each group member is alive before healing/buffing them

This commit is contained in:
dongresource 2020-12-01 21:15:43 +01:00
parent 046e7bb6f1
commit 8a86c75747

View File

@ -590,18 +590,23 @@ bool doBuff(CNSocket *sock, sSkillResult_Buff *respdata, int i, int32_t targetID
respdata[i].eCT = 1; respdata[i].eCT = 1;
respdata[i].iID = plr->iID; respdata[i].iID = plr->iID;
respdata[i].iConditionBitFlag = bitFlag; respdata[i].iConditionBitFlag = 0;
INITSTRUCT(sP_FE2CL_PC_BUFF_UPDATE, pkt); // only apply buffs if the player is actually alive
pkt.eCSTB = timeBuffID; // eCharStatusTimeBuffID if (plr->HP > 0) {
pkt.eTBU = 1; // eTimeBuffUpdate respdata[i].iConditionBitFlag = bitFlag;
pkt.eTBT = 1; // eTimeBuffType 1 means nano
pkt.iConditionBitFlag = plr->iConditionBitFlag |= bitFlag;
if (amount > 0) INITSTRUCT(sP_FE2CL_PC_BUFF_UPDATE, pkt);
pkt.TimeBuff.iValue = amount; pkt.eCSTB = timeBuffID; // eCharStatusTimeBuffID
pkt.eTBU = 1; // eTimeBuffUpdate
pkt.eTBT = 1; // eTimeBuffType 1 means nano
pkt.iConditionBitFlag = plr->iConditionBitFlag |= bitFlag;
sock->sendPacket((void*)&pkt, P_FE2CL_PC_BUFF_UPDATE, sizeof(sP_FE2CL_PC_BUFF_UPDATE)); if (amount > 0)
pkt.TimeBuff.iValue = amount;
sock->sendPacket((void*)&pkt, P_FE2CL_PC_BUFF_UPDATE, sizeof(sP_FE2CL_PC_BUFF_UPDATE));
}
return true; return true;
} }
@ -646,6 +651,10 @@ bool doHeal(CNSocket *sock, sSkillResult_Heal_HP *respdata, int i, int32_t targe
int healedAmount = PC_MAXHEALTH(plr->level) * amount / 1500; int healedAmount = PC_MAXHEALTH(plr->level) * amount / 1500;
// do not heal dead players
if (plr->HP <= 0)
healedAmount = 0;
plr->HP += healedAmount; plr->HP += healedAmount;
if (plr->HP > PC_MAXHEALTH(plr->level)) if (plr->HP > PC_MAXHEALTH(plr->level))