mirror of
https://github.com/araxiaonline/mod-mythic-plus.git
synced 2026-06-13 11:12:23 -04:00
Added Unit damage code and removed chatty logging
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "MpLogger.h"
|
||||
#include "Player.h"
|
||||
#include "MythicPlus.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
class MythicPlus_UnitScript : public UnitScript
|
||||
@@ -7,29 +8,119 @@ class MythicPlus_UnitScript : public UnitScript
|
||||
public:
|
||||
MythicPlus_UnitScript() : UnitScript("MythicPlus_UnitScript", true) { }
|
||||
|
||||
uint32 DealDamage(Unit* /*AttackerUnit*/, Unit* /*playerVictim*/, uint32 damage, DamageEffectType /*damagetype*/) override {
|
||||
return damage;
|
||||
void ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage, SpellInfo const* /*spellInfo*/) override {
|
||||
Map *map = target->GetMap();
|
||||
if(!sMythicPlus->IsMapEligible(map)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the target is the enemy then increase the amount of healing by the instance data modifier for spell output.
|
||||
if(target->isType(TYPEID_PLAYER) && attacker->isType(TYPEID_UNIT)) {
|
||||
Creature* creature = target->ToCreature();
|
||||
if(!creature || !sMythicPlus->IsCreatureEligible(creature)) {
|
||||
return;
|
||||
}
|
||||
|
||||
MpInstanceData* instanceData = sMpDataStore->GetInstanceData(map->GetId(), map->GetInstanceId());
|
||||
if(!instanceData) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(creature->IsDungeonBoss()) {
|
||||
damage = damage * (instanceData->boss.spell * 0.8);
|
||||
} else {
|
||||
damage = damage * (instanceData->creature.spell * 0.8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ModifyPeriodicDamageAurasTick(Unit* /*target */, Unit* /*attacker*/, uint32& /*damage*/, SpellInfo const* /*spellInfo*/) override {
|
||||
void ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage, SpellInfo const* /*spellInfo*/) override {
|
||||
Map *map = target->GetMap();
|
||||
if(!sMythicPlus->IsMapEligible(map)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the target is the enemy then increase the amount of healing by the instance data modifier for spell output.
|
||||
if(target->isType(TYPEID_PLAYER) && attacker->isType(TYPEID_UNIT)) {
|
||||
Creature* creature = target->ToCreature();
|
||||
if(!creature || !sMythicPlus->IsCreatureEligible(creature)) {
|
||||
return;
|
||||
}
|
||||
|
||||
MpInstanceData* instanceData = sMpDataStore->GetInstanceData(map->GetId(), map->GetInstanceId());
|
||||
if(!instanceData) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(creature->IsDungeonBoss()) {
|
||||
damage = damage * instanceData->boss.spell;
|
||||
} else {
|
||||
damage = damage * instanceData->creature.spell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage) override {
|
||||
|
||||
Map *map = target->GetMap();
|
||||
if(!sMythicPlus->IsMapEligible(map)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the target is the enemy then increase the amount of healing by the instance data modifier for spell output.
|
||||
if(target->isType(TYPEID_PLAYER) && attacker->isType(TYPEID_UNIT)) {
|
||||
Creature* creature = target->ToCreature();
|
||||
if(!creature || !sMythicPlus->IsCreatureEligible(creature)) {
|
||||
return;
|
||||
}
|
||||
|
||||
MpInstanceData* instanceData = sMpDataStore->GetInstanceData(map->GetId(), map->GetInstanceId());
|
||||
if(!instanceData) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(creature->IsDungeonBoss()) {
|
||||
damage = damage * instanceData->boss.melee *10;
|
||||
} else {
|
||||
damage = damage * instanceData->creature.melee * 10 ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ModifySpellDamageTaken(Unit* /*target*/, Unit* /*attacker*/, int32& /*damage*/, SpellInfo const* /*spellInfo*/) override {
|
||||
// When a healing spell hits a mythic+ enemy modify based on the modifiers for the difficulty
|
||||
void ModifyHealReceived(Unit* target, Unit* healer, uint32& healing, SpellInfo const* /*spellInfo*/) override {
|
||||
|
||||
Map *map = target->GetMap();
|
||||
if(!sMythicPlus->IsMapEligible(map)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the target is the enemy then increase the amount of healing by the instance data modifier for spell output.
|
||||
if(target->isType(TYPEID_UNIT)) {
|
||||
Creature* creature = target->ToCreature();
|
||||
if(!creature || !sMythicPlus->IsCreatureEligible(creature)) {
|
||||
return;
|
||||
}
|
||||
|
||||
MpInstanceData* instanceData = sMpDataStore->GetInstanceData(map->GetId(), map->GetInstanceId());
|
||||
if(!instanceData) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(creature->IsDungeonBoss()) {
|
||||
healing = healing * instanceData->boss.spell;
|
||||
} else {
|
||||
healing = healing * instanceData->creature.spell;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ModifyMeleeDamage(Unit* /*target*/, Unit* /*attacker*/, uint32& /*damage*/) override {
|
||||
// void OnAuraApply(Unit* unit, Aura* aura) override {
|
||||
|
||||
}
|
||||
|
||||
void ModifyHealReceived(Unit* /*target*/, Unit* /*attacker*/, uint32& /*damage*/, SpellInfo const* /*spellInfo*/) override {
|
||||
|
||||
}
|
||||
|
||||
void OnAuraApply(Unit* unit, Aura* aura) override {
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
};
|
||||
void Add_MP_UnitScripts()
|
||||
|
||||
Reference in New Issue
Block a user