1
This commit is contained in:
parent
20de4d231c
commit
8cfc78be90
@ -3932,17 +3932,46 @@ void Creature::AdjustMobaBornDir()
|
||||
|
||||
void Creature::SetHeroLevel(int level, int exp, const mt::BattleHeroGrow* grow_meta)
|
||||
{
|
||||
for (int buff_uniid : grow_buff_list_) {
|
||||
RemoveBuffByUniId(buff_uniid);
|
||||
}
|
||||
grow_buff_list_.clear();
|
||||
hero_level_ = level;
|
||||
hero_exp_ = exp;
|
||||
hero_grow_meta_ = grow_meta;
|
||||
if (hero_grow_meta_) {
|
||||
{
|
||||
auto attrs = hero_grow_meta_->GetLevelAttrs();
|
||||
if (attrs) {
|
||||
for (auto handle : grow_attr_list_) {
|
||||
GetAbility()->RemoveAttr(handle);
|
||||
}
|
||||
grow_attr_list_.clear();
|
||||
hero_level_ = level;
|
||||
hero_exp_ = exp;
|
||||
hero_grow_meta_ = grow_meta;
|
||||
for (auto tuple : *attrs) {
|
||||
auto handle = GetAbility()->AddAttr(std::get<0>(tuple), std::get<1>(tuple));
|
||||
if (!handle.expired()) {
|
||||
grow_attr_list_.push_back(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
auto effects = hero_grow_meta_->GetEquipEffects();
|
||||
if (effects) {
|
||||
for (int buff_uniid : grow_buff_list_) {
|
||||
RemoveBuffByUniId(buff_uniid);
|
||||
}
|
||||
grow_buff_list_.clear();
|
||||
for (int buff_id : *effects) {
|
||||
TryAddBuff(this, buff_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hero_grow_meta_->GetSkillEffect()) {
|
||||
for (auto& pair : skill_hash_) {
|
||||
pair.second->LevelUp();
|
||||
}
|
||||
for (auto& pair : passive_skill_hash_) {
|
||||
pair.second->LevelUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Creature::GetHeroLevel()
|
||||
|
@ -36,7 +36,7 @@ namespace mt
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int BattleHeroGrow::GetSkilLEffect() const
|
||||
int BattleHeroGrow::GetSkillEffect() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace mt
|
||||
bool IsFullLevel() const;
|
||||
std::shared_ptr<std::vector<std::tuple<int, float>>> GetLevelAttrs() const;
|
||||
std::shared_ptr<std::vector<int>> GetEquipEffects() const;
|
||||
int GetSkilLEffect() const;
|
||||
int GetSkillEffect() const;
|
||||
|
||||
private:
|
||||
};
|
||||
|
@ -550,6 +550,11 @@ void Skill::LevelUp()
|
||||
}
|
||||
}
|
||||
|
||||
bool Skill::IsFullLevel()
|
||||
{
|
||||
return level_ == 4;
|
||||
}
|
||||
|
||||
void Skill::Reset()
|
||||
{
|
||||
Clear();
|
||||
|
@ -56,6 +56,7 @@ class Skill
|
||||
void Deactive() { actived_ = false; }
|
||||
bool IsMainSkill();
|
||||
void LevelUp();
|
||||
bool IsFullLevel();
|
||||
void Clear();
|
||||
void Reset();
|
||||
const mt::Skill* GetCurrSkillMeta();
|
||||
|
Loading…
x
Reference in New Issue
Block a user