mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/CombatAI: Use std::chrono::duration overloads of EventMap (#25037)
Contributes to #25012
(cherry picked from commit bd837d4c3d)
This commit is contained in:
committed by
Shauren
parent
b27c70aff2
commit
d62b7c1e35
@@ -84,7 +84,7 @@ void CombatAI::JustEngagedWith(Unit* who)
|
||||
if (info->condition == AICOND_AGGRO)
|
||||
me->CastSpell(who, spell, false);
|
||||
else if (info->condition == AICOND_COMBAT)
|
||||
Events.ScheduleEvent(spell, info->cooldown + rand32() % info->cooldown);
|
||||
Events.ScheduleEvent(spell, info->cooldown, info->cooldown * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ void CombatAI::UpdateAI(uint32 diff)
|
||||
{
|
||||
DoCast(spellId);
|
||||
if (AISpellInfoType const* info = GetAISpellInfo(spellId, me->GetMap()->GetDifficultyID()))
|
||||
Events.ScheduleEvent(spellId, info->cooldown + rand32() % info->cooldown);
|
||||
Events.ScheduleEvent(spellId, info->cooldown, info->cooldown * 2);
|
||||
}
|
||||
else
|
||||
DoMeleeAttackIfReady();
|
||||
@@ -111,7 +111,7 @@ void CombatAI::UpdateAI(uint32 diff)
|
||||
|
||||
void CombatAI::SpellInterrupted(uint32 spellId, uint32 unTimeMs)
|
||||
{
|
||||
Events.RescheduleEvent(spellId, unTimeMs);
|
||||
Events.RescheduleEvent(spellId, Milliseconds(unTimeMs));
|
||||
}
|
||||
|
||||
/////////////////
|
||||
@@ -148,11 +148,11 @@ void CasterAI::JustEngagedWith(Unit* who)
|
||||
me->CastSpell(who, *itr, false);
|
||||
else if (info->condition == AICOND_COMBAT)
|
||||
{
|
||||
uint32 cooldown = info->realCooldown;
|
||||
Milliseconds cooldown = info->realCooldown;
|
||||
if (count == spell)
|
||||
{
|
||||
DoCast(Spells[spell]);
|
||||
cooldown += me->GetCurrentSpellCastTime(*itr);
|
||||
cooldown += Milliseconds(me->GetCurrentSpellCastTime(*itr));
|
||||
}
|
||||
Events.ScheduleEvent(*itr, cooldown);
|
||||
}
|
||||
@@ -181,7 +181,7 @@ void CasterAI::UpdateAI(uint32 diff)
|
||||
DoCast(spellId);
|
||||
uint32 casttime = me->GetCurrentSpellCastTime(spellId);
|
||||
if (AISpellInfoType const* info = GetAISpellInfo(spellId, me->GetMap()->GetDifficultyID()))
|
||||
Events.ScheduleEvent(spellId, (casttime ? casttime : 500) + info->realCooldown);
|
||||
Events.ScheduleEvent(spellId, Milliseconds(casttime ? casttime : 500) + info->realCooldown);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -198,8 +198,8 @@ void UnitAI::FillAISpellInfo()
|
||||
else
|
||||
AIInfo->condition = AICOND_COMBAT;
|
||||
|
||||
if (AIInfo->cooldown < spellInfo->RecoveryTime)
|
||||
AIInfo->cooldown = spellInfo->RecoveryTime;
|
||||
if (AIInfo->cooldown.count() < int32(spellInfo->RecoveryTime))
|
||||
AIInfo->cooldown = Milliseconds(spellInfo->RecoveryTime);
|
||||
|
||||
if (!spellInfo->GetMaxRange(false))
|
||||
UPDATE_TARGET(AITARGET_SELF)
|
||||
@@ -224,7 +224,7 @@ void UnitAI::FillAISpellInfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
AIInfo->realCooldown = spellInfo->RecoveryTime + spellInfo->StartRecoveryTime;
|
||||
AIInfo->realCooldown = Milliseconds(spellInfo->RecoveryTime + spellInfo->StartRecoveryTime);
|
||||
AIInfo->maxRange = spellInfo->GetMaxRange(false) * 3 / 4;
|
||||
|
||||
AIInfo->Effects = 0;
|
||||
|
||||
@@ -78,8 +78,8 @@ struct AISpellInfoType
|
||||
, cooldown(AI_DEFAULT_COOLDOWN), realCooldown(0), maxRange(0.0f){ }
|
||||
AITarget target;
|
||||
AICondition condition;
|
||||
uint32 cooldown;
|
||||
uint32 realCooldown;
|
||||
Milliseconds cooldown;
|
||||
Milliseconds realCooldown;
|
||||
float maxRange;
|
||||
|
||||
uint8 Targets; // set of enum SelectTarget
|
||||
|
||||
Reference in New Issue
Block a user