This commit is contained in:
aozhiwei 2019-07-23 20:03:57 +08:00
parent 3e3d375bd0
commit 86b9092ecf
2 changed files with 12 additions and 10 deletions

View File

@ -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;

View File

@ -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();