修复hole问题

This commit is contained in:
aozhiwei 2021-05-27 16:41:07 +08:00
parent 245dbfafdb
commit 3ee619f4b1
6 changed files with 42 additions and 20 deletions

View File

@ -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()) {
}
}
}

View File

@ -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);

View File

@ -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,

View File

@ -43,6 +43,7 @@ class Creature : public MoveableEntity
std::list<int> aiming_buffs;
long long aiming_frameno = 0;
a8::Vec2 shoot_offset;
int shot_hole = 0;
HumanAbility ability;
a8::Vec2 target_pos;
std::function<bool ()> 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);

View File

@ -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);
}
}
{

View File

@ -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;