Skip to content

Commit a2ac466

Browse files
authored
Paladin bot for mangos zero (#285)
1 parent 0916c45 commit a2ac466

10 files changed

Lines changed: 199 additions & 13 deletions

src/game/WorldHandlers/SpellEffects.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4552,14 +4552,14 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
45524552
{
45534553
SpellEntry const* spellInfo = (*itr)->GetSpellProto();
45544554

4555-
// search seal (all seals have judgement's aura dummy spell id in 2 effect
4556-
if (!spellInfo || !IsSealSpell((*itr)->GetSpellProto()) || (*itr)->GetEffIndex() != 2)
4555+
// the judgement spell id is stored in whatever effect index the seal's dummy aura occupies
4556+
if (!spellInfo || !IsSealSpell((*itr)->GetSpellProto()))
45574557
{
45584558
continue;
45594559
}
45604560

45614561
// must be calculated base at raw base points in spell proto, GetModifier()->m_value for S.Righteousness modified by SPELLMOD_DAMAGE
4562-
spellId2 = (*itr)->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_2);
4562+
spellId2 = (*itr)->GetSpellProto()->CalculateSimpleValue((SpellEffectIndex)(*itr)->GetEffIndex());
45634563

45644564
if (spellId2 <= 1)
45654565
{

src/modules/Bots/playerbot/strategy/paladin/DpsPaladinStrategy.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@ class DpsPaladinStrategyActionNodeFactory : public NamedObjectFactory<ActionNode
1010
public:
1111
DpsPaladinStrategyActionNodeFactory()
1212
{
13+
creators["seal of the crusader"] = &seal_of_the_crusader;
1314
creators["seal of vengeance"] = &seal_of_vengeance;
1415
creators["seal of command"] = &seal_of_command;
1516
creators["blessing of might"] = &blessing_of_might;
1617
creators["crusader strike"] = &crusader_strike;
1718
}
1819

1920
private:
21+
static ActionNode* seal_of_the_crusader(PlayerbotAI* ai)
22+
{
23+
return new ActionNode ("seal of the crusader",
24+
/*P*/ NULL,
25+
/*A*/ NextAction::array(0, new NextAction("seal of vengeance"), NULL),
26+
/*C*/ NULL);
27+
}
2028
static ActionNode* seal_of_vengeance(PlayerbotAI* ai)
2129
{
2230
return new ActionNode ("seal of vengeance",
@@ -28,7 +36,7 @@ class DpsPaladinStrategyActionNodeFactory : public NamedObjectFactory<ActionNode
2836
{
2937
return new ActionNode ("seal of command",
3038
/*P*/ NULL,
31-
/*A*/ NextAction::array(0, new NextAction("seal of wisdom"), NULL),
39+
/*A*/ NextAction::array(0, new NextAction("seal of righteousness"), NULL),
3240
/*C*/ NULL);
3341
}
3442
static ActionNode* blessing_of_might(PlayerbotAI* ai)
@@ -70,7 +78,7 @@ void DpsPaladinStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
7078
NextAction::array(0, new NextAction("judgement of wisdom", ACTION_NORMAL + 2), NULL)));
7179

7280
triggers.push_back(new TriggerNode(
73-
"blessing",
81+
"blessing of might",
7482
NextAction::array(0, new NextAction("blessing of might", ACTION_HIGH + 8), NULL)));
7583

7684
triggers.push_back(new TriggerNode(

src/modules/Bots/playerbot/strategy/paladin/GenericPaladinNonCombatStrategy.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ void GenericPaladinNonCombatStrategy::InitTriggers(std::list<TriggerNode*> &trig
1515
{
1616
NonCombatStrategy::InitTriggers(triggers);
1717

18+
triggers.push_back(new TriggerNode(
19+
"aura",
20+
NextAction::array(0, new NextAction("devotion aura", 8.0f), NULL)));
21+
1822
triggers.push_back(new TriggerNode(
1923
"blessing of kings on party",
2024
NextAction::array(0, new NextAction("blessing of kings on party", 11.0f), NULL)));

src/modules/Bots/playerbot/strategy/paladin/GenericPaladinStrategy.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,16 @@ void GenericPaladinStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
7474
triggers.push_back(new TriggerNode(
7575
"cleanse party member cure magic",
7676
NextAction::array(0, new NextAction("cleanse magic on party", ACTION_DISPEL + 1), NULL)));
77+
78+
triggers.push_back(new TriggerNode(
79+
"holy wrath",
80+
NextAction::array(0, new NextAction("holy wrath", ACTION_HIGH + 3), NULL)));
81+
82+
triggers.push_back(new TriggerNode(
83+
"exorcism",
84+
NextAction::array(0, new NextAction("exorcism", ACTION_HIGH + 2), NULL)));
85+
86+
triggers.push_back(new TriggerNode(
87+
"blessing of freedom",
88+
NextAction::array(0, new NextAction("blessing of freedom", ACTION_EMERGENCY), NULL)));
7789
}

src/modules/Bots/playerbot/strategy/paladin/GenericPaladinStrategyActionNodeFactory.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace ai
77
public:
88
GenericPaladinStrategyActionNodeFactory()
99
{
10+
creators["blessing of kings on party"] = &blessing_of_kings_on_party;
1011
creators["seal of light"] = &seal_of_light;
1112
creators["cleanse poison"] = &cleanse_poison;
1213
creators["cleanse disease"] = &cleanse_disease;
@@ -16,7 +17,9 @@ namespace ai
1617
creators["seal of wisdom"] = &seal_of_wisdom;
1718
creators["seal of justice"] = &seal_of_justice;
1819
creators["hand of reckoning"] = &hand_of_reckoning;
20+
creators["judgement of justice"] = &judgement_of_justice;
1921
creators["judgement of wisdom"] = &judgement_of_wisdom;
22+
creators["judgement of light"] = &judgement_of_light;
2023
creators["divine shield"] = &divine_shield;
2124
creators["flash of light"] = &flash_of_light;
2225
creators["flash of light on party"] = &flash_of_light_on_party;
@@ -25,6 +28,13 @@ namespace ai
2528
creators["lay on hands on party"] = &lay_on_hands_on_party;
2629
}
2730
private:
31+
static ActionNode* blessing_of_kings_on_party(PlayerbotAI* ai)
32+
{
33+
return new ActionNode ("blessing of kings on party",
34+
/*P*/ NULL,
35+
/*A*/ NextAction::array(0, new NextAction("blessing of might on party"), NULL),
36+
/*C*/ NULL);
37+
}
2838
static ActionNode* lay_on_hands(PlayerbotAI* ai)
2939
{
3040
return new ActionNode ("lay on hands",
@@ -102,13 +112,27 @@ namespace ai
102112
/*A*/ NextAction::array(0, new NextAction("judgement of justice"), NULL),
103113
/*C*/ NULL);
104114
}
115+
static ActionNode* judgement_of_justice(PlayerbotAI* ai)
116+
{
117+
return new ActionNode ("judgement of justice",
118+
/*P*/ NULL,
119+
/*A*/ NextAction::array(0, new NextAction("judgement"), NULL),
120+
/*C*/ NULL);
121+
}
105122
static ActionNode* judgement_of_wisdom(PlayerbotAI* ai)
106123
{
107124
return new ActionNode ("judgement of wisdom",
108125
/*P*/ NULL,
109126
/*A*/ NextAction::array(0, new NextAction("judgement of light"), NULL),
110127
/*C*/ NULL);
111128
}
129+
static ActionNode* judgement_of_light(PlayerbotAI* ai)
130+
{
131+
return new ActionNode ("judgement of light",
132+
/*P*/ NULL,
133+
/*A*/ NextAction::array(0, new NextAction("judgement"), NULL),
134+
/*C*/ NULL);
135+
}
112136
static ActionNode* divine_shield(PlayerbotAI* ai)
113137
{
114138
return new ActionNode ("divine shield",

src/modules/Bots/playerbot/strategy/paladin/PaladinActions.h

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,42 @@
33

44
namespace ai
55
{
6-
class CastJudgementOfLightAction : public CastMeleeSpellAction
6+
// Base for judgement actions that guards against judging with no active seal
7+
class CastJudgementBaseAction : public CastMeleeSpellAction
78
{
89
public:
9-
CastJudgementOfLightAction(PlayerbotAI* ai) : CastMeleeSpellAction(ai, "judgement of light") {}
10+
CastJudgementBaseAction(PlayerbotAI* ai, string spell) : CastMeleeSpellAction(ai, spell) {}
11+
virtual bool isPossible()
12+
{
13+
Unit* bot = ai->GetBot();
14+
if (!ai->HasAura("seal of righteousness", bot) &&
15+
!ai->HasAura("seal of the crusader", bot) &&
16+
!ai->HasAura("seal of command", bot) &&
17+
!ai->HasAura("seal of vengeance", bot) &&
18+
!ai->HasAura("seal of justice", bot) &&
19+
!ai->HasAura("seal of light", bot) &&
20+
!ai->HasAura("seal of wisdom", bot))
21+
return false;
22+
return CastMeleeSpellAction::isPossible();
23+
}
1024
};
1125

12-
class CastJudgementOfWisdomAction : public CastMeleeSpellAction
26+
class CastJudgementOfLightAction : public CastJudgementBaseAction
1327
{
1428
public:
15-
CastJudgementOfWisdomAction(PlayerbotAI* ai) : CastMeleeSpellAction(ai, "judgement of wisdom") {}
29+
CastJudgementOfLightAction(PlayerbotAI* ai) : CastJudgementBaseAction(ai, "judgement of light") {}
1630
};
1731

18-
class CastJudgementOfJusticeAction : public CastMeleeSpellAction
32+
class CastJudgementOfWisdomAction : public CastJudgementBaseAction
1933
{
2034
public:
21-
CastJudgementOfJusticeAction(PlayerbotAI* ai) : CastMeleeSpellAction(ai, "judgement of justice") {}
35+
CastJudgementOfWisdomAction(PlayerbotAI* ai) : CastJudgementBaseAction(ai, "judgement of wisdom") {}
36+
};
37+
38+
class CastJudgementOfJusticeAction : public CastJudgementBaseAction
39+
{
40+
public:
41+
CastJudgementOfJusticeAction(PlayerbotAI* ai) : CastJudgementBaseAction(ai, "judgement of justice") {}
2242
};
2343

2444
class CastRighteousFuryAction : public CastBuffSpellAction
@@ -69,6 +89,25 @@ namespace ai
6989
CastSealOfRighteousnessAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "seal of righteousness") {}
7090
};
7191

92+
class CastSealOfTheCrusaderAction : public CastBuffSpellAction
93+
{
94+
public:
95+
CastSealOfTheCrusaderAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "seal of the crusader") {}
96+
virtual bool isPossible()
97+
{
98+
Unit* target = AI_VALUE(Unit*, "current target");
99+
if (target && ai->HasAura("judgement of the crusader", target))
100+
return false;
101+
return CastBuffSpellAction::isPossible();
102+
}
103+
};
104+
105+
class CastJudgementAction : public CastJudgementBaseAction
106+
{
107+
public:
108+
CastJudgementAction(PlayerbotAI* ai) : CastJudgementBaseAction(ai, "judgement") {}
109+
};
110+
72111
class CastSealOfJusticeAction : public CastBuffSpellAction
73112
{
74113
public:
@@ -305,6 +344,12 @@ namespace ai
305344
BEGIN_SPELL_ACTION(CastExorcismAction, "exorcism")
306345
END_SPELL_ACTION()
307346

347+
class CastBlessingOfFreedomAction : public CastBuffSpellAction
348+
{
349+
public:
350+
CastBlessingOfFreedomAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "blessing of freedom") {}
351+
};
352+
308353
class CastHolyShieldAction : public CastBuffSpellAction
309354
{
310355
public:

src/modules/Bots/playerbot/strategy/paladin/PaladinAiObjectContext.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ namespace ai
9494
{
9595
creators["judgement of wisdom"] = &TriggerFactoryInternal::judgement_of_wisdom;
9696
creators["judgement of light"] = &TriggerFactoryInternal::judgement_of_light;
97+
creators["aura"] = &TriggerFactoryInternal::aura;
9798
creators["blessing"] = &TriggerFactoryInternal::blessing;
99+
creators["blessing of might"] = &TriggerFactoryInternal::blessing_of_might;
98100
creators["seal"] = &TriggerFactoryInternal::seal;
99101
creators["art of war"] = &TriggerFactoryInternal::art_of_war;
100102
creators["blessing of kings on party"] = &TriggerFactoryInternal::blessing_of_kings_on_party;
@@ -115,14 +117,19 @@ namespace ai
115117
creators["righteous fury"] = &TriggerFactoryInternal::righteous_fury;
116118
creators["holy shield"] = &TriggerFactoryInternal::holy_shield;
117119
creators["hammer of justice on enemy healer"] = &TriggerFactoryInternal::hammer_of_justice_on_enemy_target;
120+
creators["holy wrath"] = &TriggerFactoryInternal::holy_wrath;
121+
creators["exorcism"] = &TriggerFactoryInternal::exorcism;
122+
creators["blessing of freedom"] = &TriggerFactoryInternal::blessing_of_freedom;
118123
}
119124

120125
private:
121126
static Trigger* holy_shield(PlayerbotAI* ai) { return new HolyShieldTrigger(ai); }
122127
static Trigger* righteous_fury(PlayerbotAI* ai) { return new RighteousFuryTrigger(ai); }
123128
static Trigger* judgement_of_wisdom(PlayerbotAI* ai) { return new JudgementOfWisdomTrigger(ai); }
124129
static Trigger* judgement_of_light(PlayerbotAI* ai) { return new JudgementOfLightTrigger(ai); }
130+
static Trigger* aura(PlayerbotAI* ai) { return new AuraTrigger(ai); }
125131
static Trigger* blessing(PlayerbotAI* ai) { return new BlessingTrigger(ai); }
132+
static Trigger* blessing_of_might(PlayerbotAI* ai) { return new BlessingOfMightTrigger(ai); }
126133
static Trigger* seal(PlayerbotAI* ai) { return new SealTrigger(ai); }
127134
static Trigger* art_of_war(PlayerbotAI* ai) { return new ArtOfWarTrigger(ai); }
128135
static Trigger* blessing_of_kings_on_party(PlayerbotAI* ai) { return new BlessingOfKingsOnPartyTrigger(ai); }
@@ -141,6 +148,9 @@ namespace ai
141148
static Trigger* CleanseCureMagic(PlayerbotAI* ai) { return new CleanseCureMagicTrigger(ai); }
142149
static Trigger* CleanseCurePartyMemberMagic(PlayerbotAI* ai) { return new CleanseCurePartyMemberMagicTrigger(ai); }
143150
static Trigger* hammer_of_justice_on_enemy_target(PlayerbotAI* ai) { return new HammerOfJusticeEnemyHealerTrigger(ai); }
151+
static Trigger* holy_wrath(PlayerbotAI* ai) { return new HolyWrathTrigger(ai); }
152+
static Trigger* exorcism(PlayerbotAI* ai) { return new ExorcismTrigger(ai); }
153+
static Trigger* blessing_of_freedom(PlayerbotAI* ai) { return new BlessingOfFreedomTrigger(ai); }
144154
};
145155
};
146156
};
@@ -156,12 +166,18 @@ namespace ai
156166
public:
157167
AiObjectContextInternal()
158168
{
169+
creators["seal of the crusader"] = &AiObjectContextInternal::seal_of_the_crusader;
170+
creators["judgement"] = &AiObjectContextInternal::judgement;
159171
creators["seal of command"] = &AiObjectContextInternal::seal_of_command;
160172
creators["blessing of might"] = &AiObjectContextInternal::blessing_of_might;
173+
creators["blessing of might on party"] = &AiObjectContextInternal::blessing_of_might_on_party;
174+
creators["blessing of wisdom"] = &AiObjectContextInternal::blessing_of_wisdom;
175+
creators["blessing of wisdom on party"] = &AiObjectContextInternal::blessing_of_wisdom_on_party;
161176
creators["blessing of kings on party"] = &AiObjectContextInternal::blessing_of_kings_on_party;
162177
creators["redemption"] = &AiObjectContextInternal::redemption;
163178
creators["seal of light"] = &AiObjectContextInternal::seal_of_light;
164179
creators["devotion aura"] = &AiObjectContextInternal::devotion_aura;
180+
creators["concentration aura"] = &AiObjectContextInternal::concentration_aura;
165181
creators["holy wrath"] = &AiObjectContextInternal::holy_wrath;
166182
creators["consecration"] = &AiObjectContextInternal::consecration;
167183
creators["cleanse disease"] = &AiObjectContextInternal::cleanse_disease;
@@ -201,17 +217,24 @@ namespace ai
201217
creators["righteous fury"] = &AiObjectContextInternal::righteous_fury;
202218
creators["blessing of sanctuary"] = &AiObjectContextInternal::blessing_of_sanctuary;
203219
creators["hammer of justice on enemy healer"] = &AiObjectContextInternal::hammer_of_justice_on_enemy_healer;
220+
creators["blessing of freedom"] = &AiObjectContextInternal::blessing_of_freedom;
204221
}
205222

206223
private:
207224
static Action* righteous_fury(PlayerbotAI* ai) { return new CastRighteousFuryAction(ai); }
208225
static Action* blessing_of_sanctuary(PlayerbotAI* ai) { return new CastBlessingOfSanctuaryAction(ai); }
226+
static Action* seal_of_the_crusader(PlayerbotAI* ai) { return new CastSealOfTheCrusaderAction(ai); }
227+
static Action* judgement(PlayerbotAI* ai) { return new CastJudgementAction(ai); }
209228
static Action* seal_of_command(PlayerbotAI* ai) { return new CastSealOfCommandAction(ai); }
210229
static Action* blessing_of_might(PlayerbotAI* ai) { return new CastBlessingOfMightAction(ai); }
230+
static Action* blessing_of_might_on_party(PlayerbotAI* ai) { return new CastBlessingOfMightOnPartyAction(ai); }
231+
static Action* blessing_of_wisdom(PlayerbotAI* ai) { return new CastBlessingOfWisdomAction(ai); }
232+
static Action* blessing_of_wisdom_on_party(PlayerbotAI* ai) { return new CastBlessingOfWisdomOnPartyAction(ai); }
211233
static Action* blessing_of_kings_on_party(PlayerbotAI* ai) { return new CastBlessingOfKingsOnPartyAction(ai); }
212234
static Action* redemption(PlayerbotAI* ai) { return new CastRedemptionAction(ai); }
213235
static Action* seal_of_light(PlayerbotAI* ai) { return new CastSealOfLightAction(ai); }
214236
static Action* devotion_aura(PlayerbotAI* ai) { return new CastDevotionAuraAction(ai); }
237+
static Action* concentration_aura(PlayerbotAI* ai) { return new CastConcentrationAuraAction(ai); }
215238
static Action* holy_wrath(PlayerbotAI* ai) { return new CastHolyWrathAction(ai); }
216239
static Action* consecration(PlayerbotAI* ai) { return new CastConsecrationAction(ai); }
217240
static Action* cleanse_poison(PlayerbotAI* ai) { return new CastCleansePoisonAction(ai); }
@@ -249,6 +272,7 @@ namespace ai
249272
static Action* frost_resistance_aura(PlayerbotAI* ai) { return new CastFrostResistanceAuraAction(ai); }
250273
static Action* fire_resistance_aura(PlayerbotAI* ai) { return new CastFireResistanceAuraAction(ai); }
251274
static Action* hammer_of_justice_on_enemy_healer(PlayerbotAI* ai) { return new CastHammerOfJusticeOnEnemyHealerAction(ai); }
275+
static Action* blessing_of_freedom(PlayerbotAI* ai) { return new CastBlessingOfFreedomAction(ai); }
252276
};
253277
};
254278
};

src/modules/Bots/playerbot/strategy/paladin/PaladinBuffStrategies.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void PaladinBuffDpsStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
3030
{
3131
triggers.push_back(new TriggerNode(
3232
"seal",
33-
NextAction::array(0, new NextAction("seal of vengeance", 89.0f), NULL)));
33+
NextAction::array(0, new NextAction("seal of the crusader", 89.0f), NULL)));
3434

3535
triggers.push_back(new TriggerNode(
3636
"retribution aura",

src/modules/Bots/playerbot/strategy/paladin/PaladinTriggers.cpp

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,50 @@ bool SealTrigger::IsActive()
1313
!ai->HasAura("seal of vengeance", target) &&
1414
!ai->HasAura("seal of righteousness", target) &&
1515
!ai->HasAura("seal of light", target) &&
16-
!ai->HasAura("seal of wisdom", target);
16+
!ai->HasAura("seal of wisdom", target) &&
17+
!ai->HasAura("seal of the crusader", target);
18+
}
19+
20+
bool AuraTrigger::IsActive()
21+
{
22+
Unit* target = GetTarget();
23+
return !ai->HasAura("devotion aura", target) &&
24+
!ai->HasAura("retribution aura", target) &&
25+
!ai->HasAura("concentration aura", target) &&
26+
!ai->HasAura("shadow resistance aura", target) &&
27+
!ai->HasAura("frost resistance aura", target) &&
28+
!ai->HasAura("fire resistance aura", target) &&
29+
!ai->HasAura("crusader aura", target);
1730
}
1831

1932
bool CrusaderAuraTrigger::IsActive()
2033
{
2134
Unit* target = GetTarget();
2235
return AI_VALUE2(bool, "mounted", "self target") && !ai->HasAura("crusader aura", target);
2336
}
37+
38+
bool HolyWrathTrigger::IsActive()
39+
{
40+
Unit* target = AI_VALUE(Unit*, "current target");
41+
if (!target)
42+
return false;
43+
uint32 ctype = target->GetCreatureType();
44+
if (ctype != CREATURE_TYPE_UNDEAD && ctype != CREATURE_TYPE_DEMON)
45+
return false;
46+
return AI_VALUE(uint8, "attacker count") >= 2;
47+
}
48+
49+
bool ExorcismTrigger::IsActive()
50+
{
51+
Unit* target = AI_VALUE(Unit*, "current target");
52+
if (!target)
53+
return false;
54+
uint32 ctype = target->GetCreatureType();
55+
return ctype == CREATURE_TYPE_UNDEAD || ctype == CREATURE_TYPE_DEMON;
56+
}
57+
58+
bool BlessingOfFreedomTrigger::IsActive()
59+
{
60+
Unit* bot = ai->GetBot();
61+
return bot->IsInRoots() || bot->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED);
62+
}

0 commit comments

Comments
 (0)