Skip to content
Permalink
Browse files

Prevent a failure case for Triage quests

* Prevent injured NPCs to still loose health after being saved, causing quest failure.
Thanks @Trystanosaurus  for pointing.
This closes cmangos/issues#1543
  • Loading branch information...
cala committed Jan 23, 2018
1 parent e1e113a commit b162a97ba3c7809e6d06e89dc52b08d0fe02fd70
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/game/AI/ScriptDevAI/scripts/world/npcs_special.cpp
@@ -527,10 +527,11 @@ struct npc_doctorAI : public ScriptedAI

struct npc_injured_patientAI : public ScriptedAI
{
npc_injured_patientAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
npc_injured_patientAI(Creature* pCreature) : ScriptedAI(pCreature), isSaved(false) {Reset();}

ObjectGuid m_doctorGuid;
Location* m_pCoord;
bool isSaved;

void Reset() override
{
@@ -589,6 +590,7 @@ struct npc_injured_patientAI : public ScriptedAI
}

m_creature->SetWalk(false);
isSaved = true;

switch (m_creature->GetEntry())
{
@@ -610,7 +612,8 @@ struct npc_injured_patientAI : public ScriptedAI

void UpdateAI(const uint32 uiDiff) override
{
if (m_creature->hasUnitState(UNIT_FLAG_NOT_SELECTABLE))
// Don't reduce health if already healed
if (m_creature->hasUnitState(UNIT_FLAG_NOT_SELECTABLE) || isSaved)
return;

// lower HP on every world tick makes it a useful counter, not officlone though

0 comments on commit b162a97

Please sign in to comment.
You can’t perform that action at this time.