1
This commit is contained in:
parent
e1c51d6da0
commit
234a9d013f
@ -340,6 +340,13 @@ void Buff::RecoverHoldWeapons()
|
|||||||
void Buff::ProcSprint()
|
void Buff::ProcSprint()
|
||||||
{
|
{
|
||||||
if (caster_.Get()->IsPlayer()) {
|
if (caster_.Get()->IsPlayer()) {
|
||||||
|
owner->IncDisableMoveDirTimes();
|
||||||
|
{
|
||||||
|
int old_times = owner->GetDisableMoveDirTimes();
|
||||||
|
owner->SetDisableMoveDirTimes(0);
|
||||||
|
owner->SetMoveDir(owner->context_dir);
|
||||||
|
owner->SetDisableMoveDirTimes(old_times);
|
||||||
|
}
|
||||||
Player* hum = (Player*)caster_.Get();
|
Player* hum = (Player*)caster_.Get();
|
||||||
std::set<int>* hited_objects = new std::set<int>;
|
std::set<int>* hited_objects = new std::set<int>;
|
||||||
owner->room->xtimer.AddRepeatTimerAndAttach
|
owner->room->xtimer.AddRepeatTimerAndAttach
|
||||||
|
@ -615,6 +615,17 @@ void Creature::RecalcBuffAttr()
|
|||||||
|
|
||||||
void Creature::OnBuffRemove(Buff& buff)
|
void Creature::OnBuffRemove(Buff& buff)
|
||||||
{
|
{
|
||||||
|
switch (buff.meta->i->buff_effect()) {
|
||||||
|
case kBET_Sprint:
|
||||||
|
{
|
||||||
|
DecDisableMoveDirTimes();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!buff.meta->i->only_server()) {
|
if (!buff.meta->i->only_server()) {
|
||||||
room->frame_event.RemoveBuff(GetWeakPtrRef(), buff.meta->i->buff_id());
|
room->frame_event.RemoveBuff(GetWeakPtrRef(), buff.meta->i->buff_id());
|
||||||
}
|
}
|
||||||
@ -1353,7 +1364,7 @@ void Creature::Initialize()
|
|||||||
|
|
||||||
void Creature::SetMoveDir(const a8::Vec2& move_dir)
|
void Creature::SetMoveDir(const a8::Vec2& move_dir)
|
||||||
{
|
{
|
||||||
if (!GetBuffByEffectId(kBET_Sprint)) {
|
if (GetDisableMoveDirTimes() <= 0) {
|
||||||
MoveableEntity::SetMoveDir(move_dir);
|
MoveableEntity::SetMoveDir(move_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,10 @@ class Creature : public MoveableEntity
|
|||||||
void FollowToTarget();
|
void FollowToTarget();
|
||||||
int GetFollowTimes() { return follow_times_; };
|
int GetFollowTimes() { return follow_times_; };
|
||||||
void IncFollowTimes() { ++follow_times_; };
|
void IncFollowTimes() { ++follow_times_; };
|
||||||
|
void IncDisableMoveDirTimes() { ++disable_move_dir_times_ ; };
|
||||||
|
void DecDisableMoveDirTimes() { ++disable_move_dir_times_ ; };
|
||||||
|
int GetDisableMoveDirTimes() { return disable_move_dir_times_ ; };
|
||||||
|
void SetDisableMoveDirTimes(int times) { disable_move_dir_times_ = times; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void OnBuffRemove(Buff& buff);
|
virtual void OnBuffRemove(Buff& buff);
|
||||||
@ -305,6 +309,8 @@ private:
|
|||||||
xtimer_list* auto_switch_weapon_timer_ = nullptr;
|
xtimer_list* auto_switch_weapon_timer_ = nullptr;
|
||||||
int follow_times_ = 0;
|
int follow_times_ = 0;
|
||||||
|
|
||||||
|
int disable_move_dir_times_ = 0;
|
||||||
|
|
||||||
a8::Vec2 skill_dir_;
|
a8::Vec2 skill_dir_;
|
||||||
float skill_param1 = 0;
|
float skill_param1 = 0;
|
||||||
size_t curr_skill_phase = 0;
|
size_t curr_skill_phase = 0;
|
||||||
|
@ -660,6 +660,7 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
|||||||
TypeConvert::FromPb(new_move_dir, &msg.move_dir());
|
TypeConvert::FromPb(new_move_dir, &msg.move_dir());
|
||||||
if (!HasBuffEffect(kBET_Vertigo)) {
|
if (!HasBuffEffect(kBET_Vertigo)) {
|
||||||
if (!(HasBuffEffect(kBET_Jump) && follow_target.Get())) {
|
if (!(HasBuffEffect(kBET_Jump) && follow_target.Get())) {
|
||||||
|
if (GetDisableMoveDirTimes() <= 0) {
|
||||||
new_move_dir.Normalize();
|
new_move_dir.Normalize();
|
||||||
SetMoveDir(new_move_dir);
|
SetMoveDir(new_move_dir);
|
||||||
moving = true;
|
moving = true;
|
||||||
@ -667,6 +668,7 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
assert(!isnan(GetMoveDir().x) && !isnan(GetMoveDir().y));
|
assert(!isnan(GetMoveDir().x) && !isnan(GetMoveDir().y));
|
||||||
if (msg.has_attack_dir()) {
|
if (msg.has_attack_dir()) {
|
||||||
if (std::isfinite(msg.attack_dir().x()) &&
|
if (std::isfinite(msg.attack_dir().x()) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user