Skip to content

Commit

Permalink
Merge pull request liyunfan1223#423 from liyunfan1223/improve-knockback
Browse files Browse the repository at this point in the history
Improve knockback (update the core before pull this commit)
  • Loading branch information
liyunfan1223 authored Aug 2, 2024
2 parents 46c877d + 024efed commit 966cc1b
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/PlayerbotAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,23 +846,9 @@ void PlayerbotAI::HandleBotOutgoingPacket(WorldPacket const& packet)
bot->StopMoving();
bot->GetMotionMaster()->Clear();


float moveTimeHalf = verticalSpeed / Movement::gravity;
float dist = 2 * moveTimeHalf * horizontalSpeed;
Position dest = bot->GetPosition();

bot->MovePositionToFirstCollision(dest, dist, bot->GetRelativeAngle(bot->GetPositionX() + vcos, bot->GetPositionY() + vsin));
float x, y, z;
x = dest.GetPositionX();
y = dest.GetPositionY();
z = dest.GetPositionZ();
// char speak[1024];
// sprintf(speak, "SMSG_MOVE_KNOCK_BACK: %.2f %.2f, horizontalSpeed: %.2f, verticalSpeed: %.2f, tX: %.2f, tY: %.2f, tZ: %.2f, relativeAngle: %.2f, orientation: %.2f",
// vcos, vsin, horizontalSpeed, verticalSpeed, x, y, z, bot->GetRelativeAngle(vcos, vsin), bot->GetOrientation());
// bot->Say(speak, LANG_UNIVERSAL);
// bot->GetClosePoint(x, y, z, bot->GetObjectSize(), dist, bot->GetAngle(vcos, vsin));
Unit* currentTarget = GetAiObjectContext()->GetValue<Unit*>("current target")->Get();
bot->GetMotionMaster()->MoveJump(x, y, z, horizontalSpeed, verticalSpeed, 0, currentTarget);
bot->GetMotionMaster()->MoveKnockbackFromForPlayer(bot->GetPositionX() + vcos, bot->GetPositionY() + vsin, horizontalSpeed, verticalSpeed);

// bot->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
// bot->AddUnitMovementFlag(MOVEMENTFLAG_FORWARD);
// bot->m_movementInfo.AddMovementFlag(MOVEMENTFLAG_PENDING_STOP);
Expand Down

0 comments on commit 966cc1b

Please sign in to comment.