This commit is contained in:
aozhiwei 2024-05-23 15:11:45 +08:00
parent 871a41749a
commit 3a41ec1f53
7 changed files with 18 additions and 6 deletions

View File

@ -74,5 +74,6 @@ A8_DECLARE_ENUM(HumanVirtualAttrType_e,
kHVAT_DirectAtk = 1014,
kHVAT_Volume = 1015,
kHVAT_FireRate = 1016,
kHVAT_BulletScale = 1017,
kHVAT_End
);

View File

@ -36,6 +36,7 @@ class Bullet : public MoveableEntity, public IBullet
bool ignore_original_dmg = false;
std::function<void(Bullet*)> on_bullet_exit = nullptr;
int duration = 0;
std::shared_ptr<float> scale;
virtual ~Bullet() override;
virtual void Initialize() override;

View File

@ -95,7 +95,8 @@ void FrameEvent::AddBullet(int bullet_uniid,
std::shared_ptr<std::set<int>> reporter_list,
int shot_uniid,
int force_player_id,
int duration)
int duration,
std::shared_ptr<float> scale)
{
{
auto& tuple = a8::FastAppend(room->frame_event_data->bullets_);

View File

@ -29,7 +29,8 @@ public:
std::shared_ptr<std::set<int>> reporter_list,
int shot_uniid,
int force_player_id = 0,
int duration = 0);
int duration = 0,
std::shared_ptr<float> = nullptr);
void RemoveBullet(glm::vec3 pos, int bullet_uniid);
void AddExplosion(Bullet* bullet, int item_id, Position bomb_pos);
void AddPlaySkill(CreatureWeakPtr& sender, int skill_id);

View File

@ -809,7 +809,8 @@ int Room::CreateBullet(Creature* sender,
std::shared_ptr<std::set<int>> reporter_list,
int shot_uniid,
std::function<void(Bullet*)> on_bullet_exit,
int duration)
int duration,
std::shared_ptr<float> scale)
{
int bullet_uniid = 0;
if (grid_service->CanAdd(pos.x, pos.z)) {

View File

@ -192,7 +192,8 @@ public:
std::shared_ptr<std::set<int>> reporter_list,
int shot_uniid,
std::function<void(Bullet*)> on_bullet_exit,
int duration);
int duration,
std::shared_ptr<float> scale);
Car* CreateCar(Human* driver,
int car_uniid,
const mt::Equip* meta,

View File

@ -59,6 +59,7 @@ struct BulletInfo
bool ignore_original_dmg = false;
std::function<void(Bullet*)> on_bullet_exit;
int duration = 0;
std::shared_ptr<float> scale;
};
static void CalcGunMuzzlePosition(Creature* c,
@ -286,7 +287,8 @@ static void InternalCreateBullet(BulletInfo& bullet_info)
bullet_info.reporter_list,
bullet_info.shot_uniid,
bullet_info.on_bullet_exit,
bullet_info.duration);
bullet_info.duration,
bullet_info.scale);
#ifdef MYDEBUG1
if (bullet_info.c.Get()->IsPlayer()) {
bullet_info.c.Get()->SendDebugMsg(a8::Format("CreateBullet id:%d",
@ -330,7 +332,8 @@ static void InternalCreateBullet(BulletInfo& bullet_info)
bullet_info.reporter_list,
bullet_info.shot_uniid,
0,
bullet_info.duration);
bullet_info.duration,
bullet_info.scale);
if (bullet_uniid && (bullet_info.trace_target_uniid || bullet_info.reporter_list)) {
c->room->AddReportBullet(
bullet_uniid
@ -550,6 +553,9 @@ void InternalShot(Creature* c,
bullet_info.ignore_original_dmg = c->GetAbility()->GetSwitchTimes(kIgnoreOriginalDmg) > 0;
bullet_info.on_bullet_exit = on_bullet_exit;
bullet_info.duration = duration;
if (c->GetAbility()->HasAttr(kHVAT_BulletScale)) {
bullet_info.scale = std::make_shared<float>(1.0f + c->GetAbility()->GetAttr(kHVAT_BulletScale));
}
if (shot_animi && shot_animi->is_other) {
bullet_info.hand = shot_animi->GetShotHand(bulletIdx - 1);
} else {