diff --git a/server/gameserver/buff.cc b/server/gameserver/buff.cc index 07b238f..a31cd8c 100644 --- a/server/gameserver/buff.cc +++ b/server/gameserver/buff.cc @@ -392,3 +392,30 @@ void Buff::ProcSeletTargetWithSelfPos(Creature* caster) } } } + +void Buff::ProcTurnOver(Creature* caster) +{ + Skill* skill = owner->CurrentSkill(); + if (!skill) { + return; + } + MetaData::SkillPhase* phase = owner->GetCurrSkillPhase(); + if (!phase) { + return; + } + #if 0 + if (phase->time_offset < skill->GetPassedTime()) { + return; + } + #endif + a8::Vec2 old_pos = owner->GetPos(); + float distance = owner->HasBuffEffect(kBET_Car) ? phase->param1.GetDouble() * 1.5 : phase->param1.GetDouble(); + if (meta->int_param1 == 1) { + //穿墙 + } else { + owner->_UpdateMove(distance); + if (!meta->param2_int_list.empty()) { + + } + } +} diff --git a/server/gameserver/buff.h b/server/gameserver/buff.h index f2c6764..fdbcc9d 100644 --- a/server/gameserver/buff.h +++ b/server/gameserver/buff.h @@ -46,6 +46,7 @@ class Buff void ProcRemovePassenger(Creature* caster); void ProcSprint(Creature* caster); void ProcSeletTargetWithSelfPos(Creature* caster); + void ProcTurnOver(Creature* caster); private: void InternalTimerAddBuff(Creature* caster); diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index cb60d7e..c595044 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -739,21 +739,7 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff) break; case kBET_TurnOver: { - Skill* skill = CurrentSkill(); - if (skill) { - MetaData::SkillPhase* phase = GetCurrSkillPhase(); -#if 1 - if (phase) { -#else - if (phase && phase->time_offset >= skill->GetPassedTime()) { -#endif - if (HasBuffEffect(kBET_Car)) { - _UpdateMove(phase->param1.GetDouble() * 1.5); - } else { - _UpdateMove(phase->param1); - } - } - } + buff->ProcTurnOver(caster); } break; case kBET_Camouflage: @@ -1057,6 +1043,11 @@ bool Creature::IsHuman() const return IsEntityType(ET_Player); } +bool Creature::IsCar() const +{ + return IsEntityType(ET_Car); +} + void Creature::StartAction(ActionType_e action_type, int action_duration, int item_id, diff --git a/server/gameserver/creature.h b/server/gameserver/creature.h index 03db0c0..4376815 100644 --- a/server/gameserver/creature.h +++ b/server/gameserver/creature.h @@ -43,6 +43,7 @@ class Creature : public MoveableEntity std::list aiming_buffs; long long aiming_frameno = 0; a8::Vec2 shoot_offset; + int shot_hole = 0; HumanAbility ability; a8::Vec2 target_pos; std::function on_move_collision; @@ -118,6 +119,7 @@ class Creature : public MoveableEntity bool IsPlayer() const; bool IsAndroid() const; bool IsHuman() const; + bool IsCar() const; virtual void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) {}; void AddHp(float hp); diff --git a/server/gameserver/frameevent.cc b/server/gameserver/frameevent.cc index f6380a7..391d1f7 100644 --- a/server/gameserver/frameevent.cc +++ b/server/gameserver/frameevent.cc @@ -8,6 +8,7 @@ #include "buff.h" #include "human.h" #include "room.h" +#include "car.h" void FrameEvent::AddAirDrop(int appear_time, int box_id, a8::Vec2 box_pos) { @@ -51,11 +52,8 @@ void FrameEvent::AddShot(Creature* sender) } else { sender->GetCurrWeapon()->ToPB(p.mutable_weapon()); } - if (sender->IsHuman()) { - Human* hum = (Human*)sender; - if (hum->GetCar()) { - p.set_hole(hum->GetSeat()); - } + if (sender->IsCar()) { + p.set_hole(sender->shot_hole); } } { diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index ab7c705..a99dea4 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -199,7 +199,9 @@ void Player::UpdateShot() a8::Vec2 target_dir = GetAttackDir(); a8::Vec2 old_car_shoot_offset = GetCar()->shoot_offset; a8::Vec2 old_car_attack_dir = GetCar()->GetAttackDir(); + int old_car_shot_hole = GetCar()->shot_hole; GetCar()->shoot_offset = shoot_offset; + GetCar()->shot_hole = GetSeat(); GetCar()->SetAttackDir(GetAttackDir()); GetCar()->Shot(target_dir, shot_ok, fly_distance); if (!moving && GetCar()->IsDriver(this)) { @@ -208,6 +210,7 @@ void Player::UpdateShot() if (!GetCar()->IsDriver(this)) { GetCar()->SetAttackDir(old_car_attack_dir); } + GetCar()->shot_hole = old_car_shot_hole; GetCar()->shoot_offset = old_car_shoot_offset; } shot_start = false;