From 166eb5125fa8cfc6ed25c72684f8fc42a45470a0 Mon Sep 17 00:00:00 2001 From: Jade Date: Wed, 25 Nov 2020 00:16:06 +0000 Subject: [PATCH] Group Heal Range Limit --- src/MissionManager.cpp | 4 ++-- src/NanoManager.cpp | 19 ++++++++++++++++--- src/NanoManager.hpp | 1 + src/TableData.cpp | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/MissionManager.cpp b/src/MissionManager.cpp index d916101..80bb47e 100644 --- a/src/MissionManager.cpp +++ b/src/MissionManager.cpp @@ -398,14 +398,14 @@ int MissionManager::giveMissionReward(CNSocket *sock, int task) { plr->money += reward->money; if (plr->iConditionBitFlag & CSB_BIT_REWARD_CASH) { // nano boost for taros int boost = 0; - if (NanoManager::getNanoBoost(plr)) + if (NanoManager::getNanoBoost(plr)) // for gumballs boost = 1; plr->money += reward->money * (5 + boost) / 25; } if (plr->iConditionBitFlag & CSB_BIT_REWARD_BLOB) { // nano boost for fm int boost = 0; - if (NanoManager::getNanoBoost(plr)) + if (NanoManager::getNanoBoost(plr)) // for gumballs boost = 1; updateFusionMatter(sock, reward->fusionmatter * (30 + boost) / 25); } else diff --git a/src/NanoManager.cpp b/src/NanoManager.cpp index b9475cc..2739783 100644 --- a/src/NanoManager.cpp +++ b/src/NanoManager.cpp @@ -536,9 +536,22 @@ int* NanoManager::findTargets(Player* plr, int skillID, CNPacketData* data) { if (otherPlr == nullptr) return tD; - tD[0] = otherPlr->groupCnt; - for (int i = 0; i < otherPlr->groupCnt; i++) - tD[i+1] = otherPlr->groupIDs[i]; + if (SkillTable[skillID].effectArea == 0) { // for buffs + tD[0] = otherPlr->groupCnt; + for (int i = 0; i < otherPlr->groupCnt; i++) + tD[i+1] = otherPlr->groupIDs[i]; + return tD; + } + + for (int i = 0; i < otherPlr->groupCnt; i++) { // group heals have an area limit + Player *otherPlr2 = PlayerManager::getPlayerFromID(otherPlr->groupIDs[i]); + if (otherPlr2 == nullptr) + continue; + if (hypot(otherPlr2->x - plr->x, otherPlr2->y - plr->y) < SkillTable[skillID].effectArea) { + tD[i+1] = otherPlr->groupIDs[i]; + tD[0] += 1; + } + } } return tD; diff --git a/src/NanoManager.hpp b/src/NanoManager.hpp index 5aa9942..076ee94 100644 --- a/src/NanoManager.hpp +++ b/src/NanoManager.hpp @@ -36,6 +36,7 @@ struct SkillData { int skillType; int targetType; int drainType; + int effectArea; int batteryUse[4]; int durationTime[4]; int powerIntensity[4]; diff --git a/src/TableData.cpp b/src/TableData.cpp index d88502f..885fa71 100644 --- a/src/TableData.cpp +++ b/src/TableData.cpp @@ -195,7 +195,7 @@ void TableData::init() { for (nlohmann::json::iterator _skills = skills.begin(); _skills != skills.end(); _skills++) { auto skills = _skills.value(); - SkillData skillData = {skills["m_iSkillType"], skills["m_iTargetType"], skills["m_iBatteryDrainType"]}; + SkillData skillData = {skills["m_iSkillType"], skills["m_iTargetType"], skills["m_iBatteryDrainType"], skills["m_iEffectArea"]}; for (int i = 0; i < 4; i++) { skillData.batteryUse[i] = skills["m_iBatteryDrainUse"][i]; skillData.durationTime[i] = skills["m_iDurationTime"][i];