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:
Aaron Kimbrell
2026-09-27 04:18:51 -05:00
parent 347a0a7286
commit e44eaf1862
13 changed files with 494 additions and 353 deletions

View File

@@ -470,18 +470,10 @@ bool DestroyableComponent::IsCooldownImmune() const {
bool DestroyableComponent::IsKnockbackImmune() const {
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
auto* inventoryComponent = m_Parent->GetComponent<InventoryComponent>();
if (characterComponent != nullptr && inventoryComponent != nullptr && characterComponent->GetCurrentActivity() == eGameActivity::QUICKBUILDING) {
const auto hasPassive = inventoryComponent->HasAnyPassive({
eItemSetPassiveAbilityID::EngineerRank2, eItemSetPassiveAbilityID::EngineerRank3,
eItemSetPassiveAbilityID::SummonerRank2, eItemSetPassiveAbilityID::SummonerRank3,
eItemSetPassiveAbilityID::InventorRank2, eItemSetPassiveAbilityID::InventorRank3,
}, 5);
if (hasPassive) {
return true;
}
// Quickbuild interrupt immunity comes from Immunity behaviors, e.g. the 5 item Assembly rank 2 and 3 set skill (584)
if (characterComponent != nullptr && characterComponent->GetCurrentActivity() == eGameActivity::QUICKBUILDING && GetImmuneToQuickbuildInterrupt()) {
return true;
}
return IsImmune() || m_IsShielded || m_AttacksToBlock > 0;

View File

@@ -1357,21 +1357,6 @@ void InventoryComponent::TriggerPassiveAbility(PassiveAbilityTrigger trigger, En
}
}
bool InventoryComponent::HasAnyPassive(const std::vector<eItemSetPassiveAbilityID>& passiveIDs, int32_t equipmentRequirement) const {
for (auto* set : m_Itemsets) {
if (set->GetEquippedCount() < equipmentRequirement) {
continue;
}
// Check if the set has any of the passive abilities
if (std::find(passiveIDs.begin(), passiveIDs.end(), static_cast<eItemSetPassiveAbilityID>(set->GetID())) != passiveIDs.end()) {
return true;
}
}
return false;
}
void InventoryComponent::DespawnPet() {
auto* current = PetComponent::GetActivePet(m_Parent->GetObjectID());

View File

@@ -17,7 +17,6 @@
#include "DatabasePet.h"
#include "Component.h"
#include "ItemSetPassiveAbility.h"
#include "eItemSetPassiveAbilityID.h"
#include "PossessorComponent.h"
#include "eInventoryType.h"
#include "eReplicaComponentType.h"
@@ -358,14 +357,6 @@ public:
*/
void TriggerPassiveAbility(PassiveAbilityTrigger trigger, Entity* target = nullptr);
/**
* Returns if the entity has any of the passed passive abilities equipped
* @param passiveIDs the IDs to check for
* @param equipmentRequirement the number of equipment required to be allowed to have the ability
* @return if the entity has any of the passed passive abilities equipped
*/
bool HasAnyPassive(const std::vector<eItemSetPassiveAbilityID>& passiveIDs, int32_t equipmentRequirement) const;
/**
* Despawns the currently active pet, if any
*/

View File

@@ -466,6 +466,19 @@ void SkillComponent::HandleUnmanaged(const uint32_t behaviorId, const LWOOBJID t
behavior->Handle(&context, bitStream, { target });
}
void SkillComponent::CalculateUnmanaged(const uint32_t behaviorId, const LWOOBJID caster, const LWOOBJID target) {
BehaviorContext context{ caster, true };
context.unmanaged = true;
context.caster = caster;
auto* behavior = Behavior::CreateBehavior(behaviorId);
RakNet::BitStream bitStream{};
behavior->Calculate(&context, bitStream, { target });
}
void SkillComponent::HandleUnCast(const uint32_t behaviorId, const LWOOBJID target) {
BehaviorContext context{ target };

View File

@@ -174,6 +174,15 @@ public:
*/
static void HandleUnmanaged(uint32_t behaviorId, LWOOBJID target, LWOOBJID source = LWOOBJID_EMPTY);
/**
* Calculates a behavior on the server only, without syncing it to clients, for effects the
* clients already run on their own (e.g. item set DarkInspiration status effects).
* @param behaviorId the root behavior ID of the skill
* @param caster the entity the behavior is cast by
* @param target the entity the behavior targets
*/
static void CalculateUnmanaged(uint32_t behaviorId, LWOOBJID caster, LWOOBJID target);
/**
* Computes a server-side skill uncast calculation without an associated entity.
* @param behaviorId the root behavior ID of the skill