From c73dba69d708ecfc88c6d23c3c26d637c6bb992f Mon Sep 17 00:00:00 2001 From: Ben Carter Date: Fri, 4 Oct 2024 20:41:52 -0400 Subject: [PATCH] Added new melee scaling --- .../base/mythic_plus_scale_factors.sql | 114 +++++++------- src/MpDataStore.cpp | 16 +- src/MpDataStore.h | 3 + src/MythicPlus.cpp | 146 +++++++++++------- src/MythicPlus.h | 2 +- src/UnitScript.cpp | 32 ++-- 6 files changed, 187 insertions(+), 126 deletions(-) diff --git a/data/sql/db-world/base/mythic_plus_scale_factors.sql b/data/sql/db-world/base/mythic_plus_scale_factors.sql index bcf57e8..1722f32 100644 --- a/data/sql/db-world/base/mythic_plus_scale_factors.sql +++ b/data/sql/db-world/base/mythic_plus_scale_factors.sql @@ -1,89 +1,91 @@ -- Last Update: 2021/08/15 -- Description: Scale factors for Mythic+ dungeons used to normalize dungeon difficulty across expansions. +DROP TABLE IF EXISTS mythic_plus_scale_factors; CREATE TABLE IF NOT EXISTS mythic_plus_scale_factors ( mapId SMALLINT PRIMARY KEY, dmg_bonus TINYINT, + spell_bonus TINYINT, hp_bonus TINYINT, difficulty TINYINT, max TINYINT ); -- 1. Pre 60 level dungeons (13 dmg_bonus, 2 hp_bonus, max 23, difficulty 3) -INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, hp_bonus, difficulty, max) +INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, spell_bonus, hp_bonus, difficulty, max) VALUES - (389, 19, 2, 3, 23), -- Ragefire Chasm - (43, 19, 2, 3, 23), -- Wailing Caverns - (36, 19, 2, 3, 23), -- The Deadmines - (33, 19, 2, 3, 23), -- Shadowfang Keep - (34, 19, 2, 3, 23), -- The Stockade - (48, 19, 2, 3, 23), -- Blackfathom Deeps - (90, 19, 2, 3, 23), -- Gnomeregan - (47, 19, 2, 3, 23), -- Razorfen Kraul - (189, 19, 2, 3, 23), -- Scarlet Monastery (Graveyard) - (129, 19, 2, 3, 23), -- Razorfen Downs - (70, 19, 2, 3, 23), -- Uldaman - (209, 19, 2, 3, 23), -- Zul'Farrak - (349, 19, 2, 3, 23) -- Maraudon + (389, 22, 19,2, 3, 23), -- Ragefire Chasm + (43, 19, 18,2, 3, 23), -- Wailing Caverns + (36, 19, 19,2, 3, 23), -- The Deadmines + (33, 19, 19,2, 3, 23), -- Shadowfang Keep + (34, 19, 19,2, 3, 23), -- The Stockade + (48, 19, 19,2, 3, 23), -- Blackfathom Deeps + (90, 19, 19,2, 3, 23), -- Gnomeregan + (47, 19, 19,2, 3, 23), -- Razorfen Kraul + (189, 19, 19,2, 3, 23), -- Scarlet Monastery (Graveyard) + (129, 19, 19,2, 3, 23), -- Razorfen Downs + (70, 19, 19,2, 3, 23), -- Uldaman + (209, 19, 19,2, 3, 23), -- Zul'Farrak + (349, 19, 19,2, 3, 23) -- Maraudon ON DUPLICATE KEY UPDATE mapId = mapId; -- 2. Level 60 dungeons for classic (15 dmg_bonus, 3 hp_bonus, max 25, difficulty 3) -INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, hp_bonus, difficulty, max) +INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, spell_bonus, hp_bonus, difficulty, max) VALUES - (289, 17, 3, 3, 25), -- Scholomance - (109, 17, 3, 3, 25), -- Sunken Temple - (329, 17, 3, 3, 25), -- Stratholme - (229, 17, 3, 3, 25), -- Blackrock Spire (Lower) - (230, 17, 3, 3, 25), -- Blackrock Spire (Upper) - (429, 17, 3, 3, 25), -- Dire Maul - (269, 17, 3, 3, 25) -- Temple of Atal'Hakkar + (289, 17, 20,3, 3, 25), -- Scholomance + (109, 17, 20,3, 3, 25), -- Sunken Temple + (329, 17, 20,3, 3, 25), -- Stratholme + (229, 17, 20,3, 3, 25), -- Blackrock Spire (Lower) + (230, 17, 20,3, 3, 25), -- Blackrock Spire (Upper) + (429, 17, 20,3, 3, 25), -- Dire Maul + (269, 17, 20,3, 3, 25) -- Temple of Atal'Hakkar ON DUPLICATE KEY UPDATE mapId = mapId; -- 3. Pre 70 dungeons in Burning Crusade (15 dmg_bonus, 4 hp_bonus, max 26, difficulty 3) -INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, hp_bonus, difficulty, max) +INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, spell_bonus, hp_bonus, difficulty, max) VALUES - (542, 16, 4, 3, 26), -- Hellfire The Blood Furnace - (543, 16, 4, 3, 26), -- Hellfire Ramparts - (545, 16, 4, 3, 26), -- Coilfang Steamvaults - (546, 16, 4, 3, 26), -- Coilfang Reservoir: The Underbog - (547, 16, 4, 3, 26), -- Coilfang Reservoir: The Underbog - (557, 16, 4, 3, 26), -- Auchindoun: Mana-Tombs - (558, 16, 4, 3, 26), -- Auchindoun: Auchenai Crypts - (560, 16, 4, 3, 26) -- Caverns of Time: Old Hillsbrad Foothills + (542, 16, 14,4, 3, 26), -- Hellfire The Blood Furnace + (543, 16, 14,4, 3, 26), -- Hellfire Ramparts + (545, 16, 14,4, 3, 26), -- Coilfang Steamvaults + (546, 16, 14,4, 3, 26), -- Coilfang Reservoir: The Underbog + (547, 16, 14,4, 3, 26), -- Coilfang Reservoir: The Underbog + (557, 16, 14,4, 3, 26), -- Auchindoun: Mana-Tombs + (558, 16, 14,4, 3, 26), -- Auchindoun: Auchenai Crypts + (560, 16, 14,4, 3, 26) -- Caverns of Time: Old Hillsbrad Foothills ON DUPLICATE KEY UPDATE mapId = mapId; -- 4. Level 70 dungeons in Burning Crusade (14 dmg_bonus, 4 hp_bonus, max 29, difficulty 3) -INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, hp_bonus, difficulty, max) +INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, spell_bonus, hp_bonus, difficulty, max) VALUES - (540, 14, 4, 3, 29), -- Shattered Halls - (556, 14, 4, 3, 29), -- Auchindoun: Sethekk Halls - (555, 14, 4, 3, 29), -- Auchindoun: Shadow Labyrinth - (553, 14, 4, 3, 29), -- Tempest Keep: The Botanica - (554, 14, 4, 3, 29), -- Tempest Keep: The Mechanar - (552, 14, 4, 3, 29), -- Tempest Keep: The Arcatraz - (585, 14, 4, 3, 29) -- Magisters' Terrace + (540, 14, 13,4, 3, 29), -- Shattered Halls + (556, 14, 13,4, 3, 29), -- Auchindoun: Sethekk Halls + (555, 14, 13,4, 3, 29), -- Auchindoun: Shadow Labyrinth + (553, 14, 13,4, 3, 29), -- Tempest Keep: The Botanica + (554, 14, 13,4, 3, 29), -- Tempest Keep: The Mechanar + (552, 14, 13,4, 3, 29), -- Tempest Keep: The Arcatraz + (585, 14, 13,4, 3, 29) -- Magisters' Terrace ON DUPLICATE KEY UPDATE mapId = mapId; -- 5. Pre 80 dungeons in Wrath of the Lich King (17 dmg_bonus, 3 hp_bonus, max 30, difficulty 3) -INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, hp_bonus, difficulty, max) +INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, spell_bonus, hp_bonus, difficulty, max) VALUES - (574, 17, 3, 3, 30), -- Utgarde Keep - (619, 17, 3, 3, 30), -- Ahn'kahet: The Old Kingdom - (576, 17, 3, 3, 30), -- The Nexus - (600, 17, 3, 3, 30), -- Drak'Tharon Keep - (601, 17, 3, 3, 30), -- Azjol-Nerub - (608, 17, 3, 3, 30) -- The Violet Hold + (574, 19, 12,3, 3, 30), -- Utgarde Keep + (619, 19, 12,3, 3, 30), -- Ahn'kahet: The Old Kingdom + (576, 19, 12,3, 3, 30), -- The Nexus + (600, 19, 12,3, 3, 30), -- Drak'Tharon Keep + (601, 19, 12,3, 3, 30), -- Azjol-Nerub + (608, 19, 12,3, 3, 30) -- The Violet Hold ON DUPLICATE KEY UPDATE mapId = mapId; -- 6. Level 80 dungeons in Wrath of the Lich King (19 dmg_bonus, 4 hp_bonus, max 33, difficulty 3) -INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, hp_bonus, difficulty, max) +INSERT INTO mythic_plus_scale_factors (mapId, dmg_bonus, spell_bonus, hp_bonus, difficulty, max) VALUES - (595, 19, 4, 3, 33), -- The Culling of Stratholme - (604, 19, 4, 3, 33), -- Gundrak - (599, 19, 4, 3, 33), -- Halls of Stone - (602, 19, 4, 3, 33), -- Halls of Lightning - (578, 19, 4, 3, 33), -- The Oculus - (650, 19, 4, 3, 33), -- Trial of the Champion - (632, 19, 4, 3, 33), -- The Forge of Souls - (658, 19, 4, 3, 33), -- Pit of Saron - (668, 19, 4, 3, 33) -- Halls of Reflection + (595, 19, 13,5, 3, 33), -- The Culling of Stratholme + (604, 19, 13,5, 3, 33), -- Gundrak + (599, 19, 13,5, 3, 33), -- Halls of Stone + (602, 19, 13,5, 3, 33), -- Halls of Lightning + (578, 19, 13,5, 3, 33), -- The Oculus + (650, 19, 13,5, 3, 33), -- Trial of the Champion + (632, 19, 13,5, 3, 33), -- The Forge of Souls + (658, 19, 13,5, 3, 33), -- Pit of Saron + (668, 19, 13,5, 3, 33) -- Halls of Reflection ON DUPLICATE KEY UPDATE mapId = mapId; diff --git a/src/MpDataStore.cpp b/src/MpDataStore.cpp index 9ff9541..93adfc4 100644 --- a/src/MpDataStore.cpp +++ b/src/MpDataStore.cpp @@ -151,13 +151,17 @@ int32 MpDataStore::GetDamageScaleFactor(int32 mapId, int32 difficulty) const { return GetScaleFactor(mapId, difficulty).dmgBonus; } +int32 MpDataStore::GetSpellScaleFactor(int32 mapId, int32 difficulty) const { + return GetScaleFactor(mapId, difficulty).spellBonus; +} + int32 MpDataStore::GetMaxDamageScaleFactor(int32 mapId, int32 difficulty) const { return GetScaleFactor(mapId, difficulty).maxDamageBonus; } int32 MpDataStore::LoadScaleFactors() { - // 0 1 2 3 4 - QueryResult result = WorldDatabase.Query("SELECT mapId, dmg_bonus, hp_bonus, difficulty, max FROM mythic_plus_scale_factors"); + // 0 1 2 3 4 5 + QueryResult result = WorldDatabase.Query("SELECT mapId, dmg_bonus, spell_bonus, hp_bonus, difficulty, max FROM mythic_plus_scale_factors"); if (!result) { MpLogger::error("Failed to load mythic scale factors from database"); return 0; @@ -167,13 +171,15 @@ int32 MpDataStore::LoadScaleFactors() { Field* fields = result->Fetch(); uint32 mapId = fields[0].Get(); int32 damageBonus = fields[1].Get(); - int32 healthBonus = fields[2].Get(); - int32 difficulty = fields[3].Get(); - int32 maxDamageBonus = fields[4].Get(); + int32 spellBonus = fields[2].Get(); + int32 healthBonus = fields[3].Get(); + int32 difficulty = fields[4].Get(); + int32 maxDamageBonus = fields[5].Get(); MpScaleFactor scaleFactor = { .dmgBonus = damageBonus, .healthBonus = healthBonus, + .spellBonus = spellBonus, .maxDamageBonus = maxDamageBonus }; diff --git a/src/MpDataStore.h b/src/MpDataStore.h index 7ef94cf..4bd95c3 100644 --- a/src/MpDataStore.h +++ b/src/MpDataStore.h @@ -55,10 +55,12 @@ struct MpScaleFactor { int32 dmgBonus; int32 healthBonus; + int32 spellBonus; int32 maxDamageBonus; std::string ToString() const { return "MpScaleFactor: { dmgBonus: " + std::to_string(dmgBonus) + + ", healthBonus: " + std::to_string(healthBonus) + ", healthBonus: " + std::to_string(healthBonus) + ", maxDamageBonus: " + std::to_string(maxDamageBonus) + " }"; } @@ -238,6 +240,7 @@ public: int32 GetHealthScaleFactor(int32 mapId, int32 difficulty) const; int32 GetDamageScaleFactor(int32 mapId, int32 difficulty) const; int32 GetMaxDamageScaleFactor(int32 mapId, int32 difficulty) const; + int32 GetSpellScaleFactor(int32 mapId, int32 difficulty) const; MpScaleFactor GetScaleFactor(int32 mapId, int32 difficulty) const; auto GetInstanceDataKey(uint32 mapId, uint32 instanceId) const { diff --git a/src/MythicPlus.cpp b/src/MythicPlus.cpp index 00306d7..442d739 100644 --- a/src/MythicPlus.cpp +++ b/src/MythicPlus.cpp @@ -163,6 +163,8 @@ void MythicPlus::AddCreatureForScaling(Creature* creature) void MythicPlus::AddScaledCreature(Creature* creature, MpInstanceData* instanceData) { + MpCreatureData creatureData = MpCreatureData(creature); + // allow small variance in level for non-boss creatures uint8 level = uint8(urand(instanceData->creature.avgLevel - 1, instanceData->creature.avgLevel + 1)); if(creature->IsDungeonBoss()) { @@ -171,7 +173,6 @@ void MythicPlus::AddScaledCreature(Creature* creature, MpInstanceData* instanceD ScaleCreature(level, creature, &instanceData->creature, instanceData->difficulty); } - MpCreatureData creatureData = MpCreatureData(creature); creatureData.SetScaled(true); sMpDataStore->AddCreatureData(creature->GetGUID(), creatureData); @@ -246,110 +247,149 @@ void MythicPlus::ScaleCreature(uint8 level, Creature* creature, MpMultipliers* m creature->SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, (float)mana * 3.0f); } - // need to calcuate a new base weapon damage that makes sense for the level and class - uint32 ap = stats->AttackPower; - uint32 rangeAp = irand(115, 157); - MpLogger::debug("Creature {} base attack power{}", - creature->GetName(), - ap - ); + float oldAp = stats->AttackPower; + float oldRangeAp = stats->RangedAttackPower; + uint32 rangeAp = irand(215, 357); + float ap; // = ((85 - origLevel) * APratio); // * 100; - ap = pow(float(creature->GetLevel() / origLevel), 1.8f) * 1000; + int32 damageBonus = sMpDataStore->GetDamageScaleFactor(mapId, difficulty); + float dmgMod = cInfo->DamageModifier + damageBonus; + + + ap = dmgMod * 80 + oldAp; + if (creature->GetLevel() >= 60) { + ap = ap * 1.25f; + rangeAp = rangeAp * 1.25f; + } creature->SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, ap); creature->SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, rangeAp); + // MpLogger::debug("Creature {} base attack power {} new ap {}", + // creature->GetName(), + // oldAp, + // ap + // ); // This works out a bonus damage to apply to the mob using the database and original mod settings. // the thought behind this is some mobs in dungeons are intended to hit harder than others // so applying a flat bonus keeps the ratios the same but increases the overall difficulty. // Of course within reason. - int32 damageBonus = sMpDataStore->GetDamageScaleFactor(mapId, difficulty); + int32 maxBonus = sMpDataStore->GetMaxDamageScaleFactor(mapId, difficulty); - float dmgMod = cInfo->DamageModifier + damageBonus; + // Allow bosses to scale as high as they want but limit non-bosses to a max bonus if(!creature->IsDungeonBoss() && damageBonus > maxBonus) { dmgMod = maxBonus; } float oldDmgModifier = creature->GetModifierValue(UNIT_MOD_DAMAGE_MAINHAND, BASE_VALUE); - creature->SetModifierValue(UNIT_MOD_DAMAGE_MAINHAND,BASE_VALUE, dmgMod); - creature->SetModifierValue(UNIT_MOD_DAMAGE_OFFHAND,BASE_VALUE, dmgMod*0.85f); - creature->SetModifierValue(UNIT_MOD_DAMAGE_RANGED,BASE_VALUE, dmgMod); - - MpLogger::debug("Creature new attack damage scaled from {} to {}", - oldDmgModifier, - dmgMod - ); - + creature->SetModifierValue(UNIT_MOD_DAMAGE_MAINHAND,BASE_PCT, dmgMod); + creature->SetModifierValue(UNIT_MOD_DAMAGE_OFFHAND,BASE_PCT, dmgMod*0.85f); + creature->SetModifierValue(UNIT_MOD_DAMAGE_RANGED,BASE_PCT, dmgMod); creature->UpdateAllStats(); // Scale up the armor with some variance also to make some tougher enemies in the mix uint32 armor = uint32(std::ceil(stats->BaseArmor * multipliers->armor * cInfo->ModArmor)); creature->SetArmor(armor); - /** - * @TODO: Explore scaling other variable stats and resistances on the creature type at a later date. - */ - // creature->SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, stats->AttackPower * multipliers->melee); - // creature->SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, stats->RangedAttackPower * multipliers->melee); + // ap = pow(float((creature->GetLevel() - origLevel) / 5), 1.8f) * 1000 } -int32 MythicPlus::ScaleDamageSpell(SpellInfo const * spellInfo, MpCreatureData* creatureData, Creature* creature, float damageMultiplier) +int32 MythicPlus::ScaleDamageSpell(SpellInfo const * spellInfo, uint32 damage, MpCreatureData* creatureData, Creature* creature, Unit* target, float damageMultiplier) { if (!spellInfo) { MpLogger::error("Invalid spell info ScaleDamageSpell()"); - return 0; + return damage; } if(!creatureData) { + // this is probably a summoned object or totem so going to cheat here and just use the flat modifer + + // Handle totems that do some nasty things to us Slave Pens anyone + if(creature->IsTotem()) { + Unit* owner = creature->GetOwner(); + if(owner) { + float lvlDmgBonus = float(85 - owner->GetLevel() / 5.0f); + return int32(damage * lvlDmgBonus * damageMultiplier); + } else { + return damage * damageMultiplier; + } + } + MpLogger::error("Invalid creature data ScaleDamageSpell()"); - return 0; + return damage * damageMultiplier; } if(!creature) { MpLogger::error("Invalid creature ScaleDamageSpell()"); - return 0; + return damage * damageMultiplier; } int32 originalLevel = creatureData->originalLevel; + + MpInstanceData *instanceData = sMpDataStore->GetInstanceData(creature->GetMapId(), creature->GetInstanceId()); + int32 spellBonus = sMpDataStore->GetSpellScaleFactor(creature->GetMapId(), instanceData->difficulty); + if(creature->IsDungeonBoss()) { + spellBonus *= 1.25; + } + + // since we are using logrithmic operation divide the level by the original level + + float scalingFactor = pow(float((creature->GetLevel() - originalLevel) / 10.0f ), float(spellBonus) / 5.0f); + MpLogger::debug("Creature {} original level: {} New Level{} and Scaling level {}", creature->GetName(), originalLevel, creature->GetLevel(), scalingFactor); + int32 totalDamage = 0; - - // Calculate the scaling factor using the 1.8 exponent - float scalingFactor = pow(float(creature->GetLevel()*1.5 / originalLevel), 1.8f); auto effects = spellInfo->GetEffects(); - - // Loop through all spell effects to scale their base damage for (uint8 i = 0; i < effects.size(); ++i) { - MpLogger::debug("Spell effect {} base points: {}", i, effects[i].BasePoints); SpellEffectInfo effect = effects[i]; - totalDamage += effect.CalcValue(creature, &effect.BasePoints, nullptr); - - MpLogger::debug("Spell effect {} total damage: {}", i, totalDamage); - - if(effect.IsAreaAuraEffect()) { - MpLogger::debug("Skipping area aura effect"); - continue; - } - if(effect.IsAura()) { - MpLogger::debug("Skipping aura effect"); - continue; - } + switch(spellInfo->Effects[i].ApplyAuraName) { + case SPELL_AURA_PERIODIC_DAMAGE: + case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: + case SPELL_AURA_POWER_BURN: + case SPELL_AURA_PERIODIC_LEECH: + case SPELL_AURA_PERIODIC_TRIGGER_SPELL: + case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: + case SPELL_AURA_PERIODIC_DUMMY: + case SPELL_AURA_DUMMY: + totalDamage += effect.CalcValue(creature, nullptr, target); + break; + default: + break; + } + } else { + switch(effect.Effect) + { + case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: + case SPELL_EFFECT_WEAPON_DAMAGE: + case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: + return damage; - - if(effect.IsEffect(SPELL_EFFECT_WEAPON_DAMAGE) || effect.IsEffect(SPELL_EFFECT_WEAPON_PERCENT_DAMAGE)) { - MpLogger::debug("Skipping weapon damage effect"); - continue; + case SPELL_EFFECT_SCHOOL_DAMAGE: + case SPELL_EFFECT_ENVIRONMENTAL_DAMAGE: + case SPELL_EFFECT_POWER_BURN: + case SPELL_EFFECT_HEALTH_LEECH: + case SPELL_EFFECT_TRIGGER_SPELL: + case SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE: + case SPELL_EFFECT_DUMMY: + totalDamage += effect.CalcValue(creature, nullptr, target); + break; + default: + break; + } } } + if(totalDamage == 0) { + return damage; + } + // Apply scaling factor and the set multiplier from the instance data totalDamage = int32(totalDamage * scalingFactor * damageMultiplier); - - MpLogger::debug("Spell damage scaled from for spell New Damage: {} using: scaling Factor: {} and damangeMulti", totalDamage, scalingFactor, damageMultiplier); + MpLogger::debug("Spell {} damage scaled from for spell New Damage: {} using: scaling Factor: {} and damage Multi: {}",spellInfo->SpellName[0], totalDamage, scalingFactor, damageMultiplier); return totalDamage; } diff --git a/src/MythicPlus.h b/src/MythicPlus.h index 6c43721..2760357 100644 --- a/src/MythicPlus.h +++ b/src/MythicPlus.h @@ -107,7 +107,7 @@ public: void ScaleCreature(uint8 level, Creature* creature, MpMultipliers* multipliers, MpDifficulty difficulty); // Scales a damage spell up based on the level increase - int32 ScaleDamageSpell(SpellInfo const * spellInfo, MpCreatureData* creatureData, Creature* creature, float damageMultiplier); + int32 ScaleDamageSpell(SpellInfo const * spellInfo, uint32 damage, MpCreatureData* creatureData, Creature* creature, Unit* target, float damageMultiplier); // This scales a heal spell up based on the how much % the original heal spell was int32 ScaleHealSpell(SpellInfo const * spellInfo, MpCreatureData* creatureData, Creature* creature, Creature* target, float healMultiplier); diff --git a/src/UnitScript.cpp b/src/UnitScript.cpp index d1de77d..95598ab 100644 --- a/src/UnitScript.cpp +++ b/src/UnitScript.cpp @@ -18,15 +18,22 @@ public: return; } - bool haspositiveeffect = false; + auto effects = spellInfo->Effects; + bool isHot = false; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if (spellInfo->_IsPositiveEffect(i, true)) { - haspositiveeffect = true; - break; + switch(effects[i].Effect) { + case SPELL_EFFECT_HEAL: + case SPELL_EFFECT_HEAL_MAX_HEALTH: + case SPELL_EFFECT_HEAL_MECHANICAL: + case SPELL_EFFECT_HEAL_PCT: + case SPELL_EFFECT_SPIRIT_HEAL: + isHot = true; + break; } } - if(haspositiveeffect) { + + if(isHot) { damage = modifyIncomingDmgHeal(MythicPlus::UNIT_EVENT_HOT, target, attacker, damage, spellInfo); } else { damage = modifyIncomingDmgHeal(MythicPlus::UNIT_EVENT_DOT, target, attacker, damage, spellInfo); @@ -135,6 +142,11 @@ public: if(eventType != MythicPlus::UNIT_EVENT_MELEE) { MpLogger::debug("Incoming Event Type ({}): {} hits {} before mod: {} spell: ", eventName, attacker->GetName(), target->GetName(), damageOrHeal, spellInfo ? spellInfo->SpellName[0] : "none"); + if(creature->IsDungeonBoss()) { + alteredDmgHeal = damageOrHeal * instanceData->boss.melee; + } else { + alteredDmgHeal = damageOrHeal * instanceData->creature.melee; + } } // If the target is the enemy then increase the amount of healing by the instance data modifier for spell output. @@ -150,26 +162,26 @@ public: } else { alteredDmgHeal = damageOrHeal * instanceData->creature.melee; } - // MpLogger::debug("Incoming Melee New Damage: {}({}) {} hits {}", alteredDmgHeal, damageOrHeal, attacker->GetName(), target->GetName()); + MpLogger::debug("Incoming Melee New Damage: {}({}) {} hits {}", alteredDmgHeal, damageOrHeal, attacker->GetName(), target->GetName()); break; case MythicPlus::UNIT_EVENT_DOT: case MythicPlus::UNIT_EVENT_SPELL: if(creature->IsDungeonBoss()) { if(spellInfo) { - alteredDmgHeal = sMythicPlus->ScaleDamageSpell(spellInfo, sMpDataStore->GetCreatureData(attacker->GetGUID()), creature, instanceData->boss.spell); + alteredDmgHeal = sMythicPlus->ScaleDamageSpell(spellInfo, damageOrHeal, sMpDataStore->GetCreatureData(attacker->GetGUID()), creature, target, instanceData->boss.spell); } else { alteredDmgHeal = damageOrHeal * instanceData->boss.spell; } } else { if(spellInfo) { - alteredDmgHeal = sMythicPlus->ScaleDamageSpell(spellInfo, sMpDataStore->GetCreatureData(attacker->GetGUID()), creature, instanceData->creature.spell); + alteredDmgHeal = sMythicPlus->ScaleDamageSpell(spellInfo, damageOrHeal, sMpDataStore->GetCreatureData(attacker->GetGUID()), creature, target, instanceData->creature.spell); } else { alteredDmgHeal = damageOrHeal * instanceData->creature.spell; } } if(spellInfo) { - MpLogger::debug("Incoming spell New Damage: {}({}) {} hits {} spell: {}", alteredDmgHeal, damageOrHeal, attacker->GetName(), target->GetName(), spellInfo->SpellName[0]); + MpLogger::debug("Incoming spell New Damage: {}({}) {} hits {} spell: {} ID: {}", alteredDmgHeal, damageOrHeal, attacker->GetName(), target->GetName(), spellInfo->SpellName[0], spellInfo->Id); } else { MpLogger::debug("Incoming spell New Damage: {}({}) {} hits {}", alteredDmgHeal, damageOrHeal, attacker->GetName(), target->GetName()); } @@ -180,8 +192,6 @@ public: } } - - /** * @TODO: Add more granular control over the scaling of healing spells */