This commit is contained in:
aozhiwei 2020-07-23 16:34:16 +08:00
parent c84825747d
commit 6242574bfd
5 changed files with 111 additions and 46 deletions

View File

@ -28,6 +28,7 @@
const int kReviveTimeAdd = 12;
const int kSkinNum = 4;
const int kREVIVE_BUFF_ID = 0;
Human::Human():MoveableEntity()
{
@ -980,9 +981,36 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
break;
}
}
++stats.dead_times;
stats.killer_id = killer_id;
stats.killer_name = killer_name;
stats.weapon_id = weapon_id;
if (room->GetRoomMode() == kZombieMode) {
dead = true;
downed = false;
real_dead = true;
dead_frameno = room->GetFrameNo();
DoGetDown();
if (HasBuffEffect(kBET_Camouflage)) {
RemoveBuffByEffectId(kBET_Camouflage);
}
ClearLordMode();
ClearBuffList();
room->frame_event.AddDead(this,
MetaMgr::Instance()->zbmode_revive_time * 1000);
SyncAroundPlayers(__FILE__, __LINE__, __func__);
room->xtimer.AddDeadLineTimerAndAttach
(MetaMgr::Instance()->zbmode_revive_time * SERVER_FRAME_RATE,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
Human* hum = (Human*)param.sender.GetUserData();
hum->Revive();
},
&xtimer_attacher.timer_list_
);
} else {
dead = true;
downed = false;
ability.hp = 0.0f;
@ -1008,6 +1036,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
DoGetDown();
}
}
}
void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id)
{
@ -2962,6 +2991,28 @@ void Human::RecalcBuffAttr()
void Human::Revive()
{
if (room->GetRoomMode() == kZombieMode) {
dead = false;
downed = false;
real_dead = false;
ability.hp = GetMaxHP();
ClearBuffList();
{
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(kREVIVE_BUFF_ID);
if (buff_meta) {
AddBuff(buff_meta, 1);
}
}
room->frame_event.AddRevive(this);
room->OnHumanRevive(this);
use_skill = false;
curr_skill_phase = 0;
skill_dir = a8::Vec2();
skill_param1 = 0.0f;
playing_skill = false;
SyncAroundPlayers(__FILE__, __LINE__, __func__);
} else {
auto callback =
[] (const a8::XParams& param)
{
@ -2984,6 +3035,7 @@ void Human::Revive()
});
SyncAroundPlayers(__FILE__, __LINE__, __func__);
}
}
void Human::ResetTankSkin()
{

View File

@ -48,6 +48,7 @@ class MetaMgr : public a8::Singleton<MetaMgr>
MetaData::Robot* RandRobot(std::set<int>& refreshed_robot_set);
MetaData::AI* GetAI(int ai_level);
int zbmode_revive_time = 3;
int gas_inactive_time = 10;
int newbie_gas_inactive_time = 5;
int midbrid_gas_inactive_time = 15;

View File

@ -557,6 +557,9 @@ void Room::RemoveObjectLater(RoomEntity* entity)
void Room::OnHumanDie(Human* hum)
{
if (GetRoomMode() == kZombieMode) {
NotifyUiUpdate();
} else {
--alive_count_;
alive_count_chged_frameno_ = GetFrameNo();
--PerfMonitor::Instance()->alive_count;
@ -564,6 +567,12 @@ void Room::OnHumanDie(Human* hum)
NotifyUiUpdate();
CheckShowHand();
}
}
void Room::OnHumanRevive(Human* hum)
{
NotifyUiUpdate();
}
bool Room::OverBorder(const a8::Vec2 pos, float radius)
{

View File

@ -93,6 +93,7 @@ public:
a8::Vec2 pos, a8::Vec2 dir, float fly_distance, bool is_tank_skin = false);
void OnHumanDie(Human* hum);
void OnHumanRevive(Human* hum);
bool OverBorder(const a8::Vec2 pos, float radius);
Human* GetWatchWarTarget(Human* hum);
bool BattleStarted();

View File

@ -85,6 +85,8 @@ struct PlayerStats
int rank = 0;
int use_skill_times = 0;
int dead_times = 0;
};
struct CarObject