Core/Spells: Removed duplicated check
Revert "Core/Groups: fix wrong query for loading group instance data. canReset attribute was calculated in the wrong way"
Core/Scripts: moved Wild Growth calculation to script and fixed formula
This commit is contained in:
hondacrx
2020-06-21 13:10:09 -04:00
parent 1a2411ae0f
commit b600c21ac2
4 changed files with 43 additions and 22 deletions
+7 -5
View File
@@ -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<uint>(2), (Difficulty)diff, result.Read<uint>(5), result.Read<uint>(6), result.Read<ulong>(7) != 0, true);
InstanceSave save = Global.InstanceSaveMgr.AddInstanceSave(mapEntry.Id, result.Read<uint>(2), (Difficulty)diff, result.Read<uint>(5), result.Read<uint>(6), result.Read<ulong>(7) == 0, true);
group.BindToInstance(save, result.Read<bool>(3), true);
++count;
}
-13
View File
@@ -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());
+1 -4
View File
@@ -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;
+35
View File
@@ -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<WorldObject> _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));
}
}
}