Created
November 9, 2011 12:32
-
-
Save tobmaps/1351306 to your computer and use it in GitHub Desktop.
Frostfire bolt vs resists fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp | |
index 3fd87cd..6cd4af0 100755 | |
--- a/src/server/game/Entities/Unit/Unit.cpp | |
+++ b/src/server/game/Entities/Unit/Unit.cpp | |
@@ -1584,7 +1584,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe | |
// Magic damage, check for resists | |
if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0) | |
{ | |
- float victimResistance = float(victim->GetResistance(GetFirstSchoolInMask(schoolMask))); | |
+ float victimResistance = float(victim->GetResistance(schoolMask)); | |
victimResistance += float(GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask)); | |
if (Player* player = ToPlayer()) | |
@@ -17398,6 +17398,16 @@ uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType | |
return amount; | |
} | |
+uint32 Unit::GetResistance(SpellSchoolMask mask) const | |
+{ | |
+ uint32 resist = 0; | |
+ for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) | |
+ if (mask & (1 << i) && (!resist || resist > GetResistance(SpellSchools(i)))) | |
+ resist = GetResistance(SpellSchools(i)); | |
+ | |
+ return resist; | |
+} | |
+ | |
void Unit::SendClearTarget() | |
{ | |
WorldPacket data(SMSG_BREAK_TARGET, GetPackGUID().size()); | |
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h | |
index 877bf11..ec4d1d2 100755 | |
--- a/src/server/game/Entities/Unit/Unit.h | |
+++ b/src/server/game/Entities/Unit/Unit.h | |
@@ -1346,6 +1346,7 @@ class Unit : public WorldObject | |
void SetArmor(int32 val) { SetResistance(SPELL_SCHOOL_NORMAL, val); } | |
uint32 GetResistance(SpellSchools school) const { return GetUInt32Value(UNIT_FIELD_RESISTANCES+school); } | |
+ uint32 GetResistance(SpellSchoolMask mask) const; | |
void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES+school, val); } | |
uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); } | |
@@ -1517,7 +1518,7 @@ class Unit : public WorldObject | |
{ | |
value = soft_cap + ((value - soft_cap) / 2); | |
} | |
- | |
+ | |
return value; | |
} | |
uint32 GetUnitMeleeSkill(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } | |
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp | |
index 5b61294..7ef2e88 100644 | |
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp | |
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp | |
@@ -971,7 +971,7 @@ class spell_sindragosa_s_fury : public SpellScriptLoader | |
if (!GetHitUnit()->isAlive() || !_targetCount) | |
return; | |
- float resistance = float(GetHitUnit()->GetResistance(GetFirstSchoolInMask(SpellSchoolMask(GetSpellInfo()->SchoolMask)))); | |
+ float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask))); | |
uint32 minResistFactor = uint32((resistance / (resistance + 510.0f))* 10.0f) * 2; | |
uint32 randomResist = urand(0, (9 - minResistFactor) * 100)/100 + minResistFactor; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment