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(); task->bomb_pos = GetPos();
if (target) { if (target) {
task->follow_target.Attach(target); task->follow_target.Attach(target);
task->force_target.Attach(target);
if (gun_meta->int_param1 > 0) { if (gun_meta->int_param1 > 0) {
int buff_uniid = target->TryAddBuff(sender.Get(), gun_meta->int_param1); int buff_uniid = target->TryAddBuff(sender.Get(), gun_meta->int_param1);
if (buff_uniid != 0) { 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) { for (auto& target : objects) {
if (target->IsCreature(room_) && ((Creature*)target)->HasBuffEffect(kBET_BulletThrough)) { if (target->IsCreature(room_) && ((Creature*)target)->HasBuffEffect(kBET_BulletThrough)) {
continue; continue;
@ -129,3 +132,8 @@ bool Explosion::IsPreBattleExplosion()
{ {
return create_frameno_ <= room_->GetBattleStartFrameNo() || room_->GetBattleStartFrameNo() == 0; 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, int explosion_effect,
float dmg, float dmg,
long long special_damage_type = 0); long long special_damage_type = 0);
void AddForceTarget(CreatureWeakPtr force_target);
private: private:
void InternalAttack(); void InternalAttack();
@ -33,6 +35,7 @@ class Explosion
int type_ = 0; int type_ = 0;
Room* room_ = nullptr; Room* room_ = nullptr;
CreatureWeakPtr sender_; CreatureWeakPtr sender_;
CreatureWeakPtr force_target_;
float explosion_range_ = 0; float explosion_range_ = 0;
int explosion_effect_ = 0; int explosion_effect_ = 0;
float dmg_ = 0; float dmg_ = 0;

View File

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

View File

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