[refactor] New buff framework (player implementation)

Get rid of `iConditionBitFlag` in favor of a system of individual buff
objects that get composited to a bitflag on-the-fly.
Buff objects can have callbacks for application, expiration, and tick,
making them pretty flexible. Scripting languages can eventually use
these for custom behavior, too.

TODO:
- Get rid of bitflag in BaseNPC
- Apply buffs from passive nano powers
- Apply buffs from active nano powers
- Move eggs to new system
- ???
This commit is contained in:
gsemaj
2022-07-16 23:33:57 -07:00
committed by gsemaj
parent d32827b692
commit 31677e2638
26 changed files with 1267 additions and 521 deletions

View File

@@ -1,10 +1,15 @@
#pragma once
#include "core/Core.hpp"
#include "Entities.hpp"
#include "Player.hpp"
#include <map>
#include <vector>
constexpr size_t MAX_SKILLRESULT_SIZE = sizeof(sSkillResult_BatteryDrain);
enum class SkillEffectTarget {
POINT = 1,
SELF = 2,
@@ -25,8 +30,20 @@ enum class SkillDrainType {
PASSIVE = 2
};
struct SkillResult {
size_t size;
uint8_t payload[MAX_SKILLRESULT_SIZE];
SkillResult(size_t len, void* dat) {
size = len;
memcpy(payload, dat, len);
}
SkillResult() {
size = 0;
}
};
struct SkillData {
int skillType;
int skillType; // eST
SkillEffectTarget effectTarget;
int effectType; // always 1?
SkillTargetType targetType;
@@ -43,8 +60,9 @@ struct SkillData {
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 useNanoSkill(CNSocket*, sNano&, std::vector<ICombatant*>);
void useNPCSkill(EntityRef, int skillID, std::vector<ICombatant*>);
void init();
std::vector<EntityRef> matchTargets(SkillData*, int, int32_t*);
int getCSTBFromST(int eSkillType);
}