diff --git a/server/gameserver/battledatacontext.cc b/server/gameserver/battledatacontext.cc index ea9e0b21..1936f17e 100644 --- a/server/gameserver/battledatacontext.cc +++ b/server/gameserver/battledatacontext.cc @@ -10,6 +10,7 @@ #include "types.h" #include "bullet.h" #include "app.h" +#include "room.h" #include "attrhelper.h" @@ -55,18 +56,18 @@ public: return dodge_damage_ruduce_; } - void Init() + void Init(Creature* c) { if (hero_dto) { - DtoInit(); + DtoInit(c); } else { - DefaultInit(); + DefaultInit(c); } } private: - void DefaultInit() + void DefaultInit(Creature* c) { hp_ = hero_meta->i->hp(); atk_ = hero_meta->i->damage(); @@ -75,9 +76,23 @@ private: crit_atk_ratio_ = hero_meta->i->crit_atk_ratio(); dodge_ = hero_meta->i->miss(); dodge_damage_ruduce_ = hero_meta->i->miss_damage_ruduce(); + if (c->room->pve_instance) { + MetaData::NpcStandard* standard_meta = MetaMgr::Instance()->GetNpcStandard + (c->room->pve_instance->pb->gemini_lv()); + if (standard_meta) { + hp_ = standard_meta->pb->hp() * hero_meta->i->hp_ratio() * + c->room->pve_instance->GetHpMul(c->room->GetHumanNum()); + atk_ = standard_meta->pb->damage() * hero_meta->i->damage_ratio(); + def_ = standard_meta->pb->defence() * hero_meta->i->defence_ratio(); + } else { +#ifdef DEBUG + abort(); +#endif + } + } } - void DtoInit() + void DtoInit(Creature* c) { std::array base_attr_abs = {0}; std::array base_attr_rate = {0}; @@ -204,18 +219,18 @@ public: return reload_time_; } - void Init() + void Init(Creature* c) { if (weapon_dto) { - DtoInit(); + DtoInit(c); } else { - DefaultInit(); + DefaultInit(c); } } private: - void DefaultInit() + void DefaultInit(Creature* c) { atk_ = weapon_meta->i->atk(); crit_atk_ = weapon_meta->i->critical(); @@ -225,7 +240,7 @@ private: reload_time_ = weapon_meta->i->reload_time(); } - void DtoInit() + void DtoInit(Creature* c) { std::array base_attr_abs = {0}; std::array base_attr_rate = {0}; @@ -635,12 +650,12 @@ void BattleDataContext::Init(Creature* c) if (!hero_ability_->hero_uniid_) { hero_ability_->hero_uniid_ = App::Instance()->AllocTempHeroUniId(); } - hero_ability_->Init(); + hero_ability_->Init(c); if (weapon1_ability_) { - weapon1_ability_->Init(); + weapon1_ability_->Init(c); } if (weapon2_ability_) { - weapon2_ability_->Init(); + weapon2_ability_->Init(c); } } diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index 969a8288..9129bbeb 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -575,6 +575,7 @@ message MFBullet optional int32 gun_id = 10; //枪id optional float fly_distance = 11; //只有手雷和烟雾弹时这个字段才有意义 optional int32 bullet_uniid = 12; //子弹唯一id + optional int32 trace_target_uniid = 13; //不为空和0的时候表示要追踪的目标对象uniid } //射击 diff --git a/server/tools/protobuild/metatable.proto b/server/tools/protobuild/metatable.proto index 009b2593..6080a37c 100755 --- a/server/tools/protobuild/metatable.proto +++ b/server/tools/protobuild/metatable.proto @@ -256,6 +256,10 @@ message Player optional int32 skill1list = 60; optional int32 skill2list = 61; optional int32 skill3list = 62; + + optional float hp_ratio = 63; + optional float damage_ratio = 64; + optional float defence_ratio = 65; } message Robot