refactor(Core): code cleanup (part 3) (#6380)

This commit is contained in:
Francesco Borzì
2021-06-19 01:25:29 +02:00
committed by GitHub
parent 4d20442a1e
commit 23e9b85d0e
31 changed files with 34 additions and 65 deletions

View File

@@ -379,7 +379,7 @@ AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32* baseAmount, Unit* cast
m_amount = CalculateAmount(caster);
m_casterLevel = caster ? caster->getLevel() : 0;
m_applyResilience = caster ? caster->CanApplyResilience() : false;
m_applyResilience = caster && caster->CanApplyResilience();
m_auraGroup = sSpellMgr->GetSpellGroup(GetId());
CalculateSpellMod();
@@ -5222,9 +5222,11 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
{
if (target->isDead() && GetBase() && target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == 24601)
{
Unit* caster = GetBase()->GetCaster();
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
caster->ToPlayer()->KilledMonsterCredit(25987);
auto caster2 = GetBase()->GetCaster();
if (caster2 && caster2->GetTypeId() == TYPEID_PLAYER)
{
caster2->ToPlayer()->KilledMonsterCredit(25987);
}
}
return;
}
@@ -6567,15 +6569,17 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
// xinef: caster is available, checked earlier
if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_NO_TARGET_PER_SECOND_COST))
{
uint32 damage = GetSpellInfo()->ManaPerSecond;
if ((int32)damage > gain && gain > 0)
damage = gain;
uint32 manaPerSecond = GetSpellInfo()->ManaPerSecond;
if ((int32)manaPerSecond > gain && gain > 0)
{
manaPerSecond = gain;
}
uint32 absorb = 0;
Unit::DealDamageMods(caster, damage, &absorb);
uint32 absorb2 = 0;
Unit::DealDamageMods(caster, manaPerSecond, &absorb2);
CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
Unit::DealDamage(caster, caster, damage, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
Unit::DealDamage(caster, caster, manaPerSecond, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
}
uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;

View File

@@ -2599,7 +2599,7 @@ UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
LoadScripts();
_InitEffects(effMask, caster, baseAmount);
GetUnitOwner()->_AddAura(this, caster);
};
}
void UnitAura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication* aurApp)
{

View File

@@ -21,7 +21,6 @@ class AuraEffect;
class Aura;
class DynamicObject;
class AuraScript;
class ProcInfo;
class AuraApplication
{

View File

@@ -4,7 +4,6 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "AccountMgr.h"
#include "Battleground.h"
#include "BattlegroundEY.h"
#include "BattlegroundIC.h"
@@ -14,22 +13,17 @@
#include "CellImpl.h"
#include "Common.h"
#include "Creature.h"
#include "CreatureAI.h"
#include "DatabaseEnv.h"
#include "DynamicObject.h"
#include "Formulas.h"
#include "GameObject.h"
#include "GameObjectAI.h"
#include "GossipDef.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "InstanceScript.h"
#include "Language.h"
#include "Log.h"
#include "MapManager.h"
#include "MMapFactory.h"
#include "MMapManager.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
@@ -39,7 +33,6 @@
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "SharedDefines.h"
#include "SkillDiscovery.h"
#include "SkillExtraItems.h"
#include "SocialMgr.h"
#include "Spell.h"
@@ -54,7 +47,6 @@
#include "UpdateMask.h"
#include "Util.h"
#include "Vehicle.h"
#include "VMapFactory.h"
#include "World.h"
#include "WorldPacket.h"

View File

@@ -1849,7 +1849,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
him, because it would be it's passenger, there's no such case where this gets to fail legitimacy, this problem
cannot be solved from within the check in other way since target type cannot be called for the spell currently
Spell examples: [ID - 52864 Devour Water, ID - 52862 Devour Wind, ID - 49370 Wyrmrest Defender: Destabilize Azure Dragonshrine Effect] */
if (!caster->IsVehicle() && !(caster->GetCharmerOrOwner() == target))
if (!caster->IsVehicle() && caster->GetCharmerOrOwner() != target)
{
if (TargetAuraState && !unitTarget->HasAuraState(AuraStateType(TargetAuraState), this, caster))
return SPELL_FAILED_TARGET_AURASTATE;