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

This commit is contained in:
nytmyr
2024-11-08 10:59:01 -06:00
parent 686fdb9bda
commit 77da29f940
+46 -7
View File
@@ -588,7 +588,7 @@ void Bot::ChangeBotRangedWeapons(bool isRanged) {
BotAddEquipItem(EQ::invslot::slotAmmo, GetBotItemBySlot(EQ::invslot::slotAmmo)); BotAddEquipItem(EQ::invslot::slotAmmo, GetBotItemBySlot(EQ::invslot::slotAmmo));
BotAddEquipItem(EQ::invslot::slotSecondary, GetBotItemBySlot(EQ::invslot::slotRange)); BotAddEquipItem(EQ::invslot::slotSecondary, GetBotItemBySlot(EQ::invslot::slotRange));
SetAttackTimer(); 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()) { if (IsStunned() && stunned_timer.Check()) {
Mob::UnStun(); Mob::UnStun();
spun_timer.Disable();
} }
if (!GetBotOwner()) { if (!GetBotOwner()) {
@@ -1600,7 +1601,6 @@ bool Bot::Process()
} }
if (GetDepop()) { if (GetDepop()) {
_botOwner = nullptr; _botOwner = nullptr;
_botOwnerCharacterID = 0; _botOwnerCharacterID = 0;
@@ -1623,7 +1623,7 @@ bool Bot::Process()
BuffProcess(); BuffProcess();
CalcRestState(); CalcRestState();
if (currently_fleeing) { if (currently_fleeing || IsFeared()) {
ProcessFlee(); ProcessFlee();
} }
@@ -1658,6 +1658,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) { if (GetAppearance() == eaDead && GetHP() > 0) {
SetAppearance(eaStanding); SetAppearance(eaStanding);
} }
@@ -1666,7 +1676,6 @@ bool Bot::Process()
ping_timer.Disable(); ping_timer.Disable();
} }
else { else {
if (!ping_timer.Enabled()) { if (!ping_timer.Enabled()) {
ping_timer.Start(BOT_KEEP_ALIVE_INTERVAL); ping_timer.Start(BOT_KEEP_ALIVE_INTERVAL);
} }
@@ -1687,7 +1696,19 @@ bool Bot::Process()
auto_save_timer.Start(RuleI(Bots, AutosaveIntervalSeconds) * 1000); 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; return true;
} }
@@ -2158,7 +2179,6 @@ void Bot::AI_Process()
// PULLING FLAG (ACTIONABLE RANGE) // PULLING FLAG (ACTIONABLE RANGE)
if (GetPullingFlag()) { 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()) { if (!IsBotNonSpellFighter() && !HOLDING && AI_HasSpells() && AI_EngagedCastCheck()) {
return; return;
} }
@@ -3133,6 +3153,25 @@ bool Bot::CheckIfIncapacitated() {
return true; 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; return false;
} }
@@ -10881,7 +10920,7 @@ bool Bot::IsValidSpellTypeBySpellID(uint16 spellType, uint16 spellid) {
return false; return false;
} }
switch (spellType) { //TODO bot rewrite - fix Buff/ResistBuff switch (spellType) {
case BotSpellTypes::Buff: case BotSpellTypes::Buff:
if (IsResistanceOnlySpell(spellid) || IsDamageShieldOnlySpell(spellid) || IsDamageShieldAndResistanceSpellOnly(spellid)) { if (IsResistanceOnlySpell(spellid) || IsDamageShieldOnlySpell(spellid) || IsDamageShieldAndResistanceSpellOnly(spellid)) {
return false; return false;