Merge branch 'online' into dev
This commit is contained in:
commit
01b4969583
@ -100,17 +100,7 @@ void SprintBuff::Check(Position& pre_pos, Position& src_pos, std::map<int, long
|
||||
if (pre_pos.ManhattanDistance2D(owner->GetPos()) < 2) {
|
||||
++stop_times_;
|
||||
if (stop_times_ > 3) {
|
||||
owner->room->xtimer.SetTimeoutEx
|
||||
(
|
||||
1,
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
owner->RemoveBuffByUniId(buff_uniid);
|
||||
owner->TryAddBuff(owner, meta->_int_buff_param1, skill_meta);
|
||||
}
|
||||
},
|
||||
&xtimer_attacher);
|
||||
SprintEnd();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -175,3 +165,18 @@ void SprintBuff::OnEnemyHit(Creature* enemy)
|
||||
enemy->TryAddBuff(owner, buff_id, skill_meta);
|
||||
}
|
||||
}
|
||||
|
||||
void SprintBuff::SprintEnd()
|
||||
{
|
||||
owner->room->xtimer.SetTimeoutEx
|
||||
(
|
||||
1,
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
owner->RemoveBuffByUniId(buff_uniid);
|
||||
owner->TryAddBuff(owner, meta->_int_buff_param1, skill_meta);
|
||||
}
|
||||
},
|
||||
&xtimer_attacher);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ class SprintBuff : public Buff
|
||||
|
||||
virtual void Activate() override;
|
||||
virtual void Deactivate() override;
|
||||
void SprintEnd();
|
||||
|
||||
private:
|
||||
void SprintMove();
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "mt/MapThing.h"
|
||||
#include "mt/Text.h"
|
||||
|
||||
#include "buff/sprint.h"
|
||||
|
||||
#include "f8/utils.h"
|
||||
|
||||
#include "buff/bufffactory.h"
|
||||
@ -2299,8 +2301,15 @@ void Creature::UpdateMove()
|
||||
if (!GetMovement()->IsFindPath()) {
|
||||
GetMovement()->CalcTargetPos(mt::Param::s().move_step_len);
|
||||
if (!GetMovement()->UpdatePosition()) {
|
||||
if (IsPlayer() && !HasBuffEffect(kBET_Sprint)) {
|
||||
ShortFindPath();
|
||||
if (IsPlayer()) {
|
||||
if (HasBuffEffect(kBET_Sprint)) {
|
||||
SprintBuff* buff = (SprintBuff*)GetBuffByEffectId(kBET_Sprint);
|
||||
if (buff) {
|
||||
buff->SprintEnd();
|
||||
}
|
||||
} else {
|
||||
ShortFindPath();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -682,8 +682,8 @@ void RoomObstacle::InstallPreExplostionSummonTimer()
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
glm::vec3 pos = glm::vec3(
|
||||
GetPos().GetX() + bomb_born_offset.GetX(),
|
||||
0.0f,
|
||||
GetPos().GetY() + bomb_born_offset.GetY()
|
||||
GetPos().GetY(),
|
||||
GetPos().GetZ() + bomb_born_offset.GetZ()
|
||||
);
|
||||
if (room->CanAddObstacle(pos, obstacle_id)) {
|
||||
RoomObstacle* p = room->CreateObstacle
|
||||
|
Loading…
x
Reference in New Issue
Block a user