1
This commit is contained in:
parent
8cfc78be90
commit
a556db9d7f
@ -2429,11 +2429,35 @@ void Creature::DoRecoilForce(int distance)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::WinSkillExp(int win_exp)
|
void Creature::WinExp(int win_exp)
|
||||||
{
|
{
|
||||||
|
if (win_exp <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!IsHuman()) {
|
if (!IsHuman()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!hero_grow_meta_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (hero_grow_meta_->levelExp() <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (hero_grow_meta_->IsFullLevel()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int add_exp = win_exp;
|
||||||
|
while (
|
||||||
|
hero_grow_meta_->GetNextMeta() &&
|
||||||
|
hero_grow_meta_->levelExp() > 0 &&
|
||||||
|
!hero_grow_meta_->IsFullLevel() &&
|
||||||
|
GetHeroExp() + add_exp >= hero_grow_meta_->levelExp()
|
||||||
|
) {
|
||||||
|
add_exp -= hero_grow_meta_->levelExp();
|
||||||
|
hero_grow_meta_ = hero_grow_meta_->GetNextMeta();
|
||||||
|
hero_level_ = hero_grow_meta_->level();
|
||||||
|
GenLevelAttr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::RecalcDtoAttr()
|
void Creature::RecalcDtoAttr()
|
||||||
@ -3935,6 +3959,29 @@ void Creature::SetHeroLevel(int level, int exp, const mt::BattleHeroGrow* grow_m
|
|||||||
hero_level_ = level;
|
hero_level_ = level;
|
||||||
hero_exp_ = exp;
|
hero_exp_ = exp;
|
||||||
hero_grow_meta_ = grow_meta;
|
hero_grow_meta_ = grow_meta;
|
||||||
|
GenLevelAttr();
|
||||||
|
}
|
||||||
|
|
||||||
|
int Creature::GetHeroLevel()
|
||||||
|
{
|
||||||
|
return hero_level_;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Creature::GetHeroExp()
|
||||||
|
{
|
||||||
|
return hero_exp_;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Creature::GetHeroMaxExp()
|
||||||
|
{
|
||||||
|
if (hero_grow_meta_) {
|
||||||
|
return hero_grow_meta_->levelExp();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Creature::GenLevelAttr()
|
||||||
|
{
|
||||||
if (hero_grow_meta_) {
|
if (hero_grow_meta_) {
|
||||||
{
|
{
|
||||||
auto attrs = hero_grow_meta_->GetLevelAttrs();
|
auto attrs = hero_grow_meta_->GetLevelAttrs();
|
||||||
@ -3973,21 +4020,3 @@ void Creature::SetHeroLevel(int level, int exp, const mt::BattleHeroGrow* grow_m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Creature::GetHeroLevel()
|
|
||||||
{
|
|
||||||
return hero_level_;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Creature::GetHeroExp()
|
|
||||||
{
|
|
||||||
return hero_exp_;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Creature::GetHeroMaxExp()
|
|
||||||
{
|
|
||||||
if (hero_grow_meta_) {
|
|
||||||
return hero_grow_meta_->levelExp();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
@ -360,7 +360,7 @@ class Creature : public MoveableEntity
|
|||||||
int GetHeroLevel();
|
int GetHeroLevel();
|
||||||
int GetHeroExp();
|
int GetHeroExp();
|
||||||
int GetHeroMaxExp();
|
int GetHeroMaxExp();
|
||||||
void WinSkillExp(int win_exp);
|
void WinExp(int win_exp);
|
||||||
void RecalcDtoAttr();
|
void RecalcDtoAttr();
|
||||||
void AutoNavigation(const glm::vec3& target_pos, float speed,
|
void AutoNavigation(const glm::vec3& target_pos, float speed,
|
||||||
std::function<void (Creature*)> cb);
|
std::function<void (Creature*)> cb);
|
||||||
@ -435,6 +435,7 @@ private:
|
|||||||
void CheckLoadingBullet();
|
void CheckLoadingBullet();
|
||||||
bool InternalCanUseSkill(Skill* skill);
|
bool InternalCanUseSkill(Skill* skill);
|
||||||
void InternalUseSkill();
|
void InternalUseSkill();
|
||||||
|
void GenLevelAttr();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool need_sync_active_player_ = false;
|
bool need_sync_active_player_ = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user