mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +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:
@@ -119,6 +119,15 @@ public:
|
||||
*/
|
||||
void RegisterPlayerProjectile(LWOOBJID projectileId, BehaviorContext* context, const BehaviorBranchContext& branch, LOT lot);
|
||||
|
||||
/**
|
||||
* Wrapper for CalculateBehavior that mimics the call structure in scripts and helps reduce magic numbers
|
||||
* @param skillId the skill to cast
|
||||
* @param target the target of the skill
|
||||
* @param optionalOriginatorID change the originator of the skill
|
||||
* @return if the case succeeded
|
||||
*/
|
||||
bool CastSkill(const uint32_t skillId, LWOOBJID target = LWOOBJID_EMPTY, const LWOOBJID optionalOriginatorID = LWOOBJID_EMPTY);
|
||||
|
||||
/**
|
||||
* Initializes a server-side skill calculation.
|
||||
* @param skillId the skill ID
|
||||
@@ -190,6 +199,11 @@ private:
|
||||
*/
|
||||
uint32_t m_skillUid;
|
||||
|
||||
/**
|
||||
* Cache for looking up a behavior id via a skill ID
|
||||
*/
|
||||
static std::unordered_map<uint32_t, uint32_t> m_skillBehaviorCache;
|
||||
|
||||
/**
|
||||
* Sync a server-side projectile calculation.
|
||||
* @param entry the projectile information
|
||||
|
Reference in New Issue
Block a user