mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-15 01:49:09 +00:00
miscs: movement, coredump fix, rndbot
This commit is contained in:
@@ -158,11 +158,10 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
}
|
||||
|
||||
bool generatePath = !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) &&
|
||||
!bot->IsFlying() && !bot->IsUnderWater();
|
||||
!bot->IsFlying() && !bot->isSwimming();
|
||||
MotionMaster &mm = *bot->GetMotionMaster();
|
||||
mm.Clear();
|
||||
mm.MovePoint(mapId, x, y, z, generatePath);
|
||||
|
||||
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -68,10 +68,10 @@ class MoonfireTrigger : public DebuffTrigger
|
||||
bool IsActive() override;
|
||||
};
|
||||
|
||||
class FaerieFireTrigger : public DebuffTrigger
|
||||
class FaerieFireTrigger : public DebuffOnBossTrigger
|
||||
{
|
||||
public:
|
||||
FaerieFireTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "faerie fire") { }
|
||||
FaerieFireTrigger(PlayerbotAI* botAI) : DebuffOnBossTrigger(botAI, "faerie fire") { }
|
||||
};
|
||||
|
||||
class FaerieFireFeralTrigger : public DebuffTrigger
|
||||
|
||||
@@ -4,8 +4,14 @@
|
||||
|
||||
#include "HunterActions.h"
|
||||
#include "Event.h"
|
||||
#include "GenericSpellActions.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool CastHuntersMarkAction::isUseful()
|
||||
{
|
||||
return CastDebuffSpellAction::isUseful();
|
||||
}
|
||||
|
||||
bool CastViperStingAction::isUseful()
|
||||
{
|
||||
return AI_VALUE2(uint8, "mana", "self target") < 50 && AI_VALUE2(uint8, "mana", "current target") >= 30;
|
||||
|
||||
@@ -11,9 +11,15 @@
|
||||
class PlayerbotAI;
|
||||
class Unit;
|
||||
|
||||
BEGIN_RANGED_SPELL_ACTION(CastHuntersMarkAction, "hunter's mark")
|
||||
END_SPELL_ACTION()
|
||||
// BEGIN_RANGED_SPELL_ACTION(CastHuntersMarkAction, "hunter's mark")
|
||||
// END_SPELL_ACTION()
|
||||
|
||||
class CastHuntersMarkAction : public CastDebuffSpellAction
|
||||
{
|
||||
public:
|
||||
CastHuntersMarkAction(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, "hunter's mark") { }
|
||||
bool isUseful() override;
|
||||
};
|
||||
class CastAutoShotAction : public CastSpellAction
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -67,10 +67,10 @@ class BlackArrowTrigger : public DebuffTrigger
|
||||
BlackArrowTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "black arrow", 1, true) { }
|
||||
};
|
||||
|
||||
class HuntersMarkTrigger : public DebuffTrigger
|
||||
class HuntersMarkTrigger : public DebuffOnBossTrigger
|
||||
{
|
||||
public:
|
||||
HuntersMarkTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "hunter's mark") { }
|
||||
HuntersMarkTrigger(PlayerbotAI* botAI) : DebuffOnBossTrigger(botAI, "hunter's mark") { }
|
||||
};
|
||||
|
||||
class FreezingTrapTrigger : public HasCcTargetTrigger
|
||||
|
||||
@@ -596,8 +596,10 @@ bool SapphironFlightPositionAction::MoveToNearestIcebolt()
|
||||
}
|
||||
if (playerWithIcebolt) {
|
||||
Unit* boss = AI_VALUE2(Unit*, "find target", "sapphiron");
|
||||
float angle = boss->GetAngle(playerWithIcebolt);
|
||||
return MoveTo(NAXX_MAP_ID, playerWithIcebolt->GetPositionX() + cos(angle) * 3.0f, playerWithIcebolt->GetPositionY() + sin(angle) * 3.0f, helper.GENERIC_HEIGHT);
|
||||
if (boss) {
|
||||
float angle = boss->GetAngle(playerWithIcebolt);
|
||||
return MoveTo(NAXX_MAP_ID, playerWithIcebolt->GetPositionX() + cos(angle) * 3.0f, playerWithIcebolt->GetPositionY() + sin(angle) * 3.0f, helper.GENERIC_HEIGHT);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class GenericBossHelper : public AiObject {
|
||||
public:
|
||||
GenericBossHelper(PlayerbotAI* botAI, std::string name): AiObject(botAI), name_(name) {}
|
||||
virtual bool UpdateBossAI() {
|
||||
if(unit_ && !unit_->IsInWorld()) {
|
||||
if(unit_ && (!unit_->IsInWorld() || !unit_->IsAlive())) {
|
||||
unit_ = nullptr;
|
||||
}
|
||||
if (!unit_) {
|
||||
|
||||
@@ -205,6 +205,15 @@ bool DebuffTrigger::IsActive()
|
||||
return BuffTrigger::IsActive() && AI_VALUE2(uint8, "health", GetTargetName()) > life_bound;
|
||||
}
|
||||
|
||||
bool DebuffOnBossTrigger::IsActive()
|
||||
{
|
||||
if (!DebuffTrigger::IsActive()) {
|
||||
return false;
|
||||
}
|
||||
Creature *c = GetTarget()->ToCreature();
|
||||
return c && ((c->IsDungeonBoss()) || (c->isWorldBoss()));
|
||||
}
|
||||
|
||||
bool SpellTrigger::IsActive()
|
||||
{
|
||||
return GetTarget();
|
||||
|
||||
@@ -314,6 +314,13 @@ class DebuffTrigger : public BuffTrigger
|
||||
float life_bound;
|
||||
};
|
||||
|
||||
class DebuffOnBossTrigger : public DebuffTrigger
|
||||
{
|
||||
public:
|
||||
DebuffOnBossTrigger(PlayerbotAI* botAI, std::string const spell, int32 checkInterval = 1, bool checkIsOwner = false) : DebuffTrigger(botAI, spell, checkInterval, checkIsOwner) {}
|
||||
bool IsActive() override;
|
||||
};
|
||||
|
||||
class DebuffOnAttackerTrigger : public DebuffTrigger
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -11,5 +11,5 @@ bool IsFacingValue::Calculate()
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
return bot->HasInArc(CAST_ANGLE_IN_FRONT, target, sPlayerbotAIConfig->sightDistance);
|
||||
return bot->HasInArc(CAST_ANGLE_IN_FRONT, target);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user