Rogue eviscerate for almost dead enemy

This commit is contained in:
Yunfan Li
2024-01-07 00:47:20 +08:00
parent bc193f3cc3
commit 09db983a35
4 changed files with 25 additions and 0 deletions

View File

@@ -101,6 +101,11 @@ void DpsRogueStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
NextAction::array(0,
new NextAction("rupture", ACTION_HIGH + 1), NULL)));
triggers.push_back(new TriggerNode(
"target with combo points almost dead",
NextAction::array(0,
new NextAction("eviscerate", ACTION_HIGH + 1), NULL)));
triggers.push_back(new TriggerNode(
"medium threat",
NextAction::array(0, new NextAction("vanish", ACTION_HIGH), NULL)));

View File

@@ -73,6 +73,7 @@ class RogueTriggerFactoryInternal : public NamedObjectContext<Trigger>
creators["off hand weapon no enchant"] = &RogueTriggerFactoryInternal::off_hand_weapon_no_enchant;
creators["tricks of the trade on main tank"] = &RogueTriggerFactoryInternal::tricks_of_the_trade_on_main_tank;
creators["adrenaline rush"] = &RogueTriggerFactoryInternal::adrenaline_rush;
creators["target with combo points almost dead"] =&RogueTriggerFactoryInternal::target_with_combo_points_almost_dead;
}
private:
@@ -91,6 +92,7 @@ class RogueTriggerFactoryInternal : public NamedObjectContext<Trigger>
static Trigger* main_hand_weapon_no_enchant(PlayerbotAI* ai) { return new MainHandWeaponNoEnchantTrigger(ai); }
static Trigger* off_hand_weapon_no_enchant(PlayerbotAI* ai) { return new OffHandWeaponNoEnchantTrigger(ai); }
static Trigger* tricks_of_the_trade_on_main_tank(PlayerbotAI* ai) { return new TricksOfTheTradeOnMainTankTrigger(ai); }
static Trigger* target_with_combo_points_almost_dead(PlayerbotAI* ai) { return new TargetWithComboPointsLowerHealTrigger(ai, 3, 3.0f); }
};
class RogueAiObjectContextInternal : public NamedObjectContext<Action>

View File

@@ -3,6 +3,7 @@
*/
#include "RogueTriggers.h"
#include "GenericTriggers.h"
#include "Playerbots.h"
#include "ServerFacade.h"
@@ -116,4 +117,12 @@ bool OffHandWeaponNoEnchantTrigger::IsActive() {
if (!itemForSpell || itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return false;
return true;
}
bool TargetWithComboPointsLowerHealTrigger::IsActive() {
Unit* target = AI_VALUE(Unit*, "current target");
if (!target || !target->IsAlive() || !target->IsInWorld()) {
return false;
}
return ComboPointsAvailableTrigger::IsActive() && (target->GetHealth() / AI_VALUE(float, "expected group dps")) <= lifeTime;
}

View File

@@ -113,4 +113,13 @@ class TricksOfTheTradeOnMainTankTrigger : public BuffOnMainTankTrigger
TricksOfTheTradeOnMainTankTrigger(PlayerbotAI* ai) : BuffOnMainTankTrigger(ai, "tricks of the trade", true) {}
};
class TargetWithComboPointsLowerHealTrigger : public ComboPointsAvailableTrigger
{
public:
TargetWithComboPointsLowerHealTrigger(PlayerbotAI* ai, int32 combo_point = 5, float lifeTime = 8.0f) : ComboPointsAvailableTrigger(ai, combo_point), lifeTime(lifeTime) {}
bool IsActive() override;
private:
float lifeTime;
};
#endif