Skip to content

Commit 2b2a3ec

Browse files
authored
Shaman bot fixes and tweeks (#292)
1 parent c444fa6 commit 2b2a3ec

7 files changed

Lines changed: 145 additions & 1 deletion

File tree

src/modules/Bots/playerbot/strategy/shaman/CasterShamanStrategy.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class CasterShamanStrategyActionNodeFactory : public NamedObjectFactory<ActionNo
1111
CasterShamanStrategyActionNodeFactory()
1212
{
1313
creators["magma totem"] = &magma_totem;
14+
creators["thunderstorm"] = &thunderstorm;
1415
}
1516
private:
1617
static ActionNode* magma_totem(PlayerbotAI* ai)
@@ -20,6 +21,13 @@ class CasterShamanStrategyActionNodeFactory : public NamedObjectFactory<ActionNo
2021
/*A*/ NULL,
2122
/*C*/ NextAction::array(0, new NextAction("fire nova"), NULL));
2223
}
24+
static ActionNode* thunderstorm(PlayerbotAI* ai)
25+
{
26+
return new ActionNode ("thunderstorm",
27+
/*P*/ NULL,
28+
/*A*/ NextAction::array(0, new NextAction("chain lightning"), NULL),
29+
/*C*/ NULL);
30+
}
2331
};
2432

2533
CasterShamanStrategy::CasterShamanStrategy(PlayerbotAI* ai) : GenericShamanStrategy(ai)

src/modules/Bots/playerbot/strategy/shaman/GenericShamanStrategy.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class GenericShamanStrategyActionNodeFactory : public NamedObjectFactory<ActionN
2020
creators["chain heal on party"] = &chain_heal_on_party;
2121
creators["riptide on party"] = &riptide_on_party;
2222
creators["earth shock"] = &earth_shock;
23+
creators["cleanse spirit"] = &cleanse_spirit;
24+
creators["water shield"] = &water_shield;
25+
creators["fire nova"] = &fire_nova;
2326
}
2427
private:
2528
static ActionNode* earth_shock(PlayerbotAI* ai)
@@ -29,6 +32,27 @@ class GenericShamanStrategyActionNodeFactory : public NamedObjectFactory<ActionN
2932
/*A*/ NextAction::array(0, new NextAction("flame shock"), NULL),
3033
/*C*/ NULL);
3134
}
35+
static ActionNode* cleanse_spirit(PlayerbotAI* ai)
36+
{
37+
return new ActionNode ("cleanse spirit",
38+
/*P*/ NULL,
39+
/*A*/ NextAction::array(0, new NextAction("cleansing totem"), NULL),
40+
/*C*/ NULL);
41+
}
42+
static ActionNode* water_shield(PlayerbotAI* ai)
43+
{
44+
return new ActionNode ("water shield",
45+
/*P*/ NULL,
46+
/*A*/ NextAction::array(0, new NextAction("lightning shield"), NULL),
47+
/*C*/ NULL);
48+
}
49+
static ActionNode* fire_nova(PlayerbotAI* ai)
50+
{
51+
return new ActionNode ("fire nova",
52+
/*P*/ NULL,
53+
/*A*/ NULL,
54+
/*C*/ NULL);
55+
}
3256
static ActionNode* flametongue_weapon(PlayerbotAI* ai)
3357
{
3458
return new ActionNode ("flametongue weapon",

src/modules/Bots/playerbot/strategy/shaman/ShamanActions.h

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,70 @@ namespace ai
207207
public:
208208
CastBloodlustAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "bloodlust") {}
209209
};
210+
211+
class CastHeroismAction : public CastBuffSpellAction
212+
{
213+
public:
214+
CastHeroismAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "heroism") {}
215+
};
216+
217+
class CastWaterShieldAction : public CastBuffSpellAction
218+
{
219+
public:
220+
CastWaterShieldAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "water shield") {}
221+
};
222+
223+
class CastCleanseSpiritAction : public CastSpellAction
224+
{
225+
public:
226+
CastCleanseSpiritAction(PlayerbotAI* ai) : CastSpellAction(ai, "cleanse spirit") {}
227+
virtual string GetTargetName() { return "self target"; }
228+
};
229+
230+
class CastCleanseSpiritPoisonOnPartyAction : public CurePartyMemberAction
231+
{
232+
public:
233+
CastCleanseSpiritPoisonOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "cleanse spirit", DISPEL_POISON) {}
234+
virtual string getName() { return "cleanse spirit poison on party"; }
235+
};
236+
237+
class CastCleanseSpiritCurseOnPartyAction : public CurePartyMemberAction
238+
{
239+
public:
240+
CastCleanseSpiritCurseOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "cleanse spirit", DISPEL_CURSE) {}
241+
virtual string getName() { return "cleanse spirit curse on party"; }
242+
};
243+
244+
class CastCleanseSpiritDiseaseOnPartyAction : public CurePartyMemberAction
245+
{
246+
public:
247+
CastCleanseSpiritDiseaseOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "cleanse spirit", DISPEL_DISEASE) {}
248+
virtual string getName() { return "cleanse spirit disease on party"; }
249+
};
250+
251+
class CastFireNovaAction : public CastSpellAction
252+
{
253+
public:
254+
CastFireNovaAction(PlayerbotAI* ai) : CastSpellAction(ai, "fire nova") {}
255+
virtual string GetTargetName() { return "self target"; }
256+
};
257+
258+
class CastThunderstormAction : public CastSpellAction
259+
{
260+
public:
261+
CastThunderstormAction(PlayerbotAI* ai) : CastSpellAction(ai, "thunderstorm") {}
262+
virtual string GetTargetName() { return "self target"; }
263+
};
264+
265+
class CastGhostWolfAction : public CastBuffSpellAction
266+
{
267+
public:
268+
CastGhostWolfAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "ghost wolf") {}
269+
};
270+
271+
class CastTremorTotemAction : public CastTotemAction
272+
{
273+
public:
274+
CastTremorTotemAction(PlayerbotAI* ai) : CastTotemAction(ai, "tremor totem") {}
275+
};
210276
}

src/modules/Bots/playerbot/strategy/shaman/ShamanAiObjectContext.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,14 @@ namespace ai
109109
creators["bloodlust"] = &TriggerFactoryInternal::bloodlust;
110110
creators["maelstrom weapon"] = &TriggerFactoryInternal::maelstrom_weapon;
111111
creators["wind shear on enemy healer"] = &TriggerFactoryInternal::wind_shear_on_enemy_healer;
112+
creators["ghost wolf"] = &TriggerFactoryInternal::ghost_wolf;
113+
creators["tremor totem"] = &TriggerFactoryInternal::tremor_totem; // unwired intentionally
112114
}
113115

114116
private:
115117
static Trigger* maelstrom_weapon(PlayerbotAI* ai) { return new MaelstromWeaponTrigger(ai); }
118+
static Trigger* ghost_wolf(PlayerbotAI* ai) { return new GhostWolfTrigger(ai); }
119+
static Trigger* tremor_totem(PlayerbotAI* ai) { return new TremorTotemTrigger(ai); }
116120
static Trigger* heroism(PlayerbotAI* ai) { return new HeroismTrigger(ai); }
117121
static Trigger* bloodlust(PlayerbotAI* ai) { return new BloodlustTrigger(ai); }
118122
static Trigger* party_member_cleanse_disease(PlayerbotAI* ai) { return new PartyMemberCleanseSpiritDiseaseTrigger(ai); }
@@ -186,10 +190,32 @@ namespace ai
186190
creators["chain lightning"] = &AiObjectContextInternal::chain_lightning;
187191
creators["lightning bolt"] = &AiObjectContextInternal::lightning_bolt;
188192
creators["bloodlust"] = &AiObjectContextInternal::bloodlust;
193+
creators["heroism"] = &AiObjectContextInternal::heroism;
194+
creators["water shield"] = &AiObjectContextInternal::water_shield;
195+
creators["cleanse spirit"] = &AiObjectContextInternal::cleanse_spirit;
196+
creators["cleanse spirit poison on party"] = &AiObjectContextInternal::cleanse_spirit_poison_on_party;
197+
creators["cleanse spirit curse on party"] = &AiObjectContextInternal::cleanse_spirit_curse_on_party;
198+
creators["cleanse spirit disease on party"] = &AiObjectContextInternal::cleanse_spirit_disease_on_party;
199+
creators["cleansing totem"] = &AiObjectContextInternal::cleansing_totem;
200+
creators["fire nova"] = &AiObjectContextInternal::fire_nova;
201+
creators["thunderstorm"] = &AiObjectContextInternal::thunderstorm;
202+
creators["ghost wolf"] = &AiObjectContextInternal::ghost_wolf;
203+
creators["tremor totem"] = &AiObjectContextInternal::tremor_totem; // unwired intentionally
189204
}
190205

191206
private:
192207
static Action* bloodlust(PlayerbotAI* ai) { return new CastBloodlustAction(ai); }
208+
static Action* heroism(PlayerbotAI* ai) { return new CastHeroismAction(ai); }
209+
static Action* water_shield(PlayerbotAI* ai) { return new CastWaterShieldAction(ai); }
210+
static Action* cleanse_spirit(PlayerbotAI* ai) { return new CastCleanseSpiritAction(ai); }
211+
static Action* cleanse_spirit_poison_on_party(PlayerbotAI* ai) { return new CastCleanseSpiritPoisonOnPartyAction(ai); }
212+
static Action* cleanse_spirit_curse_on_party(PlayerbotAI* ai) { return new CastCleanseSpiritCurseOnPartyAction(ai); }
213+
static Action* cleanse_spirit_disease_on_party(PlayerbotAI* ai) { return new CastCleanseSpiritDiseaseOnPartyAction(ai); }
214+
static Action* cleansing_totem(PlayerbotAI* ai) { return new CastCleansingTotemAction(ai); }
215+
static Action* fire_nova(PlayerbotAI* ai) { return new CastFireNovaAction(ai); }
216+
static Action* thunderstorm(PlayerbotAI* ai) { return new CastThunderstormAction(ai); }
217+
static Action* ghost_wolf(PlayerbotAI* ai) { return new CastGhostWolfAction(ai); }
218+
static Action* tremor_totem(PlayerbotAI* ai) { return new CastTremorTotemAction(ai); }
193219
static Action* lightning_bolt(PlayerbotAI* ai) { return new CastLightningBoltAction(ai); }
194220
static Action* chain_lightning(PlayerbotAI* ai) { return new CastChainLightningAction(ai); }
195221
static Action* frost_shock(PlayerbotAI* ai) { return new CastFrostShockAction(ai); }

src/modules/Bots/playerbot/strategy/shaman/ShamanNonCombatStrategy.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ void ShamanNonCombatStrategy::InitTriggers(std::list<TriggerNode*> &triggers)
4040
triggers.push_back(new TriggerNode(
4141
"medium aoe heal",
4242
NextAction::array(0, new NextAction("chain heal", 27.0f), NULL)));
43+
44+
triggers.push_back(new TriggerNode(
45+
"ghost wolf",
46+
NextAction::array(0, new NextAction("ghost wolf", 9.0f), NULL)));
4347
}
4448

4549
void ShamanNonCombatStrategy::InitMultipliers(std::list<Multiplier*> &multipliers)

src/modules/Bots/playerbot/strategy/shaman/ShamanTriggers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bool ShamanWeaponTrigger::IsActive()
2020

2121
for (list<string>::iterator i = spells.begin(); i != spells.end(); ++i)
2222
{
23-
uint32 spellId = AI_VALUE2(uint32, "spell id", spell);
23+
uint32 spellId = AI_VALUE2(uint32, "spell id", *i);
2424
if (!spellId)
2525
{
2626
continue;

src/modules/Bots/playerbot/strategy/shaman/ShamanTriggers.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,20 @@ namespace ai
194194
public:
195195
WindShearInterruptEnemyHealerSpellTrigger(PlayerbotAI* ai) : InterruptEnemyHealerTrigger(ai, "wind shear") {}
196196
};
197+
198+
class GhostWolfTrigger : public BuffTrigger
199+
{
200+
public:
201+
GhostWolfTrigger(PlayerbotAI* ai) : BuffTrigger(ai, "ghost wolf") {}
202+
};
203+
204+
class TremorTotemTrigger : public TotemTrigger
205+
{
206+
public:
207+
TremorTotemTrigger(PlayerbotAI* ai) : TotemTrigger(ai, "tremor totem", 1) {}
208+
virtual bool IsActive()
209+
{
210+
return TotemTrigger::IsActive() && !AI_VALUE2(bool, "has totem", "strength of earth totem");
211+
}
212+
};
197213
}

0 commit comments

Comments
 (0)