Skip to content

Commit 589f681

Browse files
Merge AzerothCore 3.3.5 to ElunaAzerothcore [skip ci]
2 parents 34e853e + c6f9f67 commit 589f681

9 files changed

Lines changed: 165 additions & 15 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- DB update 2026_01_21_02 -> 2026_01_22_00
2+
--
3+
DELETE FROM `spell_script_names` WHERE `spell_id` = 28375;
4+
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
5+
(28375, 'spell_gluth_decimate_damage');
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-- DB update 2026_01_22_00 -> 2026_01_22_01
2+
-- PrevQuestID from 12822 to 18221, A Flawless Plan requires Opening the Backdoor, not Know No Fear
3+
UPDATE `quest_template_addon` SET `PrevQuestID` = 12821 WHERE `ID` = 12823;
4+
5+
-- Remove phase shifts in Garm and Garm's Rise for Know No Fear
6+
DELETE FROM `spell_area`
7+
WHERE `Quest_start` = 12822
8+
AND `quest_start_status` = 74;
9+
10+
-- Add phase shift in Garm and Garm's Rise after turning in Opening the Backdoor
11+
DELETE FROM `spell_area` WHERE `Quest_start` = 12821 AND `Spell` = 54635;
12+
INSERT INTO `spell_area`
13+
(
14+
`Spell`,
15+
`Area`,
16+
`Quest_start`,
17+
`Quest_end`,
18+
`Aura_spell`,
19+
`Racemask`,
20+
`Gender`,
21+
`Autocast`,
22+
`Quest_start_status`,
23+
`Quest_end_status`
24+
)
25+
VALUES
26+
(54635, 4421, 12821, 0, 0, 0, 2, 1, 64, 0),
27+
(54635, 4461, 12821, 0, 0, 0, 2, 1, 64, 0);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- DB update 2026_01_22_01 -> 2026_01_22_02
2+
--
3+
DELETE FROM `smart_scripts` WHERE `entryorguid` = 28581 AND `source_type` = 0 AND `id` IN (0, 1, 2);
4+
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
5+
(28581, 0, 0, 0, 0, 0, 100, 2, 0, 9000, 11000, 14000, 0, 0, 11, 52778, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 'Stormforged Tactician - In Combat - Cast \'Welding Beam\' (Normal Dungeon)'),
6+
(28581, 0, 1, 0, 0, 0, 100, 4, 0, 9000, 11000, 14000, 0, 0, 11, 59166, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 'Stormforged Tactician - In Combat - Cast \'Welding Beam\' (Heroic Dungeon)'),
7+
(28581, 0, 2, 0, 2, 0, 100, 6, 0, 70, 15000, 27000, 0, 0, 11, 59085, 32, 0, 0, 0, 0, 5, 40, 0, 0, 0, 0, 0, 0, 0, 'Stormforged Tactician - Between 0-70% Health - Cast \'Arc Weld\' (Dungeon)');
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- DB update 2026_01_22_02 -> 2026_01_22_03
2+
--
3+
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 29134;
4+
5+
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 29134) AND (`source_type` = 0) AND (`id` IN (0, 1));
6+
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
7+
(29134, 0, 0, 0, 54, 0, 100, 0, 0, 0, 0, 0, 0, 0, 41, 180000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Brown Rabbit - On Just Summoned - Despawn In 180000 ms'),
8+
(29134, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 53273, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Brown Rabbit - On Death - Cast \'Decoy Explosive\'');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- DB update 2026_01_22_03 -> 2026_01_22_04
2+
-- Sniffed from 50664 Build
3+
UPDATE `creature_template` SET `unit_flags` = `unit_flags`&~(2|131072), `unit_flags` = `unit_flags`|256 WHERE (`entry` IN (31079, 31492));

src/server/game/Combat/ThreatMgr.cpp

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ HostileReference* ThreatContainer::SelectNextVictim(Creature* attacker, HostileR
328328
Unit* cvUnit = currentVictim->getTarget();
329329
if (!attacker->CanCreatureAttack(cvUnit)) // pussywizard: if currentVictim is not valid => don't compare the threat with it, just take the highest threat valid target
330330
currentVictim = nullptr;
331-
else if (cvUnit->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || cvUnit->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE) || cvUnit->HasUnitState(UNIT_STATE_CONFUSED)) // pussywizard: no 10%/30% if currentVictim is immune to damage or has auras breakable by damage
331+
else if (!IsPreferredTarget(attacker, cvUnit)) // pussywizard: no 10%/30% if currentVictim is immune to damage or has auras breakable by damage
332332
currentVictim = nullptr;
333333
}
334334

@@ -345,7 +345,7 @@ HostileReference* ThreatContainer::SelectNextVictim(Creature* attacker, HostileR
345345

346346
// pussywizard: don't go to threat comparison if this ref is immune to damage or has aura breakable on damage (second choice target)
347347
// pussywizard: if this is the last entry on the threat list, then all targets are second choice, set bool to true and loop threat list again, ignoring this section
348-
if (!noPriorityTargetFound && (target->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE) || target->HasUnitState(UNIT_STATE_CONFUSED) || target->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, attacker->GetGUID())))
348+
if (!noPriorityTargetFound && !IsPreferredTarget(attacker, target))
349349
{
350350
if (iter != lastRef)
351351
{
@@ -394,6 +394,8 @@ HostileReference* ThreatContainer::SelectNextVictim(Creature* attacker, HostileR
394394
}
395395
else // pussywizard: no currentVictim, first passing all checks is chosen (highest threat, list is sorted)
396396
{
397+
// tie-breaker if multiple targets have the same threat: select closest target
398+
currentRef = SelectNextVictimTieBreaker(attacker, iter, noPriorityTargetFound);
397399
found = true;
398400
break;
399401
}
@@ -406,6 +408,69 @@ HostileReference* ThreatContainer::SelectNextVictim(Creature* attacker, HostileR
406408
return currentRef;
407409
}
408410

411+
// Helper for Tie-breakers
412+
HostileReference* ThreatContainer::SelectNextVictimTieBreaker(Creature* attacker, ThreatContainer::StorageType::const_iterator currentIter, bool noPriorityTargetFound) const
413+
{
414+
HostileReference* bestRef = *currentIter;
415+
float bestThreat = bestRef->GetThreat();
416+
float shortestDistSq = attacker->GetExactDistSq(bestRef->getTarget());
417+
418+
auto tieIter = std::next(currentIter);
419+
420+
while (tieIter != iThreatList.end())
421+
{
422+
HostileReference* nextRef = *tieIter;
423+
424+
if (!nextRef)
425+
{
426+
++tieIter;
427+
continue;
428+
}
429+
430+
// Threatlist is sorted, so we can stop as soon as we find a lower threat
431+
if (bestThreat - nextRef->GetThreat() > 0.01f)
432+
break;
433+
434+
Unit* target = nextRef->getTarget();
435+
436+
if (!target)
437+
{
438+
++tieIter;
439+
continue;
440+
}
441+
442+
if (attacker->CanCreatureAttack(target) && (noPriorityTargetFound || IsPreferredTarget(attacker, target)))
443+
{
444+
float distSq = attacker->GetExactDistSq(target);
445+
if (distSq < shortestDistSq)
446+
{
447+
bestRef = nextRef;
448+
shortestDistSq = distSq;
449+
}
450+
}
451+
++tieIter;
452+
}
453+
return bestRef;
454+
}
455+
456+
// Helper for checking if a target is preferred (not immune, not confused, etc)
457+
bool ThreatContainer::IsPreferredTarget(Creature* attacker, Unit* target) const
458+
{
459+
if (target->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()))
460+
return false;
461+
462+
if (target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE))
463+
return false;
464+
465+
if (target->HasUnitState(UNIT_STATE_CONFUSED))
466+
return false;
467+
468+
if (target->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, attacker->GetGUID()))
469+
return false;
470+
471+
return true;
472+
}
473+
409474
//============================================================
410475
//=================== ThreatMgr ==========================
411476
//============================================================

src/server/game/Combat/ThreatMgr.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ class ThreatContainer
156156

157157
HostileReference* SelectNextVictim(Creature* attacker, HostileReference* currentVictim) const;
158158

159+
HostileReference* SelectNextVictimTieBreaker(Creature* attacker, ThreatContainer::StorageType::const_iterator currentIter, bool noPriorityTargetFound) const;
160+
161+
bool IsPreferredTarget(Creature* attacker, Unit* target) const;
162+
159163
void setDirty(bool isDirty) { iDirty = isDirty; }
160164

161165
[[nodiscard]] bool isDirty() const { return iDirty; }

src/server/game/Entities/Unit/Unit.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,36 +2148,36 @@ uint32 Unit::CalcArmorReducedDamage(Unit const* attacker, Unit const* victim, co
21482148

21492149
float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim)
21502150
{
2151-
float victimResistance = float(victim->GetResistance(schoolMask));
2151+
float victimResistance = static_cast<float>(victim->GetResistance(schoolMask));
21522152
if (owner)
21532153
{
21542154
// Xinef: pets inherit 100% of masters penetration
21552155
// Xinef: excluding traps
21562156
Player const* player = owner->GetSpellModOwner();
21572157
if (player && owner->GetEntry() != WORLD_TRIGGER)
21582158
{
2159-
victimResistance += float(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2160-
victimResistance -= float(player->GetSpellPenetrationItemMod());
2159+
victimResistance += static_cast<float>(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2160+
victimResistance -= static_cast<float>(player->GetSpellPenetrationItemMod());
21612161
}
21622162
else
2163-
victimResistance += float(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2163+
victimResistance += static_cast<float>(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
21642164
}
21652165

21662166
victimResistance = std::max(victimResistance, 0.0f);
21672167
if (owner)
2168-
victimResistance += std::max((float(victim->GetLevel()) - float(owner->GetLevel())) * 5.0f, 0.0f);
2168+
victimResistance += std::max(static_cast<float>(victim->GetLevel() - owner->GetLevel()) * 5.0f, 0.0f);
21692169

2170-
static uint32 const BOSS_LEVEL = 83;
2171-
static float const BOSS_RESISTANCE_CONSTANT = 510.0f;
2172-
uint32 level = victim->GetLevel();
2170+
float level = static_cast<float>(victim->GetLevel());
21732171
float resistanceConstant = 0.0f;
21742172

2175-
if (level == BOSS_LEVEL)
2176-
resistanceConstant = BOSS_RESISTANCE_CONSTANT;
2173+
if (level > 60.0f)
2174+
resistanceConstant = 150.0f + (level - 60.0f) * (level - 67.5f);
2175+
else if (level > 20.0f)
2176+
resistanceConstant = 50.0f + (level - 20.0f) * 2.5f;
21772177
else
2178-
resistanceConstant = level * 5.0f;
2178+
resistanceConstant = 50.0f;
21792179

2180-
return victimResistance / (victimResistance + resistanceConstant);
2180+
return std::min(victimResistance / (victimResistance + resistanceConstant), 0.75f);
21812181
}
21822182

21832183
void Unit::CalcAbsorbResist(DamageInfo& dmgInfo, bool Splited)

src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ class spell_gluth_decimate : public SpellScript
255255
Unit::DealDamage(GetCaster(), cTarget, damage);
256256
return;
257257
}
258-
GetCaster()->CastCustomSpell(SPELL_DECIMATE_DAMAGE, SPELLVALUE_BASE_POINT0, damage, unitTarget);
258+
259+
GetCaster()->CastSpell(unitTarget, SPELL_DECIMATE_DAMAGE);
259260
}
260261
}
261262

@@ -265,8 +266,38 @@ class spell_gluth_decimate : public SpellScript
265266
}
266267
};
267268

269+
// 28375 - Decimate
270+
class spell_gluth_decimate_damage : public SpellScript
271+
{
272+
PrepareSpellScript(spell_gluth_decimate_damage)
273+
274+
void RecalculateDamage()
275+
{
276+
Unit* target = GetHitUnit();
277+
if (!target)
278+
return;
279+
280+
int32 targetHealth = int32(target->GetHealth());
281+
int32 fivePctHealth = int32(target->CountPctFromMaxHealth(5));
282+
283+
// Damage needed to leave the target at exactly 5%
284+
int32 damage = targetHealth - fivePctHealth;
285+
286+
if (damage <= 0)
287+
damage = 0;
288+
289+
SetHitDamage(damage);
290+
}
291+
292+
void Register() override
293+
{
294+
OnHit += SpellHitFn(spell_gluth_decimate_damage::RecalculateDamage);
295+
}
296+
};
297+
268298
void AddSC_boss_gluth()
269299
{
270300
new boss_gluth();
271301
RegisterSpellScript(spell_gluth_decimate);
302+
RegisterSpellScript(spell_gluth_decimate_damage);
272303
}

0 commit comments

Comments
 (0)