diff --git a/src/MpDataStore.h b/src/MpDataStore.h index be12b02..7460eaa 100644 --- a/src/MpDataStore.h +++ b/src/MpDataStore.h @@ -39,6 +39,7 @@ struct MpMultipliers { float health; float melee; + float baseDamage; float spell; float armor; uint8 avgLevel; @@ -46,6 +47,7 @@ struct MpMultipliers std::string ToString() const { return "MpMultipliers: { health: " + std::to_string(health) + ", melee: " + std::to_string(melee) + + ", melee: " + std::to_string(baseDamage) + ", spell: " + std::to_string(spell) + ", armor: " + std::to_string(armor) + ", avgLevel: " + std::to_string(avgLevel) + " }"; diff --git a/src/MythicPlus.cpp b/src/MythicPlus.cpp index 3c12ab7..d369654 100644 --- a/src/MythicPlus.cpp +++ b/src/MythicPlus.cpp @@ -3,6 +3,7 @@ #include "MpLogger.h" #include "ObjectMgr.h" #include "MapMgr.h" +#include "ScriptMgr.h" bool MythicPlus::IsMapEligible(Map* map) { @@ -52,6 +53,14 @@ bool MythicPlus::EligibleTarget(Unit* target) return true; } + MpLogger::debug("EligibleTarget: target {} is not a player", target->GetName()); + + #if defined(NPCBots) + MpLogger::debug("MOD_PRESET_NPCBOTS: value {}", MOD_PRESENT_NPCBOTS); + #endif + + + #if defined(MOD_PRESENT_NPCBOTS) MpLogger::debug("IN BOT DEFINED STUFF: target: {} BOT?{}", target->GetName(), target->IsNPCBot()); if (target->IsNPCBot()) { @@ -59,7 +68,7 @@ bool MythicPlus::EligibleTarget(Unit* target) return true; } - if ((target->IsPet() || creature->IsSummon() || creature->IsHunterPet()) && target->GetOwner()->IsNPCBot()) { + if ((target->IsPet() || target->IsSummon() || target->IsHunterPet()) && target->GetOwner()->IsNPCBot()) { return true; } #endif @@ -87,7 +96,7 @@ bool MythicPlus::IsCreatureEligible(Creature* creature) } # if defined(MOD_PRESENT_NPCBOTS) - if (creature->IsNpcBot()) { + if (creature->IsNPCBot()) { MpLogger::debug("Creature {} is an NPC Bot do not scale", creature->GetName()); return false; } @@ -168,6 +177,7 @@ void MythicPlus::RemoveCreature(Creature* creature) void MythicPlus::ScaleCreature(uint8 level, Creature* creature, MpMultipliers* multipliers) { + uint32 origLevel = creature->GetLevel(); creature->SetLevel(level); CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats( level, @@ -192,12 +202,6 @@ void MythicPlus::ScaleCreature(uint8 level, Creature* creature, MpMultipliers* m creature->SetHealth(health); creature->ResetPlayerDamageReq(); - // Scale up the armor with some variance also to make some tougher enemies in the mix - uint32 armor = uint32(std::ceil(stats->BaseArmor * cInfo->ModArmor * multipliers->armor)); - creature->SetArmor(armor); - - creature->UpdateArmor(); - // Scales the creatures mana uint32 mana = uint32(std::ceil(stats->BaseMana * cInfo->ModMana)); creature->SetCreateMana(mana); @@ -207,11 +211,19 @@ void MythicPlus::ScaleCreature(uint8 level, Creature* creature, MpMultipliers* m creature->SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health); creature->SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, (float)mana); - // Scales the damage based on the melee multiplier - float basedamage = uint32(std::ceil(stats->BaseDamage[EXPANSION_WRATH_OF_THE_LICH_KING] * cInfo->DamageModifier)); + // Normalize the damage from earlier expansions + float cTemplateDmgMult = cInfo->DamageModifier; + if (origLevel <= 60 && cTemplateDmgMult < 3.0f) { + cTemplateDmgMult = 3.0f; + } + if (origLevel <= 70 && origLevel > 60 && cTemplateDmgMult < 4.0f) { + cTemplateDmgMult = 4.0f; + } + + float basedamage = uint32(std::ceil(stats->BaseDamage[EXPANSION_WRATH_OF_THE_LICH_KING])); float creatureTypeMult = GetDamageModifier(rank); - float weaponBaseMinDamage = basedamage * multipliers->melee * creatureTypeMult; - float weaponBaseMaxDamage = basedamage * multipliers->melee * creatureTypeMult * 1.5; + float weaponBaseMinDamage = basedamage * cTemplateDmgMult * creatureTypeMult * multipliers->baseDamage; + float weaponBaseMaxDamage = weaponBaseMinDamage * 1.5f; creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, weaponBaseMinDamage); creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, weaponBaseMaxDamage); @@ -220,10 +232,15 @@ void MythicPlus::ScaleCreature(uint8 level, Creature* creature, MpMultipliers* m creature->SetBaseWeaponDamage(RANGED_ATTACK, MINDAMAGE, weaponBaseMinDamage); creature->SetBaseWeaponDamage(RANGED_ATTACK, MAXDAMAGE, weaponBaseMaxDamage); - 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); 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)); + creature->SetArmor(armor); + // 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); + + MpLogger::debug("Scaled creature reported base damage from {} to {}", creature->GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE), creature->GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE)); MpLogger::debug("Scaled creature {} armor to {}", creature->GetName(), creature->GetArmor()); } diff --git a/src/UnitScript.cpp b/src/UnitScript.cpp index dd25727..462ab92 100644 --- a/src/UnitScript.cpp +++ b/src/UnitScript.cpp @@ -74,14 +74,7 @@ public: // If the target is the enemy then increase the amount of healing by the instance data modifier for spell output. if(sMythicPlus->EligibleTarget(target)) { - if (!attacker->GetTypeId() == TYPEID_UNIT) { - return; - } - Creature* creature = attacker->ToCreature(); - if(!creature || !sMythicPlus->IsCreatureEligible(creature)) { - return; - } MpInstanceData* instanceData = sMpDataStore->GetInstanceData(map->GetId(), map->GetInstanceId()); if(!instanceData) { @@ -94,7 +87,6 @@ public: } else { damage = damage * instanceData->creature.melee; } - // MpLogger::debug("ModifyMeleeDamage: from {} to {}); ", origDamage, damage); } } diff --git a/src/WorldScript.cpp b/src/WorldScript.cpp index 14a14b7..d7538cb 100644 --- a/src/WorldScript.cpp +++ b/src/WorldScript.cpp @@ -25,6 +25,7 @@ public: sMythicPlus->mythicDungeonModifiers = { .health = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonHealth", 1.25f), .melee = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonMelee", 1.25f), + .baseDamage = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonBaseDamage", 1.5f), .spell = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonSpell", 1.15f), .armor = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonArmor", 1.25f), .avgLevel = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonAvgLevel", 83) @@ -33,6 +34,7 @@ public: sMythicPlus->mythicBossModifiers = { .health = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonBossHealth", 1.50f), .melee = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonBossMelee", 1.35f), + .baseDamage = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonBossBaseDamage", 2.0f), .spell = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonBossSpell", 1.25f), .armor = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonBossArmor", 1.35f), .avgLevel = sConfigMgr->GetOption("MythicPlus.Mythic.DungeonBossLevel", 85) @@ -42,6 +44,7 @@ public: sMythicPlus->legendaryDungeonModifiers = { .health = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonHealth", 2.25f), .melee = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonMelee", 2.25f), + .baseDamage = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonBaseDamage", 2.75f), .spell = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonSpell", 2.25f), .armor = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonArmor", 2.25f), .avgLevel = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonAvgLevel", 85) @@ -50,6 +53,7 @@ public: sMythicPlus->legendaryBossModifiers = { .health = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonBossHealth", 2.25f), .melee = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonBossMelee", 2.25f), + .baseDamage = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonBossBaseDamage", 4.0f), .spell = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonBossSpell", 2.25f), .armor = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonBossArmor", 3.25f), .avgLevel = sConfigMgr->GetOption("MythicPlus.Legendary.DungeonBossLevel", 87) @@ -58,6 +62,7 @@ public: sMythicPlus->ascendantDungeonModifiers = { .health = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonHealth", 3.25f), .melee = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonMelee", 3.25f), + .baseDamage = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonBaseDamage", 4.75f), .spell = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonSpell", 3.25f), .armor = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonArmor", 3.25f), .avgLevel = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonAvgLevel", 87) @@ -66,6 +71,7 @@ public: sMythicPlus->ascendantBossModifiers = { .health = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonBossHealth", 3.25f), .melee = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonBossMelee", 3.25f), + .baseDamage = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonBossBaseDamage", 6.0f), .spell = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonBossSpell", 3.25f), .armor = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonBossArmor", 3.25f), .avgLevel = sConfigMgr->GetOption("MythicPlus.Ascendant.DungeonBossLevel", 90)