diff options
| author | QAston <none@none> | 2009-06-07 13:14:08 +0200 |
|---|---|---|
| committer | QAston <none@none> | 2009-06-07 13:14:08 +0200 |
| commit | da74a474107f8f80a3bf8f8a80b452e661ead877 (patch) | |
| tree | 9863e419041ecdf7b37b9955527bd911dd06ce72 /src/game/Unit.cpp | |
| parent | 076379d3efa49559cecb93f5d1c5bf56f3d7b4b3 (diff) | |
*Allow auras SPELL_AURA_MECHANIC_DURATION_MOD and similar to use effect mechanics to check which spell can be moded.
*Note: prev commit was about freezing arrow:)
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
| -rw-r--r-- | src/game/Unit.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index b9ba6dbe2c5..d614b743b7b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -11039,13 +11039,27 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, i //cut duration only of negative effects if (!positive) { - int32 mechanic = spellProto->Mechanic; + int32 mechanic = GetAllSpellMechanicMask(spellProto); + + int32 durationMod; + int32 durationMod_always = 0; + int32 durationMod_not_stack = 0; + + for (uint8 i = 1;i<=MECHANIC_ENRAGED;++i) + { + if (!(mechanic & 1<<i)) + continue; + // Find total mod value (negative bonus) + int32 new_durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, i); + // Find max mod (negative bonus) + int32 new_durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, i); + // Check if mods applied before were weaker + if (new_durationMod_always < durationMod_always) + durationMod_always = new_durationMod_always; + if (new_durationMod_not_stack < durationMod_not_stack) + durationMod_not_stack = new_durationMod_not_stack; + } - // Find total mod value (negative bonus) - int32 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, mechanic); - // Find max mod (negative bonus) - int32 durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, mechanic); - int32 durationMod = 0; // Select strongest negative mod if (durationMod_always > durationMod_not_stack) durationMod = durationMod_not_stack; |
