aozhiwei 2fa59af84a 1
2024-01-10 15:01:00 +08:00

140 lines
3.4 KiB
C++

#pragma once
#include "weakptr.h"
namespace MetaData
{
struct Equip;
}
class Creature;
class Obstacle;
class Explosion;
class Weapon;
struct PlayerStats;
class HeroAbility;
class WeaponAbility;
class Skill;
struct BattleDataContext
{
std::shared_ptr<cs::CMJoin> join_msg;
std::string battle_uuid;
int is_valid_battle = 0;
std::string payload;
int errcode = 0;
std::string errmsg;
bool parse_ok = false;
std::shared_ptr<a8::XObject> hero_dto;
std::shared_ptr<a8::XObject> weapon_dto1;
std::shared_ptr<a8::XObject> weapon_dto2;
BattleDataContext();
void GetHeroLvQuality(long long& hero_uniid, int& hero_lv, int& quality);
void GetWeaponLvQuality(long long weapon_uniid, int& weapon_lv, int& quality);
int GetWeaponMaxLv();
void ParseResult(a8::XObject& obj);
void CalcBattleStat(struct PlayerStats* stats);
float CalcDmg(Creature* target, IBullet* bullet);
float CalcDmg(Obstacle* target, IBullet* bullet);
float CalcDmg(Explosion* e);
bool IsCrit();
bool IsBlock();
int GetCritBp();
int GetBlockBp();
float GetCritDmg();
int GetDmgBp();
float GetMaxHP();
float GetAttack();
float GetDef();
float GetBlock();
float GetCrit();
void RecalcMaxHP();
void RecalcAttack();
void RecalcDef();
void RecalcBlock();
void RecalcCrit();
int GetRank();
void ForceInit(long long hero_uniid,
const mt::Hero* hum_meta,
long long weapon1_uniid,
const mt::Equip* weapon1_meta,
long long weapon2_uniid,
const mt::Equip* weapon2_meta);
void Init(Creature* c);
void GetSkillList(std::vector<int>& skill_list);
int GetClipVolume(Creature* c, Weapon* weapon);
int GetFireRate(Creature* c, Weapon* weapon);
int GetReloadTime(Creature* c, Weapon* weapon);
float GetHeroTotalAtk();
float GetExtRecoverHp();
float GetBrainLifePct();
float GetSkillCdPct();
float GetRescueTimePct();
float GetDrugTimePct();
float GetDrugEfficacyPct();
float GetTenacityPct();
float GetRecoverHpAdd();
float CalcReceiveDmg(Creature* sender, float normal_dmg);
float CalcSkillReceiveDmg(Creature* sender, float normal_dmg);
void SetReviveCoin(int num);
int GetReviveCoin();
void SetMatchMode(int match_mode);
int GetMatchMode();
int GetSkinId();
int GetLevel();
int GetHeroId();
int GetHeroLevel();
bool IsMainSkill(Skill* skill);
int GetCurrentGetStar();
int GetBattleTimes();
int GetHonor();
int GetElo() { return elo_; }
const std::list<int>& GetAvatars() { return avatars_; }
std::shared_ptr<HeroAbility> GetHeroAbility() { return hero_ability_; }
private:
void Clear();
float GetWeaponAtk(IBullet* bullet);
std::shared_ptr<WeaponAbility> GetWeaponByUniId(long long weapon_uniid);
private:
CreatureWeakPtr owner_;
int revive_coin_ = 0;
int match_mode_ = 0;
std::shared_ptr<HeroAbility> hero_ability_;
std::shared_ptr<WeaponAbility> weapon1_ability_;
std::shared_ptr<WeaponAbility> weapon2_ability_;
int rank_ = 0;
int honor_ = 0;
int skin_id_ = 0;
int level_ = 0;
int hero_lv_ = 0;
int elo_ = 0;
int current_get_star_ = 0;
int battle_times_ = 0;
std::list<int> avatars_;
int skill1_lv = 1;
int skill2_lv = 1;
int skill3_lv = 1;
};