remove downed state
This commit is contained in:
parent
f3c81fd90c
commit
8b367c8d96
@ -61,8 +61,6 @@ enum ActionType_e
|
|||||||
AT_None = 0,
|
AT_None = 0,
|
||||||
AT_Reload = 1,
|
AT_Reload = 1,
|
||||||
AT_UseItem = 2,
|
AT_UseItem = 2,
|
||||||
AT_Relive = 3,
|
|
||||||
AT_Rescue = 4
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum InventorySlot_e
|
enum InventorySlot_e
|
||||||
|
@ -77,19 +77,13 @@ float Human::GetSpeed()
|
|||||||
return buff->meta->param2;
|
return buff->meta->param2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float speed = 0.0f;
|
float speed = ability.speed;
|
||||||
if (downed) {
|
if (action_type == AT_Reload) {
|
||||||
//倒地速度
|
speed = ability.reload_speed;
|
||||||
speed = ability.speed;
|
} else if (shot_hold) {
|
||||||
} else {
|
if (curr_weapon->weapon_idx == GUN_SLOT1 ||
|
||||||
speed = ability.speed;
|
curr_weapon->weapon_idx == GUN_SLOT2) {
|
||||||
if (action_type == AT_Reload) {
|
speed = ability.shot_speed;
|
||||||
speed = ability.reload_speed;
|
|
||||||
} else if (shot_hold) {
|
|
||||||
if (curr_weapon->weapon_idx == GUN_SLOT1 ||
|
|
||||||
curr_weapon->weapon_idx == GUN_SLOT2) {
|
|
||||||
speed = ability.shot_speed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
speed = (speed + buff_attr_abs_[HAT_Speed]) * (1 + buff_attr_rate_[HAT_Speed]);
|
speed = (speed + buff_attr_abs_[HAT_Speed]) * (1 + buff_attr_rate_[HAT_Speed]);
|
||||||
@ -123,7 +117,9 @@ void Human::FillMFObjectFull(cs::MFObjectFull* full_data)
|
|||||||
p->set_health(GetHP());
|
p->set_health(GetHP());
|
||||||
p->set_max_health(GetMaxHP());
|
p->set_max_health(GetMaxHP());
|
||||||
p->set_dead(dead);
|
p->set_dead(dead);
|
||||||
|
#if 0
|
||||||
p->set_downed(downed);
|
p->set_downed(downed);
|
||||||
|
#endif
|
||||||
p->set_disconnected(disconnected);
|
p->set_disconnected(disconnected);
|
||||||
if (skin_jlf.skin_id != 0) {
|
if (skin_jlf.skin_id != 0) {
|
||||||
skin_jlf.ToPB(p->mutable_skin());
|
skin_jlf.ToPB(p->mutable_skin());
|
||||||
@ -196,7 +192,9 @@ void Human::FillMFTeamData(cs::MFTeamData* team_data)
|
|||||||
team_data->set_max_health(GetMaxHP());
|
team_data->set_max_health(GetMaxHP());
|
||||||
team_data->set_disconnected(false);
|
team_data->set_disconnected(false);
|
||||||
team_data->set_dead(dead);
|
team_data->set_dead(dead);
|
||||||
|
#if 0
|
||||||
team_data->set_downed(downed);
|
team_data->set_downed(downed);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::Shot()
|
void Human::Shot()
|
||||||
@ -482,15 +480,6 @@ void Human::StartAction(ActionType_e action_type,
|
|||||||
|
|
||||||
void Human::CancelAction()
|
void Human::CancelAction()
|
||||||
{
|
{
|
||||||
if (action_type == AT_Relive) {
|
|
||||||
Entity* entity = room->GetEntityByUniId(action_target_id);
|
|
||||||
if (entity->entity_type != ET_Player) {
|
|
||||||
Human* hum = (Human*)entity;
|
|
||||||
if (hum->action_type == AT_Rescue) {
|
|
||||||
hum->CancelAction();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ResetAction();
|
ResetAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,23 +532,6 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
|||||||
|
|
||||||
void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id)
|
void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id)
|
||||||
{
|
{
|
||||||
auto downed_func = [] (const a8::XParams& param)
|
|
||||||
{
|
|
||||||
Human* hum = (Human*)param.sender.GetUserData();
|
|
||||||
if (!hum->downed) {
|
|
||||||
hum->room->xtimer.DeleteTimer(hum->downed_timer);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (hum->dead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!hum->HasLiveTeammate()) {
|
|
||||||
hum->BeKill(param.param1, param.param2, param.param3);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int dec_hp = MetaMgr::Instance()->GetSysParamAsInt("downed_dec_hp");
|
|
||||||
hum->DecHP(dec_hp, param.param1, param.param2, param.param3);
|
|
||||||
};
|
|
||||||
if (energy_shield > 0.001f) {
|
if (energy_shield > 0.001f) {
|
||||||
energy_shield = std::max(0.0f, energy_shield - dec_hp);
|
energy_shield = std::max(0.0f, energy_shield - dec_hp);
|
||||||
} else {
|
} else {
|
||||||
@ -569,31 +541,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
|
|||||||
stats.damage_amount_in += GetHP() - old_health;
|
stats.damage_amount_in += GetHP() - old_health;
|
||||||
}
|
}
|
||||||
if (GetHP() <= 0.0001f && !dead) {
|
if (GetHP() <= 0.0001f && !dead) {
|
||||||
if (downed) {
|
BeKill(killer_id, killer_name, weapon_id);
|
||||||
if (downed_timer) {
|
|
||||||
room->xtimer.DeleteTimer(downed_timer);
|
|
||||||
}
|
|
||||||
downed = false;
|
|
||||||
downed_timer = nullptr;
|
|
||||||
BeKill(killer_id, killer_name, weapon_id);
|
|
||||||
} else {
|
|
||||||
if (HasNoDownedTeammate()) {
|
|
||||||
ability.hp = MetaMgr::Instance()->GetSysParamAsInt("downed_recover_hp");
|
|
||||||
downed = true;
|
|
||||||
downed_timer = room->xtimer.AddRepeatTimerAndAttach(
|
|
||||||
SERVER_FRAME_RATE,
|
|
||||||
a8::XParams()
|
|
||||||
.SetSender(this)
|
|
||||||
.SetParam1(killer_id)
|
|
||||||
.SetParam2(killer_name)
|
|
||||||
.SetParam3(weapon_id),
|
|
||||||
downed_func,
|
|
||||||
&xtimer_attacher.timer_list_
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
BeKill(killer_id, killer_name, weapon_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
last_attacker_id = killer_id;
|
last_attacker_id = killer_id;
|
||||||
@ -644,18 +592,6 @@ bool Human::HasLiveTeammate()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Human::HasNoDownedTeammate()
|
|
||||||
{
|
|
||||||
if (team_members) {
|
|
||||||
for (auto& hum : *team_members) {
|
|
||||||
if (hum != this && !hum->dead && !hum->downed) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Human::DoSkill()
|
void Human::DoSkill()
|
||||||
{
|
{
|
||||||
if (skill_meta && GetSkillLeftTime() <= 0 && !a8::HasBitFlag(status, HS_Assaulting)) {
|
if (skill_meta && GetSkillLeftTime() <= 0 && !a8::HasBitFlag(status, HS_Assaulting)) {
|
||||||
@ -1192,29 +1128,6 @@ void Human::UpdateAction()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AT_Relive:
|
|
||||||
{
|
|
||||||
Entity* entity = room->GetEntityByUniId(action_target_id);
|
|
||||||
if (entity->entity_type != ET_Player) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Human* hum = (Human*)entity;
|
|
||||||
if (hum->action_type == AT_Rescue) {
|
|
||||||
hum->CancelAction();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!hum->dead && hum->downed) {
|
|
||||||
hum->ability.hp = MetaMgr::Instance()->GetSysParamAsInt("downed_relive_recover_hp");
|
|
||||||
hum->downed = false;
|
|
||||||
if (hum->downed_timer) {
|
|
||||||
room->xtimer.DeleteTimer(hum->downed_timer);
|
|
||||||
hum->downed_timer = nullptr;
|
|
||||||
}
|
|
||||||
++hum->stats.rescue_member;
|
|
||||||
}
|
|
||||||
hum->SyncAroundPlayers();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,6 @@ class Human : public Entity
|
|||||||
std::string name;
|
std::string name;
|
||||||
std::string avatar_url;
|
std::string avatar_url;
|
||||||
bool dead = false;
|
bool dead = false;
|
||||||
bool downed = false;
|
|
||||||
bool disconnected = false;
|
bool disconnected = false;
|
||||||
int anim_type = 0;
|
int anim_type = 0;
|
||||||
int anim_seq = 0;
|
int anim_seq = 0;
|
||||||
@ -98,8 +97,6 @@ class Human : public Entity
|
|||||||
int pain_killer_lastingtime = 0;
|
int pain_killer_lastingtime = 0;
|
||||||
xtimer_list* pain_killer_timer = nullptr;
|
xtimer_list* pain_killer_timer = nullptr;
|
||||||
|
|
||||||
xtimer_list* downed_timer = nullptr;
|
|
||||||
|
|
||||||
std::set<Human*>* team_members = nullptr;
|
std::set<Human*>* team_members = nullptr;
|
||||||
std::set<Human*> kill_humans;
|
std::set<Human*> kill_humans;
|
||||||
|
|
||||||
@ -160,7 +157,6 @@ class Human : public Entity
|
|||||||
void AddOutObjects(Entity* entity);
|
void AddOutObjects(Entity* entity);
|
||||||
void RemoveOutObjects(Entity* entity);
|
void RemoveOutObjects(Entity* entity);
|
||||||
bool HasLiveTeammate();
|
bool HasLiveTeammate();
|
||||||
bool HasNoDownedTeammate();
|
|
||||||
void DoSkill();
|
void DoSkill();
|
||||||
void FindLocation();
|
void FindLocation();
|
||||||
void RefreshView();
|
void RefreshView();
|
||||||
|
@ -110,9 +110,6 @@ void Player::Update(int delta_time)
|
|||||||
|
|
||||||
void Player::UpdateMove()
|
void Player::UpdateMove()
|
||||||
{
|
{
|
||||||
if (action_type == AT_Relive) {
|
|
||||||
CancelAction();
|
|
||||||
}
|
|
||||||
if (dead || HasBuffEffect(BET_Vertigo) || HasBuffEffect(BET_Dcgr)) {
|
if (dead || HasBuffEffect(BET_Vertigo) || HasBuffEffect(BET_Dcgr)) {
|
||||||
moving = false;
|
moving = false;
|
||||||
moved_frames = 0;
|
moved_frames = 0;
|
||||||
@ -337,24 +334,6 @@ void Player::HumanInteraction(Human* hum)
|
|||||||
if (hum == this) {
|
if (hum == this) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!hum->downed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (hum->action_type == AT_Rescue) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
hum->StartAction(
|
|
||||||
AT_Rescue,
|
|
||||||
MetaMgr::Instance()->GetSysParamAsInt("downed_relive_time") * 1000,
|
|
||||||
room->frame_no,
|
|
||||||
entity_uniid
|
|
||||||
);
|
|
||||||
StartAction(
|
|
||||||
AT_Relive,
|
|
||||||
MetaMgr::Instance()->GetSysParamAsInt("downed_relive_time") * 1000,
|
|
||||||
room->frame_no,
|
|
||||||
hum->entity_uniid
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::ProcPrepareItems(const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& prepare_items)
|
void Player::ProcPrepareItems(const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& prepare_items)
|
||||||
|
@ -79,7 +79,6 @@ struct PlayerStats
|
|||||||
int damage_amount_in = 0;
|
int damage_amount_in = 0;
|
||||||
int damage_amount_out = 0;
|
int damage_amount_out = 0;
|
||||||
int heal_amount = 0;
|
int heal_amount = 0;
|
||||||
int rescue_member = 0;
|
|
||||||
|
|
||||||
int history_time_alive = 0;
|
int history_time_alive = 0;
|
||||||
int history_kills = 0;
|
int history_kills = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user