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;
|
|
|
|
|
|
|
|
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-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;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|