天赋功能ok

This commit is contained in:
aozhiwei 2021-12-16 16:34:54 +08:00
parent 3aa9102bcf
commit 6a2355c730
3 changed files with 27 additions and 0 deletions

View File

@ -648,6 +648,26 @@ void Creature::RecalcBuffAttr()
}
}
}
for (auto& tuple : talent_list) {
auto talent_meta = MetaMgr::Instance()->GetTalent(std::get<0>(tuple), std::get<1>(tuple));
if (talent_meta) {
for (auto& tuple1 : talent_meta->addattr) {
int attr_type = std::get<0>(tuple1);
int attr_val = std::get<1>(tuple1);
if (talent_meta->i->addtype() == 0) {
float* p = ability_->GetBuffAttrAbsPtr(attr_type);
if (p) {
*p += attr_val;
}
} else if (talent_meta->i->addtype() == 1) {
float* p = ability_->GetBuffAttrRatePtr(attr_type);
if (p) {
*p += attr_val;
}
}
}
}
}
if (need_refresh_hp) {
SetHP(GetMaxHP());
GetTrigger()->HpChg();

View File

@ -94,6 +94,8 @@ class Creature : public MoveableEntity
a8::Vec2 context_dir;
std::shared_ptr<Ability> context_ability;
std::vector<std::tuple<int, int>> talent_list;
bool need_sync_active_player = false;
std::function<void ()> on_loading_bullet;
CreatureWeakPtr follow_target;

View File

@ -127,6 +127,11 @@ Player* PlayerMgr::CreatePlayerByCMJoin(Player* hum,
#else
hum->SetSkinInfo(msg.baseskin());
#endif
for (auto& pair : msg.talent_list()) {
hum->talent_list.push_back(
std::make_tuple(pair.key(), pair.value())
);
}
socket_hash_[socket] = hum;
return hum;
}