aozhiwei b120b4355a 1
2023-07-16 13:32:44 +08:00

127 lines
3.1 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;
long long battle_uuid = 0;
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();
float GetCritDmg();
float GetHP();
float GetMaxHP();
float GetDef();
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);
void SetReviveCoin(int num);
int GetReviveCoin();
void SetMatchMode(int match_mode);
int GetMatchMode();
int GetSkinId();
int GetLevel();
int GetHeroLevel();
bool IsMainSkill(Skill* skill);
int GetCurrentGetStar();
int GetBattleTimes();
int GetHonor();
private:
void Clear();
float GetTotalAtk(IBullet* bullet);
float GetWeaponAtk(IBullet* bullet);
bool IsCrit(IBullet* bullet);
float GetCrit(IBullet* bullet);
float GetCritRate(IBullet* bullet);
bool IsDodge(IBullet* bullet);
float GetDodge(IBullet* bullet);
float GetDodgeRuduce(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 current_get_star_ = 0;
int battle_times_ = 0;
int skill1_lv = 1;
int skill2_lv = 1;
int skill3_lv = 1;
};