DarkflameServer/dGame/AdditionalEntityData.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

83 lines
1.9 KiB
C
Raw Normal View History

2024-06-02 07:53:56 +00:00
#pragma once
#include <cstdint>
#include <vector>
#include "Entity.h"
#include "ModifierInstance.h"
#include "EntityTemplate.h"
2024-06-02 13:43:35 +00:00
#include "UpgradeTriggerType.h"
#include <unordered_set>
2024-06-02 07:53:56 +00:00
namespace nejlika
{
class AdditionalEntityData
{
public:
AdditionalEntityData() = default;
AdditionalEntityData(LWOOBJID id, LOT lot) : id(id), lot(lot) {}
float CalculateModifier(ModifierType type, ModifierOperator op, bool resistance) const;
float CalculateModifier(ModifierType type, std::vector<ModifierInstance>& additionalModifiers, ModifierOperator op, bool resistance) const;
float CalculateModifier(ModifierType type, int32_t level) const;
float CalculateModifier(ModifierType type) const;
float CalculateModifier(ModifierType type, std::vector<ModifierInstance>& additionalModifiers, int32_t level) const;
float CalculateResistance(ModifierType type) const;
2024-06-08 15:31:22 +00:00
/**
* @brief Calculate the multiplier for a given modifier type. With a base value of 1.0.
*
* @param type The modifier type.
* @return The multiplier.
*/
float CalculateMultiplier(ModifierType type) const;
2024-06-02 07:53:56 +00:00
void ApplyToEntity();
void CheckForRescale(AdditionalEntityData* other);
int32_t GetLevel() const { return level; }
LWOOBJID GetID() const { return id; }
LOT GetLOT() const { return lot; }
2024-06-02 13:43:35 +00:00
const std::unordered_set<LWOOBJID>& GetUpgradeItems() const { return upgradeItems; }
void AddUpgradeItem(LWOOBJID id) { upgradeItems.insert(id); }
void RemoveUpgradeItem(LWOOBJID id) { upgradeItems.erase(id); }
std::vector<ModifierInstance> TriggerUpgradeItems(UpgradeTriggerType triggerType);
2024-06-08 15:31:22 +00:00
void InitializeSkills();
void AddSkills(LWOOBJID item);
void RemoveSkills(LOT lot);
2024-06-02 07:53:56 +00:00
private:
void RollStandardModifiers(int32_t level);
bool initialized = false;
std::vector<ModifierInstance> standardModifiers;
std::vector<ModifierInstance> activeModifiers;
2024-06-02 13:43:35 +00:00
std::unordered_set<LWOOBJID> upgradeItems;
2024-06-02 07:53:56 +00:00
LWOOBJID id;
LOT lot;
int32_t level = 1;
};
}