1
This commit is contained in:
parent
eb677aba5f
commit
710ea892d0
@ -7,9 +7,11 @@
|
|||||||
#include "skill.h"
|
#include "skill.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
#include "human.h"
|
#include "human.h"
|
||||||
|
#include "ability.h"
|
||||||
|
|
||||||
#include "mt/Buff.h"
|
#include "mt/Buff.h"
|
||||||
#include "mt/Skill.h"
|
#include "mt/Skill.h"
|
||||||
|
#include "mt/SkillNumber.h"
|
||||||
|
|
||||||
void SprintBuff::Activate()
|
void SprintBuff::Activate()
|
||||||
{
|
{
|
||||||
@ -100,22 +102,23 @@ void SprintBuff::CoCollisionCheck()
|
|||||||
std::map<int, long long> hited_objects = std::map<int, long long>();
|
std::map<int, long long> hited_objects = std::map<int, long long>();
|
||||||
Position pre_pos;
|
Position pre_pos;
|
||||||
pre_pos = owner->GetPos();
|
pre_pos = owner->GetPos();
|
||||||
|
Position src_pos = owner->GetPos();
|
||||||
owner->room->xtimer.SetIntervalEx
|
owner->room->xtimer.SetIntervalEx
|
||||||
(
|
(
|
||||||
1,
|
1,
|
||||||
[this, hited_objects, pre_pos]
|
[this, hited_objects, pre_pos, src_pos]
|
||||||
(int event, const a8::Args* args) mutable
|
(int event, const a8::Args* args) mutable
|
||||||
{
|
{
|
||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
if (a8::TIMER_EXEC_EVENT == event) {
|
||||||
if (!meta->_buff_param3_int_list.empty() || skill_meta) {
|
if (!meta->_buff_param3_int_list.empty() || skill_meta) {
|
||||||
Check(pre_pos, hited_objects);
|
Check(pre_pos, src_pos, hited_objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
&xtimer_attacher);
|
&xtimer_attacher);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SprintBuff::Check(Position& pre_pos, std::map<int, long long>& hited_objects)
|
void SprintBuff::Check(Position& pre_pos, Position& src_pos, std::map<int, long long>& hited_objects)
|
||||||
{
|
{
|
||||||
if (pre_pos.ManhattanDistance2D(owner->GetPos()) < 2) {
|
if (pre_pos.ManhattanDistance2D(owner->GetPos()) < 2) {
|
||||||
++stop_times_;
|
++stop_times_;
|
||||||
@ -134,6 +137,32 @@ void SprintBuff::Check(Position& pre_pos, std::map<int, long long>& hited_object
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
stop_times_ = 0;
|
stop_times_ = 0;
|
||||||
|
if (skill_meta) {
|
||||||
|
switch (skill_meta->GetMagicId()) {
|
||||||
|
case MAGIC_20901_XIONG:
|
||||||
|
{
|
||||||
|
float moved_distance = owner->GetPos().Distance2D2(src_pos);
|
||||||
|
if (moved_distance >= skill_meta->_number_meta->_float_range) {
|
||||||
|
owner->room->xtimer.SetTimeoutEx
|
||||||
|
(
|
||||||
|
1,
|
||||||
|
[this] (int event, const a8::Args* args)
|
||||||
|
{
|
||||||
|
if (a8::TIMER_EXEC_EVENT == event) {
|
||||||
|
owner->RemoveBuffByUniId(buff_uniid);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
&xtimer_attacher);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 dir = owner->GetPos().ToGlmVec3() - pre_pos.ToGlmVec3();
|
glm::vec3 dir = owner->GetPos().ToGlmVec3() - pre_pos.ToGlmVec3();
|
||||||
dir.y = 0.0f;
|
dir.y = 0.0f;
|
||||||
@ -204,6 +233,7 @@ void SprintBuff::ProcSkill()
|
|||||||
owner->room->xtimer.ModifyTime
|
owner->room->xtimer.ModifyTime
|
||||||
(remover_timer,
|
(remover_timer,
|
||||||
SkillHelper::GetYmczBuffTime(skill_meta) / FRAME_RATE_MS);
|
SkillHelper::GetYmczBuffTime(skill_meta) / FRAME_RATE_MS);
|
||||||
|
owner->GetAbility()->AddSpeedAddition(skill_meta->_number_meta->_float_speed);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -218,9 +248,5 @@ void SprintBuff::ProcSkill()
|
|||||||
void SprintBuff::ProcXiongHun()
|
void SprintBuff::ProcXiongHun()
|
||||||
{
|
{
|
||||||
owner->TryAddBuff(owner, 209016);
|
owner->TryAddBuff(owner, 209016);
|
||||||
}
|
owner->GetAbility()->DelSpeedAddition(skill_meta->_number_meta->_float_speed);
|
||||||
|
|
||||||
float SprintBuff::GetSpeed()
|
|
||||||
{
|
|
||||||
return meta->_buff_param2;
|
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,11 @@ class SprintBuff : public Buff
|
|||||||
|
|
||||||
virtual void Activate() override;
|
virtual void Activate() override;
|
||||||
virtual void Deactivate() override;
|
virtual void Deactivate() override;
|
||||||
float GetSpeed();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SprintMove();
|
void SprintMove();
|
||||||
void CoCollisionCheck();
|
void CoCollisionCheck();
|
||||||
void Check(Position& pre_pos, std::map<int, long long>& hited_objects);
|
void Check(Position& pre_pos, Position& src_pos, std::map<int, long long>& hited_objects);
|
||||||
void OnEnemyHit(Creature* enemy);
|
void OnEnemyHit(Creature* enemy);
|
||||||
void ProcSkill();
|
void ProcSkill();
|
||||||
void ProcXiongHun();
|
void ProcXiongHun();
|
||||||
|
@ -492,12 +492,6 @@ float Human::GetSpeed()
|
|||||||
return buff->meta->_buff_param2;
|
return buff->meta->_buff_param2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
|
||||||
Buff* buff = GetBuffByEffectId(kBET_Sprint);
|
|
||||||
if (buff) {
|
|
||||||
return ((SprintBuff*)buff)->GetSpeed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
float speed = 1.0;
|
float speed = 1.0;
|
||||||
if (downed) {
|
if (downed) {
|
||||||
speed = meta->move_speed3();
|
speed = meta->move_speed3();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user