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