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) {
|
if (pre_pos.ManhattanDistance2D(owner->GetPos()) < 2) {
|
||||||
++stop_times_;
|
++stop_times_;
|
||||||
if (stop_times_ > 3) {
|
if (stop_times_ > 3) {
|
||||||
owner->room->xtimer.SetTimeoutEx
|
SprintEnd();
|
||||||
(
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -175,3 +165,18 @@ void SprintBuff::OnEnemyHit(Creature* enemy)
|
|||||||
enemy->TryAddBuff(owner, buff_id, skill_meta);
|
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 Activate() override;
|
||||||
virtual void Deactivate() override;
|
virtual void Deactivate() override;
|
||||||
|
void SprintEnd();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SprintMove();
|
void SprintMove();
|
||||||
|
@ -41,6 +41,8 @@
|
|||||||
#include "mt/MapThing.h"
|
#include "mt/MapThing.h"
|
||||||
#include "mt/Text.h"
|
#include "mt/Text.h"
|
||||||
|
|
||||||
|
#include "buff/sprint.h"
|
||||||
|
|
||||||
#include "f8/utils.h"
|
#include "f8/utils.h"
|
||||||
|
|
||||||
#include "buff/bufffactory.h"
|
#include "buff/bufffactory.h"
|
||||||
@ -2299,12 +2301,19 @@ void Creature::UpdateMove()
|
|||||||
if (!GetMovement()->IsFindPath()) {
|
if (!GetMovement()->IsFindPath()) {
|
||||||
GetMovement()->CalcTargetPos(mt::Param::s().move_step_len);
|
GetMovement()->CalcTargetPos(mt::Param::s().move_step_len);
|
||||||
if (!GetMovement()->UpdatePosition()) {
|
if (!GetMovement()->UpdatePosition()) {
|
||||||
if (IsPlayer() && !HasBuffEffect(kBET_Sprint)) {
|
if (IsPlayer()) {
|
||||||
|
if (HasBuffEffect(kBET_Sprint)) {
|
||||||
|
SprintBuff* buff = (SprintBuff*)GetBuffByEffectId(kBET_Sprint);
|
||||||
|
if (buff) {
|
||||||
|
buff->SprintEnd();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
ShortFindPath();
|
ShortFindPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
room->grid_service->MoveCreature(this);
|
room->grid_service->MoveCreature(this);
|
||||||
if (room->IsPveRoom() && IsEntityType(ET_Hero) && IsNearGas()) {
|
if (room->IsPveRoom() && IsEntityType(ET_Hero) && IsNearGas()) {
|
||||||
GetMutablePos() = old_pos;
|
GetMutablePos() = old_pos;
|
||||||
|
@ -682,8 +682,8 @@ void RoomObstacle::InstallPreExplostionSummonTimer()
|
|||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
if (a8::TIMER_EXEC_EVENT == event) {
|
||||||
glm::vec3 pos = glm::vec3(
|
glm::vec3 pos = glm::vec3(
|
||||||
GetPos().GetX() + bomb_born_offset.GetX(),
|
GetPos().GetX() + bomb_born_offset.GetX(),
|
||||||
0.0f,
|
GetPos().GetY(),
|
||||||
GetPos().GetY() + bomb_born_offset.GetY()
|
GetPos().GetZ() + bomb_born_offset.GetZ()
|
||||||
);
|
);
|
||||||
if (room->CanAddObstacle(pos, obstacle_id)) {
|
if (room->CanAddObstacle(pos, obstacle_id)) {
|
||||||
RoomObstacle* p = room->CreateObstacle
|
RoomObstacle* p = room->CreateObstacle
|
||||||
|
Loading…
x
Reference in New Issue
Block a user