mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-31 17:07:14 +00:00
refactor: item set passive abilities come from the CDClient and item scripts
The server hardcoded each item set's passives by set ID. They now come from data: - On-kill bonuses (Paradox imagination, Sentinel armor repair, Bat Lord heal) are the set's DarkInspiration skills in ItemSetSkills. The client turns those into a status effect that casts the behavior's action when the wearer kills something of a faction in faction_list; the server now runs the same behavior on the smashed enemy, so the amounts, faction check and extra effects (e.g. rank 3 Sorcerer team imagination) follow the data. A behavior repeated in a higher tier does not stack. - Low imagination / low armor skills are what the live equipmenttriggers item scripts do. Items link to those scripts through their ScriptComponent; the script vars (skill, items required, set, cooldown) only exist in the scripts, so they are mirrored in a small table keyed by script name. The Sentinel scripts have no cooldown (was 11s). - Knockback immunity while quickbuilding comes from the Immunity behavior's immune_quickbuild_interrupts (the 5 item Assembly rank 2/3 set skill) instead of a set ID list; ImmunityBehavior now pops its immunities when an equip skill is uncast. Removes eItemSetPassiveAbilityID and InventoryComponent::HasAnyPassive (unused now). Refs #691 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include "dCommonVars.h"
|
||||
@@ -16,6 +18,28 @@ enum class PassiveAbilityTrigger
|
||||
EnemySmashed, // Enemy is smashed
|
||||
};
|
||||
|
||||
/**
|
||||
* What a stat-triggered set ability does, as set up by one of the live
|
||||
* server's res/scripts/equipmenttriggers item scripts.
|
||||
*/
|
||||
struct ItemSetStatTrigger {
|
||||
PassiveAbilityTrigger trigger; // the Lua "trigger" var (stat + threshold)
|
||||
uint32_t skillID; // the Lua "skillID" var
|
||||
uint32_t itemsRequired; // the Lua "itemsRequired" var
|
||||
uint32_t setID; // the Lua "skillSet" var: the ItemSets row the script belongs to
|
||||
float cooldown; // the Lua "factionCooldownTime" var; 0 for scripts without "isFactionSkill"
|
||||
};
|
||||
|
||||
/**
|
||||
* One set skill that runs when the wearer smashes something: a skill in the set's
|
||||
* ItemSetSkills whose root behavior is DarkInspiration (the client's "OnKillFactionBehavior").
|
||||
*/
|
||||
struct ItemSetOnKillSkill {
|
||||
uint32_t itemsRequired; // the skillSetWithN tier the skill comes from
|
||||
uint32_t skillID;
|
||||
uint32_t behaviorID;
|
||||
};
|
||||
|
||||
/**
|
||||
* Passive abilities that belong to an item set, activated when a PassiveAbilityTrigger condition is met
|
||||
*/
|
||||
@@ -23,7 +47,6 @@ class ItemSetPassiveAbility
|
||||
{
|
||||
public:
|
||||
ItemSetPassiveAbility(PassiveAbilityTrigger trigger, Entity* parent, ItemSet* itemSet);
|
||||
~ItemSetPassiveAbility();
|
||||
void Update(float deltaTime);
|
||||
|
||||
/**
|
||||
@@ -38,22 +61,51 @@ public:
|
||||
void Activate(Entity* target = nullptr);
|
||||
|
||||
/**
|
||||
* Finds all the passive abilities associated with a certain item set
|
||||
* Finds all the passive abilities of an item set, from the CDClient and the item scripts on its items
|
||||
* @param itemSetID the item set to find abilities for
|
||||
* @param items the LOTs in the set (ItemSets.itemIDs)
|
||||
* @param skillSets the skills of each skillSetWithN tier, index 0 being skillSetWith2
|
||||
* @param parent the parent to add to the passive abilities
|
||||
* @param itemSet the item set to add to the passive abilities
|
||||
* @return the passive abilities for the provided item set
|
||||
*/
|
||||
static std::vector<ItemSetPassiveAbility> FindAbilities(uint32_t itemSetID, Entity* parent, ItemSet* itemSet);
|
||||
static std::vector<ItemSetPassiveAbility> FindAbilities(uint32_t itemSetID, const std::vector<LOT>& items, const std::array<std::vector<uint32_t>, 5>& skillSets, Entity* parent, ItemSet* itemSet);
|
||||
|
||||
/**
|
||||
* The stat triggers the set's items carry. The live server set these up in the equipmenttriggers
|
||||
* item scripts, which are linked to the items through their ScriptComponent.
|
||||
*/
|
||||
static std::vector<ItemSetStatTrigger> FindStatTriggers(uint32_t itemSetID, const std::vector<LOT>& items);
|
||||
|
||||
/**
|
||||
* The on-kill skills among the set's skills: those whose root behavior is DarkInspiration.
|
||||
*/
|
||||
static std::vector<ItemSetOnKillSkill> FindOnKillSkills(const std::array<std::vector<uint32_t>, 5>& skillSets);
|
||||
|
||||
/**
|
||||
* The trigger a live equipmenttriggers script sets up, by the script's file name (any path, any case).
|
||||
* @return nullptr when the script is not a set stat trigger
|
||||
*/
|
||||
static const ItemSetStatTrigger* GetStatTriggerForScript(std::string_view scriptName);
|
||||
|
||||
private:
|
||||
void OnEnemySmshed(Entity* target = nullptr);
|
||||
void OnEnemySmashed(Entity* target);
|
||||
|
||||
/**
|
||||
* The means of triggering this ability
|
||||
*/
|
||||
PassiveAbilityTrigger m_Trigger;
|
||||
|
||||
/**
|
||||
* What a stat trigger does, unused for EnemySmashed
|
||||
*/
|
||||
ItemSetStatTrigger m_StatTrigger{};
|
||||
|
||||
/**
|
||||
* The skills an EnemySmashed ability runs
|
||||
*/
|
||||
std::vector<ItemSetOnKillSkill> m_OnKillSkills;
|
||||
|
||||
/**
|
||||
* The owner of this ability
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user