mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Make wrapper for casting skills (#987)
* Make wrapper for casting skills this is to reduce magic numbers in the code base Only updated one use of this to demo that this works. Will be do more in a sepearate PR. Also, inadvertantly fix damage stacking and self-damage in the teslapack * add skill<->behavior caching * explicit by reference * address emo's feedback
This commit is contained in:
@@ -14,10 +14,10 @@ void CoilBackpackBase::NotifyHitOrHealResult(Entity* self, Entity* attacker, int
|
||||
if (self->GetVar<uint8_t>(u"coilCount") > 4) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (!skillComponent) return;
|
||||
skillComponent->CalculateBehavior(m_SkillId, m_BehaviorId, self->GetObjectID());
|
||||
skillComponent->CastSkill(m_SkillId);
|
||||
self->SetVar<uint8_t>(u"coilCount", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CoilBackpackBase::OnFactionTriggerItemUnequipped(Entity* itemOwner, LWOOBJID itemObjId) {
|
||||
|
@@ -5,9 +5,8 @@
|
||||
|
||||
class CoilBackpackBase: public CppScripts::Script {
|
||||
public:
|
||||
CoilBackpackBase(uint32_t skillId, uint32_t behaviorId) {
|
||||
CoilBackpackBase(uint32_t skillId) {
|
||||
m_SkillId = skillId;
|
||||
m_BehaviorId = behaviorId;
|
||||
};
|
||||
|
||||
void OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) override;
|
||||
@@ -15,7 +14,6 @@ public:
|
||||
void OnFactionTriggerItemUnequipped(Entity* itemOwner, LWOOBJID itemObjId) override;
|
||||
private:
|
||||
uint32_t m_SkillId = 0;
|
||||
uint32_t m_BehaviorId = 0;
|
||||
};
|
||||
|
||||
#endif //!__GemPackBase__H__
|
||||
|
@@ -5,10 +5,9 @@
|
||||
|
||||
class GemPack : public CoilBackpackBase {
|
||||
public:
|
||||
GemPack() : CoilBackpackBase(skillId, behaviorId) {};
|
||||
GemPack() : CoilBackpackBase(skillId) {};
|
||||
private:
|
||||
static const uint32_t skillId = 1488;
|
||||
static const uint32_t behaviorId = 36779;
|
||||
};
|
||||
|
||||
#endif //!__GEMPACK__H__
|
||||
|
@@ -5,10 +5,9 @@
|
||||
|
||||
class ShardArmor : public CoilBackpackBase {
|
||||
public:
|
||||
ShardArmor() : CoilBackpackBase(skillId, behaviorId) {};
|
||||
ShardArmor() : CoilBackpackBase(skillId) {};
|
||||
private:
|
||||
static const uint32_t skillId = 1249;
|
||||
static const uint32_t behaviorId = 29086;
|
||||
};
|
||||
|
||||
#endif //!__SHARDARMOR__H__
|
||||
|
@@ -5,10 +5,9 @@
|
||||
|
||||
class TeslaPack : public CoilBackpackBase {
|
||||
public:
|
||||
TeslaPack() : CoilBackpackBase(skillId, behaviorId) {};
|
||||
TeslaPack() : CoilBackpackBase(skillId) {};
|
||||
private:
|
||||
static const uint32_t skillId = 1001;
|
||||
static const uint32_t behaviorId = 20917;
|
||||
};
|
||||
|
||||
#endif //!__TESLAPACK__H__
|
||||
|
Reference in New Issue
Block a user