添加护盾/立刻复活
This commit is contained in:
parent
a23787edcd
commit
48cf9c6c2a
@ -88,3 +88,8 @@ void Buff::ProcReleaseFireBomb(const a8::XParams& param)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Buff::ProcLastRecover(const a8::XParams& param)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -33,4 +33,5 @@ class Buff
|
|||||||
static void ProcLastBurn(const a8::XParams& param);
|
static void ProcLastBurn(const a8::XParams& param);
|
||||||
static void ProcReleaseDcgr(const a8::XParams& param);
|
static void ProcReleaseDcgr(const a8::XParams& param);
|
||||||
static void ProcReleaseFireBomb(const a8::XParams& param);
|
static void ProcReleaseFireBomb(const a8::XParams& param);
|
||||||
|
static void ProcLastRecover(const a8::XParams& param);
|
||||||
};
|
};
|
||||||
|
@ -161,7 +161,7 @@ enum BuffEffectType_e
|
|||||||
kBET_OnceChgAttr = 11, //一次性buff
|
kBET_OnceChgAttr = 11, //一次性buff
|
||||||
kBET_LastRecover = 12, //持续回血
|
kBET_LastRecover = 12, //持续回血
|
||||||
kBET_Shield = 13, //护盾
|
kBET_Shield = 13, //护盾
|
||||||
kBET_ImmediatelyRevive = 14, //离开复活
|
kBET_ImmediatelyRevive = 14, //立刻复活
|
||||||
kBET_End
|
kBET_End
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -141,13 +141,13 @@ void FrameEvent::AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameEvent::AddDead(Human* hum)
|
void FrameEvent::AddDead(Human* hum, int revive_time)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
dead_objs_.push_back(
|
dead_objs_.push_back(
|
||||||
std::make_tuple(
|
std::make_tuple(
|
||||||
hum->entity_uniid,
|
hum->entity_uniid,
|
||||||
MetaMgr::Instance()->revive_time * 1000
|
revive_time
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
float fly_distance, int hit_time, int target_id = 0, int skill_id = 0);
|
float fly_distance, int hit_time, int target_id = 0, int skill_id = 0);
|
||||||
void AddExplosion(int item_id, a8::Vec2 bomb_pos, int effect);
|
void AddExplosion(int item_id, a8::Vec2 bomb_pos, int effect);
|
||||||
void AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos);
|
void AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos);
|
||||||
void AddDead(Human* hum);
|
void AddDead(Human* hum, int revive_time);
|
||||||
void AddRevive(Human* hum);
|
void AddRevive(Human* hum);
|
||||||
void AddBuff(Human* hum, Buff* buff);
|
void AddBuff(Human* hum, Buff* buff);
|
||||||
void RemoveBuff(Human* hum, int buff_id);
|
void RemoveBuff(Human* hum, int buff_id);
|
||||||
|
@ -459,6 +459,24 @@ void Human::ResetAction()
|
|||||||
void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||||
{
|
{
|
||||||
if (!dead && !room->game_over) {
|
if (!dead && !room->game_over) {
|
||||||
|
if (immediately_revive_times_ > 0) {
|
||||||
|
--immediately_revive_times_;
|
||||||
|
status = 0;
|
||||||
|
ClearBuffList();
|
||||||
|
room->frame_event.AddDead(this, 0);
|
||||||
|
room->xtimer.AddDeadLineTimerAndAttach(1,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(this),
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
Human* hum = (Human*)param.sender.GetUserData();
|
||||||
|
hum->ImmediatelyRevive();
|
||||||
|
},
|
||||||
|
&xtimer_attacher.timer_list_
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
lethal_weapon = weapon_id;
|
lethal_weapon = weapon_id;
|
||||||
{
|
{
|
||||||
Entity* entity = room->GetEntityByUniId(killer_id);
|
Entity* entity = room->GetEntityByUniId(killer_id);
|
||||||
@ -486,7 +504,8 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
|||||||
);
|
);
|
||||||
status = 0;
|
status = 0;
|
||||||
ClearBuffList();
|
ClearBuffList();
|
||||||
room->frame_event.AddDead(this);
|
room->frame_event.AddDead(this,
|
||||||
|
MetaMgr::Instance()->revive_time * 1000);
|
||||||
room->OnHumanDie(this);
|
room->OnHumanDie(this);
|
||||||
{
|
{
|
||||||
OnLeaveGrass();
|
OnLeaveGrass();
|
||||||
@ -1165,6 +1184,10 @@ void Human::TriggerBuff(std::set<Entity*>& target_list, BuffTriggerType_e trigge
|
|||||||
|
|
||||||
void Human::AddBuff(MetaData::Buff* buff_meta)
|
void Human::AddBuff(MetaData::Buff* buff_meta)
|
||||||
{
|
{
|
||||||
|
if (buff_meta->i->buff_effect() == kBET_ImmediatelyRevive) {
|
||||||
|
++immediately_revive_times_;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (GetBuffById(buff_meta->i->buff_id())) {
|
if (GetBuffById(buff_meta->i->buff_id())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1242,6 +1265,16 @@ void Human::ClearBuffList()
|
|||||||
if (buff_effect_[itr->meta->i->buff_effect()] == &(*itr)) {
|
if (buff_effect_[itr->meta->i->buff_effect()] == &(*itr)) {
|
||||||
buff_effect_[itr->meta->i->buff_effect()] = nullptr;
|
buff_effect_[itr->meta->i->buff_effect()] = nullptr;
|
||||||
}
|
}
|
||||||
|
switch (itr->meta->i->buff_effect()) {
|
||||||
|
case kBET_Shield:
|
||||||
|
{
|
||||||
|
energy_shield = 0.0f;
|
||||||
|
max_energy_shield = 0.0f;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
room->frame_event.RemoveBuff(this, itr->meta->i->buff_id());
|
room->frame_event.RemoveBuff(this, itr->meta->i->buff_id());
|
||||||
}
|
}
|
||||||
buff_list_.clear();
|
buff_list_.clear();
|
||||||
@ -1339,12 +1372,20 @@ void Human::ProcBuffEffect(Buff* buff)
|
|||||||
break;
|
break;
|
||||||
case kBET_LastRecover:
|
case kBET_LastRecover:
|
||||||
{
|
{
|
||||||
|
room->xtimer.AddRepeatTimerAndAttach(
|
||||||
|
kSERVER_FRAME_RATE,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(this)
|
||||||
|
.SetParam1(buff),
|
||||||
|
Buff::ProcLastRecover,
|
||||||
|
&buff->xtimer_attacher.timer_list_
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kBET_Shield:
|
case kBET_Shield:
|
||||||
{
|
{
|
||||||
|
energy_shield = buff->meta->param1;
|
||||||
|
max_energy_shield = buff->meta->param1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1806,6 +1847,28 @@ void Human::Revive()
|
|||||||
playing_skill = false;
|
playing_skill = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::ImmediatelyRevive()
|
||||||
|
{
|
||||||
|
dead = false;
|
||||||
|
ability.hp = GetMaxHP();
|
||||||
|
status = 0;
|
||||||
|
ClearBuffList();
|
||||||
|
{
|
||||||
|
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(1003);
|
||||||
|
if (buff_meta) {
|
||||||
|
AddBuff(buff_meta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
room->frame_event.AddRevive(this);
|
||||||
|
|
||||||
|
CheckSpecObject();
|
||||||
|
use_skill = false;
|
||||||
|
curr_skill_phase = 0;
|
||||||
|
skill_dir = a8::Vec2();
|
||||||
|
skill_param1 = 0.0f;
|
||||||
|
playing_skill = false;
|
||||||
|
}
|
||||||
|
|
||||||
void Human::SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list)
|
void Human::SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list)
|
||||||
{
|
{
|
||||||
switch (skill_meta_->i->skill_target()) {
|
switch (skill_meta_->i->skill_target()) {
|
||||||
|
@ -212,6 +212,7 @@ private:
|
|||||||
void ClearFrameData();
|
void ClearFrameData();
|
||||||
void DeadDrop();
|
void DeadDrop();
|
||||||
void Revive();
|
void Revive();
|
||||||
|
void ImmediatelyRevive();
|
||||||
void SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list);
|
void SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list);
|
||||||
Buff* GetBuffById(int buff_id);
|
Buff* GetBuffById(int buff_id);
|
||||||
void ProcSkillPhase(MetaData::SkillPhase* phase);
|
void ProcSkillPhase(MetaData::SkillPhase* phase);
|
||||||
@ -267,6 +268,7 @@ private:
|
|||||||
Tank tank_;
|
Tank tank_;
|
||||||
long long send_gameover_trycount_ = 0;
|
long long send_gameover_trycount_ = 0;
|
||||||
bool sending_gameover_ = false;
|
bool sending_gameover_ = false;
|
||||||
|
int immediately_revive_times_ = 0;
|
||||||
|
|
||||||
xtimer_list* grass_hide_timer_list_ = nullptr;
|
xtimer_list* grass_hide_timer_list_ = nullptr;
|
||||||
xtimer_list* leave_grass_timer_list_ = nullptr;
|
xtimer_list* leave_grass_timer_list_ = nullptr;
|
||||||
|
@ -68,7 +68,12 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
hum->SetMeta(hum_meta);
|
hum->SetMeta(hum_meta);
|
||||||
room->AddPlayer(hum);
|
room->AddPlayer(hum);
|
||||||
hum->ProcPrepareItems(msg.prepare_items());
|
hum->ProcPrepareItems(msg.prepare_items());
|
||||||
|
for (int buff_id : msg.buff_list()) {
|
||||||
|
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
|
||||||
|
if (buff_meta) {
|
||||||
|
hum->AddBuff(buff_meta);
|
||||||
|
}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
cs::SMJoinedNotify notifymsg;
|
cs::SMJoinedNotify notifymsg;
|
||||||
notifymsg.set_error_code(0);
|
notifymsg.set_error_code(0);
|
||||||
|
@ -622,6 +622,7 @@ message CMJoin
|
|||||||
optional string from_appid = 21; //from_appid
|
optional string from_appid = 21; //from_appid
|
||||||
optional MFDriver driver = 22; //驾驶员
|
optional MFDriver driver = 22; //驾驶员
|
||||||
optional MFSkin tankskin = 23; //坦克皮肤
|
optional MFSkin tankskin = 23; //坦克皮肤
|
||||||
|
repeated int32 buff_list = 24; //周边系统带进来的战斗数据(护盾,立刻复活等)
|
||||||
|
|
||||||
repeated MFRoomMember room_member = 100; //房间成员(不包括自己)
|
repeated MFRoomMember room_member = 100; //房间成员(不包括自己)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user