1
This commit is contained in:
commit
28bca7b91c
@ -519,6 +519,17 @@ 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) {
|
||||||
|
int buff_uniid = target->TryAddBuff(sender.Get(), gun_meta->int_param1);
|
||||||
|
if (buff_uniid != 0) {
|
||||||
|
Buff* buff = target->GetBuffByUniId(buff_uniid);
|
||||||
|
if (buff && buff->remover_timer) {
|
||||||
|
target->room->xtimer.ModifyTimer(buff->remover_timer,
|
||||||
|
std::max(1, (int)(delay_time / FRAME_RATE_MS)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
task->gun_meta = gun_meta;
|
task->gun_meta = gun_meta;
|
||||||
task->meta = meta;
|
task->meta = meta;
|
||||||
|
@ -303,6 +303,48 @@ void Car::OnBulletHit(Bullet* bullet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Car::OnExplosionHit(Explosion* e)
|
||||||
|
{
|
||||||
|
if (IsInvincible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dead) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e->IsPreBattleExplosion()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (HasBuffEffect(kBET_Jump) ||
|
||||||
|
HasBuffEffect(kBET_Fly)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float dmg = e->GetDmg();
|
||||||
|
float def = GetDef() * (1 + GetAbility()->GetAttrRate(kHAT_Def)) +
|
||||||
|
GetAbility()->GetAttrAbs(kHAT_Def);
|
||||||
|
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
|
||||||
|
finaly_dmg = std::max(finaly_dmg, 0.0f);
|
||||||
|
#ifdef DEBUG
|
||||||
|
{
|
||||||
|
room->BroadcastDebugMsg(a8::Format("explosion dmg:%d def:%d finaly_dmg:%d",
|
||||||
|
{dmg,
|
||||||
|
def,
|
||||||
|
finaly_dmg}));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if 1
|
||||||
|
DecHP(finaly_dmg,
|
||||||
|
1,
|
||||||
|
"",
|
||||||
|
1);
|
||||||
|
#else
|
||||||
|
DecHP(finaly_dmg,
|
||||||
|
sender.Get()->GetUniId(),
|
||||||
|
sender.Get()->GetName(),
|
||||||
|
gun_meta->i->id());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void Car::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id)
|
void Car::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id)
|
||||||
{
|
{
|
||||||
if (dec_hp < 0.001f) {
|
if (dec_hp < 0.001f) {
|
||||||
|
@ -26,6 +26,7 @@ class Car : public Creature
|
|||||||
virtual void FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data) override;
|
virtual void FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data) override;
|
||||||
virtual void FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data) override;
|
virtual void FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data) override;
|
||||||
virtual void OnBulletHit(Bullet* bullet) override;
|
virtual void OnBulletHit(Bullet* bullet) override;
|
||||||
|
virtual void OnExplosionHit(Explosion* e) override;
|
||||||
virtual void GetAabbBox(AabbCollider& aabb_box) override;
|
virtual void GetAabbBox(AabbCollider& aabb_box) override;
|
||||||
virtual void GetHitAabbBox(AabbCollider& aabb_box) override;
|
virtual void GetHitAabbBox(AabbCollider& aabb_box) override;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -15,9 +15,13 @@ void FragMiTask::Done()
|
|||||||
a8::Vec2 center = bomb_pos;
|
a8::Vec2 center = bomb_pos;
|
||||||
if (follow_target.Get()) {
|
if (follow_target.Get()) {
|
||||||
bomb_pos = follow_target.Get()->GetPos();
|
bomb_pos = follow_target.Get()->GetPos();
|
||||||
|
center = bomb_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
Explosion explosion;
|
Explosion explosion;
|
||||||
|
if (force_target.Get()) {
|
||||||
|
explosion.AddForceTarget(force_target);
|
||||||
|
}
|
||||||
explosion.EnemyAndObstacleAttack(sender,
|
explosion.EnemyAndObstacleAttack(sender,
|
||||||
center,
|
center,
|
||||||
explosion_range,
|
explosion_range,
|
||||||
|
@ -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;
|
||||||
|
@ -216,6 +216,9 @@ namespace MetaData
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
lock_time += strings2.size() > 3 ? a8::XValue(strings2[3]).GetInt() : 0;
|
lock_time += strings2.size() > 3 ? a8::XValue(strings2[3]).GetInt() : 0;
|
||||||
|
if (strings2.size() > 4 && a8::XValue(strings2[4]).GetInt() == 1) {
|
||||||
|
lock_time = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user