完成一级一阶数值

This commit is contained in:
aozhiwei 2022-09-06 19:26:50 +08:00
parent 2d69a6a1ec
commit 7e1b020510
11 changed files with 33 additions and 27 deletions

View File

@ -46,6 +46,8 @@ void Android::Initialize()
); );
GetBattleContext()->Init(this); GetBattleContext()->Init(this);
} }
SetHP(GetBattleContext()->GetMaxHP());
SetMaxHP(GetHP());
} }
void Android::Update(int delta_time) void Android::Update(int delta_time)

View File

@ -17,6 +17,11 @@ public:
long long hero_uniid_ = 0; long long hero_uniid_ = 0;
MetaData::Player* hero_meta = nullptr; MetaData::Player* hero_meta = nullptr;
float GetHP()
{
return hero_meta->i->hp();
}
float GetAtk() float GetAtk()
{ {
return hero_meta->i->damage(); return hero_meta->i->damage();
@ -255,7 +260,8 @@ float BattleDataContext::CalcDmg(Obstacle* target, Bullet* bullet)
float BattleDataContext::CalcDmg(Explosion* e) float BattleDataContext::CalcDmg(Explosion* e)
{ {
float finaly_dmg = (1 - GetDef() / 1000) / 2 * 100;
return finaly_dmg;
} }
float BattleDataContext::GetTotalAtk(Bullet* bullet) float BattleDataContext::GetTotalAtk(Bullet* bullet)
@ -264,6 +270,16 @@ float BattleDataContext::GetTotalAtk(Bullet* bullet)
return total_atk; return total_atk;
} }
float BattleDataContext::GetHP()
{
return hero_ability_->GetHP();
}
float BattleDataContext::GetMaxHP()
{
return hero_ability_->GetHP();
}
float BattleDataContext::GetDef() float BattleDataContext::GetDef()
{ {
return def_; return def_;

View File

@ -53,6 +53,8 @@ struct BattleDataContext
float CalcDmg(Obstacle* target, Bullet* bullet); float CalcDmg(Obstacle* target, Bullet* bullet);
float CalcDmg(Explosion* e); float CalcDmg(Explosion* e);
float GetHP();
float GetMaxHP();
float GetDef(); float GetDef();
void ForceInit(long long hero_uniid, void ForceInit(long long hero_uniid,

View File

@ -48,9 +48,6 @@ void Car::Initialize()
SetCurrWeapon(&weapon); SetCurrWeapon(&weapon);
} }
born_frameno_ = room->GetFrameNo(); born_frameno_ = room->GetFrameNo();
SetDef(hero_meta_->i->def());
SetHP(hero_meta_->i->health());
SetMaxHP(std::max(GetHP(), GetMaxHP()));
TryAddBuff(this, meta->car_deactive_buff_id); TryAddBuff(this, meta->car_deactive_buff_id);
cur_oil_ = meta->i->max_oil(); cur_oil_ = meta->i->max_oil();
{ {
@ -67,6 +64,8 @@ void Car::Initialize()
); );
GetBattleContext()->Init(this); GetBattleContext()->Init(this);
} }
SetHP(GetBattleContext()->GetMaxHP());
SetMaxHP(std::max(GetHP(), GetMaxHP()));
} }
void Car::FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data) void Car::FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data)

View File

@ -2447,16 +2447,6 @@ float Creature::GetMaxHP()
GetAbility()->GetAttrAbs(kHAT_MaxHp); GetAbility()->GetAttrAbs(kHAT_MaxHp);
} }
float Creature::GetDef()
{
return ability.def;
}
void Creature::SetDef(float def)
{
ability.def = def;
}
void Creature::GetHitEnemys(std::set<Creature*>& enemys, float radius) void Creature::GetHitEnemys(std::set<Creature*>& enemys, float radius)
{ {
float min_distance = 9999999999; float min_distance = 9999999999;

View File

@ -47,9 +47,6 @@ struct HumanAbility
{ {
float hp = 0.0f; float hp = 0.0f;
float max_hp = 0.0f; float max_hp = 0.0f;
float hp_recover = 0.0f;
float atk = 0.0f;
float def = 0.0f;
float speed = 0.0f; float speed = 0.0f;
float shot_range = 0.0f; float shot_range = 0.0f;
@ -234,8 +231,6 @@ class Creature : public MoveableEntity
void ClearAimingBuffs(); void ClearAimingBuffs();
float GetHP(); float GetHP();
float GetMaxHP(); float GetMaxHP();
float GetDef();
void SetDef(float def);
void GetHitEnemys(std::set<Creature*>& enemys, float radius); void GetHitEnemys(std::set<Creature*>& enemys, float radius);
bool TryMove(const a8::Vec2& target_pos, a8::Vec2& out_pos); bool TryMove(const a8::Vec2& target_pos, a8::Vec2& out_pos);
void SetInfiniteBulletMode(); void SetInfiniteBulletMode();

View File

@ -34,8 +34,6 @@ void Hero::Initialize()
{ {
Creature::Initialize(); Creature::Initialize();
RecalcSelfCollider(); RecalcSelfCollider();
SetHP(meta->i->health());
SetMaxHP(GetHP());
MetaData::Equip* weapon_meta = MetaMgr::Instance()->GetEquip(meta->i->default_weapon()); MetaData::Equip* weapon_meta = MetaMgr::Instance()->GetEquip(meta->i->default_weapon());
if (weapon_meta) { if (weapon_meta) {
Weapon& weapon = weapons[GUN_SLOT1]; Weapon& weapon = weapons[GUN_SLOT1];
@ -63,6 +61,8 @@ void Hero::Initialize()
); );
GetBattleContext()->Init(this); GetBattleContext()->Init(this);
} }
SetHP(GetBattleContext()->GetMaxHP());
SetMaxHP(GetHP());
} }
void Hero::FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data) void Hero::FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data)

View File

@ -342,7 +342,7 @@ void Human::Initialize()
RecalcSelfCollider(); RecalcSelfCollider();
volume_ = meta->volume; volume_ = meta->volume;
observers_.insert(this); observers_.insert(this);
SetHP(meta->i->health()); #if 0
for (auto& weapon : spec_weapons) { for (auto& weapon : spec_weapons) {
if (weapon.meta) { if (weapon.meta) {
float hp = GetHP(); float hp = GetHP();
@ -350,7 +350,7 @@ void Human::Initialize()
SetHP(hp); SetHP(hp);
} }
} }
SetMaxHP(GetHP()); #endif
SetCurrWeapon(&weapons[0]); SetCurrWeapon(&weapons[0]);
SetOxygen(MetaMgr::Instance()->dive_oxygen_total); SetOxygen(MetaMgr::Instance()->dive_oxygen_total);
} }
@ -1654,6 +1654,8 @@ void Human::RecalcVolume()
void Human::RecalcBaseAttr() void Human::RecalcBaseAttr()
{ {
#if 0
xxxxxxxx
MetaData::Equip* chest_meta = MetaMgr::Instance()->GetEquip(chest); MetaData::Equip* chest_meta = MetaMgr::Instance()->GetEquip(chest);
float def = meta->i->def(); float def = meta->i->def();
if (chest_meta) { if (chest_meta) {
@ -1664,8 +1666,6 @@ void Human::RecalcBaseAttr()
def += helmet_meta->i->def(); def += helmet_meta->i->def();
} }
SetDef(def); SetDef(def);
#if 0
SetMaxHP(std::max(GetHP(), GetMaxHP()));
#endif #endif
} }

View File

@ -4090,6 +4090,8 @@ void Room::AddTeam(class MatchTeam* team)
hum->ProcPrepareItems(msg.prepare_items()); hum->ProcPrepareItems(msg.prepare_items());
hum->ProcPrepareItems2(msg.prepare_items2()); hum->ProcPrepareItems2(msg.prepare_items2());
hum->ProcSkillList(msg.skill_list()); hum->ProcSkillList(msg.skill_list());
hum->SetHP(hum->GetBattleContext()->GetMaxHP());
hum->SetMaxHP(hum->GetHP());
PlayerMgr::Instance()->IncAccountNum(msg.account_id()); PlayerMgr::Instance()->IncAccountNum(msg.account_id());
new_team->AddMember(hum); new_team->AddMember(hum);
} }

View File

@ -206,6 +206,8 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
hum->ProcPrepareItems(msg.prepare_items()); hum->ProcPrepareItems(msg.prepare_items());
hum->ProcPrepareItems2(msg.prepare_items2()); hum->ProcPrepareItems2(msg.prepare_items2());
hum->ProcSkillList(msg.skill_list()); hum->ProcSkillList(msg.skill_list());
hum->SetHP(hum->GetBattleContext()->GetMaxHP());
hum->SetMaxHP(hum->GetHP());
PlayerMgr::Instance()->IncAccountNum(msg.account_id()); PlayerMgr::Instance()->IncAccountNum(msg.account_id());
if (JsonDataMgr::Instance()->channel != 0 && if (JsonDataMgr::Instance()->channel != 0 &&
JsonDataMgr::Instance()->channel != channel) { JsonDataMgr::Instance()->channel != channel) {

View File

@ -206,7 +206,6 @@ message Player
optional float move_offset_x = 40; optional float move_offset_x = 40;
optional float move_offset_y = 41; optional float move_offset_y = 41;
optional float radius = 2; // optional float radius = 2; //
optional int32 health = 3; //
optional int32 move_speed = 4; // optional int32 move_speed = 4; //
optional int32 jump_speed = 5; // optional int32 jump_speed = 5; //
optional int32 move_speed3 = 6; optional int32 move_speed3 = 6;
@ -215,7 +214,6 @@ message Player
optional int32 move_speed4 = 10; //4 optional int32 move_speed4 = 10; //4
optional int32 reload_speed = 9; optional int32 reload_speed = 9;
optional int32 useitem_speed = 49; optional int32 useitem_speed = 49;
optional float def = 11; //
optional string volume = 12; // optional string volume = 12; //
optional int32 level = 13; optional int32 level = 13;
optional int32 race = 14; optional int32 race = 14;