修复坐骑相关bug
This commit is contained in:
parent
c36ce53e05
commit
21d43977b8
@ -110,6 +110,7 @@ enum BuffEffectType_e
|
||||
kBET_Begin = 0,
|
||||
kBET_ChgAttr = 1, //改变属性
|
||||
kBET_Jump = 2, //翻滚
|
||||
kBET_Car = 3, //骑乘
|
||||
kBET_OnceChgAttr = 11, //一次性buff
|
||||
kBET_End
|
||||
};
|
||||
|
@ -856,6 +856,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
real_dead = true;
|
||||
OnDie();
|
||||
}
|
||||
DoGetDown();
|
||||
}
|
||||
}
|
||||
|
||||
@ -902,6 +903,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
|
||||
if (HasNoDownedTeammate()) {
|
||||
ability.hp = MetaMgr::Instance()->GetSysParamAsInt("downed_recover_hp");
|
||||
downed = true;
|
||||
DoGetDown();
|
||||
downed_timer = room->xtimer.AddRepeatTimerAndAttach(
|
||||
SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
@ -1088,6 +1090,7 @@ void Human::DoGetDown()
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
room->NotifyUiUpdate();
|
||||
car_ = HumanCar();
|
||||
CancelAction();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2253,6 +2256,9 @@ void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta)
|
||||
|
||||
void Human::ProcLootCar(Loot* entity, MetaData::Equip* item_meta)
|
||||
{
|
||||
if (downed) {
|
||||
return;
|
||||
}
|
||||
if (car_.car_id != 0) {
|
||||
int entity_uniid = room->CreateLoot(car_.car_id, GetPos(), 1, 1);
|
||||
Entity* loot_entity = room->GetEntityByUniId(entity_uniid);
|
||||
@ -2262,7 +2268,10 @@ void Human::ProcLootCar(Loot* entity, MetaData::Equip* item_meta)
|
||||
((Loot*)loot_entity)->param2 = 0;
|
||||
room->UpdateCarObject(car_.car_uniid, loot_entity->entity_uniid, loot_entity->GetPos());
|
||||
}
|
||||
RemoveBuffById(item_meta->i->buffid());
|
||||
room->TakeOffCarObject(entity_uniid, GetPos());
|
||||
if (car_.meta->i->buffid()) {
|
||||
RemoveBuffById(car_.meta->i->buffid());
|
||||
}
|
||||
}
|
||||
car_.car_uniid = entity->entity_uniid;
|
||||
car_.car_id = item_meta->i->id();
|
||||
@ -2272,6 +2281,7 @@ void Human::ProcLootCar(Loot* entity, MetaData::Equip* item_meta)
|
||||
if (buff_meta) {
|
||||
AddBuff(buff_meta, 1);
|
||||
}
|
||||
CancelAction();
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
room->TakeOnCarObject(car_.car_uniid);
|
||||
room->NotifyUiUpdate();
|
||||
@ -2343,7 +2353,6 @@ void Human::FindLocationWithTarget(Entity* target)
|
||||
void Human::OnDie()
|
||||
{
|
||||
room->OnHumanDie(this);
|
||||
DoGetDown();
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
if (team_members) {
|
||||
for (auto& hum : *team_members) {
|
||||
@ -2625,6 +2634,7 @@ void Human::ProcBuffEffect(Buff* buff)
|
||||
{
|
||||
switch (buff->meta->i->buff_effect()) {
|
||||
case kBET_ChgAttr:
|
||||
case kBET_Car:
|
||||
{
|
||||
RecalcBuffAttr();
|
||||
}
|
||||
@ -2649,7 +2659,8 @@ void Human::RecalcBuffAttr()
|
||||
buff_attr_abs_ = {};
|
||||
buff_attr_rate_ = {};
|
||||
for (auto& buff : buff_list_) {
|
||||
if (buff.meta->i->buff_effect() == kBET_ChgAttr) {
|
||||
if (buff.meta->i->buff_effect() == kBET_ChgAttr ||
|
||||
buff.meta->i->buff_effect() == kBET_Car) {
|
||||
int attr_type = (int)buff.meta->param1;
|
||||
int calc_type = (int)buff.meta->param2;
|
||||
if (IsValidHumanAttr(attr_type)) {
|
||||
|
@ -1473,6 +1473,8 @@ void Room::UpdateCarObject(int old_uniid, int new_uniid, a8::Vec2 pos)
|
||||
new_obj.pos = pos;
|
||||
car_hash_[new_uniid] = new_obj;
|
||||
car_hash_.erase(old_uniid);
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user