Skip to content

Commit 1cae1b3

Browse files
authored
ToC dungeon strategies (liyunfan1223#1259)
* ICC PP WIP WIP * added mutated plague for PP * BPC added (kinetic and boss targeting need to be done by player) OT collects dark nucles, bots spread on vortex and other stuff they do ok on their own. Tested only on 10NM, should work on 25NM * Tank pos. correction * BQL, ranged spread, link, flame, bite, tanking tested 10NM to do (better fire spread, hc tacti, melee spread when in air) * LDW improved improved shadow logic, ranged spread for easier shadow handling * dbs update, fixed teleporting Bots should only go and teleport to the mage that is actually below zero now * DBS ranged fix Ranged should spread more quickly and freak out less * Festergut && DBS fixed ranged spread (both) fixed spore logic (fester) * Rotface fix Improved big ooze tanking (static pos, todo kiting) ooze explosion spread mechanic fix ooze pool fix Player needs to mark rotface with skull icon, oterwise bots try to attack oozes * BQL fixed for 25nm todo: better melee logic in air phase, better melee flame spread * VDW, Sister Svalna, Sindy update Sister Svalna, bots can pickup spears and throw at svalna when she has shield up VDW added healer strats to use portal and heal boss (atm druids are for raid healing only, so use druide + any other healer, ideally player should be healer) todo (focus on supressers, add healer rotations, atm they use quickest spell they can) Sindragosa Added tank boss manipulation (boss orientation and position) bots detect (buffet, unchained magic and chilled to the bone and act accordingly) bots detect frost beacon move to safe spot and los frost bombs around them, while dpsing tombs (todo stop dps if only one tomb is left, if we have frost bombs around, not a big deal atm since in nm they dont one shot) Last phase bots los behind tomb to loose buffet, tanks swap when they have hi buffet count. Player should tell bots with skull rti if they should kill tomb or focus boss. todo (dynamic tomb los in last phase so that healers can see tank but also hide behind tomb to break los from boss) Removed some debug messages, improved LM spike action (nearest bots also try to help kill it) Improved Lady Deathwshiper shade action (only targeted bots will run away instead of every bot that is near it) dbs improved tank switch I recommend to use 3 healers (just to be safe) and 2 paladin tanks (warr seems to struggle with agro) in 10 man 25 man 6-7 healers (just to be safe) Since most of the bosses are about survival and not dps * LK Update (doable) LK added Improved tank switching for all bosses Fixed PP gas cloud kiting Malleable goo todo (dont know how to detect it since its not object or npc) just summon ranged bots to safe position to bypass BPC fixed OT sometimes not tanking kele kinectic bombs todo (for now player should take care of them) Sindragosa fixed rare case when she is in air phase but tombs went to last phase position LK Bots can handle necrotic Bots can handle adds Bots should focus valkyre that actually grabbed someone (if unlucky and player just use attack command and summon bots to you if they are far away from you) if they grab bots you can either summon to make them useless or let bots cc them and do it legit way. Defile should be watched by player and once it was cast just summon bots to you Vile spirits for some reason go to the ground and get nuked by bots aoe spells so there is not much to be done **Player needs to be alive the whole LK fight since you will have to watch out for frost spehers (sometimes bots ignore them), summon bots when defile is up and summon ranged bots if they get stuck near shambling or raging spirits since their aoe will wipe you) all in all LK is doable both 10 and 25nm, player needs to have knowledge of lk fight and needs to know how to use multibot addon and make macros for eg summoning or commanding groups of bots or individual bots) Dont forget frost/shadow/nature resist auras in whole ICC since it will help alot I have done whole icc 10 and 25 with 2 pala tanks, 2/5 heals and rest dps, if you use +1 or +2 heals it should be easier (since I was testing I did close to 0 dmg in fights same with heals) * fixed changes made by mistake fix * Malleable fix (simple spread mechanic) Malleable mechanic added (simple spread for now) Gas cloud fixed (Bots sometimes got stuck between puddle and kite location) * Defile Update Bots detect and avoid defile (they struggle to find a way back to the boss around it tho, use summon to help them) Melee bots should be able to stand behind/to the flank of shambling/spirits * GS fixed bots not returning to their ship for A and H Bots will return back to ship after killing mage * PP gas cloud kiting improved PP gas cloud kiting improved * BPC targeting fixed Bots will mark valid prince with skull RTI now * BQL added melee spread in air pahse BQL added melee spread * VDW healing rotation improved Healers will now use strong heals and hots * Fixed Necrotic Plague Fixed issue with Necrotic where it would get dispelled too soon, or would not get dispelled at all * LK Update Refined defile logic Added 3 points for ranged and melee in winter phase (east, west, south when facing throne) fixed frost spheres targeting (hunter will focus them) Atm bots will reset z axis if they fall underground or if they get teleported by lk Better positioning in 1st phase * 10HC update until PP LK defile improved for 10nm (bots sometimes stood 2 close to defile until it grew few times) Improved rotface for HC PP remade for 10HC. Gas cloud is now properly kited Fixed a rare case of server crash when there were ooze and gas cloud alive at same time. Bots will move around puddles according to its size now. Bots that get unboud plague will simply move away from raid and die thus loosing it from raid. Volatile ooze improved stacking. Fixed ranged sometimes glitching thru walls when spreading out from other members. 10HC PP is now doable but its hard without summoning (summoning break gascloud and ooze targets so its easier to do). You need to watch boss so you dont phase 2 soon otherwise you will get 2x ooze and cloud which is almoust always a wipe. If abo is not played near perfection bots will struggle with oozes and gas clouds if they are not slowed on time. Always save energy to slow gas cloud since it will wipe the group if it reach its target. Bots will sometimes stand in puddle, just command them to move and they will figure out what to do. todo (proper malleable handling) * Up until Sindy 10HC BPC added shadow prison handling, bots stop moving if more than 12 stack, tanks more than 18 Improved spreading logic VDW fixed issue where bots in portal wold move at half speed compared to real player * fixed accidental change * LK 10HC update Added Shadow trap logic (if they stand in it, not a big deal since bots wont get yeeted only players will) When harvest soul, only player will be in another dimension (you must survive) **Sindy and LK can be done, but I must dissapoint purist, at my skill level I could not achieve to do HC without using summon or other "cheat" bot functions. Other bosses are all doable now in 10hc * ICC fixes GS, PP; BQL, SINDY Minor fixes, bite action improved * ICC improve Sindy Bots will now choose non beacon position based on difficulty, 10/25 * ICC fixed missing A/H buff Fixed missing ICC buff for A and H Buff will only be present when logged on and in ICC, once any bot or player leave ICC the buff is gone to prevent abuse. This will make ICC easier now and with recent DPS update and movement improvement bots will now actully do decent dps and even greater healing. Ally buff https://www.wowhead.com/wotlk/spell=73828/strength-of-wrynn Horde buff https://www.wowhead.com/wotlk/spell=73822/hellscreams-warsong * revert last change revert buff * ICC improve Rotface Bots will now mark Rotface with skull icon, which will make them focus boss instead of oozes automatically * ICC Festergut 10 Man fix There was a rare case in 10 Man when 2 tanks would get spores which made them both stack at melee spot. Now the code will check if any of the spored player is main tank, if it is, it will stay at melee and other spores will go at ranged spot since off tank doesn't really need to stand near main tank all the time. * ICC BPC major update, fix and improve Fixed main tank sometimes not tanking both bosses (vala and talda) Improved marking of current prince Empowered vortex: bots will now spread out when it is being cast, instead of always spreading(ranged). This will make melee also spread better now since bots will calculate and move to optimal positions. Added Kinetic bomb handling. Hunters will take care of bombs, if no hunter is present then any ranged dps will take care of kinetic bombs. * ICC BQL/VDW major update + minor fixes/improvements LDW improved spreading for ranged, tanks will move boss in the middle of the room now when shield is depleted which will make bots bug less around pillars GS Assist tank will not teleport to enemy ship and will keep tanking adds on our ship now DBS ranged spread improved (they will calcualte spot for each bot and stick with it reducing movment to minimum), fixed bug where in 25 man ranged bots would go behind walls, making them unable to dps boss, improved rune of blood tanking Festergut ranged spread improved (they will calcualte spot for each bot and stick with it reducing movment to minimum) BQL Melee spread improved, bite logic improved, added swarming shadows logic (not perfect but at least it wont be all over the room anymore), Tanks will properly handle blood mirror now VDW boss and raid healers will be automatically assinged depening by number of healers(if more than 3 healers in group, 2 will focus on raid and others will heal boss, otherwise one healer will heal raid). Druid will be assigned to raid healing if no druid present then some other random heal class. Added rotations for druid healers if they end up healing the boss. Raid healers will not use portals anymore. Healers will come to the ground now after using portals (they were stuck in air) * ICC LK minor update PP Removed pre stacking for ranged when volatile ooze spawn (they will kill it much faster now and only stack if someone actually gets targeted by ooze) LK Hunters will use trnaq shot to remove enrage from shamblings Improved valkyr cc Minimized ping-ponging during winter phase * ICC minor Sindy improve Reduced position tolerances and forced movement for beacon and non beacon positions which will make bots move to spot that they actually need to be at instead of randomly running to sindragosa or beaconed players. * ICC minor update GS Bots will mark mage with skull rti Rotface Fixed bots glitching thru walls and floors (added check if position is valid before moving) PP Bots will mark volatile ooze with skull rti now which will help them focus it and kill asap (usefull for heroic when both volatile ooze and gas cloud are present at the same time) VDW Added default group position in the middle if the room so that bots don't spread out too much which will force them to focus supressers more Fixed Boss healers not keeping themself alive when low on HP * ICC LK minor update Commented out z axis bypass since it was fixed with recent core updates. Bots no longer fall thru buggy platforms so its no longer needed which in return makes valkyrs works as they should. * ICC LM & LDW Improved LM Removed Attack Action since it was buggy and replaced it with RTI. (Improved DPS) Simplified trigger for spike action, since attack logic is handled by skull RTI now. Bots (tanks) will mark spikes with skull RTI, which will make bots instantly switch to Spike targets. If no spike is present, the boss will be marked. Added logic that will make non-tank bots move away from LM to a fixed position behind LM if they happened to be in front of LM (No more insta kills with cleave). If LM is casting Bone Storm, bots will ignore the above logic and do max dps. LDW Removed Attack Action since it was buggy and replaced it with RTI. (Improved DPS) Bots (tanks) will mark adds with skull RTI, which will make bots instantly switch to adds targets. If no spike is present, the boss will be marked, which will help with keeping allies alive when they get mind controlled by LDW. Moved 2nd phase position deeper into the room and reduced boss hp trigger to 95%, which will keep tanks where they should be during 1st phase (sometimes the boss dropped below 98% and tanks would ping pong around the room). Ranged bots will now spread closer to each other now and will ignore spreading if they are 2 far or 2 close to the boss so they can properly reposition. These changes should also fix recent bugs with bots not casting/standing still on LM and LDW. * ICC DBS Improve Replaced attack action with RTI. (Improved DPS) Ranged bots will move away from blood beast if targeted by it now. * ICC Sindragosa and LK Improve Sindragosa Improved tomb los for frost bombs. Bots will now mark tomb with moon rti to avoid killing it too soon. (If they still attack the tomb, simply reset and after bombs are over, simply attack the tomb to kill or mark with a skull.) Main Tank will reset mystic buffet stacks now to avoid tank swapping since it's really unreliable which will make sindy less frustrating to kill (other bots will need to do mechanics properly by hiding behind ice tombs). LK Necrotic plague action Bots will now check before moving to the Shambling if they are in front of the Shambling to avoid getting one shoted by shockwave. Improved multiplier, which will now properly handle dispelling of necrotic plague. Winter phase action Bots will properly move behind adds to avoid getting one shoted by shamblings or raging spirits. If there is a hunter in the grouphunter will focus on spheres; if not, any ranged DPS will focus spheres. Adds action Bots will now be in proper positions during the 1st phase, and when the off tank is done collecting shamblings, it will move away from the group. Bots (non-tanks) will move behind the shambling if they are in front of it to avoid getting one shoted in the 1st phase. Restored action for checking if bots are at ground level, since they were still sometimes glitching through the floor (valkrys will be able to carry bots and drop them off the edge if not killed in time). Improved defile calculations for 10 man and 25 man raids since defile was growing differently for 10 and 25, which would make bots in 25 man move very far away from somewhat small defile puddle. Bots will now properly CC any valkyr that wasn't CC'd, and they won't freak out anymore if multiple valkyrs are present. (They can't tell which valkyr is holding bots/ players, so we should command an attack on valkyrs that are holding someone.) Bots will now run away from Vile Spirits if they are targeted by them during the last phase. * ICC 25HC ldw shades fix Fixed bots could not detect shade if there were multiple present * ICC trigger optimization Optimized trigger and action for: KineticBomb OozePuddle * ICC LK Improve Improved Shadow Trap, Winter phase and 1st phase. Bots will now have fixed positions for 1st phase if no shadow trap is present. Tanks will now take care of taunting adds during winter phase. (Assist tank will collect adds and bring them to main tank, main tank will take over the adds so we have minimal chance of adds rotating towards the raid) Fixed shadow trap detection. * ToC dungeon update Added TOC dungeon strategies for 1st encounter. Other encounters are pretty easy and straightforward so they do not require strategies. They can be all done with follow, reset, summon, attack, skull icon etc... Bots (A/H) will automatically check if they have lance equiped or in inventory. If they don't have lance they will pick it up from nearest lance stand and equip it. Bots will mount nearest mount if they have lance equipped. Once mounted they will keep Defend aura at 3 stacks (top priority). In fight they will cast charge if more than 5f away, they will cast shield break if target has Defended aura active and they will use Thrust if they cant use anything else. In short they will melt any target and enemies wont stand a chance keeping their defend aura up. Once champions are defeated bot will automatically equip best weapon they have in inventory (weapon that was swapped with lance) * ICC minor update LM Bots will now move in smaller increments to get behind boss They will still move towards fixed position, but as soon they are not in front of boss, they will stop moving and do other actions. GS Fixed cannon trigger, now will return true if cannon is 100f from bots. It used to return true all the time. * ToC added Eadric strat bots will look away during radiance cast * ICC LK minor fix fixed crash in icclichkingsaddsaction
1 parent 707210f commit 1cae1b3

17 files changed

+709
-16
lines changed

src/strategy/AiObjectContext.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include "ChatActionContext.h"
1010
#include "ChatTriggerContext.h"
1111
#include "Playerbots.h"
12-
#include "RaidIccActionContext.h"
13-
#include "RaidIccTriggerContext.h"
1412
#include "RaidUlduarTriggerContext.h"
1513
#include "RaidUlduarActionContext.h"
1614
#include "SharedValueContext.h"
@@ -24,6 +22,8 @@
2422
#include "raids/blackwinglair/RaidBwlTriggerContext.h"
2523
#include "raids/naxxramas/RaidNaxxActionContext.h"
2624
#include "raids/naxxramas/RaidNaxxTriggerContext.h"
25+
#include "raids/icecrown/RaidIccActionContext.h"
26+
#include "raids/icecrown/RaidIccTriggerContext.h"
2727
#include "raids/obsidiansanctum/RaidOsActionContext.h"
2828
#include "raids/obsidiansanctum/RaidOsTriggerContext.h"
2929
#include "raids/eyeofeternity/RaidEoEActionContext.h"
@@ -75,6 +75,7 @@ AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
7575
actionContexts.Add(new WotlkDungeonUPActionContext());
7676
actionContexts.Add(new WotlkDungeonCoSActionContext());
7777
actionContexts.Add(new WotlkDungeonFoSActionContext());
78+
actionContexts.Add(new WotlkDungeonToCActionContext());
7879

7980
triggerContexts.Add(new TriggerContext());
8081
triggerContexts.Add(new ChatTriggerContext());
@@ -102,6 +103,7 @@ AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
102103
triggerContexts.Add(new WotlkDungeonUPTriggerContext());
103104
triggerContexts.Add(new WotlkDungeonCoSTriggerContext());
104105
triggerContexts.Add(new WotlkDungeonFosTriggerContext());
106+
triggerContexts.Add(new WotlkDungeonToCTriggerContext());
105107

106108
valueContexts.Add(new ValueContext());
107109

src/strategy/dungeons/DungeonStrategyContext.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "wotlk/utgardepinnacle/UtgardePinnacleStrategy.h"
1616
#include "wotlk/cullingofstratholme/CullingOfStratholmeStrategy.h"
1717
#include "wotlk/forgeofsouls/ForgeOfSoulsStrategy.h"
18+
#include "wotlk/trialofthechampion/TrialOfTheChampionStrategy.h"
1819

1920
/*
2021
Full list/TODO:
@@ -78,8 +79,8 @@ class DungeonStrategyContext : public NamedObjectContext<Strategy>
7879
static Strategy* wotlk_up(PlayerbotAI* botAI) { return new WotlkDungeonUPStrategy(botAI); }
7980
static Strategy* wotlk_cos(PlayerbotAI* botAI) { return new WotlkDungeonCoSStrategy(botAI); }
8081
static Strategy* wotlk_fos(PlayerbotAI* botAI) { return new WotlkDungeonFoSStrategy(botAI); }
82+
static Strategy* wotlk_toc(PlayerbotAI* botAI) { return new WotlkDungeonToCStrategy(botAI); }
8183
// NYI from here down
82-
static Strategy* wotlk_toc(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); }
8384
static Strategy* wotlk_hor(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); }
8485
static Strategy* wotlk_pos(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); }
8586

src/strategy/dungeons/wotlk/WotlkDungeonActionContext.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "utgardepinnacle/UtgardePinnacleActionContext.h"
1515
#include "cullingofstratholme/CullingOfStratholmeActionContext.h"
1616
#include "forgeofsouls/ForgeOfSoulsActionContext.h"
17-
// #include "trialofthechampion/TrialOfTheChampionActionContext.h"
17+
#include "trialofthechampion/TrialOfTheChampionActionContext.h"
1818
// #include "hallsofreflection/HallsOfReflectionActionContext.h"
1919
// #include "pitofsaron/PitOfSaronActionContext.h"
2020

src/strategy/dungeons/wotlk/WotlkDungeonTriggerContext.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "utgardepinnacle/UtgardePinnacleTriggerContext.h"
1515
#include "cullingofstratholme/CullingOfStratholmeTriggerContext.h"
1616
#include "forgeofsouls/ForgeOfSoulsTriggerContext.h"
17-
// #include "trialofthechampion/TrialOfTheChampionTriggerContext.h"
17+
#include "trialofthechampion/TrialOfTheChampionTriggerContext.h"
1818
// #include "hallsofreflection/HallsOfReflectionTriggerContext.h"
1919
// #include "pitofsaron/PitOfSaronTriggerContext.h"
2020

src/strategy/dungeons/wotlk/trialofthechampion/TODO

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef _PLAYERBOT_WOTLKDUNGEONTOCACTIONCONTEXT_H
2+
#define _PLAYERBOT_WOTLKDUNGEONTOCACTIONCONTEXT_H
3+
4+
#include "Action.h"
5+
#include "NamedObjectContext.h"
6+
#include "TrialOfTheChampionActions.h"
7+
8+
class WotlkDungeonToCActionContext : public NamedObjectContext<Action>
9+
{
10+
public:
11+
WotlkDungeonToCActionContext() {
12+
creators["toc lance"] = &WotlkDungeonToCActionContext::toc_lance;
13+
creators["toc ue lance"] = &WotlkDungeonToCActionContext::toc_ue_lance;
14+
creators["toc mount"] = &WotlkDungeonToCActionContext::toc_mount;
15+
creators["toc mounted"] = &WotlkDungeonToCActionContext::toc_mounted;
16+
creators["toc eadric"] = &WotlkDungeonToCActionContext::toc_eadric;
17+
}
18+
private:
19+
static Action* toc_lance(PlayerbotAI* ai) { return new ToCLanceAction(ai); }
20+
static Action* toc_ue_lance(PlayerbotAI* ai) { return new ToCUELanceAction(ai); }
21+
static Action* toc_mount(PlayerbotAI* ai) { return new ToCMountAction(ai); }
22+
static Action* toc_mounted(PlayerbotAI* ai) { return new ToCMountedAction(ai); }
23+
static Action* toc_eadric(PlayerbotAI* ai) { return new ToCEadricAction(ai); }
24+
};
25+
26+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
#include "Playerbots.h"
2+
#include "TrialOfTheChampionActions.h"
3+
#include "TrialOfTheChampionStrategy.h"
4+
#include "strategy/values/NearestNpcsValue.h"
5+
#include "ObjectAccessor.h"
6+
#include "Timer.h"
7+
#include "Vehicle.h"
8+
#include "GenericSpellActions.h"
9+
#include "GenericActions.h"
10+
#include <fstream>
11+
12+
13+
bool ToCLanceAction::Execute(Event event)
14+
{
15+
// If already has lance equipped, do nothing
16+
if (bot->HasItemOrGemWithIdEquipped(ITEM_LANCE, 1))
17+
return false;
18+
19+
// Store current mainhand item
20+
Item* oldWeapon = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
21+
22+
// Search inventory for the lance item
23+
Item* lanceItem = nullptr;
24+
25+
// Check main inventory
26+
for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; slot++)
27+
{
28+
Item* item = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
29+
if (item && item->GetEntry() == ITEM_LANCE)
30+
{
31+
lanceItem = item;
32+
break;
33+
}
34+
}
35+
36+
// Check bags if not found in main inventory
37+
if (!lanceItem)
38+
{
39+
for (uint8 bag = INVENTORY_SLOT_BAG_START; bag < INVENTORY_SLOT_BAG_END; bag++)
40+
{
41+
Bag* pBag = bot->GetBagByPos(bag);
42+
if (pBag)
43+
{
44+
for (uint8 slot = 0; slot < pBag->GetBagSize(); slot++)
45+
{
46+
Item* item = bot->GetItemByPos(bag, slot);
47+
if (item && item->GetEntry() == ITEM_LANCE)
48+
{
49+
lanceItem = item;
50+
break;
51+
}
52+
}
53+
}
54+
if (lanceItem)
55+
break;
56+
}
57+
}
58+
59+
// If we found the lance, equip it
60+
if (lanceItem)
61+
{
62+
// Store the lance's current position
63+
uint8 srcBag = lanceItem->GetBagSlot();
64+
uint8 srcSlot = lanceItem->GetSlot();
65+
66+
// First unequip current weapon if it exists
67+
if (oldWeapon)
68+
{
69+
bot->SwapItem(oldWeapon->GetPos(), lanceItem->GetPos());
70+
}
71+
else
72+
{
73+
bot->EquipItem(EQUIPMENT_SLOT_MAINHAND, lanceItem, true);
74+
}
75+
return true;
76+
}
77+
78+
if (bot->HasItemCount(ITEM_LANCE, 1))
79+
return false;
80+
81+
GameObject* lanceRack = bot->FindNearestGameObject(OBJECT_LANCE_RACK, 100.0f);
82+
if (!lanceRack)
83+
return false;
84+
85+
if (!lanceRack->IsWithinDistInMap(bot, INTERACTION_DISTANCE))
86+
return MoveTo(lanceRack, INTERACTION_DISTANCE);
87+
88+
botAI->RemoveShapeshift();
89+
bot->GetMotionMaster()->Clear();
90+
bot->StopMoving();
91+
lanceRack->Use(bot);
92+
93+
return false;
94+
}
95+
96+
bool ToCUELanceAction::Execute(Event event)
97+
{
98+
if (!bot->HasItemOrGemWithIdEquipped(ITEM_LANCE, 1))
99+
return false;
100+
101+
// Call EquipUpgradeAction
102+
EquipUpgradeAction equipUpgradeAction(botAI);
103+
if (!equipUpgradeAction.Execute(event))
104+
return false;
105+
106+
return false;
107+
}
108+
109+
bool ToCMountedAction::Execute(Event event)
110+
{
111+
Unit* vehicleBase = bot->GetVehicleBase();
112+
Vehicle* vehicle = bot->GetVehicle();
113+
if (!vehicleBase || !vehicle)
114+
return false;
115+
116+
GuidVector attackers = AI_VALUE(GuidVector, "possible targets no los");
117+
118+
Unit* target = nullptr;
119+
for (auto i = attackers.begin(); i != attackers.end(); ++i)
120+
{
121+
Unit* unit = botAI->GetUnit(*i);
122+
if (!unit)
123+
continue;
124+
for (uint32 entry : availableTargets)
125+
{
126+
if (unit->GetEntry() == entry)
127+
{
128+
target = unit;
129+
break;
130+
}
131+
}
132+
if (target)
133+
break;
134+
}
135+
136+
Aura* defendBot = botAI->GetAura("defend", bot, false, true);
137+
if (!defendBot || defendBot->GetStackAmount() < 3)
138+
{
139+
uint32 spellId = AI_VALUE2(uint32, "vehicle spell id", "Defend");
140+
if (botAI->CanCastVehicleSpell(spellId, target) && botAI->CastVehicleSpell(spellId, target))
141+
{
142+
vehicleBase->AddSpellCooldown(spellId, 0, 1000);
143+
return true;
144+
}
145+
}
146+
147+
if (!target)
148+
return false;
149+
150+
if (target->GetDistance2d(bot) > 5.0f)
151+
{
152+
uint32 spellId = AI_VALUE2(uint32, "vehicle spell id", "Charge");
153+
if (botAI->CanCastVehicleSpell(spellId, target) && botAI->CastVehicleSpell(spellId, target))
154+
{
155+
vehicleBase->AddSpellCooldown(spellId, 0, 1000);
156+
return true;
157+
}
158+
}
159+
160+
Aura* defendTarget = botAI->GetAura("defend", target, false, false);
161+
if (!defendTarget)
162+
{}
163+
else
164+
{
165+
uint32 spellId = AI_VALUE2(uint32, "vehicle spell id", "Shield-Breaker");
166+
if (botAI->CanCastVehicleSpell(spellId, target) && botAI->CastVehicleSpell(spellId, target))
167+
{
168+
vehicleBase->AddSpellCooldown(spellId, 0, 1000);
169+
return true;
170+
}
171+
}
172+
173+
uint32 spellId = AI_VALUE2(uint32, "vehicle spell id", "Thrust");
174+
if (botAI->CanCastVehicleSpell(spellId, target) && botAI->CastVehicleSpell(spellId, target))
175+
{
176+
vehicleBase->AddSpellCooldown(spellId, 0, 1000);
177+
return true;
178+
}
179+
180+
return false;
181+
}
182+
183+
bool ToCMountAction::Execute(Event event)
184+
{
185+
// do not switch vehicles yet
186+
if (bot->GetVehicle())
187+
return false;
188+
189+
Unit* vehicleToEnter = nullptr;
190+
GuidVector npcs = AI_VALUE(GuidVector, "nearest vehicles");
191+
for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++)
192+
{
193+
Unit* vehicleBase = botAI->GetUnit(*i);
194+
if (!vehicleBase)
195+
continue;
196+
197+
if (vehicleBase->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
198+
continue;
199+
200+
if (!vehicleBase->IsFriendlyTo(bot))
201+
continue;
202+
203+
if (!vehicleBase->GetVehicleKit() || !vehicleBase->GetVehicleKit()->GetAvailableSeatCount())
204+
continue;
205+
206+
uint32 entry = vehicleBase->GetEntry();
207+
if (entry != NPC_ARGENT_BATTLEWORG && entry != NPC_ARGENT_WARHORSE)
208+
continue;
209+
210+
if (!vehicleToEnter || bot->GetExactDist(vehicleToEnter) > bot->GetExactDist(vehicleBase))
211+
vehicleToEnter = vehicleBase;
212+
}
213+
214+
if (!vehicleToEnter)
215+
return false;
216+
217+
if (EnterVehicle(vehicleToEnter, true))
218+
return true;
219+
220+
return false;
221+
}
222+
223+
bool ToCMountAction::EnterVehicle(Unit* vehicleBase, bool moveIfFar)
224+
{
225+
float dist = bot->GetDistance(vehicleBase);
226+
227+
if (dist > INTERACTION_DISTANCE && !moveIfFar)
228+
return false;
229+
230+
if (dist > INTERACTION_DISTANCE)
231+
return MoveTo(vehicleBase);
232+
233+
botAI->RemoveShapeshift();
234+
235+
bot->GetMotionMaster()->Clear();
236+
bot->StopMoving();
237+
vehicleBase->HandleSpellClick(bot);
238+
239+
if (!bot->IsOnVehicle(vehicleBase))
240+
return false;
241+
242+
// dismount because bots can enter vehicle on mount
243+
WorldPacket emptyPacket;
244+
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
245+
return true;
246+
}
247+
248+
bool ToCEadricAction::Execute(Event event)
249+
{
250+
Unit* boss = AI_VALUE2(Unit*, "find target", "eadric the pure");
251+
if (!boss)
252+
return false;
253+
254+
// If Eadric is casting Radiance, face the opposite direction
255+
if (boss->HasUnitState(UNIT_STATE_CASTING) && boss->FindCurrentSpellBySpellId(SPELL_RADIANCE))
256+
{
257+
// Calculate the opposite direction
258+
float angle = bot->GetAngle(boss);
259+
float newAngle = Position::NormalizeOrientation(angle + M_PI); // Add 180 degrees (PI radians)
260+
261+
// Set the bot's orientation to face away from Eadric
262+
bot->SetFacingTo(newAngle);
263+
return true;
264+
}
265+
266+
return false;
267+
}

0 commit comments

Comments
 (0)