mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-22 13:06:23 +00:00
Violet Hold implementation
Violet Hold implementation Consortium guy is missing, will revisit once I reach heroics so I can code it properly
This commit is contained in:
@@ -157,50 +157,3 @@ bool IntenseColdJumpAction::Execute(Event event)
|
||||
return JumpTo(bot->GetMap()->GetId(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ() + 0.01f);
|
||||
// bot->GetMotionMaster()->MoveFall();
|
||||
}
|
||||
|
||||
bool RearFlankPositionAction::isUseful()
|
||||
{
|
||||
Unit* boss = AI_VALUE2(Unit*, "find target", "keristrasza");
|
||||
if (!boss) { return false; }
|
||||
|
||||
// Need to double the front angle check to account for mirrored angle.
|
||||
// Total 180 degrees (whole front half)
|
||||
bool inFront = boss->HasInArc(2.f * DRAGON_MELEE_MIN_ANGLE, bot);
|
||||
// Rear check does not need to double this angle as the logic is inverted
|
||||
// and we are subtracting from 2pi.
|
||||
bool inBack = !boss->HasInArc((2.f * M_PI) - DRAGON_MELEE_MAX_ANGLE, bot);
|
||||
|
||||
return inFront || inBack;
|
||||
}
|
||||
bool RearFlankPositionAction::Execute(Event event)
|
||||
{
|
||||
Unit* boss = AI_VALUE2(Unit*, "find target", "keristrasza");
|
||||
if (!boss) { return false; }
|
||||
|
||||
// float angleToMove = minAngle + rand_norm() * (maxAngle - minAngle);
|
||||
float angle = frand(DRAGON_MELEE_MIN_ANGLE, DRAGON_MELEE_MAX_ANGLE);
|
||||
// Need to reduce this value very slightly, or the bots get the jitters -
|
||||
// may be due to rounding errors. Need to bring them just inside their attack range.
|
||||
// This boss has a big hitbox so we can reduce by 50% and it's still fine and looks better.
|
||||
// TODO: Investigate using bot->GetObjectSize() for sizing
|
||||
float distance = bot->GetMeleeRange(boss) * 0.5f;
|
||||
// Alternatively, summing both unit's melee ranges seems to give a fairly natural range.
|
||||
// Use whichever gives the best results..
|
||||
// float distanceOffset = bot->GetMeleeReach() + boss->GetMeleeReach();
|
||||
Position leftFlank = boss->GetPosition();
|
||||
Position rightFlank = boss->GetPosition();
|
||||
Position* destination = nullptr;
|
||||
leftFlank.RelocatePolarOffset(angle, distance);
|
||||
rightFlank.RelocatePolarOffset(-angle, distance);
|
||||
|
||||
if (bot->GetExactDist2d(leftFlank) < bot->GetExactDist2d(rightFlank))
|
||||
{
|
||||
destination = &leftFlank;
|
||||
}
|
||||
else
|
||||
{
|
||||
destination = &rightFlank;
|
||||
}
|
||||
|
||||
return MoveTo(bot->GetMapId(), destination->GetPositionX(), destination->GetPositionY(), destination->GetPositionZ());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user