Updated how skills and upgrades work, more gui stuff

This commit is contained in:
wincent
2024-07-17 20:59:11 +02:00
parent 5e3312850c
commit 3178a702a7
27 changed files with 986 additions and 205 deletions

View File

@@ -767,8 +767,8 @@ void BaseCombatAIComponent::SetTetherSpeed(float value) {
m_TetherSpeed = value;
}
void BaseCombatAIComponent::Stun(const float time) {
if (m_StunImmune || m_StunTime > time) {
void BaseCombatAIComponent::Stun(const float time, const bool ignoreImmunity) {
if ((!ignoreImmunity && m_StunImmune) || m_StunTime > time) {
return;
}

View File

@@ -187,8 +187,9 @@ public:
/**
* Stuns the entity for a certain amount of time, will not work if the entity is stun immune
* @param time the time to stun the entity, if stunnable
* @param ignoreImmunity whether to ignore the stun immunity of the entity
*/
void Stun(float time);
void Stun(float time, bool ignoreImmunity = false);
/**
* Gets the radius that will cause this entity to get aggro'd, causing a target chase

View File

@@ -675,7 +675,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
if (m_Parent->IsPlayer()) {
m_Parent->SetNetworkVar<std::string>(u"renderText", damageUIStr, UNASSIGNED_SYSTEM_ADDRESS);
} else if (attacker->IsPlayer()) {
} else if (attacker != nullptr && attacker->IsPlayer()) {
attacker->SetNetworkVar<std::string>(u"renderText", damageUIStr, UNASSIGNED_SYSTEM_ADDRESS);
}

View File

@@ -31,7 +31,7 @@ ProjectileSyncEntry::ProjectileSyncEntry() {
std::unordered_map<uint32_t, uint32_t> SkillComponent::m_skillBehaviorCache = {};
Observable<SkillComponent*, uint32_t, bool> SkillComponent::OnSkillCast;
Observable<SkillComponent*, uint32_t, bool&, uint32_t> SkillComponent::OnSkillCast;
bool SkillComponent::CastPlayerSkill(const uint32_t behaviorId, const uint32_t skillUid, RakNet::BitStream& bitStream, const LWOOBJID target, uint32_t skillID) {
auto* context = new BehaviorContext(this->m_Parent->GetObjectID());
@@ -50,7 +50,11 @@ bool SkillComponent::CastPlayerSkill(const uint32_t behaviorId, const uint32_t s
context->ExecuteUpdates();
OnSkillCast(this, skillID, !context->failed);
bool success = !context->failed;
OnSkillCast(this, skillID, success, skillUid);
context->failed = !success;
return !context->failed;
}

View File

@@ -185,8 +185,8 @@ public:
*/
uint32_t GetUniqueSkillId();
// SkillComponent, SkillID, Success
static Observable<SkillComponent*, uint32_t, bool> OnSkillCast;
// SkillComponent, SkillID, Success, skillUID
static Observable<SkillComponent*, uint32_t, bool&, uint32_t> OnSkillCast;
private:
/**