1
This commit is contained in:
parent
17ac29d47f
commit
774ab0e2dd
@ -16,6 +16,7 @@ class HeroAbility
|
|||||||
public:
|
public:
|
||||||
long long hero_uniid_ = 0;
|
long long hero_uniid_ = 0;
|
||||||
MetaData::Player* hero_meta = nullptr;
|
MetaData::Player* hero_meta = nullptr;
|
||||||
|
std::shared_ptr<a8::XObject> hero_dto;
|
||||||
|
|
||||||
float GetHP()
|
float GetHP()
|
||||||
{
|
{
|
||||||
@ -52,6 +53,11 @@ public:
|
|||||||
return hero_meta->i->miss_damage_ruduce();
|
return hero_meta->i->miss_damage_ruduce();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
float hp_ = 0.0f;
|
float hp_ = 0.0f;
|
||||||
@ -69,6 +75,7 @@ class WeaponAbility
|
|||||||
public:
|
public:
|
||||||
long long weapon_uniid = 0;
|
long long weapon_uniid = 0;
|
||||||
MetaData::Equip* weapon_meta = nullptr;
|
MetaData::Equip* weapon_meta = nullptr;
|
||||||
|
std::shared_ptr<a8::XObject> weapon_dto;
|
||||||
|
|
||||||
float GetAtk()
|
float GetAtk()
|
||||||
{
|
{
|
||||||
@ -85,6 +92,17 @@ public:
|
|||||||
return weapon_meta->i->cri_damage();
|
return weapon_meta->i->cri_damage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
float atk_ = 0.0f;
|
||||||
|
float crit_atk_ = 0.0f;
|
||||||
|
float crit_atk_ratio_ = 0.0f;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BattleDataContext::BattleDataContext()
|
BattleDataContext::BattleDataContext()
|
||||||
@ -106,6 +124,7 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
|
|||||||
if (obj.HasKey("hero_dto") && obj.At("hero_dto")->IsObject()) {
|
if (obj.HasKey("hero_dto") && obj.At("hero_dto")->IsObject()) {
|
||||||
hero_dto = obj.At("hero_dto");
|
hero_dto = obj.At("hero_dto");
|
||||||
hero_ability_->hero_uniid_ = hero_dto->Get("hero_uniid", "");
|
hero_ability_->hero_uniid_ = hero_dto->Get("hero_uniid", "");
|
||||||
|
hero_ability_->hero_dto = hero_dto;;
|
||||||
MetaData::Player* meta = MetaMgr::Instance()->GetPlayer(hero_dto->Get("hero_id", ""));
|
MetaData::Player* meta = MetaMgr::Instance()->GetPlayer(hero_dto->Get("hero_id", ""));
|
||||||
if (meta) {
|
if (meta) {
|
||||||
hero_ability_->hero_meta = meta;
|
hero_ability_->hero_meta = meta;
|
||||||
@ -118,6 +137,7 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
|
|||||||
weapon1_ability_ = std::make_shared<WeaponAbility>();
|
weapon1_ability_ = std::make_shared<WeaponAbility>();
|
||||||
weapon1_ability_->weapon_uniid = weapon_dto1->Get("gun_uniid", 0);
|
weapon1_ability_->weapon_uniid = weapon_dto1->Get("gun_uniid", 0);
|
||||||
weapon1_ability_->weapon_meta = meta;
|
weapon1_ability_->weapon_meta = meta;
|
||||||
|
weapon1_ability_->weapon_dto = weapon_dto1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (obj.HasKey("weapon_dto2") && obj.At("weapon_dto2")->IsObject()) {
|
if (obj.HasKey("weapon_dto2") && obj.At("weapon_dto2")->IsObject()) {
|
||||||
@ -126,7 +146,8 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
|
|||||||
if (meta) {
|
if (meta) {
|
||||||
weapon2_ability_ = std::make_shared<WeaponAbility>();
|
weapon2_ability_ = std::make_shared<WeaponAbility>();
|
||||||
weapon2_ability_->weapon_uniid = weapon_dto2->Get("gun_uniid", 0);
|
weapon2_ability_->weapon_uniid = weapon_dto2->Get("gun_uniid", 0);
|
||||||
weapon1_ability_->weapon_meta = meta;
|
weapon2_ability_->weapon_meta = meta;
|
||||||
|
weapon2_ability_->weapon_dto = weapon_dto2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,6 +443,13 @@ void BattleDataContext::Init(Creature* c)
|
|||||||
if (!hero_ability_->hero_uniid_) {
|
if (!hero_ability_->hero_uniid_) {
|
||||||
hero_ability_->hero_uniid_ = App::Instance()->AllocTempHeroUniId();
|
hero_ability_->hero_uniid_ = App::Instance()->AllocTempHeroUniId();
|
||||||
}
|
}
|
||||||
|
hero_ability_->Init();
|
||||||
|
if (weapon1_ability_) {
|
||||||
|
weapon1_ability_->Init();
|
||||||
|
}
|
||||||
|
if (weapon2_ability_) {
|
||||||
|
weapon2_ability_->Init();
|
||||||
|
}
|
||||||
atk_ = hero_ability_->GetAtk();
|
atk_ = hero_ability_->GetAtk();
|
||||||
def_ = hero_ability_->GetDef();
|
def_ = hero_ability_->GetDef();
|
||||||
crit_ = hero_ability_->GetCritAtk();
|
crit_ = hero_ability_->GetCritAtk();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user