Skip to content

Commit

Permalink
Enchant paladin divine sacrifice
Browse files Browse the repository at this point in the history
  • Loading branch information
liyunfan1223 committed Mar 27, 2024
1 parent 47928a9 commit f03e12c
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 29 deletions.
2 changes: 1 addition & 1 deletion conf/playerbots.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ AiPlayerbot.AlmostFullHealth = 85
AiPlayerbot.LowMana = 15
AiPlayerbot.MediumMana = 40

# Random bot default strategies (applied after defaults)

# Enable healer bot save mana
# Default: 1 (enable)
Expand All @@ -316,6 +315,7 @@ AiPlayerbot.AutoSaveMana = 1
AiPlayerbot.SaveManaThreshold = 60


# Random bot default strategies (applied after defaults)
AiPlayerbot.RandomBotCombatStrategies = "+dps,+dps assist,-threat"
# AiPlayerbot.RandomBotNonCombatStrategies = "+grind,+loot,+rpg,+custom::say"
AiPlayerbot.RandomBotNonCombatStrategies = ""
Expand Down
36 changes: 22 additions & 14 deletions src/strategy/paladin/GenericPaladinStrategyActionNodeFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
creators["taunt spell"] = &hand_of_reckoning;
creators["righteous defense"] = &righteous_defense;
creators["avenger's shield"] = &avengers_shield;
creators["divine sacrifice"] = &divine_sacrifice;
}
private:
static ActionNode* blessing_of_sanctuary(PlayerbotAI* ai)
Expand Down Expand Up @@ -84,7 +85,7 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{
return new ActionNode ("retribution aura",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("devotion aura"), NULL),
/*A*/ NextAction::array(0, new NextAction("devotion aura"), nullptr),
/*C*/ nullptr);
}
static ActionNode* lay_on_hands(PlayerbotAI* ai)
Expand Down Expand Up @@ -112,7 +113,7 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{
return new ActionNode ("cleanse poison",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("purify poison"), NULL),
/*A*/ NextAction::array(0, new NextAction("purify poison"), nullptr),
/*C*/ nullptr);
}
static ActionNode* cleanse_magic(PlayerbotAI* ai)
Expand All @@ -126,21 +127,21 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{
return new ActionNode ("cleanse disease",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("purify disease"), NULL),
/*A*/ NextAction::array(0, new NextAction("purify disease"), nullptr),
/*C*/ nullptr);
}
static ActionNode* cleanse_poison_on_party(PlayerbotAI* ai)
{
return new ActionNode ("cleanse poison on party",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("purify poison on party"), NULL),
/*A*/ NextAction::array(0, new NextAction("purify poison on party"), nullptr),
/*C*/ nullptr);
}
static ActionNode* cleanse_disease_on_party(PlayerbotAI* ai)
{
return new ActionNode ("cleanse disease on party",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("purify disease on party"), NULL),
/*A*/ NextAction::array(0, new NextAction("purify disease on party"), nullptr),
/*C*/ nullptr);
}
// static ActionNode* seal_of_wisdom(PlayerbotAI* ai)
Expand All @@ -154,35 +155,42 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{
return new ActionNode ("seal of justice",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("seal of righteousness"), NULL),
/*A*/ NextAction::array(0, new NextAction("seal of righteousness"), nullptr),
/*C*/ nullptr);
}
static ActionNode* hand_of_reckoning(PlayerbotAI* ai)
{
return new ActionNode ("hand of reckoning",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("righteous defense"), NULL),
/*A*/ NextAction::array(0, new NextAction("righteous defense"), nullptr),
/*C*/ nullptr);
}
static ActionNode* righteous_defense(PlayerbotAI* ai)
{
return new ActionNode ("righteous defense",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("avenger's shield"), NULL),
/*A*/ NextAction::array(0, new NextAction("avenger's shield"), nullptr),
/*C*/ nullptr);
}
static ActionNode* avengers_shield(PlayerbotAI* ai)
{
return new ActionNode ("avenger's shield",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("judgement of wisdom"), NULL),
/*A*/ NextAction::array(0, new NextAction("judgement of wisdom"), nullptr),
/*C*/ nullptr);
}
static ActionNode* divine_sacrifice(PlayerbotAI* ai)
{
return new ActionNode ("divine sacrifice",
/*P*/ nullptr,
/*A*/ nullptr,
/*C*/ NextAction::array(0, new NextAction("cancel divine sacrifice"), nullptr));
}
static ActionNode* judgement_of_wisdom(PlayerbotAI* ai)
{
return new ActionNode ("judgement of wisdom",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("judgement of light"), NULL),
/*A*/ NextAction::array(0, new NextAction("judgement of light"), nullptr),
/*C*/ nullptr);
}
static ActionNode* judgement(PlayerbotAI* ai)
Expand All @@ -196,21 +204,21 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{
return new ActionNode ("divine shield",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("divine protection"), NULL),
/*A*/ NextAction::array(0, new NextAction("divine protection"), nullptr),
/*C*/ nullptr);
}
static ActionNode* flash_of_light(PlayerbotAI* ai)
{
return new ActionNode ("flash of light",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("holy light"), NULL),
/*A*/ NextAction::array(0, new NextAction("holy light"), nullptr),
/*C*/ nullptr);
}
static ActionNode* flash_of_light_on_party(PlayerbotAI* ai)
{
return new ActionNode ("flash of light on party",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("holy light on party"), NULL),
/*A*/ NextAction::array(0, new NextAction("holy light on party"), nullptr),
/*C*/ nullptr);
}
static ActionNode* holy_wrath(PlayerbotAI* ai)
Expand All @@ -231,7 +239,7 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{
return new ActionNode ("seal of command",
/*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("seal of righteousness"), NULL),
/*A*/ NextAction::array(0, new NextAction("seal of righteousness"), nullptr),
/*C*/ nullptr);
}
};
Expand Down
20 changes: 13 additions & 7 deletions src/strategy/paladin/HealPaladinStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,42 +34,48 @@ void HealPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)

// triggers.push_back(new TriggerNode("concentration aura", NextAction::array(0, new NextAction("concentration aura", ACTION_NORMAL), nullptr)));
triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of wisdom", ACTION_HIGH), nullptr)));
triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("divine illumination", ACTION_HIGH + 2), nullptr)));
triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("divine favor", ACTION_HIGH + 1), nullptr)));
// triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of sanctuary", ACTION_HIGH + 9), nullptr)));
triggers.push_back(new TriggerNode("party member to heal out of spell range", NextAction::array(0, new NextAction("reach party member to heal", ACTION_EMERGENCY + 3), nullptr)));

triggers.push_back(new TriggerNode(
"medium group heal occasion",
NextAction::array(0, new NextAction("divine sacrifice", ACTION_CRITICAL_HEAL + 5), nullptr)));

triggers.push_back(new TriggerNode(
"party member critical health",
NextAction::array(0,
new NextAction("holy shock on party", ACTION_CRITICAL_HEAL + 5),
new NextAction("holy shock on party", ACTION_CRITICAL_HEAL + 6),
new NextAction("divine sacrifice", ACTION_CRITICAL_HEAL + 5),
new NextAction("holy light on party", ACTION_CRITICAL_HEAL + 4),
NULL)));
nullptr)));

triggers.push_back(new TriggerNode(
"party member low health",
NextAction::array(0,
new NextAction("holy light on party", ACTION_MEDIUM_HEAL + 5),
NULL)));
nullptr)));

triggers.push_back(new TriggerNode(
"party member medium health",
NextAction::array(0,
new NextAction("holy light on party", ACTION_LIGHT_HEAL + 9),
new NextAction("flash of light on party", ACTION_LIGHT_HEAL + 8),
NULL)));
nullptr)));

triggers.push_back(new TriggerNode(
"party member almost full health",
NextAction::array(0,
new NextAction("flash of light on party", ACTION_LIGHT_HEAL + 3),
NULL)));
nullptr)));

triggers.push_back(new TriggerNode(
"beacon of light on main tank",
NextAction::array(0, new NextAction("beacon of light on main tank", ACTION_CRITICAL_HEAL + 7), NULL)));
NextAction::array(0, new NextAction("beacon of light on main tank", ACTION_CRITICAL_HEAL + 7), nullptr)));

triggers.push_back(new TriggerNode(
"sacred shield on main tank",
NextAction::array(0, new NextAction("sacred shield on main tank", ACTION_CRITICAL_HEAL + 6), NULL)));
NextAction::array(0, new NextAction("sacred shield on main tank", ACTION_CRITICAL_HEAL + 6), nullptr)));

}
16 changes: 16 additions & 0 deletions src/strategy/paladin/PaladinActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,20 @@ bool CastMeleeConsecrationAction::isUseful()
Unit* target = GetTarget();
// float dis = distance + CONTACT_DISTANCE;
return target && bot->IsWithinCombatRange(target, sPlayerbotAIConfig->meleeDistance); // sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", GetTargetName()), distance);
}

bool CastDivineSacrificeAction::isUseful()
{
return GetTarget() && (GetTarget() != nullptr) && CastSpellAction::isUseful() && !botAI->HasAura("divine guardian", GetTarget(), false, false, -1, true);
}

bool CastCancelDivineSacrificeAction::Execute(Event event)
{
botAI->RemoveAura("divine sacrifice");
return true;
}

bool CastCancelDivineSacrificeAction::isUseful()
{
return botAI->HasAura("divine sacrifice", GetTarget(), false, true, -1, true);
}
27 changes: 24 additions & 3 deletions src/strategy/paladin/PaladinActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ class CastHolyLightAction : public CastHealingSpellAction
class CastHolyShockOnPartyAction : public HealPartyMemberAction
{
public:
CastHolyShockOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "holy shock", 25.0f, HealingManaEfficiency::MEDIUM) { }
CastHolyShockOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "holy shock", 25.0f, HealingManaEfficiency::LOW) { }
};

class CastHolyLightOnPartyAction : public HealPartyMemberAction
{
public:
CastHolyLightOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "holy light", 50.0f, HealingManaEfficiency::HIGH) { }
CastHolyLightOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "holy light", 50.0f, HealingManaEfficiency::MEDIUM) { }
};

class CastFlashOfLightAction : public CastHealingSpellAction
Expand All @@ -188,7 +188,7 @@ class CastFlashOfLightAction : public CastHealingSpellAction
class CastFlashOfLightOnPartyAction : public HealPartyMemberAction
{
public:
CastFlashOfLightOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "flash of light", 15.0f, HealingManaEfficiency::LOW) { }
CastFlashOfLightOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "flash of light", 15.0f, HealingManaEfficiency::HIGH) { }
};

class CastLayOnHandsAction : public CastHealingSpellAction
Expand Down Expand Up @@ -393,4 +393,25 @@ class CastAvengingWrathAction : public CastBuffSpellAction
public:
CastAvengingWrathAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "avenging wrath") {}
};

class CastDivineIlluminationAction : public CastBuffSpellAction
{
public:
CastDivineIlluminationAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "divine illumination") {}
};

class CastDivineSacrificeAction : public CastBuffSpellAction
{
public:
CastDivineSacrificeAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "divine sacrifice") {}
bool isUseful() override;
};

class CastCancelDivineSacrificeAction : public Action
{
public:
CastCancelDivineSacrificeAction(PlayerbotAI* botAI) : Action(botAI, "cancel divine sacrifice") {}
bool Execute(Event event) override;
bool isUseful() override;
};
#endif
6 changes: 6 additions & 0 deletions src/strategy/paladin/PaladinAiObjectContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ class PaladinAiObjectContextInternal : public NamedObjectContext<Action>
creators["beacon of light on main tank"] = &PaladinAiObjectContextInternal::beacon_of_light_on_main_tank;
creators["sacred shield on main tank"] = &PaladinAiObjectContextInternal::sacred_shield_on_main_tank;
creators["avenging wrath"] = &PaladinAiObjectContextInternal::avenging_wrath;
creators["divine illumination"] = &PaladinAiObjectContextInternal::divine_illumination;
creators["divine sacrifice"] = &PaladinAiObjectContextInternal::divine_sacrifice;
creators["cancel divine sacrifice"] = &PaladinAiObjectContextInternal::cancel_divine_sacrifice;
}

private:
Expand Down Expand Up @@ -341,6 +344,9 @@ class PaladinAiObjectContextInternal : public NamedObjectContext<Action>
static Action* beacon_of_light_on_main_tank(PlayerbotAI* ai) { return new CastBeaconOfLightOnMainTankAction(ai); }
static Action* sacred_shield_on_main_tank(PlayerbotAI* ai) { return new CastSacredShieldOnMainTankAction(ai); }
static Action* avenging_wrath(PlayerbotAI* ai) { return new CastAvengingWrathAction(ai); }
static Action* divine_illumination(PlayerbotAI* ai) { return new CastDivineIlluminationAction(ai); }
static Action* divine_sacrifice(PlayerbotAI* ai) { return new CastDivineSacrificeAction(ai); }
static Action* cancel_divine_sacrifice(PlayerbotAI* ai) { return new CastCancelDivineSacrificeAction(ai); }
};

PaladinAiObjectContext::PaladinAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI)
Expand Down
3 changes: 3 additions & 0 deletions src/strategy/paladin/TankPaladinStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ void TankPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
triggers.push_back(new TriggerNode(
"righteous fury",
NextAction::array(0, new NextAction("righteous fury", ACTION_HIGH + 8), nullptr)));
triggers.push_back(new TriggerNode(
"medium group heal occasion",
NextAction::array(0, new NextAction("divine sacrifice", ACTION_HIGH + 5), nullptr)));
triggers.push_back(new TriggerNode(
"not facing target",
NextAction::array(0, new NextAction("set facing", ACTION_NORMAL + 7), nullptr)));
Expand Down
8 changes: 4 additions & 4 deletions src/strategy/shaman/HealShamanStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ void HealShamanStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)

triggers.push_back(new TriggerNode(
"party member critical health",
NextAction::array(0, new NextAction("riptide on party", 24.0f), new NextAction("lesser healing wave on party", 23.0f), nullptr)));
NextAction::array(0, new NextAction("riptide on party", 25.0f), new NextAction("healing wave on party", 24.0f), new NextAction("lesser healing wave on party", 23.0f), nullptr)));

triggers.push_back(new TriggerNode(
"party member low health",
NextAction::array(0, new NextAction("riptide on party", 18.0f), new NextAction("lesser healing wave on party", 17.0f), nullptr)));
NextAction::array(0, new NextAction("riptide on party", 19.0f), new NextAction("healing wave on party", 18.0f), new NextAction("lesser healing wave on party", 17.0f), nullptr)));

triggers.push_back(new TriggerNode(
"party member medium health",
NextAction::array(0, new NextAction("riptide on party", 15.0f), new NextAction("lesser healing wave on party", 14.0f), nullptr)));
NextAction::array(0, new NextAction("riptide on party", 16.0f), new NextAction("healing wave on party", 15.0f), new NextAction("lesser healing wave on party", 14.0f), nullptr)));

triggers.push_back(new TriggerNode(
"party member almost full health",
NextAction::array(0, new NextAction("riptide on party", 12.0f), nullptr)));
NextAction::array(0, new NextAction("riptide on party", 12.0f), new NextAction("lesser healing wave on party", 11.0f), nullptr)));

triggers.push_back(new TriggerNode(
"party member cleanse spirit poison",
Expand Down

0 comments on commit f03e12c

Please sign in to comment.