2021-03-13 20:22:29 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-03-17 19:07:40 +00:00
|
|
|
#include "core/Core.hpp"
|
2021-03-13 22:55:16 +00:00
|
|
|
#include "Combat.hpp"
|
2021-03-13 20:22:29 +00:00
|
|
|
|
2021-06-20 18:39:59 +00:00
|
|
|
typedef void (*PowerHandler)(EntityRef, std::vector<int>, int16_t, int16_t, int16_t, int16_t, int16_t, int32_t, int16_t);
|
2021-03-13 20:22:29 +00:00
|
|
|
|
2021-06-20 15:02:16 +00:00
|
|
|
struct Power {
|
2021-03-13 20:22:29 +00:00
|
|
|
int16_t skillType;
|
|
|
|
int32_t bitFlag;
|
|
|
|
int16_t timeBuffID;
|
|
|
|
PowerHandler handler;
|
|
|
|
|
2021-06-20 15:02:16 +00:00
|
|
|
Power(int16_t s, int32_t b, int16_t t, PowerHandler h) : skillType(s), bitFlag(b), timeBuffID(t), handler(h) {}
|
2021-03-13 20:22:29 +00:00
|
|
|
|
2021-06-20 18:39:59 +00:00
|
|
|
void handle(EntityRef ref, std::vector<int> targetData, int16_t nanoID, int16_t skillID, int16_t duration, int16_t amount) {
|
2021-03-13 20:22:29 +00:00
|
|
|
if (handler == nullptr)
|
|
|
|
return;
|
|
|
|
|
2021-06-20 18:39:59 +00:00
|
|
|
handler(ref, targetData, nanoID, skillID, duration, amount, skillType, bitFlag, timeBuffID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* overload for non-nano abilities */
|
|
|
|
void handle(EntityRef ref, std::vector<int> targetData, int16_t skillID, int16_t duration, int16_t amount) {
|
|
|
|
handle(ref, targetData, -1, skillID, duration, amount);
|
2021-03-13 20:22:29 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SkillData {
|
|
|
|
int skillType;
|
|
|
|
int targetType;
|
|
|
|
int drainType;
|
|
|
|
int effectArea;
|
|
|
|
int batteryUse[4];
|
|
|
|
int durationTime[4];
|
|
|
|
int powerIntensity[4];
|
|
|
|
};
|
|
|
|
|
2021-06-20 15:02:16 +00:00
|
|
|
namespace Abilities {
|
|
|
|
extern std::vector<Power> Powers;
|
2021-03-13 20:22:29 +00:00
|
|
|
extern std::map<int32_t, SkillData> SkillTable;
|
|
|
|
|
2021-06-20 15:02:16 +00:00
|
|
|
void removeBuff(CNSocket* sock, std::vector<int> targetData, int32_t bitFlag, int16_t timeBuffID, int16_t amount, bool groupPower);
|
2021-03-13 20:22:29 +00:00
|
|
|
int applyBuff(CNSocket* sock, int skillID, int eTBU, int eTBT, int32_t groupFlags);
|
2021-03-16 21:06:10 +00:00
|
|
|
|
|
|
|
std::vector<int> findTargets(Player* plr, int skillID, CNPacketData* data = nullptr);
|
2021-03-13 20:22:29 +00:00
|
|
|
}
|