Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
hatersgit authored Dec 2, 2023
2 parents 29069cc + 940ac97 commit fb95e32
Show file tree
Hide file tree
Showing 11 changed files with 3,105 additions and 89 deletions.
6 changes: 3 additions & 3 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1925,20 +1925,20 @@ void Player::Regenerate(Powers power)
{
if (getClass() == CLASS_PRIEST)
{
if (GetSpec() == TALENT_TREE_PRIEST_SHADOW)
if (GetActiveSpec() == TALENT_TREE_PRIEST_SHADOW)
{
float InsanityDecreaseRate = sWorld->getRate(RATE_POWER_INSANITY_LOSS);
addvalue += -30 * InsanityDecreaseRate;
}
else if (GetSpec() == TALENT_TREE_PRIEST_INQUISITION)
else if (GetActiveSpec() == TALENT_TREE_PRIEST_INQUISITION)
{
float WrathDecreaseRate = sWorld->getRate(RATE_POWER_WRATH_LOSS);
addvalue += -30 * WrathDecreaseRate;
}
}
else if (getClass() == CLASS_TINKER)
{
if (GetSpec() != TALENT_TREE_TINKER_PHYSICIAN)
if (GetActiveSpec() != TALENT_TREE_TINKER_PHYSICIAN)
{
float BatteryGaugeDecreaseRate = sWorld->getRate(RATE_POWER_RUNICPOWER_LOSS);
addvalue += -30 * BatteryGaugeDecreaseRate;
Expand Down
72 changes: 52 additions & 20 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1427,17 +1427,6 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
damageInfo->resist = dmgInfo.GetResist();
damageInfo->damage = dmgInfo.GetDamage();
}

// Aleist3r: Hijacked this to apply mage's Icy Propulsion talent proc
// probably a bit hacky and there may be better place to do this but hey, at least it works
if (crit)
{
Unit* caster = damageInfo->attacker;
if (spellInfo->SpellFamilyName & SPELLFAMILY_MAGE && (spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_MAGE_SINGLETARGET
|| spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_MAGE_SINGLETARGET || spellInfo->SpellFamilyFlags[2] & SPELLFAMILYFLAG2_MAGE_SINGLETARGET))
if (caster->HasAura(1290050) && caster->HasSpellCooldown(12472)) // 1290050 - Icy Propulsion Talent; 12472 - Icy Veins
caster->ToPlayer()->ModifySpellCooldown(12472, -1000);
}
}

void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss, Spell const* spell /*= nullptr*/)
Expand Down Expand Up @@ -11180,6 +11169,16 @@ void Unit::GetAllMinionsByEntry(std::list<Creature*>& Minions, uint32 entry)
}
}

void Unit::GetAllSummonsByEntry(std::list<TempSummon*>& Minions, uint32 entry)
{
for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
{
Unit* unit = *itr;
if (unit->GetEntry() == entry && unit->IsSummon())
Minions.push_back(unit->ToTempSummon());
}
}

void Unit::RemoveAllMinionsByEntry(uint32 entry)
{
for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
Expand Down Expand Up @@ -11851,6 +11850,14 @@ float Unit::SpellPctDamageModsDone(Unit* victim, SpellInfo const* spellProto, Da
}
break;
}
case 12500:
case 12502:
case 12503:
{
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
}
}

Expand All @@ -11861,18 +11868,18 @@ float Unit::SpellPctDamageModsDone(Unit* victim, SpellInfo const* spellProto, Da
// Ice Lance
if (spellProto->SpellIconID == 186)
{
if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this) || owner->HasAura(1290012))
if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this) || owner->HasAura(1290010))
{
// Glyph of Ice Lance
if (owner->HasAura(56377) && victim->GetLevel() > owner->GetLevel())
if (owner->HasAura(1280020) && victim->GetLevel() > owner->GetLevel())
DoneTotalMod *= 4.0f;
else
DoneTotalMod *= 3.0f;
}
}

// Torment the weak
if (spellProto->SpellFamilyFlags[0] & 0x20600021 || spellProto->SpellFamilyFlags[1] & 0x9000)
if (spellProto->SpellFamilyFlags[2] & 0x200000) // Aleist3r: used free mask to consolidate all spells that should be affected
if (victim->HasAuraWithMechanic((1 << MECHANIC_SNARE) | (1 << MECHANIC_SLOW_ATTACK)))
if (AuraEffect* aurEff = GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_GENERIC, 3263, EFFECT_0))
AddPct(DoneTotalMod, aurEff->GetAmount());
Expand Down Expand Up @@ -12117,7 +12124,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
// Check for table values
float coeff = spellProto->Effects[effIndex].BonusMultiplier;
SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
if (bonus)
if (bonus || spellProto->Id == 1310029)
{
if (damagetype == DOT)
{
Expand All @@ -12140,6 +12147,13 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
APbonus += GetTotalAttackPowerValue(attType);
DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus);
}

if (spellProto->Id == 1310029) // Aleist3r: hardcoding... well, someone had a nice idea to roll random SP bonus, I think it's better to do it here than mess in spell script
{
float coeffMin = 0.89f;
float coeffMax = 1.06f;
coeff = frand(coeffMin, coeffMax);
}
}
}

Expand All @@ -12158,6 +12172,16 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
}

if (spellProto->Id == 1310048) // Flame Convergence calc
{
if (victim->HasAura(1310031))
{
uint8 auraStacks = victim->GetAura(1310031)->GetStackAmount();
int32 dmgBonusPctMult = sSpellMgr->GetSpellInfo(1310047)->Effects[EFFECT_0].CalcValue();
DoneTotal += round(CalculatePct(DoneTotal, dmgBonusPctMult * auraStacks));
}
}

float tmpDamage = (float(pdamage) + DoneTotal) * DoneTotalMod;
// apply spellmod to Done damage (flat and pct)
if (Player* modOwner = GetSpellModOwner())
Expand Down Expand Up @@ -12532,17 +12556,21 @@ float Unit::SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto
{
// Shatter
case 911:
modChance += 21;
modChance += 16;
[[fallthrough]];
case 910:
modChance += 17;
[[fallthrough]];
case 849:
{
modChance += 17;
if (!HasAuraState(AURA_STATE_FROZEN, spellProto, caster))
if (!HasAuraState(AURA_STATE_FROZEN, spellProto, caster) || !caster->HasAura(1290010) || !caster->HasAura(1290046))
// Fingers of Frost and Chilled to the Bone are now solved like that
break;
crit_chance *= 1.5f;
crit_chance += modChance;
break;
}
case 7917: // Glyph of Shadowburn
if (HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, caster))
crit_chance += (*i)->GetAmount();
Expand All @@ -12552,6 +12580,10 @@ float Unit::SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto
if (HasAura(6788))
crit_chance += (*i)->GetAmount();
break;
case 12501:
if (HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, caster))
crit_chance = 100.0f;
break;
default:
break;
}
Expand Down Expand Up @@ -22187,8 +22219,8 @@ uint32 Unit::AdjustBeforeBlockDamage(Unit* blocker, uint32 damage) const
UnitMods Unit::ClassSpecDependantUnitMod() const
{
uint8 pClass = ToPlayer()->getClass();
uint32 pSpec = 1;
UnitMods mod = UNIT_MOD_STAT_STRENGTH;
uint32 pSpec = ToPlayer()->GetActiveSpec();
UnitMods mod;

switch (pClass)
{
Expand Down Expand Up @@ -22265,7 +22297,7 @@ UnitMods Unit::ClassSpecDependantUnitMod() const
Stats Unit::ClassSpecDependantMainStat() const
{
uint8 pClass = ToPlayer()->getClass();
uint32 pSpec = 2;
uint32 pSpec = ToPlayer()->GetActiveSpec();
Stats stat;

switch (pClass)
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Entities/Unit/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -1907,6 +1907,7 @@ class Unit : public WorldObject

void SetMinion(Minion* minion, bool apply);
void GetAllMinionsByEntry(std::list<Creature*>& Minions, uint32 entry);
void GetAllSummonsByEntry(std::list<TempSummon*>& Minions, uint32 entry);
void RemoveAllMinionsByEntry(uint32 entry);
void SetCharm(Unit* target, bool apply);
Unit* GetNextRandomRaidMemberOrPet(float radius);
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Spells/Auras/SpellAuraDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ enum AuraType
SPELL_AURA_MOD_SPELL_POWER_PCT = 329,
SPELL_AURA_MOD_SPELL_POWER_OF_STAT_PERCENT = 330,
SPELL_AURA_MOD_SPELL_POWER_OF_RATING_PERCENT = 331,
SPELL_AURA_MOD_TRIGGER_SPELL_ON_POWER_PCT = 332,
SPELL_AURA_MOD_RATING_PCT = 333,
SPELL_AURA_MOD_RATING_OF_RATING_PCT = 334,
SPELL_AURA_MOD_SCHOOL_MASK_DAMAGE_FROM_CASTER = 335,
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/Spells/Auras/SpellAuraEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS] =
&AuraEffect::HandleAuraModSpellPowerPercent, //329 SPELL_AURA_MOD_SPELL_POWER_PCT
&AuraEffect::HandleAuraModSpellPowerOfStatPercent, //330 SPELL_AURA_MOD_SPELL_POWER_OF_STAT_PERCENT
&AuraEffect::HandleAuraModSpellPowerOfCombatRatingPercent, //331 SPELL_AURA_MOD_SPELL_POWER_OF_RATING_PERCENT
&AuraEffect::HandleNoImmediateEffect, //332 SPELL_AURA_MOD_TRIGGER_SPELL_ON_POWER_PCT
&AuraEffect::HandleModRatingPercent, //333 SPELL_AURA_MOD_RATING_PCT
&AuraEffect::HandleModRatingFromRating, //334 SPELL_AURA_MOD_RATING_OF_RATING_PCT
&AuraEffect::HandleNoImmediateEffect, //335 SPELL_AURA_MOD_SCHOOL_MASK_DAMAGE_FROM_CASTER
Expand All @@ -404,7 +405,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS] =
&AuraEffect::HandleModRatingPercent, //342 SPELL_AURA_MOD_RATING_FROM_ALL_SOURCES_BY_PCT visual only, implemented in Player::UpdateRating()
&AuraEffect::HandleNoImmediateEffect, //343 SPELL_AURA_MOD_RECOVERY_RATE implemented in AuraEffect::PeriodicTick
&AuraEffect::HandleNoImmediateEffect, //344 SPELL_AURA_ADD_MASTERY_RATING_TO_SPELL_EFFECT implemented in AuraEffect::CalculateSpellMod()
&AuraEffect::HandleAuraModTriggerSpellPowerPercent, //345 SPELL_AURA_MOD_TRIGGER_SPELL_ON_POWER_PCT
&AuraEffect::HandleAuraModTriggerSpellPowerPercent, //345 SPELL_AURA_MOD_TRIGGER_SPELL_ON_POWER_PC
};

AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32* baseAmount, Unit* caster):
Expand Down
24 changes: 24 additions & 0 deletions src/server/game/Spells/Auras/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,30 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
break;
}
case 1310044: // Arcanosphere
// Arcane Potency
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_MAGE, 2120, 0))
{
uint32 spellId = 0;

if (caster->HasAura(1310052))
{
switch (aurEff->GetId())
{
case 31571:
spellId = 57529;
break;
case 31572:
spellId = 57531;
break;
default:
LOG_ERROR("spells.aura", "Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency ({}) found", aurEff->GetId());
}
if (spellId)
caster->CastSpell(caster, spellId, true);
}
}
break;
default:
break;
}
Expand Down
4 changes: 4 additions & 0 deletions src/server/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8806,6 +8806,10 @@ void Spell::PrepareTriggersExecutedOnHit()
{
if (!(*i)->IsAffectedOnSpell(m_spellInfo))
continue;

if ((*i)->GetMiscValue() == 1310076 && m_caster->HasAura(1310076))
continue;

SpellInfo const* auraSpellInfo = (*i)->GetSpellInfo();
uint32 auraSpellIdx = (*i)->GetEffIndex();
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(auraSpellInfo->Effects[auraSpellIdx].TriggerSpell))
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS] =
&Spell::EffectSpecCount, //161 SPELL_EFFECT_TALENT_SPEC_COUNT second talent spec (learn/revert)
&Spell::EffectActivateSpec, //162 SPELL_EFFECT_TALENT_SPEC_SELECT activate primary/secondary spec
&Spell::EffectNULL, //163 unused
&Spell::EffectNULL,
&Spell::EffectNULL, //164 SPELL_EFFECT_REMOVE_AURA
&Spell::EffectLearnTransmogSet, //165 SPELL_EFFECT_LEARN_TRANSMOG_SET
&Spell::EffectCreateAreaTrigger, //166 SPELL_EFFECT_CREATE_AREATRIGGER
};
Expand Down
2 changes: 1 addition & 1 deletion src/server/scripts/Spells/spell_dh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct at_dh_sigil_of_flame : AreaTriggerAI
}
};

void AddSC_dh_spell_scripts()
void AddSC_demonhunter_spell_scripts()
{
RegisterAreaTriggerAI(at_dh_sigil_of_flame);
}
Loading

0 comments on commit fb95e32

Please sign in to comment.