This commit is contained in:
aozhiwei 2023-06-20 14:19:04 +08:00
parent a85c25288a
commit cf9611cce2
3 changed files with 38 additions and 9 deletions

View File

@ -6,10 +6,10 @@
#include "skillhelper.h" #include "skillhelper.h"
#include "skill.h" #include "skill.h"
#include "room.h" #include "room.h"
#include "human.h"
#include "ability.h" #include "ability.h"
#include "collision.h" #include "collision.h"
#include "lispenv.h" #include "lispenv.h"
#include "movement.h"
#include "mt/Buff.h" #include "mt/Buff.h"
#include "mt/Skill.h" #include "mt/Skill.h"
@ -27,6 +27,9 @@ void SprintBuff::Activate()
void SprintBuff::Deactivate() void SprintBuff::Deactivate()
{ {
int i = 0; int i = 0;
if (!owner->room->IsDestorying()) {
owner->GetMovement()->ClearPath();
}
} }
void SprintBuff::SprintMove() void SprintBuff::SprintMove()
@ -56,18 +59,17 @@ void SprintBuff::SprintMove()
[this] (int event, const a8::Args* args) [this] (int event, const a8::Args* args)
{ {
if (a8::TIMER_EXEC_EVENT == event) { if (a8::TIMER_EXEC_EVENT == event) {
Human* hum = owner->AsHuman();
a8::XPrintf("%s\n", a8::XPrintf("%s\n",
{ {
a8::Format("xxxxxxxx move_dir:%f,%f,%f attack_dir:%f,%f,%f speed:%d", a8::Format("xxxxxxxx move_dir:%f,%f,%f attack_dir:%f,%f,%f speed:%d",
{ {
hum->GetMoveDir().x, owner->GetMoveDir().x,
hum->GetMoveDir().y, owner->GetMoveDir().y,
hum->GetMoveDir().z, owner->GetMoveDir().z,
hum->GetAttackDir().x, owner->GetAttackDir().x,
hum->GetAttackDir().y, owner->GetAttackDir().y,
hum->GetAttackDir().z, owner->GetAttackDir().z,
hum->GetSpeed() owner->GetSpeed()
}) })
}); });
} }
@ -176,6 +178,7 @@ void SprintBuff::SprintEnd()
{ {
if (a8::TIMER_EXEC_EVENT == event) { if (a8::TIMER_EXEC_EVENT == event) {
owner->TryAddBuff(owner, meta->_int_buff_param1, skill_meta); owner->TryAddBuff(owner, meta->_int_buff_param1, skill_meta);
owner->GetMovement()->ClearPath();
owner->RemoveBuffByUniId(buff_uniid); owner->RemoveBuffByUniId(buff_uniid);
} }
}, },

View File

@ -23,6 +23,7 @@
#include "stats.h" #include "stats.h"
#include "hero.h" #include "hero.h"
#include "skill.h" #include "skill.h"
#include "movement.h"
#include "mt/Hero.h" #include "mt/Hero.h"
#include "mt/Equip.h" #include "mt/Equip.h"
@ -576,6 +577,27 @@ void Car::DoSkillPostProc(bool used, int skill_id, int target_id)
void Car::Update(int delta_time) void Car::Update(int delta_time)
{ {
++updated_times_; ++updated_times_;
if (GetMovement()->GetPathSize() > 0 ||
HasBuffEffect(kBET_Sprint)) {
Global::Instance()->verify_set_pos = 1;
UpdateMove();
Global::Instance()->verify_set_pos = 0;
if (GetDriver()) {
Global::Instance()->verify_set_pos = 1;
GetDriver()->SetPos(GetPos());
Global::Instance()->verify_set_pos = 0;
}
SyncPos();
#ifdef DEBUG1
a8::XPrintf("updatemove old_pos:%f,%f new_pos:%f,%f\n",
{
old_pos.x,
old_pos.y,
GetPos().x,
GetPos().y,
});
#endif
}
if (playing_skill) { if (playing_skill) {
UpdateSkill(); UpdateSkill();
} }

View File

@ -2351,7 +2351,11 @@ void Creature::UpdateMove()
} else { } else {
GetMovement()->CalcTargetPos(mt::Param::s().move_step_len); GetMovement()->CalcTargetPos(mt::Param::s().move_step_len);
if (!GetMovement()->UpdatePosition()) { if (!GetMovement()->UpdatePosition()) {
#if 1
{
#else
if (IsPlayer()) { if (IsPlayer()) {
#endif
if (HasBuffEffect(kBET_Sprint)) { if (HasBuffEffect(kBET_Sprint)) {
SprintBuff* buff = (SprintBuff*)GetBuffByEffectId(kBET_Sprint); SprintBuff* buff = (SprintBuff*)GetBuffByEffectId(kBET_Sprint);
if (buff) { if (buff) {