debuff trigger and action, allow multiple spell

This commit is contained in:
Yunfan Li
2023-06-02 19:57:08 +08:00
parent 25da0af70e
commit a44b310c0a
32 changed files with 113 additions and 85 deletions

View File

@@ -118,7 +118,7 @@ CastMeleeSpellAction::CastMeleeSpellAction(PlayerbotAI* botAI, std::string const
bool CastAuraSpellAction::isUseful()
{
return GetTarget() && (GetTarget() != nullptr) && (GetTarget() != nullptr) && CastSpellAction::isUseful() && !botAI->HasAura(spell, GetTarget(), true);
return GetTarget() && (GetTarget() != nullptr) && (GetTarget() != nullptr) && CastSpellAction::isUseful() && !botAI->HasAura(spell, GetTarget(), true, isOwner);
}
CastEnchantItemAction::CastEnchantItemAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
@@ -135,7 +135,7 @@ bool CastEnchantItemAction::isPossible()
return spellId && AI_VALUE2(Item*, "item for spell", spellId);
}
CastHealingSpellAction::CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount) : CastAuraSpellAction(botAI, spell), estAmount(estAmount)
CastHealingSpellAction::CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount) : CastAuraSpellAction(botAI, spell, true), estAmount(estAmount)
{
range = botAI->GetRange("spell");
}

View File

@@ -56,7 +56,7 @@ class CastDebuffSpellAction : public CastAuraSpellAction
class CastDebuffSpellOnAttackerAction : public CastAuraSpellAction
{
public:
CastDebuffSpellOnAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = false) : CastAuraSpellAction(botAI, spell, isOwner) { }
CastDebuffSpellOnAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = true) : CastAuraSpellAction(botAI, spell, isOwner) { }
Value<Unit*>* GetTargetValue() override;
std::string const getName() override { return spell + " on attacker"; }

View File

@@ -129,7 +129,7 @@ bool MovementAction::MoveToLOS(WorldObject* target, bool ranged)
bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, bool react)
{
UpdateMovementState();
LOG_DEBUG("playerbots", "IsMovingAllowed {}", IsMovingAllowed());
// LOG_DEBUG("playerbots", "IsMovingAllowed {}", IsMovingAllowed());
if (!IsMovingAllowed())
return false;
@@ -478,7 +478,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
sPlayerbotAIConfig->log("bot_movement.csv", out.str().c_str());
}
LOG_DEBUG("playerbots", "({}, {}) -> ({}, {})", startPosition.getX(), startPosition.getY(), movePosition.getX(), movePosition.getY());
// LOG_DEBUG("playerbots", "({}, {}) -> ({}, {})", startPosition.getX(), startPosition.getY(), movePosition.getX(), movePosition.getY());
if (!react)
if (totalDistance > maxDist)
WaitForReach(startPosition.distance(movePosition) - 10.0f);
@@ -543,13 +543,13 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
bot->SetWalk(true);
bot->SendMovementFlagUpdate();
LOG_DEBUG("playerbots", "normal move? {} {} {}", !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !bot->HasAuraType(SPELL_AURA_FLY),
bot->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE), bot->getStandState());
// LOG_DEBUG("playerbots", "normal move? {} {} {}", !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !bot->HasAuraType(SPELL_AURA_FLY),
// bot->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE), bot->getStandState());
if (!bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !bot->HasAuraType(SPELL_AURA_FLY))
{
bot->SetWalk(masterWalking);
bot->GetMotionMaster()->MovePoint(movePosition.getMapId(), movePosition.getX(), movePosition.getY(), movePosition.getZ(), generatePath);
LOG_DEBUG("playerbots", "Movepoint to ({}, {})", movePosition.getX(), movePosition.getY());
// LOG_DEBUG("playerbots", "Movepoint to ({}, {})", movePosition.getX(), movePosition.getY());
}
else
{