修复武器问题

This commit is contained in:
aozhiwei 2020-05-27 10:32:57 +08:00
parent c50633cbea
commit 620db5ae5b
2 changed files with 12 additions and 1 deletions

View File

@ -2072,8 +2072,16 @@ void Human::GenBattleReportData(a8::MutableXObject* params)
{
std::string items_str;
MetaData::RankReward* rank_reward_meta = MetaMgr::Instance()->GetRankReward(rank);
#ifdef DEBUG
{
if (rank_reward_meta && rank_reward_meta->i->drop() > 0) {
#else
#endif
#ifdef DEBUG
{
#else
if (rand() % 100 < rank_reward_meta->i->drop()) {
#endif
MetaData::Equip* item_meta = MetaMgr::Instance()->GetEquip(grow_weapon.weapon_id);
if (item_meta) {
MetaData::Drop* drop_meta = MetaMgr::Instance()->GetDrop(item_meta->i->drop_id());
@ -2093,6 +2101,9 @@ void Human::GenBattleReportData(a8::MutableXObject* params)
}
}
}//end if rank_reward_meta
if (!items_str.empty() && items_str[items_str.size() - 1] == '|') {
items_str.erase(items_str.begin() + items_str.size() - 1);
}
params->SetVal("items", items_str);
}
{

View File

@ -230,7 +230,7 @@ namespace MetaData
}
}
} else if (total_weight > 0) {
int rnd = rand() % total_weight;
int rnd = rand() % (total_weight + 1);
for (auto& item : items) {
if (std::get<3>(item) >= rnd) {
for (size_t i = 0; i < std::get<0>(item).size(); ++i) {