Add viral, fear, stun, knockback, gravityeffect support to bots

This commit is contained in:
nytmyr
2024-11-08 10:59:01 -06:00
parent 2d1b34d0cb
commit 57e9b62a48
+47 -7
View File
@@ -588,7 +588,7 @@ void Bot::ChangeBotRangedWeapons(bool isRanged) {
BotAddEquipItem(EQ::invslot::slotAmmo, GetBotItemBySlot(EQ::invslot::slotAmmo));
BotAddEquipItem(EQ::invslot::slotSecondary, GetBotItemBySlot(EQ::invslot::slotRange));
SetAttackTimer();
BotGroupSay(this, "My bow is true and ready"); //TODO bot rewrite - make this say throwing or bow
BotGroupSay(this, "My blades are sheathed");
}
}
@@ -1593,6 +1593,7 @@ bool Bot::Process()
{
if (IsStunned() && stunned_timer.Check()) {
Mob::UnStun();
spun_timer.Disable();
}
if (!GetBotOwner()) {
@@ -1600,7 +1601,6 @@ bool Bot::Process()
}
if (GetDepop()) {
_botOwner = nullptr;
_botOwnerCharacterID = 0;
@@ -1608,6 +1608,7 @@ bool Bot::Process()
}
ScanCloseMobProcess();
CheckScanCloseMobsMovingTimer(); // TODO bot rewrite -- necessary for bots?
SpellProcess();
if (tic_timer.Check()) {
@@ -1620,7 +1621,7 @@ bool Bot::Process()
BuffProcess();
CalcRestState();
if (currently_fleeing) {
if (currently_fleeing || IsFeared()) {
ProcessFlee();
}
@@ -1655,6 +1656,16 @@ bool Bot::Process()
}
}
if (viral_timer.Check()) { // TODO bot rewrite -- necessary for bots?
VirusEffectProcess();
}
if (spellbonuses.GravityEffect == 1) {
if (gravity_timer.Check()) {
DoGravityEffect();
}
}
if (GetAppearance() == eaDead && GetHP() > 0) {
SetAppearance(eaStanding);
}
@@ -1663,7 +1674,6 @@ bool Bot::Process()
ping_timer.Disable();
}
else {
if (!ping_timer.Enabled()) {
ping_timer.Start(BOT_KEEP_ALIVE_INTERVAL);
}
@@ -1684,7 +1694,19 @@ bool Bot::Process()
auto_save_timer.Start(RuleI(Bots, AutosaveIntervalSeconds) * 1000);
}
if (IsStunned() || IsMezzed()) {
if (ForcedMovement) {
ProcessForcedMovement();
}
if (IsMezzed()) {
return true;
}
if (IsStunned()) {
if (spun_timer.Check()) {
Spin();
}
return true;
}
@@ -2155,7 +2177,6 @@ void Bot::AI_Process()
// PULLING FLAG (ACTIONABLE RANGE)
if (GetPullingFlag()) {
//TODO bot rewrite - add ways to here to determine if throw stone is allowed, then check for ranged/spell/melee
if (!IsBotNonSpellFighter() && !HOLDING && AI_HasSpells() && AI_EngagedCastCheck()) {
return;
}
@@ -3130,6 +3151,25 @@ bool Bot::CheckIfIncapacitated() {
return true;
}
if (currently_fleeing) {
if (RuleB(Combat, EnableFearPathing) && AI_movement_timer->Check()) {
// Check if we have reached the last fear point
if (DistanceNoZ(glm::vec3(GetX(), GetY(), GetZ()), m_FearWalkTarget) <= 5.0f) {
// Calculate a new point to run to
StopNavigation();
CalculateNewFearpoint();
}
RunTo(
m_FearWalkTarget.x,
m_FearWalkTarget.y,
m_FearWalkTarget.z
);
}
return true;
}
return false;
}
@@ -10891,7 +10931,7 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spellType, uint16 spellid) {
return false;
}
switch (spellType) { //TODO bot rewrite - fix Buff/ResistBuff
switch (spellType) {
case BotSpellTypes::Buff:
if (IsResistanceOnlySpell(spellid) || IsDamageShieldOnlySpell(spellid) || IsDamageShieldAndResistanceSpellOnly(spellid)) {
return false;