mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-26 15:00:06 +00:00
Groundwork for new buff system
This commit is contained in:
parent
fd664c4f19
commit
398e9fddf8
@ -19,33 +19,35 @@ static void emailUpdateCheck(CNSocket* sock, CNPacketData* data) {
|
|||||||
|
|
||||||
std::vector<EntityRef> Abilities::matchTargets(SkillData* skill, int count, int32_t *ids) {
|
std::vector<EntityRef> Abilities::matchTargets(SkillData* skill, int count, int32_t *ids) {
|
||||||
|
|
||||||
std::vector<int> tempTargs;
|
std::vector<EntityRef> targets;
|
||||||
switch (skill->effectTarget)
|
|
||||||
{
|
for (int i = 0; i < count; i++) {
|
||||||
case SkillEffectTarget::POINT:
|
int32_t id = ids[i];
|
||||||
std::cout << "[SKILL] POINT; ";
|
if (skill->targetType == SkillTargetType::MOBS) {
|
||||||
break;
|
// mob?
|
||||||
case SkillEffectTarget::SELF:
|
if (NPCManager::NPCs.find(id) != NPCManager::NPCs.end()) targets.push_back(id);
|
||||||
std::cout << "[SKILL] SELF; ";
|
else std::cout << "[WARN] skill: id not found\n";
|
||||||
break;
|
} else {
|
||||||
case SkillEffectTarget::CONE:
|
// player?
|
||||||
std::cout << "[SKILL] CONE; ";
|
CNSocket* sock = PlayerManager::getSockFromID(id);
|
||||||
break;
|
if (sock != nullptr) targets.push_back(sock);
|
||||||
case SkillEffectTarget::AREA_SELF:
|
else std::cout << "[WARN] skill: sock not found\n";
|
||||||
std::cout << "[SKILL] AREA_SELF; ";
|
}
|
||||||
break;
|
|
||||||
case SkillEffectTarget::AREA_TARGET:
|
|
||||||
std::cout << "[SKILL] AREA_TARGET; ";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) std::cout << ids[i] << " ";
|
|
||||||
std::cout << std::endl;
|
|
||||||
|
|
||||||
std::vector<EntityRef> targets;
|
|
||||||
return targets;
|
return targets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Abilities::useAbility(SkillData* skill, EntityRef src, std::vector<EntityRef> targets) {
|
||||||
|
for (EntityRef target : targets) {
|
||||||
|
Entity* entity = target.getEntity();
|
||||||
|
if (entity->kind != PLAYER && entity->kind != COMBAT_NPC && entity->kind != MOB)
|
||||||
|
continue; // not a combatant
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Abilities::init() {
|
void Abilities::init() {
|
||||||
//REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_EMAIL_UPDATE_CHECK, emailUpdateCheck);
|
//REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_EMAIL_UPDATE_CHECK, emailUpdateCheck);
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@ enum class SkillEffectTarget {
|
|||||||
|
|
||||||
enum class SkillTargetType {
|
enum class SkillTargetType {
|
||||||
MOBS = 1,
|
MOBS = 1,
|
||||||
PLAYERS = 2,
|
SELF = 2,
|
||||||
SELF = 3 // only used once by client /shrug
|
GROUP = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SkillData {
|
struct SkillData {
|
||||||
@ -37,5 +37,7 @@ namespace Abilities {
|
|||||||
extern std::map<int32_t, SkillData> SkillTable;
|
extern std::map<int32_t, SkillData> SkillTable;
|
||||||
|
|
||||||
std::vector<EntityRef> matchTargets(SkillData*, int, int32_t*);
|
std::vector<EntityRef> matchTargets(SkillData*, int, int32_t*);
|
||||||
|
void applyAbility(SkillData*, EntityRef, std::vector<EntityRef>);
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ enum EntityKind;
|
|||||||
|
|
||||||
struct Group {
|
struct Group {
|
||||||
std::vector<EntityRef> members;
|
std::vector<EntityRef> members;
|
||||||
int32_t conditionBitFlag;
|
int8_t conditionCounters[32];
|
||||||
|
|
||||||
std::vector<EntityRef> filter(EntityKind kind) {
|
std::vector<EntityRef> filter(EntityKind kind) {
|
||||||
std::vector<EntityRef> filtered;
|
std::vector<EntityRef> filtered;
|
||||||
|
@ -85,15 +85,16 @@ void Nanos::summonNano(CNSocket *sock, int slot, bool silent) {
|
|||||||
plr->nanoDrainRate = 0;
|
plr->nanoDrainRate = 0;
|
||||||
int16_t skillID = plr->Nanos[plr->activeNano].iSkillID;
|
int16_t skillID = plr->Nanos[plr->activeNano].iSkillID;
|
||||||
SkillData* skillData = &Abilities::SkillTable[skillID];
|
SkillData* skillData = &Abilities::SkillTable[skillID];
|
||||||
|
std::vector<EntityRef> targetData;
|
||||||
|
|
||||||
// passive nano unbuffing
|
// passive nano unbuffing
|
||||||
if (skillData->batteryDrainType == 2) {
|
if (skillData->batteryDrainType == 2) {
|
||||||
// TODO ABILITIES
|
targetData.push_back(sock); // self
|
||||||
std::vector<EntityRef> targetData = Abilities::matchTargets(skillData, 0, nullptr);
|
if (skillData->targetType == SkillTargetType::GROUP && plr->group != nullptr)
|
||||||
|
targetData = plr->group->members; // whole group
|
||||||
|
|
||||||
/*for (auto& pwr : Abilities::Powers)
|
/* TODO ABILITIES */
|
||||||
if (pwr.skillType == Abilities::SkillTable[skillID].skillType)
|
targetData.clear();
|
||||||
Abilities::removeBuff(sock, targetData, pwr.bitFlag, pwr.timeBuffID, 0,(Abilities::SkillTable[skillID].targetType == 3));*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nanoID >= NANO_COUNT || nanoID < 0)
|
if (nanoID >= NANO_COUNT || nanoID < 0)
|
||||||
@ -101,13 +102,18 @@ void Nanos::summonNano(CNSocket *sock, int slot, bool silent) {
|
|||||||
|
|
||||||
plr->activeNano = nanoID;
|
plr->activeNano = nanoID;
|
||||||
skillID = plr->Nanos[nanoID].iSkillID;
|
skillID = plr->Nanos[nanoID].iSkillID;
|
||||||
|
skillData = &Abilities::SkillTable[skillID];
|
||||||
|
|
||||||
// passive nano buffing
|
// passive nano buffing
|
||||||
if (Abilities::SkillTable[skillID].batteryDrainType == 2) {
|
if (skillData->batteryDrainType == 2) {
|
||||||
int boost = 0;
|
int boost = 0;
|
||||||
if (getNanoBoost(plr))
|
if (getNanoBoost(plr))
|
||||||
boost = 1;
|
boost = 1;
|
||||||
|
|
||||||
|
targetData.push_back(sock); // self
|
||||||
|
if (skillData->targetType == SkillTargetType::GROUP && plr->group != nullptr)
|
||||||
|
targetData = plr->group->members; // whole group
|
||||||
|
|
||||||
// TODO ABILITIES
|
// TODO ABILITIES
|
||||||
//std::vector<int> targetData = Abilities::findTargets(plr, skillID);
|
//std::vector<int> targetData = Abilities::findTargets(plr, skillID);
|
||||||
//for (auto& pwr : Abilities::Powers) {
|
//for (auto& pwr : Abilities::Powers) {
|
||||||
|
Loading…
Reference in New Issue
Block a user