From 86b9092ecfc85b70d1c01ad74dba98833be236e8 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 23 Jul 2019 20:03:57 +0800 Subject: [PATCH] 1 --- server/gameserver/human.cc | 20 +++++++++++--------- server/gameserver/human.h | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index e1ce7b2..8bf4558 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1166,13 +1166,14 @@ void Human::AddBuff(MetaData::Buff* buff_meta) if ((int)buff_meta->param1== kHAT_Hp) { if ((int)buff_meta->param2 == 1) { //绝对值 - ability.hp += buff_meta->param2; + ability.hp += buff_meta->param3; ability.hp = std::min(ability.max_hp, ability.hp); } else if ((int)buff_meta->param2 == 2) { //百分比 - ability.hp *= 1 + buff_meta->param2; + ability.hp *= 1 + buff_meta->param3; ability.hp = std::min(ability.max_hp, ability.hp); } + SyncAroundPlayers(); } } Buff* buff = &a8::FastAppend(buff_list_); @@ -1436,6 +1437,7 @@ void Human::CheckSpecObject() } break; case kET_Obstacle: + case kET_Building: { if (TestCollision((ColliderComponent*)collider)) { in_grass = true; @@ -1618,11 +1620,11 @@ void Human::_UpdateAssaultMove() hum->DecHP(finally_dmg, entity_uniid, name, 0); target_list.insert(hum); } - a8::Vec2 pull_dir = skill_dir; - if (std::abs(pull_dir.x) > FLT_EPSILON || - std::abs(pull_dir.y) > FLT_EPSILON) { - pull_dir.Normalize(); - hum->PullHuman(pull_dir, phase->param2.GetDouble()); + a8::Vec2 push_dir = skill_dir; + if (std::abs(push_dir.x) > FLT_EPSILON || + std::abs(push_dir.y) > FLT_EPSILON) { + push_dir.Normalize(); + hum->PushHuman(push_dir, phase->param2.GetDouble()); } } } @@ -1636,11 +1638,11 @@ void Human::_UpdateAssaultMove() } } -void Human::PullHuman(const a8::Vec2& pull_dir, float distance) +void Human::PushHuman(const a8::Vec2& push_dir, float distance) { for (int i = 0; i < distance; ++i) { a8::Vec2 old_pos = pos; - pos = pos + pull_dir; + pos = pos + push_dir; if (IsCollisionInMapService()) { pos = old_pos; break; diff --git a/server/gameserver/human.h b/server/gameserver/human.h index aa5e624..c2ce5e5 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -204,7 +204,7 @@ class Human : public Entity protected: void _UpdateMove(int speed); void _UpdateAssaultMove(); - void PullHuman(const a8::Vec2& pull_dir, float distance); + void PushHuman(const a8::Vec2& push_dir, float distance); private: void ClearFrameData();