From c0a9ec6b7cf401c7a25b2426ad51a446f4ade836 Mon Sep 17 00:00:00 2001 From: gsemaj Date: Mon, 14 Aug 2023 19:28:45 -0700 Subject: [PATCH] Move mob active skills to new system --- src/MobAI.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/MobAI.cpp b/src/MobAI.cpp index bddcf82..7f18ec3 100644 --- a/src/MobAI.cpp +++ b/src/MobAI.cpp @@ -326,12 +326,6 @@ static void dealCorruption(Mob *mob, std::vector targetData, int skillID, i } static void useAbilities(Mob *mob, time_t currTime) { - /* - * targetData approach - * first integer is the count - * second to fifth integers are IDs, these can be either player iID or mob's iID - * whether the skill targets players or mobs is determined by the skill packet being fired - */ Player *plr = PlayerManager::getPlayer(mob->target); if (mob->skillStyle >= 0) { // corruption hit @@ -389,14 +383,11 @@ static void useAbilities(Mob *mob, time_t currTime) { if (random < prob1) { // active skill hit int skillID = (int)mob->data["m_iActiveSkill1"]; - // TODO ABILITIES - //std::vector targetData = {1, plr->iID, 0, 0, 0}; - //for (auto& pwr : Abilities::Powers) - // if (pwr.skillType == Abilities::SkillTable[skillID].skillType) { - // if (pwr.bitFlag != 0 && (plr->iConditionBitFlag & pwr.bitFlag)) - // return; // prevent debuffing a player twice - // pwr.handle(mob->id, targetData, skillID, Abilities::SkillTable[skillID].durationTime[0], Abilities::SkillTable[skillID].powerIntensity[0]); - // } + SkillData* skill = &Abilities::SkillTable[skillID]; + int debuffID = Abilities::getCSTBFromST(skill->skillType); + if(plr->hasBuff(debuffID)) + return; // prevent debuffing a player twice + Abilities::useNPCSkill(mob->getRef(), skillID, { plr }); mob->nextAttack = currTime + (int)mob->data["m_iDelayTime"] * 100; return; }