From d79b1d0d0bbafba6875a6a924bfb0b9f34e5e541 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 28 Mar 2023 13:58:21 +0800 Subject: [PATCH] 1 --- server/gameserver/ability.cc | 12 ++++++------ server/gameserver/creature.cc | 11 ++++++++--- server/gameserver/skill.cc | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/server/gameserver/ability.cc b/server/gameserver/ability.cc index dd9397da..1e4cb7eb 100644 --- a/server/gameserver/ability.cc +++ b/server/gameserver/ability.cc @@ -456,7 +456,7 @@ AttrAdditionHandle Ability::AddAttr(int attr_id, float rate) if (IsValidHumanAttr(attr_id)) { list_add_tail(&p->entry, &std::get<1>(attr_add_[attr_id])); } else { - list_add_tail(&p->entry, &std::get<1>(vattr_add_[attr_id])); + list_add_tail(&p->entry, &std::get<1>(vattr_add_[attr_id - kHVAT_Begin])); } RecalcAttrAddition(attr_id); return p->ptr; @@ -482,7 +482,7 @@ AttrRuduceHandle Ability::DecAttr(int attr_id, float rate) if (IsValidHumanAttr(attr_id)) { list_add_tail(&p->entry, &std::get<1>(attr_dec_[attr_id])); } else { - list_add_tail(&p->entry, &std::get<1>(vattr_dec_[attr_id])); + list_add_tail(&p->entry, &std::get<1>(vattr_dec_[attr_id - kHVAT_Begin])); } RecalcAttrRuduce(attr_id); return p->ptr; @@ -506,7 +506,7 @@ void Ability::RecalcAttrAddition(int attr_id) if (IsValidHumanAttr(attr_id)) { head = &std::get<1>(attr_add_[attr_id]); } else if (IsValidHumanVirtualAttr(attr_id)) { - head = &std::get<1>(vattr_add_[attr_id]); + head = &std::get<1>(vattr_add_[attr_id - kHVAT_Begin]); } else { return; } @@ -528,7 +528,7 @@ void Ability::RecalcAttrRuduce(int attr_id) if (IsValidHumanAttr(attr_id)) { head = &std::get<1>(attr_dec_[attr_id]); } else if (IsValidHumanVirtualAttr(attr_id)) { - head = &std::get<1>(vattr_dec_[attr_id]); + head = &std::get<1>(vattr_dec_[attr_id - kHVAT_Begin]); } else { return; } @@ -571,7 +571,7 @@ float Ability::GetAttrAddition(int attr_id) if (IsValidHumanAttr(attr_id)) { return std::get<0>(attr_add_[attr_id]); } else if (IsValidHumanVirtualAttr(attr_id)) { - return std::get<0>(vattr_add_[attr_id]); + return std::get<0>(vattr_add_[attr_id - kHVAT_Begin]); } else { return 0.0f; } @@ -582,7 +582,7 @@ float Ability::GetAttrRuduce(int attr_id) if (IsValidHumanAttr(attr_id)) { return std::get<0>(attr_dec_[attr_id]); } else if (IsValidHumanVirtualAttr(attr_id)) { - return std::get<0>(vattr_dec_[attr_id]); + return std::get<0>(vattr_dec_[attr_id - kHVAT_Begin]); } else { return 0.0f; } diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 36850809..c7e00c18 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -3088,10 +3088,10 @@ float Creature::GetSpeed() float addition = 0.0f; float ruduce = 0.0f; if (aiming) { - if (GetHeroMeta()->fall_speed() > ONE_LIMIT) { - addition += GetHeroMeta()->fall_speed(); + if (GetHeroMeta()->aim_speed() > ONE_LIMIT) { + addition += GetHeroMeta()->aim_speed(); } else { - ruduce += GetHeroMeta()->fall_speed(); + ruduce += GetHeroMeta()->aim_speed(); } } else if (action_type == AT_Reload) { if (GetHeroMeta()->reload_speed() > ONE_LIMIT) { @@ -3132,6 +3132,11 @@ float Creature::GetSpeed() ruduce = std::max(ruduce, GetAbility()->GetAttrRuduce(kHAT_Speed)); float rate = addition - ruduce; finaly_speed *= 1.0f + rate; + #ifdef DEBUG + if (IsPlayer() && finaly_speed >500) { + a8::XPrintf("player speed:%f\n", {finaly_speed}); + } + #endif } return std::max(min_speed, finaly_speed) / SERVER_FRAME_RATE; } diff --git a/server/gameserver/skill.cc b/server/gameserver/skill.cc index 15745e53..70bf2955 100644 --- a/server/gameserver/skill.cc +++ b/server/gameserver/skill.cc @@ -58,7 +58,7 @@ int Skill::GetCd() meta->skill_type() == kPassiveSkill) { return meta->skill_cd() * 1000; } else { - return meta->skill_cd() * 1000 * (1 + owner->GetBattleConetxt()->GetSkillCdPct()); + return meta->skill_cd() * 1000 * (1 + owner->GetBattleContext()->GetSkillCdPct()); } }