mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-06-26 14:10:17 +00:00
Compare commits
No commits in common. "6d5cea0d9a01b220b10592a154cb6a6c04cad00c" and "02fd17c0e79e2a2f756354c070c0a1cf574b70f9" have entirely different histories.
6d5cea0d9a
...
02fd17c0e7
@ -6,7 +6,6 @@
|
|||||||
#include "PlayerManager.hpp"
|
#include "PlayerManager.hpp"
|
||||||
#include "Buffs.hpp"
|
#include "Buffs.hpp"
|
||||||
#include "Nanos.hpp"
|
#include "Nanos.hpp"
|
||||||
#include "MobAI.hpp"
|
|
||||||
|
|
||||||
using namespace Abilities;
|
using namespace Abilities;
|
||||||
|
|
||||||
@ -365,12 +364,6 @@ void Abilities::useNPCSkill(EntityRef npc, int skillID, std::vector<ICombatant*>
|
|||||||
pkt->iSkillID = skillID;
|
pkt->iSkillID = skillID;
|
||||||
pkt->eST = (int32_t)skill->skillType;
|
pkt->eST = (int32_t)skill->skillType;
|
||||||
pkt->iTargetCnt = (int32_t)results.size();
|
pkt->iTargetCnt = (int32_t)results.size();
|
||||||
if(npc.kind == EntityKind::MOB) {
|
|
||||||
Mob* mob = dynamic_cast<Mob*>(entity);
|
|
||||||
pkt->iValue1 = mob->hitX;
|
|
||||||
pkt->iValue2 = mob->hitY;
|
|
||||||
pkt->iValue3 = mob->hitZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
attachSkillResults(results, (uint8_t*)(pkt + 1));
|
attachSkillResults(results, (uint8_t*)(pkt + 1));
|
||||||
NPCManager::sendToViewable(entity, pkt, P_FE2CL_NPC_SKILL_HIT, resplen);
|
NPCManager::sendToViewable(entity, pkt, P_FE2CL_NPC_SKILL_HIT, resplen);
|
||||||
|
@ -326,6 +326,12 @@ static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void useAbilities(Mob *mob, time_t currTime) {
|
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);
|
Player *plr = PlayerManager::getPlayer(mob->target);
|
||||||
|
|
||||||
if (mob->skillStyle >= 0) { // corruption hit
|
if (mob->skillStyle >= 0) { // corruption hit
|
||||||
@ -340,7 +346,7 @@ static void useAbilities(Mob *mob, time_t currTime) {
|
|||||||
|
|
||||||
if (mob->skillStyle == -2) { // eruption hit
|
if (mob->skillStyle == -2) { // eruption hit
|
||||||
int skillID = (int)mob->data["m_iMegaType"];
|
int skillID = (int)mob->data["m_iMegaType"];
|
||||||
std::vector<ICombatant*> targets{};
|
std::vector<int> targetData = {0, 0, 0, 0, 0};
|
||||||
|
|
||||||
// find the players within range of eruption
|
// find the players within range of eruption
|
||||||
for (auto it = mob->viewableChunks.begin(); it != mob->viewableChunks.end(); it++) {
|
for (auto it = mob->viewableChunks.begin(); it != mob->viewableChunks.end(); it++) {
|
||||||
@ -350,22 +356,26 @@ static void useAbilities(Mob *mob, time_t currTime) {
|
|||||||
if (ref.kind != EntityKind::PLAYER)
|
if (ref.kind != EntityKind::PLAYER)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CNSocket *s = ref.sock;
|
CNSocket *s= ref.sock;
|
||||||
Player *plr = PlayerManager::getPlayer(s);
|
Player *plr = PlayerManager::getPlayer(s);
|
||||||
|
|
||||||
if (!plr->isAlive())
|
if (plr->HP <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int distance = hypot(mob->hitX - plr->x, mob->hitY - plr->y);
|
int distance = hypot(mob->hitX - plr->x, mob->hitY - plr->y);
|
||||||
if (distance < Abilities::SkillTable[skillID].effectArea) {
|
if (distance < Abilities::SkillTable[skillID].effectArea) {
|
||||||
targets.push_back(plr);
|
targetData[0] += 1;
|
||||||
if (targets.size() > 3) // make sure not to have more than 4
|
targetData[targetData[0]] = plr->iID;
|
||||||
|
if (targetData[0] > 3) // make sure not to have more than 4
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Abilities::useNPCSkill(mob->id, skillID, targets);
|
// TODO ABILITIES
|
||||||
|
/*for (auto& pwr : Abilities::Powers)
|
||||||
|
if (pwr.skillType == Abilities::SkillTable[skillID].skillType)
|
||||||
|
pwr.handle(mob->id, targetData, skillID, Abilities::SkillTable[skillID].durationTime[0], Abilities::SkillTable[skillID].powerIntensity[0]);*/
|
||||||
mob->skillStyle = -3; // eruption cooldown
|
mob->skillStyle = -3; // eruption cooldown
|
||||||
mob->nextAttack = currTime + 1000;
|
mob->nextAttack = currTime + 1000;
|
||||||
return;
|
return;
|
||||||
@ -383,11 +393,14 @@ static void useAbilities(Mob *mob, time_t currTime) {
|
|||||||
|
|
||||||
if (random < prob1) { // active skill hit
|
if (random < prob1) { // active skill hit
|
||||||
int skillID = (int)mob->data["m_iActiveSkill1"];
|
int skillID = (int)mob->data["m_iActiveSkill1"];
|
||||||
SkillData* skill = &Abilities::SkillTable[skillID];
|
// TODO ABILITIES
|
||||||
int debuffID = Abilities::getCSTBFromST(skill->skillType);
|
//std::vector<int> targetData = {1, plr->iID, 0, 0, 0};
|
||||||
if(plr->hasBuff(debuffID))
|
//for (auto& pwr : Abilities::Powers)
|
||||||
return; // prevent debuffing a player twice
|
// if (pwr.skillType == Abilities::SkillTable[skillID].skillType) {
|
||||||
Abilities::useNPCSkill(mob->getRef(), skillID, { plr });
|
// 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]);
|
||||||
|
// }
|
||||||
mob->nextAttack = currTime + (int)mob->data["m_iDelayTime"] * 100;
|
mob->nextAttack = currTime + (int)mob->data["m_iDelayTime"] * 100;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -741,8 +754,11 @@ void MobAI::onRoamStart(CombatNPC* npc, EntityRef src) {
|
|||||||
self->nextAttack = 0;
|
self->nextAttack = 0;
|
||||||
|
|
||||||
// cast a return home heal spell, this is the right way(tm)
|
// cast a return home heal spell, this is the right way(tm)
|
||||||
Abilities::useNPCSkill(npc->getRef(), 110, { npc });
|
// TODO ABILITIES
|
||||||
|
/*std::vector<int> targetData = { 1, 0, 0, 0, 0 };
|
||||||
|
for (auto& pwr : Abilities::Powers)
|
||||||
|
if (pwr.skillType == Abilities::SkillTable[110].skillType)
|
||||||
|
pwr.handle(self->id, targetData, 110, Abilities::SkillTable[110].durationTime[0], Abilities::SkillTable[110].powerIntensity[0]);*/
|
||||||
// clear outlying debuffs
|
// clear outlying debuffs
|
||||||
clearDebuff(self);
|
clearDebuff(self);
|
||||||
}
|
}
|
||||||
@ -759,9 +775,12 @@ void MobAI::onCombatStart(CombatNPC* npc, EntityRef src) {
|
|||||||
self->roamY = self->y;
|
self->roamY = self->y;
|
||||||
self->roamZ = self->z;
|
self->roamZ = self->z;
|
||||||
|
|
||||||
int skillID = (int)self->data["m_iPassiveBuff"];
|
int skillID = (int)self->data["m_iPassiveBuff"]; // cast passive
|
||||||
if(skillID != 0) // cast passive
|
// TODO ABILITIES
|
||||||
Abilities::useNPCSkill(npc->getRef(), skillID, { npc });
|
/*std::vector<int> targetData = { 1, self->id, 0, 0, 0 };
|
||||||
|
for (auto& pwr : Abilities::Powers)
|
||||||
|
if (pwr.skillType == Abilities::SkillTable[skillID].skillType)
|
||||||
|
pwr.handle(self->id, targetData, skillID, Abilities::SkillTable[skillID].durationTime[0], Abilities::SkillTable[skillID].powerIntensity[0]);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void MobAI::onRetreat(CombatNPC* npc, EntityRef src) {
|
void MobAI::onRetreat(CombatNPC* npc, EntityRef src) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user