Fix nanos making sound when they run out of stamina

This commit is contained in:
Gent S 2020-11-26 22:01:49 -05:00
parent c2ab5c9d02
commit 7851866d13
2 changed files with 23 additions and 9 deletions

View File

@ -951,8 +951,19 @@ void MobManager::playerTick(CNServer *serv, time_t currTime) {
plr->Nanos[plr->activeNano].iStamina -= 1 + plr->nanoDrainRate * 2 / 5; plr->Nanos[plr->activeNano].iStamina -= 1 + plr->nanoDrainRate * 2 / 5;
if (plr->Nanos[plr->activeNano].iStamina <= 0) { if (plr->Nanos[plr->activeNano].iStamina <= 0) {
// passive nano unbuffing
int skillID = plr->Nanos[plr->activeNano].iSkillID;
if (NanoManager::SkillTable[skillID].drainType == 2) {
int* targetData = NanoManager::findTargets(plr, skillID);
for (auto& pwr : NanoManager::NanoPowers)
if (pwr.skillType == NanoManager::SkillTable[skillID].skillType)
NanoManager::nanoUnbuff(sock, targetData, pwr.bitFlag, pwr.timeBuffID, 0, (NanoManager::SkillTable[skillID].targetType == 3));
}
plr->Nanos[plr->activeNano].iStamina = 0; plr->Nanos[plr->activeNano].iStamina = 0;
NanoManager::summonNano(PlayerManager::getSockFromID(plr->iID), -1); plr->activeNano = 0;
plr->nanoDrainRate = 0;
} }
transmit = true; transmit = true;

View File

@ -142,8 +142,11 @@ void NanoManager::nanoSkillUseHandler(CNSocket* sock, CNPacketData* data) {
boost = 1; boost = 1;
plr->Nanos[plr->activeNano].iStamina -= SkillTable[skillID].batteryUse[boost*3]; plr->Nanos[plr->activeNano].iStamina -= SkillTable[skillID].batteryUse[boost*3];
if (plr->Nanos[plr->activeNano].iStamina < 0) if (plr->Nanos[plr->activeNano].iStamina < 0) {
plr->Nanos[plr->activeNano].iStamina = 0; plr->Nanos[plr->activeNano].iStamina = 0;
plr->activeNano = 0;
plr->nanoDrainRate = 0;
}
for (auto& pwr : NanoPowers) for (auto& pwr : NanoPowers)
if (pwr.skillType == SkillTable[skillID].skillType) if (pwr.skillType == SkillTable[skillID].skillType)