This commit is contained in:
aozhiwei 2022-09-07 15:58:37 +08:00
parent da28c5bc0a
commit 96845f3b1f
10 changed files with 37 additions and 45 deletions

View File

@ -110,7 +110,7 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
}
}
void BattleDataContext::GetHeroLvQualit(int& hero_lv, int& quality)
void BattleDataContext::GetHeroLvQuality(int& hero_lv, int& quality)
{
hero_lv = 1;
quality = 1;
@ -122,7 +122,7 @@ void BattleDataContext::GetHeroLvQualit(int& hero_lv, int& quality)
}
}
void BattleDataContext::GetWeaponLvQualit(int& weapon_lv, int& quality)
void BattleDataContext::GetWeaponLvQuality(int& weapon_lv, int& quality)
{
weapon_lv = 1;
quality = 1;
@ -408,3 +408,16 @@ void BattleDataContext::Init(Creature* c)
dodge_ = hero_ability_->GetDodge();
dodge_damage_ruduce_ = hero_ability_->GetDodgeDamageRuduce();
}
void BattleDataContext::GetSkillList(std::vector<int>& skill_list)
{
int hero_lv = 1;
int quality = 1;
GetHeroLvQuality(hero_lv, quality);
MetaData::Skill* skill1 = MetaMgr::Instance()->GetSkill(hero_ability_->hero_meta->i->skill1list());
MetaData::Skill* skill2 = MetaMgr::Instance()->GetSkill(hero_ability_->hero_meta->i->skill2list());
MetaData::Skill* skill3 = MetaMgr::Instance()->GetSkill(hero_ability_->hero_meta->i->skill3list());
if (skill1 && skill2 && skill3) {
}
}

View File

@ -42,8 +42,8 @@ struct BattleDataContext
BattleDataContext();
void GetHeroLvQualit(int& hero_lv, int& quality);
void GetWeaponLvQualit(int& weapon_lv, int& quality);
void GetHeroLvQuality(int& hero_lv, int& quality);
void GetWeaponLvQuality(int& weapon_lv, int& quality);
void ParseResult(a8::XObject& obj);
@ -64,6 +64,7 @@ struct BattleDataContext
long long weapon2_uniid,
MetaData::Equip* weapon2_meta);
void Init(Creature* c);
void GetSkillList(std::vector<int>& skill_list);
private:
void Clear();
@ -89,4 +90,8 @@ private:
float crit_damage_rate_ = 0;
float dodge_ = 0;
float dodge_damage_ruduce_ = 0;
int skill1_lv = 1;
int skill2_lv = 1;
int skill3_lv = 1;
};

View File

@ -112,13 +112,13 @@ void PlayerStats::Statement(Human* sender)
if (a->GetBattleContext()) {
int hero_lv = 0;
int quality = 0;
a->GetBattleContext()->GetHeroLvQualit(hero_lv, quality);
a->GetBattleContext()->GetHeroLvQuality(hero_lv, quality);
a_value = hero_lv + quality;
}
if (b->GetBattleContext()) {
int hero_lv = 0;
int quality = 0;
b->GetBattleContext()->GetHeroLvQualit(hero_lv, quality);
b->GetBattleContext()->GetHeroLvQuality(hero_lv, quality);
b_value = hero_lv + quality;
}
if (a_value == b_value) {
@ -140,13 +140,13 @@ void PlayerStats::Statement(Human* sender)
if (a->GetBattleContext()) {
int weapon_lv = 0;
int quality = 0;
a->GetBattleContext()->GetWeaponLvQualit(weapon_lv, quality);
a->GetBattleContext()->GetWeaponLvQuality(weapon_lv, quality);
a_value = weapon_lv + quality;
}
if (b->GetBattleContext()) {
int weapon_lv = 0;
int quality = 0;
b->GetBattleContext()->GetWeaponLvQualit(weapon_lv, quality);
b->GetBattleContext()->GetWeaponLvQuality(weapon_lv, quality);
b_value = weapon_lv + quality;
}
if (a_value == b_value) {

View File

@ -24,14 +24,10 @@ void RawTeamMember::FillMFMatchTeamMember(cs::MFMatchTeamMember* p)
} else {
p->set_hero_id(msg->hero_id());
*p->mutable_weapons() = msg->weapons();
*p->mutable_skill_list() = msg->skill_list();
}
p->set_is_leader(is_leader);
p->set_state(state);
p->set_head_frame(msg->head_frame());
#if 0
p->set_hero_skin(msg->hero_skin());
#endif
}
void RawTeamMember::InitRobot()
@ -44,30 +40,8 @@ void RawTeamMember::InitRobot()
robot_meta = MetaMgr::Instance()->RandRobot(refreshed_robot_set);
if (robot_meta) {
msg->set_avatar_url(a8::Format("%s", {50001 + (robot_meta->i->id() % 3)}));
#if 1
msg->set_hero_id(30100 + 100 * (robot_meta->i->id() % 3));
#else
msg->set_hero_id(robot_meta->i->hero_id());
#endif
msg->set_name(robot_meta->i->name());
#if 0
auto skin = msg->add_skins();
if (!robot_meta->skin_id.empty()) {
skin->set_skin_id(robot_meta->skin_id[0]);
skin->set_skin_lv(1);
}
#endif
#if 0
{
MetaData::Player* hero_meta = MetaMgr::Instance()->GetPlayer(msg->hero_id());
if (hero_meta) {
MetaData::Item* skin_meta = MetaMgr::Instance()->GetHeroSkin(msg->hero_id());
if (skin_meta) {
msg->set_hero_skin(skin_meta->i->id());
}
}
}
#endif
} else {
A8_ABORT();
}
@ -129,7 +103,6 @@ void MatchTeam::_CMMatchChoose(f8::MsgHdr& hdr, const cs::CMMatchChoose& msg)
member->msg->set_hero_id(msg.hero_id());
member->msg->set_hero_uniid(msg.hero_uniid());
*member->msg->mutable_weapons() = msg.weapons();
*member->msg->mutable_skill_list() = msg.skill_list();
++member->choose_hero_times;
#ifdef DEBUG
a8::XPrintf("matchchoose %s\n", {member->msg->account_id()});

View File

@ -646,11 +646,12 @@ void Player::HumanInteraction(Human* hum)
);
}
void Player::ProcSkillList(const ::google::protobuf::RepeatedPtrField< cs::MFPair >&
skill_list)
void Player::ProcSkillList()
{
for (auto& pair : skill_list) {
AddSkill(pair.key());
std::vector<int> skill_list;
GetBattleContext()->GetSkillList(skill_list);
for (auto& skill_id : skill_list) {
AddSkill(skill_id);
}
}

View File

@ -100,8 +100,7 @@ class Player : public Human
void ObstacleInteraction(Obstacle* entity);
void HumanInteraction(Human* hum);
void ProcPreSettlementInfo(const std::string& pre_settlement_info);
void ProcSkillList(const ::google::protobuf::RepeatedPtrField< cs::MFPair >&
skill_list);
void ProcSkillList();
void PushJoinRoomMsg();
void _CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg);

View File

@ -4066,7 +4066,7 @@ void Room::AddTeam(class MatchTeam* team)
hum->SetBattleContext(member->battle_context);
hum->GetBattleContext()->Init(hum);
hum->ProcSkillList(msg.skill_list());
hum->ProcSkillList();
hum->SetHP(hum->GetBattleContext()->GetMaxHP());
hum->SetMaxHP(hum->GetHP());
PlayerMgr::Instance()->IncAccountNum(msg.account_id());

View File

@ -205,7 +205,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
room->AddPlayer(hum);
hum->SetBattleContext(results.at(0));
hum->GetBattleContext()->Init(hum);
hum->ProcSkillList(msg.skill_list());
hum->ProcSkillList();
hum->SetHP(hum->GetBattleContext()->GetMaxHP());
hum->SetMaxHP(hum->GetHP());
PlayerMgr::Instance()->IncAccountNum(msg.account_id());

View File

@ -818,7 +818,6 @@ message MFMatchTeamMember
optional string avatar_url = 3; //
optional int32 hero_id = 4; //id
repeated MFWeapon weapons = 5; //
repeated MFPair skill_list = 7; // key:id value:,0
optional bool is_leader = 8; //
optional int32 state = 9; //0: 1:
optional int32 head_frame = 10; //
@ -870,7 +869,6 @@ message CMJoin
repeated MFTeamMember team_members = 51; //
optional int32 room_mode = 52; //0: 1: 2:
optional int32 mapid = 53; //id 0:
repeated MFPair skill_list = 54; // key:id value:,0
optional string user_data = 60 [default = ""]; //
optional int32 hero_id = 61; //id
optional string hero_uniid = 71; //id

View File

@ -248,6 +248,9 @@ message Player
optional float miss = 57;
optional float miss_damage_ruduce = 58;
optional int32 skill1list = 60;
optional int32 skill2list = 61;
optional int32 skill3list = 62;
}
message Robot