This commit is contained in:
aozhiwei 2023-03-30 16:50:06 +08:00
parent d95a14c7ad
commit ec4e97d8c7
5 changed files with 26 additions and 6 deletions

View File

@ -126,6 +126,11 @@ void CallFuncBuff::Activate()
owner->GetAbility()->IncSwitch(kEnableDmgForwardTimes);
}
break;
case BuffCallFunc_e::kSetGunBuffId:
{
owner->GetCurrWeapon()->buff_id = meta->_int_buff_param2;
}
break;
default:
{
}
@ -159,6 +164,11 @@ void CallFuncBuff::Deactivate()
owner->GetAbility()->DecSwitch(kEnableDmgForwardTimes);
}
break;
case BuffCallFunc_e::kSetGunBuffId:
{
owner->GetCurrWeapon()->buff_id = 0;
}
break;
default:
{
}

View File

@ -15,6 +15,7 @@ class Bullet : public MoveableEntity, public IBullet
public:
long long weapon_uniid = 0;
int gun_lv = 0;
int spec_gun_buff_id = 0;
const mt::Equip* gun_meta = nullptr;
const mt::Equip* meta = nullptr;
const mt::Skill* skill_meta = nullptr;

View File

@ -607,7 +607,8 @@ int Room::CreateBullet(Creature* sender,
int trace_target_id,
int hand,
a8::XTimerWp keep_shot_animi_timer_ptr,
float shot_animi_time)
float shot_animi_time,
int weapon_buff_id)
{
int bullet_uniid = 0;
if (grid_service->CanAdd(pos.x, pos.z)) {
@ -630,6 +631,7 @@ int Room::CreateBullet(Creature* sender,
bullet->hand = hand;
bullet->keep_shot_animi_timer_ptr = keep_shot_animi_timer_ptr;
bullet->shot_animi_time = shot_animi_time;
bullet->spec_gun_buff_id = weapon_buff_id;
bullet->Initialize();
#ifdef DEBUG1
a8::XPrintf("xxxxxxx born_pos:%f,%f,%f curr_pos:%f,%f,%f\n",

View File

@ -150,7 +150,8 @@ public:
int trace_target_id,
int hand,
a8::XTimerWp keep_shot_animi_timer_ptr,
float shot_animi_time);
float shot_animi_time,
int weapon_buff_id);
Car* CreateCar(Human* driver,
int car_uniid,
const mt::Equip* meta,

View File

@ -40,6 +40,7 @@ struct BulletInfo
glm::vec3 bullet_dir = GlmHelper::ZERO;
float fly_distance = 0;
int weapon_lv = 0;
int weapon_buff_id = 0;
int delay_time = 0;
float recoil_force = 0;
int invincible_buff_uniid = 0;
@ -212,7 +213,8 @@ static void InternalCreateBullet(BulletInfo& bullet_info)
bullet_info.trace_target_uniid,
bullet_info.hand,
bullet_info.keep_shot_animi_timer_ptr,
bullet_info.shot_animi_time);
bullet_info.shot_animi_time,
bullet_info.weapon_buff_id);
#ifdef DEBUG1
if (bullet_info.c.Get()->IsPlayer()) {
bullet_info.c.Get()->SendDebugMsg(a8::Format("CreateBullet id:%d",
@ -373,10 +375,13 @@ void InternalShot(Creature* c,
c->GetBattleContext()->GetWeaponLvQuality(weapon_uniid, p_weapon_lv, p_quality);
weapon_lv = weapon_lv;
}
int weapon_buff_id = 0;
auto bullet_born_offset_ptr = &weapon_meta->_bullet_born_offset;
if (c->GetCurrWeapon()->meta == weapon_meta &&
c->GetCurrWeapon()->bullet_born_offset_ptr) {
bullet_born_offset_ptr = c->GetCurrWeapon()->bullet_born_offset_ptr;
if (c->GetCurrWeapon()->meta == weapon_meta) {
if (c->GetCurrWeapon()->bullet_born_offset_ptr) {
bullet_born_offset_ptr = c->GetCurrWeapon()->bullet_born_offset_ptr;
}
weapon_buff_id = c->GetCurrWeapon()->buff_id;
}
for (auto& tuple : *bullet_born_offset_ptr) {
glm::vec3 bullet_born_offset = glm::vec3(std::get<0>(tuple), 0.0f, std::get<1>(tuple));
@ -524,6 +529,7 @@ void InternalShot(Creature* c,
bullet_info.bullet_idx = bulletIdx;
bullet_info.bullet_num = bulletNum;
bullet_info.weapon_lv = weapon_lv;
bullet_info.weapon_buff_id = weapon_buff_id;
if (skill_meta &&
(skill_meta->GetMagicId() == MAGIC_20101_HL ||
skill_meta->GetMagicId() == MAGIC_20201_HX)