Enemy ability tweaks

- Battery drain does not set your battery below 0.
- Debuffs cast by enemies take into account intensity now. (Snare will work)
- Used int_max to replace arbitrary 20000, added more comments.
This commit is contained in:
Jade 2020-12-16 16:58:23 +00:00 committed by Gent S
parent 4fc5c092f8
commit 0104bc9329

View File

@ -557,7 +557,7 @@ void MobManager::combatStep(Mob *mob, time_t currTime) {
return; return;
} }
int distanceToTravel = 20000; int distanceToTravel = INT_MAX;
int speed = mob->data["m_iRunSpeed"]; int speed = mob->data["m_iRunSpeed"];
// movement logic: move when out of range but don't move while casting a skill // movement logic: move when out of range but don't move while casting a skill
if (distance > mobRange && mob->skillStyle == -1) { if (distance > mobRange && mob->skillStyle == -1) {
@ -598,7 +598,10 @@ void MobManager::combatStep(Mob *mob, time_t currTime) {
NPCManager::sendToViewable(mob, &pkt, P_FE2CL_NPC_MOVE, sizeof(sP_FE2CL_NPC_MOVE)); NPCManager::sendToViewable(mob, &pkt, P_FE2CL_NPC_MOVE, sizeof(sP_FE2CL_NPC_MOVE));
} }
// attack logic /* attack logic
* 2/5 represents 400 ms which is the time interval mobs use per movement logic step
* if the mob is one move interval away, we should just start attacking anyways.
*/
if (distance <= mobRange || distanceToTravel < speed*2/5) { if (distance <= mobRange || distanceToTravel < speed*2/5) {
if (mob->nextAttack == 0 || currTime >= mob->nextAttack) { if (mob->nextAttack == 0 || currTime >= mob->nextAttack) {
mob->nextAttack = currTime + (int)mob->data["m_iDelayTime"] * 100; mob->nextAttack = currTime + (int)mob->data["m_iDelayTime"] * 100;
@ -1681,6 +1684,7 @@ bool doDamageNDebuff(Mob *mob, sSkillResult_Damage_N_Debuff *respdata, int i, in
pkt.eTBU = 1; // eTimeBuffUpdate pkt.eTBU = 1; // eTimeBuffUpdate
pkt.eTBT = 2; pkt.eTBT = 2;
pkt.iConditionBitFlag = plr->iConditionBitFlag |= bitFlag; pkt.iConditionBitFlag = plr->iConditionBitFlag |= bitFlag;
pkt.TimeBuff.iValue = amount;
sock->sendPacket((void*)&pkt, P_FE2CL_PC_BUFF_UPDATE, sizeof(sP_FE2CL_PC_BUFF_UPDATE)); sock->sendPacket((void*)&pkt, P_FE2CL_PC_BUFF_UPDATE, sizeof(sP_FE2CL_PC_BUFF_UPDATE));
} }
@ -1834,8 +1838,8 @@ bool doBatteryDrain(Mob *mob, sSkillResult_BatteryDrain *respdata, int i, int32_
respdata[i].iDrainN = amount * (18 + (int)mob->data["m_iNpcLevel"]) / 36; respdata[i].iDrainN = amount * (18 + (int)mob->data["m_iNpcLevel"]) / 36;
} }
respdata[i].iBatteryW = plr->batteryW -= respdata[i].iDrainW; respdata[i].iBatteryW = plr->batteryW -= (respdata[i].iDrainW < plr->batteryW) ? respdata[i].iDrainW : plr->batteryW;
respdata[i].iBatteryN = plr->batteryN -= respdata[i].iDrainN; respdata[i].iBatteryN = plr->batteryN -= (respdata[i].iDrainN < plr->batteryN) ? respdata[i].iDrainN : plr->batteryN;
respdata[i].iStamina = plr->Nanos[plr->activeNano].iStamina; respdata[i].iStamina = plr->Nanos[plr->activeNano].iStamina;
respdata[i].iConditionBitFlag = plr->iConditionBitFlag; respdata[i].iConditionBitFlag = plr->iConditionBitFlag;