Core/CombatAI: Use TimeSpan overloads of EventMap
Port From (https://github.com/TrinityCore/TrinityCore/commit/d62b7c1e352e76f35490c22b2ab291ed299f4fa4)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Game.AI
|
||||
@@ -61,7 +62,7 @@ namespace Game.AI
|
||||
if (info.condition == AICondition.Aggro)
|
||||
me.CastSpell(victim, id, false);
|
||||
else if (info.condition == AICondition.Combat)
|
||||
_events.ScheduleEvent(id, info.cooldown + RandomHelper.Rand32() % info.cooldown);
|
||||
_events.ScheduleEvent(id, info.cooldown, info.cooldown * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,7 +91,7 @@ namespace Game.AI
|
||||
|
||||
public override void SpellInterrupted(uint spellId, uint unTimeMs)
|
||||
{
|
||||
_events.RescheduleEvent(spellId, unTimeMs);
|
||||
_events.RescheduleEvent(spellId, TimeSpan.FromMilliseconds(unTimeMs));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,11 +154,11 @@ namespace Game.AI
|
||||
me.CastSpell(victim, id, false);
|
||||
else if (info.condition == AICondition.Combat)
|
||||
{
|
||||
uint cooldown = info.realCooldown;
|
||||
TimeSpan cooldown = info.realCooldown;
|
||||
if (count == spell)
|
||||
{
|
||||
DoCast(Spells[spell]);
|
||||
cooldown += (uint)me.GetCurrentSpellCastTime(id);
|
||||
cooldown += TimeSpan.FromMilliseconds(me.GetCurrentSpellCastTime(id));
|
||||
}
|
||||
_events.ScheduleEvent(id, cooldown);
|
||||
}
|
||||
@@ -188,7 +189,7 @@ namespace Game.AI
|
||||
uint casttime = (uint)me.GetCurrentSpellCastTime(spellId);
|
||||
AISpellInfoType info = GetAISpellInfo(spellId, me.GetMap().GetDifficultyID());
|
||||
if (info != null)
|
||||
_events.ScheduleEvent(spellId, (casttime != 0 ? casttime : 500) + info.realCooldown);
|
||||
_events.ScheduleEvent(spellId, TimeSpan.FromMilliseconds(casttime != 0 ? casttime : 500) + info.realCooldown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -575,13 +576,13 @@ namespace Game.AI
|
||||
{
|
||||
target = AITarget.Self;
|
||||
condition = AICondition.Combat;
|
||||
cooldown = SharedConst.AIDefaultCooldown;
|
||||
cooldown = TimeSpan.FromMilliseconds(SharedConst.AIDefaultCooldown);
|
||||
}
|
||||
|
||||
public AITarget target;
|
||||
public AICondition condition;
|
||||
public uint cooldown;
|
||||
public uint realCooldown;
|
||||
public TimeSpan cooldown;
|
||||
public TimeSpan realCooldown;
|
||||
public float maxRange;
|
||||
|
||||
public byte Targets; // set of enum SelectTarget
|
||||
|
||||
@@ -331,8 +331,8 @@ namespace Game.AI
|
||||
else
|
||||
AIInfo.condition = AICondition.Combat;
|
||||
|
||||
if (AIInfo.cooldown < spellInfo.RecoveryTime)
|
||||
AIInfo.cooldown = spellInfo.RecoveryTime;
|
||||
if (AIInfo.cooldown.TotalMilliseconds < spellInfo.RecoveryTime)
|
||||
AIInfo.cooldown = TimeSpan.FromMilliseconds(spellInfo.RecoveryTime);
|
||||
|
||||
if (spellInfo.GetMaxRange(false) == 0)
|
||||
{
|
||||
@@ -370,7 +370,7 @@ namespace Game.AI
|
||||
}
|
||||
}
|
||||
}
|
||||
AIInfo.realCooldown = spellInfo.RecoveryTime + spellInfo.StartRecoveryTime;
|
||||
AIInfo.realCooldown = TimeSpan.FromMilliseconds(spellInfo.RecoveryTime + spellInfo.StartRecoveryTime);
|
||||
AIInfo.maxRange = spellInfo.GetMaxRange(false) * 3 / 4;
|
||||
|
||||
AIInfo.Effects = 0;
|
||||
|
||||
Reference in New Issue
Block a user