razuvious strategy

This commit is contained in:
Yunfan Li
2023-07-18 21:00:49 +08:00
parent 67a23fae3f
commit 9c1bb63d10
21 changed files with 326 additions and 265 deletions

View File

@@ -288,121 +288,129 @@ bool HeiganDanceRangedAction::Execute(Event event) {
// return MoveTo(bot->GetMapId(), position[idx].first, position[idx].second, bot->GetPositionZ());
// }
// bool RazuviousUseObedienceCrystalAction::Execute(Event event)
// {
// if (Unit* charm = bot->GetCharm()) {
// Unit* target = AI_VALUE2(Unit*, "find target", "instructor razuvious");
// if (!target) {
// return false;
// }
// charm->GetMotionMaster()->MoveChase(target);
// charm->Attack(target, true);
// charm->SetFacingToObject(target);
// Aura* forceObedience = botAI->GetAura("force obedience", charm);
// uint32 duration_time;
// if (!forceObedience) {
// forceObedience = botAI->GetAura("mind control", charm);
// duration_time = 60000;
// } else {
// duration_time = 90000;
// }
// if (!forceObedience) {
// return false;
// }
// if (charm->GetDistance(target) <= 0.51f) {
// // taunt
// bool tauntUseful = true;
// if (forceObedience->GetDuration() <= (duration_time - 5000)) {
// if (target->GetVictim() && botAI->HasAura(29061, target->GetVictim())) {
// tauntUseful = false;
// }
// if (forceObedience->GetDuration() <= 3000) {
// tauntUseful = false;
// }
// }
// if (forceObedience->GetDuration() >= (duration_time - 500)) {
// tauntUseful = false;
// }
// if ( tauntUseful && !charm->GetSpellHistory()->HasCooldown(29060) ) {
// // shield
// if (!charm->GetSpellHistory()->HasCooldown(29061)) {
// charm->CastSpell(charm, 29061, true);
// charm->GetSpellHistory()->AddCooldown(29061, 0, Seconds(30));
// }
// charm->CastSpell(target, 29060, true);
// charm->GetSpellHistory()->AddCooldown(29060, 0, Seconds(20));
// }
// // strike
// if (!charm->GetSpellHistory()->HasCooldown(61696)) {
// charm->CastSpell(target, 61696, true);
// charm->GetSpellHistory()->AddCooldown(61696, 0, Seconds(4));
// }
// }
// } else {
// Difficulty diff = bot->GetRaidDifficulty();
// if (diff == RAID_DIFFICULTY_10MAN_NORMAL) {
// list<ObjectGuid> npcs = AI_VALUE(list<ObjectGuid>, "nearest npcs");
// for (list<ObjectGuid>::iterator i = npcs.begin(); i != npcs.end(); i++)
// {
// Creature* unit = botAI->GetCreature(*i);
// if (!unit) {
// continue;
// }
// if (botAI->IsMainTank(bot) && unit->GetSpawnId() != 128352) {
// continue;
// }
// if (!botAI->IsMainTank(bot) && unit->GetSpawnId() != 128353) {
// continue;
// }
// if (MoveTo(unit)) {
// return true;
// }
// Creature *creature = bot->GetNPCIfCanInteractWith(*i, UNIT_NPC_FLAG_SPELLCLICK);
// if (!creature)
// continue;
// creature->HandleSpellClick(bot);
// return true;
// }
// } else {
// list<ObjectGuid> attackers = context->GetValue<list<ObjectGuid> >("attackers")->Get();
// Unit* target = nullptr;
// for (list<ObjectGuid>::iterator i = attackers.begin(); i != attackers.end(); ++i) {
// Unit* unit = botAI->GetUnit(*i);
// if (!unit)
// continue;
// if (botAI->EqualLowercaseName(unit->GetName(), "death knight understudy")) {
// target = unit;
// break;
// }
// }
// if (target) {
// if (bot->GetDistance2d(target) > sPlayerbotAIConfig.spellDistance) {
// return MoveNear(target, sPlayerbotAIConfig.spellDistance);
// } else {
// return botAI->CastSpell("mind control", target);
// }
// }
// }
// }
// return false;
// }
bool RazuviousUseObedienceCrystalAction::Execute(Event event)
{
if (!helper.UpdateBossAI()) {
return false;
}
// bot->GetCharm
if (Unit* charm = bot->GetCharm()) {
Unit* target = AI_VALUE2(Unit*, "find target", "instructor razuvious");
if (!target) {
return false;
}
if (charm->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == NULL_MOTION_TYPE) {
charm->GetMotionMaster()->Clear();
charm->GetMotionMaster()->MoveChase(target);
charm->GetAI()->AttackStart(target);
}
Aura* forceObedience = botAI->GetAura("force obedience", charm);
uint32 duration_time;
if (!forceObedience) {
forceObedience = botAI->GetAura("mind control", charm);
duration_time = 60000;
} else {
duration_time = 90000;
}
if (!forceObedience) {
return false;
}
if (charm->GetDistance(target) <= 0.51f) {
// taunt
bool tauntUseful = true;
if (forceObedience->GetDuration() <= (duration_time - 5000)) {
if (target->GetVictim() && botAI->HasAura(29061, target->GetVictim())) {
tauntUseful = false;
}
if (forceObedience->GetDuration() <= 3000) {
tauntUseful = false;
}
}
if (forceObedience->GetDuration() >= (duration_time - 500)) {
tauntUseful = false;
}
if ( tauntUseful && !charm->HasSpellCooldown(29060) ) {
// shield
if (!charm->HasSpellCooldown(29061)) {
charm->CastSpell(charm, 29061, true);
charm->AddSpellCooldown(29061, 0, 30 * 1000);
}
charm->CastSpell(target, 29060, true);
charm->AddSpellCooldown(29060, 0, 20 * 1000);
}
// strike
if (!charm->HasSpellCooldown(61696)) {
charm->CastSpell(target, 61696, true);
charm->AddSpellCooldown(61696, 0, 4 * 1000);
}
}
} else {
Difficulty diff = bot->GetRaidDifficulty();
if (diff == RAID_DIFFICULTY_10MAN_NORMAL) {
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
for (auto i = npcs.begin(); i != npcs.end(); i++)
{
Creature* unit = botAI->GetCreature(*i);
if (!unit) {
continue;
}
if (botAI->IsMainTank(bot) && unit->GetSpawnId() != 128352) {
continue;
}
if (!botAI->IsMainTank(bot) && unit->GetSpawnId() != 128353) {
continue;
}
if (MoveTo(unit)) {
return true;
}
Creature *creature = bot->GetNPCIfCanInteractWith(*i, UNIT_NPC_FLAG_SPELLCLICK);
if (!creature)
continue;
creature->HandleSpellClick(bot);
return true;
}
} else {
GuidVector attackers = context->GetValue<GuidVector>("attackers")->Get();
Unit* target = nullptr;
for (auto i = attackers.begin(); i != attackers.end(); ++i) {
Unit* unit = botAI->GetUnit(*i);
if (!unit)
continue;
if (botAI->EqualLowercaseName(unit->GetName(), "death knight understudy")) {
target = unit;
break;
}
}
if (target) {
if (bot->GetDistance2d(target) > sPlayerbotAIConfig->spellDistance) {
return MoveNear(target, sPlayerbotAIConfig->spellDistance);
} else {
return botAI->CastSpell("mind control", target);
}
}
}
}
return false;
}
// bool RazuviousTargetAction::Execute(Event event)
// {
// Unit* razuvious = AI_VALUE2(Unit*, "find target", "instructor razuvious");
// Unit* understudy = AI_VALUE2(Unit*, "find target", "death knight understudy");
// Unit* target = nullptr;
// if (botAI->IsTank(bot)) {
// target = understudy;
// } else {
// target = razuvious;
// }
// if (AI_VALUE(Unit*, "current target") == target) {
// return false;
// }
// return Attack(target);
// }
bool RazuviousTargetAction::Execute(Event event)
{
if (!helper.UpdateBossAI()) {
return false;
}
Unit* razuvious = AI_VALUE2(Unit*, "find target", "instructor razuvious");
Unit* understudy = AI_VALUE2(Unit*, "find target", "death knight understudy");
Unit* target = nullptr;
if (botAI->IsTank(bot)) {
target = understudy;
} else {
target = razuvious;
}
if (AI_VALUE(Unit*, "current target") == target) {
return false;
}
return Attack(target);
}
// bool HorsemanAttractAlternativelyAction::Execute(Event event)
// {