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::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;
@@ -1608,6 +1608,7 @@ bool Bot::Process()
} }
ScanCloseMobProcess(); ScanCloseMobProcess();
CheckScanCloseMobsMovingTimer(); // TODO bot rewrite -- necessary for bots?
SpellProcess(); SpellProcess();
if (tic_timer.Check()) { if (tic_timer.Check()) {
@@ -1620,7 +1621,7 @@ bool Bot::Process()
BuffProcess(); BuffProcess();
CalcRestState(); CalcRestState();
if (currently_fleeing) { if (currently_fleeing || IsFeared()) {
ProcessFlee(); 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) { if (GetAppearance() == eaDead && GetHP() > 0) {
SetAppearance(eaStanding); SetAppearance(eaStanding);
} }
@@ -1663,7 +1674,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);
} }
@@ -1684,7 +1694,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;
} }
@@ -2155,7 +2177,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;
} }
@@ -3130,6 +3151,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;
} }
@@ -10891,7 +10931,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;