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;
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;
NanoManager::summonNano(PlayerManager::getSockFromID(plr->iID), -1);
plr->activeNano = 0;
plr->nanoDrainRate = 0;
}
transmit = true;

View File

@ -142,8 +142,11 @@ void NanoManager::nanoSkillUseHandler(CNSocket* sock, CNPacketData* data) {
boost = 1;
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->activeNano = 0;
plr->nanoDrainRate = 0;
}
for (auto& pwr : NanoPowers)
if (pwr.skillType == SkillTable[skillID].skillType)
@ -303,9 +306,9 @@ void NanoManager::summonNano(CNSocket *sock, int slot) {
if (SkillTable[skillID].drainType == 2) {
int *targetData = findTargets(plr, skillID);
for (auto& pwr : NanoPowers)
if (pwr.skillType == SkillTable[skillID].skillType)
nanoUnbuff(sock, targetData, pwr.bitFlag, pwr.timeBuffID, 0,(SkillTable[skillID].targetType == 3));
for (auto& pwr : NanoPowers)
if (pwr.skillType == SkillTable[skillID].skillType)
nanoUnbuff(sock, targetData, pwr.bitFlag, pwr.timeBuffID, 0,(SkillTable[skillID].targetType == 3));
}
int16_t nanoID = slot == -1 ? 0 : plr->equippedNanos[slot];
@ -321,9 +324,9 @@ void NanoManager::summonNano(CNSocket *sock, int slot) {
if (SkillTable[skillID].drainType == 2) {
int *targetData = findTargets(plr, skillID);
int boost = 0;
if (getNanoBoost(plr))
boost = 1;
int boost = 0;
if (getNanoBoost(plr))
boost = 1;
for (auto& pwr : NanoPowers) {
if (pwr.skillType == SkillTable[skillID].skillType) {
@ -904,4 +907,4 @@ std::vector<NanoPower> NanoPowers = {
};
}; // namespace
#pragma endregion
#pragma endregion