alpha seems to be working

This commit is contained in:
2024-09-27 00:48:08 -04:00
parent 5815d20c1c
commit 6356d975d8
4 changed files with 39 additions and 22 deletions

View File

@@ -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) + " }";

View File

@@ -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());
}

View File

@@ -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);
}
}

View File

@@ -25,6 +25,7 @@ public:
sMythicPlus->mythicDungeonModifiers = {
.health = sConfigMgr->GetOption<float>("MythicPlus.Mythic.DungeonHealth", 1.25f),
.melee = sConfigMgr->GetOption<float>("MythicPlus.Mythic.DungeonMelee", 1.25f),
.baseDamage = sConfigMgr->GetOption<float>("MythicPlus.Mythic.DungeonBaseDamage", 1.5f),
.spell = sConfigMgr->GetOption<float>("MythicPlus.Mythic.DungeonSpell", 1.15f),
.armor = sConfigMgr->GetOption<float>("MythicPlus.Mythic.DungeonArmor", 1.25f),
.avgLevel = sConfigMgr->GetOption<uint8>("MythicPlus.Mythic.DungeonAvgLevel", 83)
@@ -33,6 +34,7 @@ public:
sMythicPlus->mythicBossModifiers = {
.health = sConfigMgr->GetOption<float>("MythicPlus.Mythic.DungeonBossHealth", 1.50f),
.melee = sConfigMgr->GetOption<float>("MythicPlus.Mythic.DungeonBossMelee", 1.35f),
.baseDamage = sConfigMgr->GetOption<float>("MythicPlus.Mythic.DungeonBossBaseDamage", 2.0f),
.spell = sConfigMgr->GetOption<float>("MythicPlus.Mythic.DungeonBossSpell", 1.25f),
.armor = sConfigMgr->GetOption<float>("MythicPlus.Mythic.DungeonBossArmor", 1.35f),
.avgLevel = sConfigMgr->GetOption<uint8>("MythicPlus.Mythic.DungeonBossLevel", 85)
@@ -42,6 +44,7 @@ public:
sMythicPlus->legendaryDungeonModifiers = {
.health = sConfigMgr->GetOption<float>("MythicPlus.Legendary.DungeonHealth", 2.25f),
.melee = sConfigMgr->GetOption<float>("MythicPlus.Legendary.DungeonMelee", 2.25f),
.baseDamage = sConfigMgr->GetOption<float>("MythicPlus.Legendary.DungeonBaseDamage", 2.75f),
.spell = sConfigMgr->GetOption<float>("MythicPlus.Legendary.DungeonSpell", 2.25f),
.armor = sConfigMgr->GetOption<float>("MythicPlus.Legendary.DungeonArmor", 2.25f),
.avgLevel = sConfigMgr->GetOption<uint8>("MythicPlus.Legendary.DungeonAvgLevel", 85)
@@ -50,6 +53,7 @@ public:
sMythicPlus->legendaryBossModifiers = {
.health = sConfigMgr->GetOption<float>("MythicPlus.Legendary.DungeonBossHealth", 2.25f),
.melee = sConfigMgr->GetOption<float>("MythicPlus.Legendary.DungeonBossMelee", 2.25f),
.baseDamage = sConfigMgr->GetOption<float>("MythicPlus.Legendary.DungeonBossBaseDamage", 4.0f),
.spell = sConfigMgr->GetOption<float>("MythicPlus.Legendary.DungeonBossSpell", 2.25f),
.armor = sConfigMgr->GetOption<float>("MythicPlus.Legendary.DungeonBossArmor", 3.25f),
.avgLevel = sConfigMgr->GetOption<uint8>("MythicPlus.Legendary.DungeonBossLevel", 87)
@@ -58,6 +62,7 @@ public:
sMythicPlus->ascendantDungeonModifiers = {
.health = sConfigMgr->GetOption<float>("MythicPlus.Ascendant.DungeonHealth", 3.25f),
.melee = sConfigMgr->GetOption<float>("MythicPlus.Ascendant.DungeonMelee", 3.25f),
.baseDamage = sConfigMgr->GetOption<float>("MythicPlus.Ascendant.DungeonBaseDamage", 4.75f),
.spell = sConfigMgr->GetOption<float>("MythicPlus.Ascendant.DungeonSpell", 3.25f),
.armor = sConfigMgr->GetOption<float>("MythicPlus.Ascendant.DungeonArmor", 3.25f),
.avgLevel = sConfigMgr->GetOption<uint8>("MythicPlus.Ascendant.DungeonAvgLevel", 87)
@@ -66,6 +71,7 @@ public:
sMythicPlus->ascendantBossModifiers = {
.health = sConfigMgr->GetOption<float>("MythicPlus.Ascendant.DungeonBossHealth", 3.25f),
.melee = sConfigMgr->GetOption<float>("MythicPlus.Ascendant.DungeonBossMelee", 3.25f),
.baseDamage = sConfigMgr->GetOption<float>("MythicPlus.Ascendant.DungeonBossBaseDamage", 6.0f),
.spell = sConfigMgr->GetOption<float>("MythicPlus.Ascendant.DungeonBossSpell", 3.25f),
.armor = sConfigMgr->GetOption<float>("MythicPlus.Ascendant.DungeonBossArmor", 3.25f),
.avgLevel = sConfigMgr->GetOption<uint8>("MythicPlus.Ascendant.DungeonBossLevel", 90)