修复 9.机甲,射杀敌人未显示击杀信息
This commit is contained in:
parent
056fe43a24
commit
0bbf83d6a3
@ -23,6 +23,7 @@ class Bullet : public MoveableEntity
|
|||||||
MetaData::EquipUpgrade* gun_upgrade_meta = nullptr;
|
MetaData::EquipUpgrade* gun_upgrade_meta = nullptr;
|
||||||
MetaData::Equip* meta = nullptr;
|
MetaData::Equip* meta = nullptr;
|
||||||
CreatureWeakPtr sender;
|
CreatureWeakPtr sender;
|
||||||
|
CreatureWeakPtr passenger;
|
||||||
a8::Vec2 dir;
|
a8::Vec2 dir;
|
||||||
a8::Vec2 born_pos;
|
a8::Vec2 born_pos;
|
||||||
a8::Vec2 born_dir;
|
a8::Vec2 born_dir;
|
||||||
|
@ -68,6 +68,7 @@ void InternalShot(Creature* c,
|
|||||||
(c->room->GetGasData().gas_mode == GasJump &&
|
(c->room->GetGasData().gas_mode == GasJump &&
|
||||||
!c->HasBuffEffect(kBET_Jump))) {
|
!c->HasBuffEffect(kBET_Jump))) {
|
||||||
c->room->CreateBullet(c,
|
c->room->CreateBullet(c,
|
||||||
|
c->shot_passenger,
|
||||||
weapon_meta,
|
weapon_meta,
|
||||||
weapon_upgrade_meta,
|
weapon_upgrade_meta,
|
||||||
bullet_meta,
|
bullet_meta,
|
||||||
|
@ -44,6 +44,7 @@ class Creature : public MoveableEntity
|
|||||||
long long aiming_frameno = 0;
|
long long aiming_frameno = 0;
|
||||||
a8::Vec2 shoot_offset;
|
a8::Vec2 shoot_offset;
|
||||||
int shot_hole = 0;
|
int shot_hole = 0;
|
||||||
|
Creature* shot_passenger = nullptr;
|
||||||
HumanAbility ability;
|
HumanAbility ability;
|
||||||
a8::Vec2 target_pos;
|
a8::Vec2 target_pos;
|
||||||
std::function<bool ()> on_move_collision;
|
std::function<bool ()> on_move_collision;
|
||||||
|
@ -3693,10 +3693,17 @@ void Human::OnBulletHit(Bullet* bullet)
|
|||||||
if (bullet->meta->buff_meta) {
|
if (bullet->meta->buff_meta) {
|
||||||
MustBeAddBuff(this, bullet->meta->i->buffid());
|
MustBeAddBuff(this, bullet->meta->i->buffid());
|
||||||
}
|
}
|
||||||
|
if (bullet->sender.Get() && bullet->sender.Get()->IsCar() && bullet->passenger.Get()) {
|
||||||
|
DecHP(finaly_dmg,
|
||||||
|
bullet->passenger.Get()->GetEntityUniId(),
|
||||||
|
bullet->passenger.Get()->GetName(),
|
||||||
|
bullet->gun_meta->i->id());
|
||||||
|
} else {
|
||||||
DecHP(finaly_dmg,
|
DecHP(finaly_dmg,
|
||||||
bullet->sender.Get()->GetEntityUniId(),
|
bullet->sender.Get()->GetEntityUniId(),
|
||||||
bullet->sender.Get()->GetName(),
|
bullet->sender.Get()->GetName(),
|
||||||
bullet->gun_meta->i->id());
|
bullet->gun_meta->i->id());
|
||||||
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bullet->sender.Get()->SendDebugMsg
|
bullet->sender.Get()->SendDebugMsg
|
||||||
(a8::Format("bullet weapon_id:%d atk:%f",
|
(a8::Format("bullet weapon_id:%d atk:%f",
|
||||||
|
@ -200,9 +200,11 @@ void Player::UpdateShot()
|
|||||||
a8::Vec2 target_dir = GetAttackDir();
|
a8::Vec2 target_dir = GetAttackDir();
|
||||||
a8::Vec2 old_car_shoot_offset = GetCar()->shoot_offset;
|
a8::Vec2 old_car_shoot_offset = GetCar()->shoot_offset;
|
||||||
a8::Vec2 old_car_attack_dir = GetCar()->GetAttackDir();
|
a8::Vec2 old_car_attack_dir = GetCar()->GetAttackDir();
|
||||||
|
Creature* old_car_shot_passenger = GetCar()->shot_passenger;
|
||||||
int old_car_shot_hole = GetCar()->shot_hole;
|
int old_car_shot_hole = GetCar()->shot_hole;
|
||||||
GetCar()->shoot_offset = shoot_offset;
|
GetCar()->shoot_offset = shoot_offset;
|
||||||
GetCar()->shot_hole = GetSeat();
|
GetCar()->shot_hole = GetSeat();
|
||||||
|
GetCar()->shot_passenger = this;
|
||||||
GetCar()->SetAttackDir(GetAttackDir());
|
GetCar()->SetAttackDir(GetAttackDir());
|
||||||
GetCar()->Shot(target_dir, shot_ok, fly_distance);
|
GetCar()->Shot(target_dir, shot_ok, fly_distance);
|
||||||
if (!moving && GetCar()->IsDriver(this)) {
|
if (!moving && GetCar()->IsDriver(this)) {
|
||||||
@ -213,6 +215,7 @@ void Player::UpdateShot()
|
|||||||
}
|
}
|
||||||
GetCar()->shot_hole = old_car_shot_hole;
|
GetCar()->shot_hole = old_car_shot_hole;
|
||||||
GetCar()->shoot_offset = old_car_shoot_offset;
|
GetCar()->shoot_offset = old_car_shoot_offset;
|
||||||
|
GetCar()->shot_passenger = old_car_shot_passenger;
|
||||||
}
|
}
|
||||||
shot_start = false;
|
shot_start = false;
|
||||||
return;
|
return;
|
||||||
|
@ -547,6 +547,7 @@ int Room::CreateLootEx(int equip_id, a8::Vec2 born_pos, a8::Vec2 pos, int count,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Room::CreateBullet(Creature* sender,
|
void Room::CreateBullet(Creature* sender,
|
||||||
|
Creature* passenger,
|
||||||
MetaData::Equip* weapon_meta,
|
MetaData::Equip* weapon_meta,
|
||||||
MetaData::EquipUpgrade* weapon_upgrade_meta,
|
MetaData::EquipUpgrade* weapon_upgrade_meta,
|
||||||
MetaData::Equip* bullet_meta,
|
MetaData::Equip* bullet_meta,
|
||||||
@ -558,6 +559,9 @@ void Room::CreateBullet(Creature* sender,
|
|||||||
if (grid_service->CanAdd(pos.x, pos.y)) {
|
if (grid_service->CanAdd(pos.x, pos.y)) {
|
||||||
Bullet* bullet = EntityFactory::Instance()->MakeBullet(AllocUniid());
|
Bullet* bullet = EntityFactory::Instance()->MakeBullet(AllocUniid());
|
||||||
bullet->sender.Attach(sender);
|
bullet->sender.Attach(sender);
|
||||||
|
if (passenger) {
|
||||||
|
bullet->passenger.Attach(passenger);
|
||||||
|
}
|
||||||
bullet->room = this;
|
bullet->room = this;
|
||||||
bullet->gun_meta = weapon_meta;
|
bullet->gun_meta = weapon_meta;
|
||||||
bullet->gun_upgrade_meta = weapon_upgrade_meta;
|
bullet->gun_upgrade_meta = weapon_upgrade_meta;
|
||||||
|
@ -110,6 +110,7 @@ public:
|
|||||||
int CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv);
|
int CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv);
|
||||||
int CreateLootEx(int equip_id, a8::Vec2 born_pos, a8::Vec2 pos, int count, int equip_lv, bool show_anim);
|
int CreateLootEx(int equip_id, a8::Vec2 born_pos, a8::Vec2 pos, int count, int equip_lv, bool show_anim);
|
||||||
void CreateBullet(Creature* sender,
|
void CreateBullet(Creature* sender,
|
||||||
|
Creature* passenger,
|
||||||
MetaData::Equip* weapon_meta,
|
MetaData::Equip* weapon_meta,
|
||||||
MetaData::EquipUpgrade* weapon_upgrade_meta,
|
MetaData::EquipUpgrade* weapon_upgrade_meta,
|
||||||
MetaData::Equip* bullet_meta,
|
MetaData::Equip* bullet_meta,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user