This commit is contained in:
aozhiwei 2021-08-25 13:48:20 +08:00
parent 6656bbabb9
commit eb5818c8e2
5 changed files with 16 additions and 0 deletions

View File

@ -519,6 +519,7 @@ void Bullet::ProcC4Bomb(Car* target, int delay_time)
task->bomb_pos = GetPos();
if (target) {
task->follow_target.Attach(target);
task->force_target.Attach(target);
if (gun_meta->int_param1 > 0) {
int buff_uniid = target->TryAddBuff(sender.Get(), gun_meta->int_param1);
if (buff_uniid != 0) {

View File

@ -117,6 +117,9 @@ void Explosion::InternalAttack()
}
}
);
if (force_target_.Get() && objects.find(force_target_.Get()) == objects.end()) {
objects.insert(force_target_.Get());
}
for (auto& target : objects) {
if (target->IsCreature(room_) && ((Creature*)target)->HasBuffEffect(kBET_BulletThrough)) {
continue;
@ -129,3 +132,8 @@ bool Explosion::IsPreBattleExplosion()
{
return create_frameno_ <= room_->GetBattleStartFrameNo() || room_->GetBattleStartFrameNo() == 0;
}
void Explosion::AddForceTarget(CreatureWeakPtr force_target)
{
force_target_ = force_target;
}

View File

@ -26,6 +26,8 @@ class Explosion
int explosion_effect,
float dmg,
long long special_damage_type = 0);
void AddForceTarget(CreatureWeakPtr force_target);
private:
void InternalAttack();
@ -33,6 +35,7 @@ class Explosion
int type_ = 0;
Room* room_ = nullptr;
CreatureWeakPtr sender_;
CreatureWeakPtr force_target_;
float explosion_range_ = 0;
int explosion_effect_ = 0;
float dmg_ = 0;

View File

@ -19,6 +19,9 @@ void FragMiTask::Done()
}
Explosion explosion;
if (force_target.Get()) {
explosion.AddForceTarget(force_target);
}
explosion.EnemyAndObstacleAttack(sender,
center,
explosion_range,

View File

@ -17,6 +17,7 @@ class FragMiTask : public MicroTask
a8::Vec2 bomb_pos;
CreatureWeakPtr sender;
CreatureWeakPtr follow_target;
CreatureWeakPtr force_target;
MetaData::Equip* gun_meta = nullptr;
MetaData::Equip* meta = nullptr;
float explosion_range = 1;