From 6795dd189c38b41817e776ff9a8e2f94b5f2cf6e Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Mon, 6 Nov 2023 14:49:53 -0800 Subject: [PATCH] CombatChallenge: Fix exploding dummy --- .../Map/NT/NtCombatChallengeExplodingDummy.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dScripts/02_server/Map/NT/NtCombatChallengeExplodingDummy.cpp b/dScripts/02_server/Map/NT/NtCombatChallengeExplodingDummy.cpp index de27e106..4ae2b335 100644 --- a/dScripts/02_server/Map/NT/NtCombatChallengeExplodingDummy.cpp +++ b/dScripts/02_server/Map/NT/NtCombatChallengeExplodingDummy.cpp @@ -1,6 +1,7 @@ #include "NtCombatChallengeExplodingDummy.h" #include "EntityManager.h" #include "SkillComponent.h" +#include "DestroyableComponent.h" void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) { const auto challengeObjectID = self->GetVar(u"challengeObjectID"); @@ -15,6 +16,17 @@ void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) { } void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) { + auto* destroyableComponent = self->GetComponent(); + auto numTimesHit = self->GetVar(u"numTimesHit"); + if (destroyableComponent && numTimesHit == 0) { + self->SetVar(u"numTimesHit", 1); + destroyableComponent->SetHealth(destroyableComponent->GetHealth() / 2); + return; + } else if (numTimesHit == 2) { + return; + } + self->SetVar(u"numTimesHit", 2); + const auto challengeObjectID = self->GetVar(u"challengeObjectID"); auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID); @@ -28,5 +40,6 @@ void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* at if (skillComponent != nullptr) { skillComponent->CalculateBehavior(1338, 30875, attacker->GetObjectID()); } - self->Kill(attacker); + GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake", self->GetObjectID(), 16.0f); + self->Smash(attacker->GetObjectID()); }