mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
Live filled Die's direction_relative_angle_xz, _angle_y and _force on 11,606 of 19,428 deaths. The values are the dir_angle_xz, dir_angle_y (degrees, sent as radians) and dir_force parameters of the BasicAttack that dealt the killing blow: per killing skill the triple is constant (skill 1210: -25 degrees, force 12 on 540 of 549 kills; skill 10: force 7 on 1,830 of 1,835), and deaths with no killer (5,948) never have one. BasicAttack is the only behavior with these parameters apart from one Grab. The client passes them to PerformSmashableDeath, which throws the smashable's pieces that way; DLU sent 0. The radians are rounded the way live did (-25 is 0xbedf66f3, 20 is 0x3eb2b8c3). Not covered: use_caster_velocity (one behavior, racing). Check: smash crates and enemies with different weapons; the pieces fly off to the side/up per weapon instead of straight out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.6 KiB
C++
69 lines
2.6 KiB
C++
#pragma once
|
|
#include "Behavior.h"
|
|
#include "DestroyableComponent.h"
|
|
|
|
class BasicAttackBehavior final : public Behavior
|
|
{
|
|
public:
|
|
explicit BasicAttackBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
|
}
|
|
|
|
/**
|
|
* @brief Reads a 16bit short from the bitStream and when the actual behavior handling finishes with all of its branches, the bitStream
|
|
* is then offset to after the allocated bits for this stream.
|
|
*
|
|
*/
|
|
void DoHandleBehavior(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch);
|
|
|
|
/**
|
|
* @brief Handles a client initialized Basic Attack Behavior cast to be deserialized and verified on the server.
|
|
*
|
|
* @param context The Skill's Behavior context. All behaviors in the same tree share the same context
|
|
* @param bitStream The bitStream to deserialize. BitStreams will always check their bounds before reading in a behavior
|
|
* and will fail gracefully if an overread is detected.
|
|
* @param branch The context of this specific branch of the Skill Behavior. Changes based on which branch you are going down.
|
|
*/
|
|
void Handle(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
|
|
|
/**
|
|
* @brief Writes a 16bit short to the bitStream and when the actual behavior calculation finishes with all of its branches, the number
|
|
* of bits used is then written to where the 16bit short initially was.
|
|
*
|
|
*/
|
|
void Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) override;
|
|
|
|
/**
|
|
* @brief Calculates a server initialized Basic Attack Behavior cast to be serialized to the client
|
|
*
|
|
* @param context The Skill's Behavior context. All behaviors in the same tree share the same context
|
|
* @param bitStream The bitStream to serialize to.
|
|
* @param branch The context of this specific branch of the Skill Behavior. Changes based on which branch you are going down.
|
|
*/
|
|
void DoBehaviorCalculation(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch);
|
|
|
|
/**
|
|
* @brief Loads this Behaviors parameters from the database. For this behavior specifically:
|
|
* max and min damage will always be the same. If min is less than max, they are both set to max.
|
|
* If an action is not in the database, then no action is taken for that result.
|
|
*
|
|
*/
|
|
void Load() override;
|
|
private:
|
|
bool m_DontApplyImmune;
|
|
|
|
uint32_t m_MinDamage;
|
|
|
|
uint32_t m_MaxDamage;
|
|
|
|
// dir_angle_xz, dir_angle_y and dir_force: sent in Die when this attack kills its target.
|
|
DeathDirection m_DeathDirection;
|
|
|
|
Behavior* m_OnSuccess;
|
|
|
|
Behavior* m_OnFailArmor;
|
|
|
|
Behavior* m_OnFailImmune;
|
|
|
|
Behavior* m_OnFailBlocked;
|
|
};
|