diff options
author | Aqua Deus <95978183+aquadeus@users.noreply.github.com> | 2022-02-15 23:36:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-15 23:36:18 +0100 |
commit | f205a89c86f64bab531a611aa89766aad1c27e83 (patch) | |
tree | 16151c31a327d80c0b944627236dbe918262a7cf | |
parent | 272addbf2bd53b0cf6856d4bf81c9558079cce82 (diff) |
Core/Spells: Implement spell attribute SPELL_ATTR3_NO_DURABILITY_LOSS (#27750)
Co-authored-by: Shauren <shauren.trinity@gmail.com>
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 7 | ||||
-rw-r--r-- | src/server/game/Miscellaneous/SharedDefines.h | 2 | ||||
-rw-r--r-- | src/server/game/Miscellaneous/enuminfo_SharedDefines.cpp | 6 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 13be26b9ba2..446884cb412 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -927,6 +927,9 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons } } + if (spellProto && spellProto->HasAttribute(SPELL_ATTR3_NO_DURABILITY_LOSS)) + durabilityLoss = false; + if (killed) Unit::Kill(attacker, victim, durabilityLoss, skipSettingDeathState); else @@ -951,7 +954,7 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons else // victim is a player { // random durability for items (HIT TAKEN) - if (roll_chance_f(sWorld->getRate(RATE_DURABILITY_LOSS_DAMAGE))) + if (durabilityLoss && roll_chance_f(sWorld->getRate(RATE_DURABILITY_LOSS_DAMAGE))) { EquipmentSlots slot = EquipmentSlots(urand(0, EQUIPMENT_SLOT_END-1)); victim->ToPlayer()->DurabilityPointLossForEquipSlot(slot); @@ -961,7 +964,7 @@ bool Unit::HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel) cons if (attacker && attacker->GetTypeId() == TYPEID_PLAYER) { // random durability for items (HIT DONE) - if (roll_chance_f(sWorld->getRate(RATE_DURABILITY_LOSS_DAMAGE))) + if (durabilityLoss && roll_chance_f(sWorld->getRate(RATE_DURABILITY_LOSS_DAMAGE))) { EquipmentSlots slot = EquipmentSlots(urand(0, EQUIPMENT_SLOT_END-1)); attacker->ToPlayer()->DurabilityPointLossForEquipSlot(slot); diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 7831fb897e1..0b681d014a6 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -518,7 +518,7 @@ enum SpellAttr3 : uint32 SPELL_ATTR3_UNK2 = 0x00000004, // TITLE Unknown attribute 2@Attr3 SPELL_ATTR3_BLOCKABLE_SPELL = 0x00000008, // TITLE Blockable spell SPELL_ATTR3_IGNORE_RESURRECTION_TIMER = 0x00000010, // TITLE Ignore resurrection timer - SPELL_ATTR3_UNK5 = 0x00000020, // TITLE Unknown attribute 5@Attr3 + SPELL_ATTR3_NO_DURABILITY_LOSS = 0x00000020, // TITLE No Durability Loss SPELL_ATTR3_UNK6 = 0x00000040, // TITLE Unknown attribute 6@Attr3 SPELL_ATTR3_STACK_FOR_DIFF_CASTERS = 0x00000080, // TITLE Stack separately for each caster SPELL_ATTR3_ONLY_TARGET_PLAYERS = 0x00000100, // TITLE Can only target players diff --git a/src/server/game/Miscellaneous/enuminfo_SharedDefines.cpp b/src/server/game/Miscellaneous/enuminfo_SharedDefines.cpp index ab86d61c4e7..9685499250f 100644 --- a/src/server/game/Miscellaneous/enuminfo_SharedDefines.cpp +++ b/src/server/game/Miscellaneous/enuminfo_SharedDefines.cpp @@ -639,7 +639,7 @@ TC_API_EXPORT EnumText EnumUtils<SpellAttr3>::ToString(SpellAttr3 value) case SPELL_ATTR3_UNK2: return { "SPELL_ATTR3_UNK2", "Unknown attribute 2@Attr3", "" }; case SPELL_ATTR3_BLOCKABLE_SPELL: return { "SPELL_ATTR3_BLOCKABLE_SPELL", "Blockable spell", "" }; case SPELL_ATTR3_IGNORE_RESURRECTION_TIMER: return { "SPELL_ATTR3_IGNORE_RESURRECTION_TIMER", "Ignore resurrection timer", "" }; - case SPELL_ATTR3_UNK5: return { "SPELL_ATTR3_UNK5", "Unknown attribute 5@Attr3", "" }; + case SPELL_ATTR3_NO_DURABILITY_LOSS: return { "SPELL_ATTR3_NO_DURABILITY_LOSS", "No Durability Loss", "" }; case SPELL_ATTR3_UNK6: return { "SPELL_ATTR3_UNK6", "Unknown attribute 6@Attr3", "" }; case SPELL_ATTR3_STACK_FOR_DIFF_CASTERS: return { "SPELL_ATTR3_STACK_FOR_DIFF_CASTERS", "Stack separately for each caster", "" }; case SPELL_ATTR3_ONLY_TARGET_PLAYERS: return { "SPELL_ATTR3_ONLY_TARGET_PLAYERS", "Can only target players", "" }; @@ -683,7 +683,7 @@ TC_API_EXPORT SpellAttr3 EnumUtils<SpellAttr3>::FromIndex(size_t index) case 2: return SPELL_ATTR3_UNK2; case 3: return SPELL_ATTR3_BLOCKABLE_SPELL; case 4: return SPELL_ATTR3_IGNORE_RESURRECTION_TIMER; - case 5: return SPELL_ATTR3_UNK5; + case 5: return SPELL_ATTR3_NO_DURABILITY_LOSS; case 6: return SPELL_ATTR3_UNK6; case 7: return SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; case 8: return SPELL_ATTR3_ONLY_TARGET_PLAYERS; @@ -724,7 +724,7 @@ TC_API_EXPORT size_t EnumUtils<SpellAttr3>::ToIndex(SpellAttr3 value) case SPELL_ATTR3_UNK2: return 2; case SPELL_ATTR3_BLOCKABLE_SPELL: return 3; case SPELL_ATTR3_IGNORE_RESURRECTION_TIMER: return 4; - case SPELL_ATTR3_UNK5: return 5; + case SPELL_ATTR3_NO_DURABILITY_LOSS: return 5; case SPELL_ATTR3_UNK6: return 6; case SPELL_ATTR3_STACK_FOR_DIFF_CASTERS: return 7; case SPELL_ATTR3_ONLY_TARGET_PLAYERS: return 8; |