mirror of
https://github.com/araxiaonline/mod-mythic-plus.git
synced 2026-06-13 03:02:24 -04:00
Added new AP fixes and working on healing fixes for enemy creature
This commit is contained in:
@@ -23,21 +23,20 @@ public:
|
||||
{
|
||||
{"", HandleHelp, SEC_PLAYER, Console::No},
|
||||
{"status", HandleStatus, SEC_PLAYER, Console::No},
|
||||
{"showstats", HandleDebug, SEC_PLAYER, Console::No},
|
||||
// {"mythic",HandleMythic, SEC_PLAYER, Console::No},
|
||||
// {"legendary",HandleLegendary, SEC_PLAYER, Console::No},
|
||||
// {"ascendant",HandleAscendant, SEC_PLAYER, Console::No},
|
||||
{"set", HandleSetDifficulty, SEC_PLAYER, Console::No},
|
||||
{"update", HandleUpdate, SEC_GAMEMASTER,Console::No },
|
||||
{"disable", HandleDisable, SEC_ADMINISTRATOR, Console::Yes},
|
||||
{"enable", HandleEnable, SEC_ADMINISTRATOR, Console::Yes}
|
||||
{"enable", HandleEnable, SEC_ADMINISTRATOR, Console::Yes},
|
||||
{"change melee", HandleChangeMelee, SEC_ADMINISTRATOR, Console::Yes},
|
||||
{"change spell", HandleChangeSpell, SEC_ADMINISTRATOR, Console::Yes},
|
||||
{"change health", HandleChangeHealth, SEC_ADMINISTRATOR, Console::Yes}
|
||||
};
|
||||
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{"mp", commandTableMain},
|
||||
{"mythicplus", commandTableMain},
|
||||
{"mp debug", HandleDebug, SEC_PLAYER, Console::No}
|
||||
{"mp debug", HandleDebug, SEC_PLAYER, Console::No},
|
||||
{"mp reload", HandleReload, SEC_GAMEMASTER, Console::No}
|
||||
};
|
||||
|
||||
return commandTable;
|
||||
@@ -54,7 +53,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleUpdate(ChatHandler* handler, const std::vector<std::string>& /*args*/)
|
||||
static bool HandleReload(ChatHandler* handler)
|
||||
{
|
||||
sMpDataStore->LoadScaleFactors();
|
||||
handler->PSendSysMessage("Mythic+ scale factors updated.");
|
||||
@@ -62,7 +61,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDebug(ChatHandler* handler, const std::vector<std::string>& /* args */)
|
||||
static bool HandleDebug(ChatHandler* handler)
|
||||
{
|
||||
|
||||
Creature* target = handler->getSelectedCreature();
|
||||
@@ -72,6 +71,8 @@ public:
|
||||
}
|
||||
|
||||
CreatureTemplate const* creatureTemplate = target->GetCreatureTemplate();
|
||||
MpCreatureData* creatureData = sMpDataStore->GetCreatureData(target->GetGUID());
|
||||
|
||||
|
||||
handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->GetLevel());
|
||||
handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
|
||||
@@ -92,6 +93,10 @@ public:
|
||||
handler->PSendSysMessage("Armor {}", target->GetArmor());
|
||||
handler->PSendSysMessage("Damage Modifier on template {}",creatureTemplate->DamageModifier);
|
||||
|
||||
if(creatureData) {
|
||||
handler->PSendSysMessage("CreatureData: {}", creatureData->ToString());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
@@ -176,6 +181,9 @@ public:
|
||||
{
|
||||
Player* player = handler->GetPlayer();
|
||||
|
||||
Map* map = player->GetMap();
|
||||
uint32 mapId = player->GetMapId();
|
||||
|
||||
std::string status = Acore::StringFormat(
|
||||
"Mythic+ Status:\n"
|
||||
" Mythic+ Enabled: %s\n"
|
||||
@@ -188,11 +196,20 @@ public:
|
||||
if (player->GetGroup()) {
|
||||
auto groupData = sMpDataStore->GetGroupData(player->GetGroup()->GetGUID());
|
||||
if (groupData) {
|
||||
MpScaleFactor scaleFactors;
|
||||
|
||||
if(map->IsDungeon()) {
|
||||
scaleFactors = sMpDataStore->GetScaleFactor(mapId, groupData->difficulty);
|
||||
}
|
||||
|
||||
status += Acore::StringFormat(
|
||||
" Group Difficulty: %u\n"
|
||||
" Group Deaths: %u\n",
|
||||
" Group Deaths: %u\n"
|
||||
" Scale FactorStr %s\n",
|
||||
groupData->difficulty,
|
||||
groupData->deaths);
|
||||
groupData->deaths,
|
||||
scaleFactors.ToString()
|
||||
);
|
||||
} else {
|
||||
status += " Group Difficulty: Not Set\n";
|
||||
}
|
||||
@@ -202,6 +219,38 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleReScale(ChatHandler* handler)
|
||||
{
|
||||
|
||||
Creature* creature = handler->getSelectedCreature();
|
||||
if(!creature) {
|
||||
handler->PSendSysMessage("You must select a creature to rescale.");
|
||||
return true;
|
||||
}
|
||||
|
||||
MpCreatureData* creatureData = sMpDataStore->GetCreatureData(creature->GetGUID());
|
||||
if(!creatureData) {
|
||||
handler->PSendSysMessage("Creature is not eligible for rescaling.");
|
||||
return true;
|
||||
}
|
||||
|
||||
auto instanceData = sMpDataStore->GetInstanceData(creature->GetMapId(), creature->GetInstanceId());
|
||||
if(!instanceData) {
|
||||
handler->PSendSysMessage("No instance data found for this creature.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(creature->IsDungeonBoss() || creature->GetEntry() == 23682) {
|
||||
sMythicPlus->ScaleCreature(creature->GetLevel(), creature, &instanceData->boss, instanceData->difficulty);
|
||||
} else {
|
||||
sMythicPlus->ScaleCreature(creature->GetLevel(), creature, &instanceData->creature, instanceData->difficulty);
|
||||
}
|
||||
|
||||
handler->PSendSysMessage("Creature rescaled: %s", creature->GetName());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDisable(ChatHandler* handler)
|
||||
{
|
||||
MpLogger::debug("HandleDisable()");
|
||||
@@ -218,6 +267,45 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleChangeMelee(ChatHandler* handler, const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.empty()) {
|
||||
handler->PSendSysMessage("|cFFFF0000 You must specify a value to set the melee scale factor.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
uint32 value = std::stoi(args[0]);
|
||||
sMpDataStore->SetDamageScaleFactor(player->GetMapId(), player->GetMap()->GetInstanceId(), value);
|
||||
}
|
||||
|
||||
static bool HandleChangeSpell(ChatHandler* handler, const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.empty()) {
|
||||
handler->PSendSysMessage("|cFFFF0000 You must specify a value to set the spell scale factor.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
uint32 value = std::stoi(args[0]);
|
||||
sMpDataStore->SetSpellScaleFactor(player->GetMapId(), player->GetMap()->GetInstanceId(), value);
|
||||
}
|
||||
|
||||
static bool HandleChangeHealth(ChatHandler* handler, const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.empty()) {
|
||||
handler->PSendSysMessage("|cFFFF0000 You must specify a value to set the health scale factor.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
uint32 value = std::stoi(args[0]);
|
||||
sMpDataStore->SetHealthScaleFactor(player->GetMapId(), player->GetMap()->GetInstanceId(), value);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void Add_MP_CommandScripts()
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
#include "BaseCreatureHandler.h"
|
||||
#include "Spell.h"
|
||||
// #include "BaseCreatureHandler.h"
|
||||
// #include "Spell.h"
|
||||
|
||||
/**
|
||||
* Bazzalan need some upgrades so made him more formidable
|
||||
*/
|
||||
class Ragefire_Bazzalan_Mythic : public BaseCreatureHandler
|
||||
{
|
||||
public:
|
||||
Ragefire_Bazzalan_Mythic() : BaseCreatureHandler(11519) {}
|
||||
// /**
|
||||
// * Bazzalan need some upgrades so made him more formidable
|
||||
// */
|
||||
// class Ragefire_Bazzalan_Mythic : public BaseCreatureHandler
|
||||
// {
|
||||
// public:
|
||||
// Ragefire_Bazzalan_Mythic() : BaseCreatureHandler(11519) {}
|
||||
|
||||
|
||||
void OnAddToInstance(Creature* creature) override {
|
||||
// void OnAddToInstance(Creature* creature) override {
|
||||
|
||||
uint32 health = creature->GetMaxHealth() * 2;
|
||||
creature->SetCreateHealth(health);
|
||||
creature->SetMaxHealth(health);
|
||||
creature->SetHealth(health);
|
||||
creature->ResetPlayerDamageReq();
|
||||
creature->SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health);
|
||||
// uint32 health = creature->GetMaxHealth() * 2;
|
||||
// creature->SetCreateHealth(health);
|
||||
// creature->SetMaxHealth(health);
|
||||
// creature->SetHealth(health);
|
||||
// creature->ResetPlayerDamageReq();
|
||||
// creature->SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health);
|
||||
|
||||
creature->AddExtraAttacks(3);
|
||||
creature->SetObjectScale(2.0f);
|
||||
// creature->AddExtraAttacks(3);
|
||||
// creature->SetObjectScale(2.0f);
|
||||
|
||||
}
|
||||
};
|
||||
// }
|
||||
// };
|
||||
|
||||
@@ -159,7 +159,30 @@ int32 MpDataStore::GetMaxDamageScaleFactor(int32 mapId, int32 difficulty) const
|
||||
return GetScaleFactor(mapId, difficulty).maxDamageBonus;
|
||||
}
|
||||
|
||||
void MpDataStore::SetHealthScaleFactor(int32 mapId, int32 difficulty, int32 newValue) {
|
||||
auto key = GetScaleFactorKey(mapId, difficulty);
|
||||
if (_scaleFactors->contains(key)) {
|
||||
_scaleFactors->at(key).healthBonus = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
void MpDataStore::SetDamageScaleFactor(int32 mapId, int32 difficulty, int32 newValue) {
|
||||
auto key = GetScaleFactorKey(mapId, difficulty);
|
||||
if (_scaleFactors->contains(key)) {
|
||||
_scaleFactors->at(key).dmgBonus = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
void MpDataStore::SetSpellScaleFactor(int32 mapId, int32 difficulty, int32 newValue) {
|
||||
auto key = GetScaleFactorKey(mapId, difficulty);
|
||||
if (_scaleFactors->contains(key)) {
|
||||
_scaleFactors->at(key).spellBonus = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
int32 MpDataStore::LoadScaleFactors() {
|
||||
_scaleFactors->clear();
|
||||
|
||||
// 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) {
|
||||
@@ -183,12 +206,9 @@ int32 MpDataStore::LoadScaleFactors() {
|
||||
.maxDamageBonus = maxDamageBonus
|
||||
};
|
||||
|
||||
_mutableScaleFactors->emplace(GetScaleFactorKey(mapId, difficulty), scaleFactor);
|
||||
_scaleFactors->emplace(GetScaleFactorKey(mapId, difficulty), scaleFactor);
|
||||
|
||||
} while (result->NextRow());
|
||||
|
||||
// move to const map one loaded so can not be changed after
|
||||
_scaleFactors = std::move(_mutableScaleFactors);
|
||||
|
||||
return int32(_scaleFactors->size());
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define MYTHICPLUS_DATASTORE_H
|
||||
|
||||
#include "Creature.h"
|
||||
// #include "CreatureOverride.h"
|
||||
#include "Group.h"
|
||||
#include "MapMgr.h"
|
||||
#include "Player.h"
|
||||
@@ -112,8 +113,6 @@ struct MpInstanceData
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Simple struct for managing information about creatures that
|
||||
* are in a mythic+ instance.
|
||||
@@ -123,8 +122,15 @@ struct MpCreatureData
|
||||
Creature* creature;
|
||||
bool scaled;
|
||||
|
||||
// AttackPower calculated based on settings
|
||||
uint32 NewAttackPower;
|
||||
|
||||
// New Scaling Multiplier based on database factors + level growth formula
|
||||
float AttackPowerScaleMultiplier;
|
||||
|
||||
// Original information about the creature that was altered.
|
||||
uint8 originalLevel;
|
||||
|
||||
CreatureBaseStats const* originalStats;
|
||||
MpDifficulty difficulty;
|
||||
|
||||
@@ -159,6 +165,30 @@ struct MpCreatureData
|
||||
return scaled;
|
||||
}
|
||||
|
||||
std::string ToString() const {
|
||||
|
||||
std::string origStatsStr;
|
||||
if(originalStats) {
|
||||
uint32 health = *originalStats->BaseHealth;
|
||||
uint32 mana = originalStats->BaseMana;
|
||||
uint32 armor = originalStats->BaseArmor;
|
||||
uint32 ap = originalStats->AttackPower;
|
||||
|
||||
origStatsStr = "Original Stats: \n Health: " + std::to_string(health) + "\n" +
|
||||
"Mana: " + std::to_string(mana) + "\n" +
|
||||
"Armor: " + std::to_string(armor) + "\n" +
|
||||
"Attack Power: " + std::to_string(ap) + "\n";
|
||||
|
||||
} else {
|
||||
origStatsStr = "Original Stats Display Failed: \n Did you select target or in an non-scaled instance? \n";
|
||||
}
|
||||
|
||||
return " MpCreatureData: \n Original level: " + std::to_string(originalLevel) + "\n" +
|
||||
origStatsStr +
|
||||
" Difficulty: " + std::to_string(difficulty) + "\n" +
|
||||
" Scaled: " + (scaled ? "true" : "false") + "\n";
|
||||
}
|
||||
|
||||
/**@todo Add Affixes and Aura Spell methods */
|
||||
};
|
||||
|
||||
@@ -169,7 +199,7 @@ private:
|
||||
_instanceData(std::make_unique<std::map<std::pair<uint32, uint32>, MpInstanceData>>()),
|
||||
_groupData(std::make_unique<std::unordered_map<ObjectGuid, MpGroupData>>()),
|
||||
_instanceCreatureData(std::make_unique<std::unordered_map<ObjectGuid, MpCreatureData>>()),
|
||||
_mutableScaleFactors(std::make_unique<std::map<std::pair<int32, int32>,MpScaleFactor>>())
|
||||
_scaleFactors(std::make_unique<std::map<std::pair<int32, int32>,MpScaleFactor>>())
|
||||
{
|
||||
_playerData->reserve(32);
|
||||
_groupData->reserve(32);
|
||||
@@ -190,9 +220,10 @@ private:
|
||||
std::unique_ptr<std::unordered_map<ObjectGuid, MpCreatureData>> _instanceCreatureData;
|
||||
|
||||
// use to mimic pattern normals scale to heroic (loaded at server start)
|
||||
std::unique_ptr<std::map<std::pair<int32,int32>,MpScaleFactor>> _mutableScaleFactors; // {mapId,difficulty}
|
||||
std::unique_ptr<const std::map<std::pair<int32,int32>,MpScaleFactor>> _scaleFactors; // {mapId,difficulty}
|
||||
std::unique_ptr<std::map<std::pair<int32,int32>,MpScaleFactor>> _scaleFactors; // {mapId,difficulty}
|
||||
|
||||
// Single creature multipliers used to scale creatures individually that may need tuned up or down.
|
||||
// std::unique_ptr<std::unordered_map<uint32, CreatureOverride>> _creatureOverrides;
|
||||
|
||||
public:
|
||||
|
||||
@@ -248,6 +279,14 @@ public:
|
||||
int32 GetSpellScaleFactor(int32 mapId, int32 difficulty) const;
|
||||
MpScaleFactor GetScaleFactor(int32 mapId, int32 difficulty) const;
|
||||
|
||||
void SetDamageScaleFactor(int32 mapId, int32 difficulty, int32 value);
|
||||
void SetHealthScaleFactor(int32 mapId, int32 difficulty, int32 value);
|
||||
void SetSpellScaleFactor(int32 mapId, int32 difficulty, int32 value);
|
||||
|
||||
// Individual Creature Scaling Multipliers
|
||||
// void AddCreatureOverride(uint32 entry, CreatureOverride* override);
|
||||
// MpMultipliers* GetCreatureOverride(uint32 entry);
|
||||
|
||||
auto GetInstanceDataKey(uint32 mapId, uint32 instanceId) const {
|
||||
return std::make_pair(mapId, instanceId);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
// Special case for Headless Horseman Event
|
||||
const uint32 HEADLESS_HORSEMAN = 23682;
|
||||
|
||||
bool MythicPlus::IsMapEligible(Map* map)
|
||||
{
|
||||
if (!Enabled) {
|
||||
@@ -173,6 +176,7 @@ void MythicPlus::AddCreatureForScaling(Creature* creature)
|
||||
void MythicPlus::AddScaledCreature(Creature* creature, MpInstanceData* instanceData)
|
||||
{
|
||||
MpCreatureData creatureData = MpCreatureData(creature);
|
||||
sMpDataStore->AddCreatureData(creature->GetGUID(), creatureData);
|
||||
|
||||
// allow small variance in level for non-boss creatures
|
||||
uint8 level = uint8(urand(instanceData->creature.avgLevel - 1, instanceData->creature.avgLevel + 1));
|
||||
@@ -206,7 +210,6 @@ void MythicPlus::AddScaledCreature(Creature* creature, MpInstanceData* instanceD
|
||||
|
||||
creatureData.SetScaled(true);
|
||||
creatureData.SetDifficulty(instanceData->difficulty);
|
||||
sMpDataStore->AddCreatureData(creature->GetGUID(), creatureData);
|
||||
|
||||
// MpLogger::debug("Scaled Creature {} Entry {} Id {} level from {} to {}",
|
||||
// creature->GetName(),
|
||||
@@ -249,7 +252,7 @@ void MythicPlus::ScaleCreature(uint8 level, Creature* creature, MpMultipliers* m
|
||||
);
|
||||
|
||||
uint32 basehp = stats->BaseHealth[EXPANSION_WRATH_OF_THE_LICH_KING];
|
||||
uint32 health = CalculateNewHealth(cInfo, mapId, difficulty, basehp, multipliers->health);
|
||||
uint32 health = CalculateNewHealth(creature, cInfo, mapId, difficulty, basehp, multipliers->health);
|
||||
|
||||
creature->SetCreateHealth(health);
|
||||
creature->SetMaxHealth(health);
|
||||
@@ -279,35 +282,40 @@ void MythicPlus::ScaleCreature(uint8 level, Creature* creature, MpMultipliers* m
|
||||
meleeDamage *= 1.15;
|
||||
|
||||
// Give the boss an increase in casting speed.
|
||||
creature->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.30f);
|
||||
creature->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.20f);
|
||||
}
|
||||
|
||||
// Calculate the level difference
|
||||
float levelDifference = creature->GetLevel() - origLevel;
|
||||
|
||||
// New formula with adjusted divisor for smoother scaling
|
||||
float scalingFactor = 1 + (std::log2(levelDifference + 1) * (float(meleeDamage) / 30.0f));
|
||||
float scalingFactor = 1 + (std::log2(levelDifference + 1) * (float(meleeDamage)));
|
||||
|
||||
|
||||
uint32 ap = uint32(sMythicPlus->meleeAttackPowerStart - sMythicPlus->meleeAttackPowerDampener * log(cInfo->DamageModifier));
|
||||
uint32 ap = uint32(sMythicPlus->meleeAttackPowerStart - sMythicPlus->meleeAttackPowerDampener);
|
||||
uint32 rangeAp = irand(215, 357);
|
||||
|
||||
if(cInfo->unit_class == UNIT_CLASS_MAGE) {
|
||||
ap = ap * 0.6f;
|
||||
}
|
||||
|
||||
|
||||
if(cInfo->unit_class == UNIT_CLASS_WARRIOR) {
|
||||
ap = ap * 1.2f;
|
||||
}
|
||||
|
||||
if(cInfo->unit_class == UNIT_CLASS_ROGUE) {
|
||||
ap = ap * 1.5f;
|
||||
ap = ap * 1.4f;
|
||||
}
|
||||
|
||||
MpCreatureData* creatureData = sMpDataStore->GetCreatureData(creature->GetGUID());
|
||||
if(creatureData) {
|
||||
creatureData->NewAttackPower = ap;
|
||||
creatureData->AttackPowerScaleMultiplier = scalingFactor;
|
||||
}
|
||||
|
||||
// Set scaled attack power
|
||||
creature->SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, ap + stats->AttackPower * scalingFactor);
|
||||
creature->SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, rangeAp + stats->RangedAttackPower * scalingFactor);
|
||||
creature->SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, (ap * scalingFactor) + stats->AttackPower);
|
||||
creature->SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, (rangeAp * scalingFactor) + stats->RangedAttackPower);
|
||||
|
||||
// set the base weapon damage
|
||||
creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, stats->BaseDamage[EXPANSION_WRATH_OF_THE_LICH_KING], 0);
|
||||
@@ -320,7 +328,6 @@ void MythicPlus::ScaleCreature(uint8 level, Creature* creature, MpMultipliers* m
|
||||
uint32 armor = uint32(std::ceil(stats->BaseArmor * multipliers->armor * cInfo->ModArmor));
|
||||
creature->SetArmor(armor);
|
||||
|
||||
// ap = pow(float((creature->GetLevel() - origLevel) / 5), 1.8f) * 1000
|
||||
}
|
||||
|
||||
int32 MythicPlus::ScaleDamageSpell(SpellInfo const * spellInfo, uint32 damage, MpCreatureData* creatureData, Creature* creature, Unit* target, float damageMultiplier)
|
||||
@@ -338,7 +345,7 @@ int32 MythicPlus::ScaleDamageSpell(SpellInfo const * spellInfo, uint32 damage, M
|
||||
if(creature->IsTotem()) {
|
||||
Unit* owner = creature->GetOwner();
|
||||
if(owner) {
|
||||
float lvlDmgBonus = float(85 - owner->GetLevel() / 5.0f);
|
||||
float lvlDmgBonus = float(85 - owner->GetLevel() / 10.0f);
|
||||
return int32(damage * lvlDmgBonus * damageMultiplier);
|
||||
} else {
|
||||
return damage * damageMultiplier;
|
||||
@@ -358,7 +365,7 @@ int32 MythicPlus::ScaleDamageSpell(SpellInfo const * spellInfo, uint32 damage, M
|
||||
|
||||
MpInstanceData *instanceData = sMpDataStore->GetInstanceData(creature->GetMapId(), creature->GetInstanceId());
|
||||
int32 spellBonus = sMpDataStore->GetSpellScaleFactor(creature->GetMapId(), instanceData->difficulty);
|
||||
if(creature->IsDungeonBoss() || creature->GetEntry() == 23682) {
|
||||
if((creature->IsDungeonBoss() && creature->isElite()) || creature->GetEntry() == 23682) {
|
||||
spellBonus *= 1.15;
|
||||
}
|
||||
|
||||
@@ -366,7 +373,7 @@ int32 MythicPlus::ScaleDamageSpell(SpellInfo const * spellInfo, uint32 damage, M
|
||||
float levelDifference = creature->GetLevel() - originalLevel;
|
||||
|
||||
// New formula with adjusted divisor for smoother scaling
|
||||
float scalingFactor = 1 + (std::log2(levelDifference + 1) * (float(spellBonus) / 10.0f));
|
||||
float scalingFactor = 1 + (std::log2(levelDifference + 1) * (float(spellBonus)));
|
||||
|
||||
// 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);
|
||||
@@ -425,8 +432,9 @@ int32 MythicPlus::ScaleDamageSpell(SpellInfo const * spellInfo, uint32 damage, M
|
||||
return totalDamage;
|
||||
}
|
||||
|
||||
int32 MythicPlus::ScaleHealSpell(SpellInfo const * spellInfo, MpCreatureData* creatureData, Creature* creature, Creature* target, float healMultiplier)
|
||||
int32 MythicPlus::ScaleHealSpell(SpellInfo const * spellInfo, uint32 heal, MpCreatureData* creatureData, Creature* creature, Creature* target, float healMultiplier)
|
||||
{
|
||||
|
||||
if (!spellInfo) {
|
||||
MpLogger::error("Invalid spell info ScaleHealSpell()");
|
||||
return 0;
|
||||
@@ -442,26 +450,34 @@ int32 MythicPlus::ScaleHealSpell(SpellInfo const * spellInfo, MpCreatureData* cr
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto effects = spellInfo->GetEffects();
|
||||
for (uint8 i = 0; i < effects.size(); ++i)
|
||||
{
|
||||
SpellEffectInfo effect = effects[i];
|
||||
MpLogger::debug(" >>> Spell {} effect {} value: {} by creature {}", spellInfo->SpellName[i], effects[i].Effect, heal, creature->GetName());
|
||||
MpLogger::debug(" >>>>> Spell is Aura {}", (effect.IsAura() ? "true" : "false"));
|
||||
}
|
||||
|
||||
if(!target) {
|
||||
MpLogger::error("Invalid target ScaleHealSpell()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32 originalHp = creatureData->originalStats->BaseHealth[EXPANSION_WRATH_OF_THE_LICH_KING];
|
||||
int32 currentHealth = creature->GetHealth();
|
||||
int32 totalHeal = 0;
|
||||
// int32 originalHp = creatureData->originalStats->BaseHealth[EXPANSION_WRATH_OF_THE_LICH_KING];
|
||||
// int32 currentHealth = creature->GetHealth();
|
||||
// int32 totalHeal = 0;
|
||||
|
||||
auto effects = spellInfo->GetEffects();
|
||||
// Loop through all spell effects to scale their base healing
|
||||
for (uint8 i = 0; i < effects.size(); ++i)
|
||||
{
|
||||
SpellEffectInfo effect = effects[i];
|
||||
totalHeal += effect.CalcValue(creature, nullptr, target);
|
||||
}
|
||||
// auto effects = spellInfo->GetEffects();
|
||||
// // Loop through all spell effects to scale their base healing
|
||||
// for (uint8 i = 0; i < effects.size(); ++i)
|
||||
// {
|
||||
// SpellEffectInfo effect = effects[i];
|
||||
// totalHeal += effect.CalcValue(creature, nullptr, target);
|
||||
// }
|
||||
|
||||
// Apply scaling factor and the set multiplier from the instance data
|
||||
// MpLogger::debug("Spell healing scaled from for spell New Damage: {}", totalHeal);
|
||||
return pow((totalHeal / originalHp) * currentHealth, 0.8f) * healMultiplier;
|
||||
// // Apply scaling factor and the set multiplier from the instance data
|
||||
// // MpLogger::debug("Spell healing scaled from for spell New Damage: {}", totalHeal);
|
||||
// return pow((totalHeal / originalHp) * currentHealth, 0.8f) * healMultiplier;
|
||||
}
|
||||
|
||||
|
||||
@@ -488,19 +504,38 @@ float GetTypeHealthModifier(int32 Rank)
|
||||
}
|
||||
|
||||
// This takes the orignal health and scales flat based on the factor then applies the configuration modifier from the conf file
|
||||
uint32 CalculateNewHealth(CreatureTemplate const* cInfo, uint32 mapId, MpDifficulty difficulty, uint32 origHealth, float confHPMod)
|
||||
uint32 CalculateNewHealth(Creature* creature, CreatureTemplate const* cInfo, uint32 mapId, MpDifficulty difficulty, uint32 origHealth, float confHPMod)
|
||||
{
|
||||
int32 rank = 0;
|
||||
if(cInfo && cInfo->rank > 0) {
|
||||
rank = cInfo->rank;
|
||||
}
|
||||
|
||||
float healthVariation;
|
||||
|
||||
if(creature->IsPet() || creature->IsSummon() || creature->IsTotem()) {
|
||||
return origHealth;
|
||||
}
|
||||
|
||||
int32 hpScaleFactor = sMpDataStore->GetHealthScaleFactor(mapId, difficulty);
|
||||
|
||||
// Add some variance to the healthpool so enemies are not all the same
|
||||
float healthVariation = frand(0.85f, 1.15f);
|
||||
if(creature->IsDungeonBoss() || creature->GetEntry() == HEADLESS_HORSEMAN || creature->isWorldBoss()) { // Is a boss of some kind
|
||||
healthVariation = frand(1.1f, 1.2f);
|
||||
} else if(creature->isElite() || cInfo->rank == CREATURE_ELITE_RARE) { // Is Elite Mob
|
||||
healthVariation = frand(1.0f, 1.10f);
|
||||
hpScaleFactor *= 0.90;
|
||||
} else if(creature->IsSummon() || creature->IsPet() || creature->IsTotem()) { // Is a pet or summon
|
||||
healthVariation = frand(1.0f, 1.05f);
|
||||
hpScaleFactor *= 0.35;
|
||||
} else {
|
||||
healthVariation = frand(1.0f, 1.1f);
|
||||
hpScaleFactor *= 0.45;
|
||||
}
|
||||
|
||||
float unitTypeMod = GetTypeHealthModifier(rank);
|
||||
uint32 basehp = uint32(std::ceil(origHealth * unitTypeMod * healthVariation));
|
||||
|
||||
int32 hpScaleFactor = sMpDataStore->GetHealthScaleFactor(mapId, difficulty);
|
||||
if(cInfo->ModHealth > 0.0f) {
|
||||
return uint32(basehp * (cInfo->ModHealth + hpScaleFactor) * confHPMod);
|
||||
} else {
|
||||
@@ -526,3 +561,4 @@ float GetTypeDamageModifier(int32 Rank)
|
||||
return sWorld->getRate(RATE_CREATURE_ELITE_ELITE_DAMAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
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);
|
||||
int32 ScaleHealSpell(SpellInfo const * spellInfo, uint32 heal, MpCreatureData* creatureData, Creature* creature, Creature* target, float healMultiplier);
|
||||
|
||||
private:
|
||||
MythicPlus() { }
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
|
||||
float GetTypeHealthModifier(int32 rank);
|
||||
float GetTypeDamageModifier(int32 rank);
|
||||
uint32 CalculateNewHealth(CreatureTemplate const* cInfo, uint32 mapId, MpDifficulty difficulty, uint32 origHealth, float confHPMod);
|
||||
uint32 CalculateNewHealth(Creature* creature, CreatureTemplate const* cInfo, uint32 mapId, MpDifficulty difficulty, uint32 origHealth, float confHPMod);
|
||||
float CalculateNewBaseDamage(CreatureTemplate const* cInfo, uint32 mapId, MpDifficulty difficulty, float origDamage);
|
||||
|
||||
#define sMythicPlus MythicPlus::instance()
|
||||
|
||||
@@ -29,7 +29,7 @@ void Addmod_mythic_plusScripts()
|
||||
Add_MP_UnitScripts();
|
||||
Add_MP_WorldScripts();
|
||||
|
||||
new Ragefire_Bazzalan_Mythic();
|
||||
// new Ragefire_Bazzalan_Mythic();
|
||||
|
||||
// list of boss / creature event handlers
|
||||
// new Ragefire_Bazzalan_Mythic(RAGEFIRE_BAZZALAN);
|
||||
|
||||
@@ -166,7 +166,6 @@ public:
|
||||
break;
|
||||
case MythicPlus::UNIT_EVENT_DOT:
|
||||
case MythicPlus::UNIT_EVENT_SPELL:
|
||||
case MythicPlus::UNIT_EVENT_HOT:
|
||||
if(creature->IsDungeonBoss() || creature->GetEntry() == 23682) {
|
||||
if(spellInfo) {
|
||||
alteredDmgHeal = sMythicPlus->ScaleDamageSpell(spellInfo, damageOrHeal, sMpDataStore->GetCreatureData(attacker->GetGUID()), creature, target, instanceData->boss.spell);
|
||||
@@ -188,6 +187,7 @@ public:
|
||||
}
|
||||
break;
|
||||
case MythicPlus::UNIT_EVENT_HEAL:
|
||||
case MythicPlus::UNIT_EVENT_HOT:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -199,13 +199,13 @@ public:
|
||||
bool isHeal = true;
|
||||
if(creature->IsDungeonBoss()) {
|
||||
if(spellInfo) {
|
||||
alteredDmgHeal = sMythicPlus->ScaleHealSpell(spellInfo, sMpDataStore->GetCreatureData(attacker->GetGUID()), creature, attacker->ToCreature(), instanceData->boss.spell);
|
||||
alteredDmgHeal = sMythicPlus->ScaleHealSpell(spellInfo, damageOrHeal, sMpDataStore->GetCreatureData(attacker->GetGUID()), creature, attacker->ToCreature(), instanceData->boss.spell);
|
||||
} else {
|
||||
alteredDmgHeal = damageOrHeal * instanceData->boss.spell;
|
||||
}
|
||||
} else {
|
||||
if(spellInfo) {
|
||||
alteredDmgHeal = sMythicPlus->ScaleHealSpell(spellInfo, sMpDataStore->GetCreatureData(attacker->GetGUID()), creature, attacker->ToCreature(), instanceData->creature.spell);
|
||||
alteredDmgHeal = sMythicPlus->ScaleHealSpell(spellInfo, damageOrHeal, sMpDataStore->GetCreatureData(attacker->GetGUID()), creature, attacker->ToCreature(), instanceData->creature.spell);
|
||||
} else {
|
||||
alteredDmgHeal = damageOrHeal * instanceData->creature.spell;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,6 @@ public:
|
||||
{
|
||||
int32 size = sMpDataStore->LoadScaleFactors();
|
||||
MpLogger::info("Loaded {} Mythic+ Scaling Factors from database...", size);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user