This commit is contained in:
aozhiwei 2022-09-06 15:29:19 +08:00
parent b4d55cbea1
commit 0d9b301a15
2 changed files with 7 additions and 2 deletions

View File

@ -50,6 +50,12 @@ float* GetAttrRatePtr(std::array<float, kHAT_End>& attr, int attr_id)
return &attr[attr_id];
}
BattleDataContext::BattleDataContext()
{
hero_ability_ = std::make_shared<HeroAbility>();
hero_ability_->hero_meta = MetaMgr::Instance()->human_meta;
}
void BattleDataContext::Clear()
{
if (hero_ability_) {
@ -74,7 +80,6 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
errmsg = obj.Get("errmsg").GetString();
if (obj.HasKey("hero_dto") && obj.At("hero_dto")->IsObject()) {
hero_dto = obj.At("hero_dto");
hero_ability_ = std::make_shared<HeroAbility>();
hero_ability_->hero_uniid_ = hero_dto->Get("hero_uniid", "");
if (hero_dto->HasKey("attr") && hero_dto->IsArray()) {
ApplyAttr(hero_ability_->attr_abs_,
@ -378,7 +383,6 @@ void BattleDataContext::ForceInit(long long hero_uniid,
long long weapon2_uniid,
MetaData::Equip* weapon2_meta)
{
hero_ability_ = std::make_shared<HeroAbility>();
hero_ability_->hero_uniid_ = hero_uniid;
hero_ability_->hero_meta = hum_meta;
if (weapon1_uniid && weapon1_meta) {

View File

@ -37,6 +37,7 @@ struct BattleDataContext
std::shared_ptr<a8::XObject> weapon_dto1;
std::shared_ptr<a8::XObject> weapon_dto2;
BattleDataContext();
float GetHeroAttrAbs(long long hero_uniid, int attr_id);
float GetHeroAttrRate(long long hero_uniid, int attr_id);