diff --git a/Source/Game/Groups/GroupManager.cs b/Source/Game/Groups/GroupManager.cs index ad4349cd1..529171dc1 100644 --- a/Source/Game/Groups/GroupManager.cs +++ b/Source/Game/Groups/GroupManager.cs @@ -182,10 +182,12 @@ namespace Game.Groups { uint oldMSTime = Time.GetMSTime(); - // 0 1 2 3 4 5 6 7 - SQLResult result = DB.Characters.Query("SELECT gi.guid, i.map, gi.instance, gi.permanent, i.difficulty, i.resettime, i.entranceId, COUNT(g.guid) " + - "FROM group_instance gi INNER JOIN instance i ON gi.instance = i.id " + - "LEFT JOIN character_instance ci LEFT JOIN groups g ON g.leaderGuid = ci.guid ON ci.instance = gi.instance AND ci.permanent = 1 GROUP BY gi.instance ORDER BY gi.guid"); + // 0 1 2 3 4 5 6 + SQLResult result = DB.Characters.Query("SELECT gi.guid, i.map, gi.instance, gi.permanent, i.difficulty, i.resettime, i.entranceId, " + + // 7 + "(SELECT COUNT(1) FROM character_instance ci LEFT JOIN groups g ON ci.guid = g.leaderGuid WHERE ci.instance = gi.instance AND ci.permanent = 1 LIMIT 1) " + + "FROM group_instance gi LEFT JOIN instance i ON gi.instance = i.id ORDER BY guid"); + if (result.IsEmpty()) { Log.outInfo(LogFilter.ServerLoading, "Loaded 0 group-instance saves. DB table `group_instance` is empty!"); @@ -210,7 +212,7 @@ namespace Game.Groups if (difficultyEntry == null || difficultyEntry.InstanceType != mapEntry.InstanceType) continue; - InstanceSave save = Global.InstanceSaveMgr.AddInstanceSave(mapEntry.Id, result.Read(2), (Difficulty)diff, result.Read(5), result.Read(6), result.Read(7) != 0, true); + InstanceSave save = Global.InstanceSaveMgr.AddInstanceSave(mapEntry.Id, result.Read(2), (Difficulty)diff, result.Read(5), result.Read(6), result.Read(7) == 0, true); group.BindToInstance(save, result.Read(3), true); ++count; } diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 8f25025bf..b23ff5752 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -5690,19 +5690,6 @@ namespace Game.Spells } else { - // Wild Growth = amount + (6 - 2*doneTicks) * ticks* amount / 100 - if (m_spellInfo.SpellFamilyName == SpellFamilyNames.Druid && m_spellInfo.SpellFamilyFlags & new FlagArray128(0, 0x04000000, 0, 0)) - { - int addition = (int)((damage * GetTotalTicks()) * ((6 - (2 * (GetTickNumber() - 1))) / 100)); - - // Item - Druid T10 Restoration 2P Bonus - AuraEffect aurEff = caster.GetAuraEffect(70658, 0); - if (aurEff != null) - // divided by 50 instead of 100 because calculated as for every 2 tick - addition += Math.Abs((addition * aurEff.GetAmount()) / 50); - - damage += addition; - } if (isAreaAura) damage = (int)(caster.SpellHealingBonusDone(target, GetSpellInfo(), (uint)damage, DamageEffectType.DOT, GetSpellEffectInfo(), GetBase().GetStackAmount()) * caster.SpellHealingPctDone(target, m_spellInfo)); damage = (int)target.SpellHealingBonusTaken(caster, GetSpellInfo(), (uint)damage, DamageEffectType.DOT, GetSpellEffectInfo(), GetBase().GetStackAmount()); diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index f5fb9ea08..39a8a9aa1 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -2447,12 +2447,9 @@ namespace Game.Spells if (effectHandleMode != SpellEffectHandleMode.HitTarget) return; - if (unitTarget == null) - return; - // this effect use before aura Taunt apply for prevent taunt already attacking target // for spell as marked "non effective at already attacking target" - if (!unitTarget.CanHaveThreatList() || unitTarget.GetVictim() == m_caster) + if (unitTarget == null || !unitTarget.CanHaveThreatList() || unitTarget.GetVictim() == m_caster) { SendCastResult(SpellCastResult.DontReport); return; diff --git a/Source/Scripts/Spells/Druid.cs b/Source/Scripts/Spells/Druid.cs index e373dfc60..65a1d890b 100644 --- a/Source/Scripts/Spells/Druid.cs +++ b/Source/Scripts/Spells/Druid.cs @@ -55,6 +55,7 @@ namespace Scripts.Spells.Druid public const uint LivingSeedProc = 48504; public const uint MoonfireDamage = 164812; public const uint RejuvenationT10Proc = 70691; + public const uint RestorationT102PBonus = 70658; public const uint SavageRoar = 62071; public const uint StampedeBearRank1 = 81016; public const uint StampedeCatRank1 = 81021; @@ -1045,4 +1046,38 @@ namespace Scripts.Spells.Druid List _targets; } + + [Script] + class spell_dru_wild_growth_AuraScript : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.RestorationT102PBonus); + } + + void HandleTickUpdate(AuraEffect aurEff) + { + Unit caster = GetCaster(); + if (!caster) + return; + + // calculate from base damage, not from aurEff->GetAmount() (already modified) + float damage = caster.CalculateSpellDamage(GetUnitOwner(), GetSpellInfo(), aurEff.GetEffIndex()); + + // Wild Growth = first tick gains a 6% bonus, reduced by 2% each tick + float reduction = 2.0f; + AuraEffect bonus = caster.GetAuraEffect(SpellIds.RestorationT102PBonus, 0); + if (bonus != null) + reduction -= MathFunctions.CalculatePct(reduction, bonus.GetAmount()); + reduction *= (aurEff.GetTickNumber() - 1); + + MathFunctions.AddPct(ref damage, 6.0f - reduction); + aurEff.SetAmount((int)damage); + } + + public override void Register() + { + OnEffectUpdatePeriodic.Add(new EffectUpdatePeriodicHandler(HandleTickUpdate, 0, AuraType.PeriodicHeal)); + } + } }