This commit is contained in:
aozhiwei 2021-07-06 13:15:46 +08:00
parent 2561d1ecf5
commit 1562212376
5 changed files with 22 additions and 3 deletions

View File

@ -61,9 +61,8 @@ void Bullet::OnHit(std::set<Entity*>& objects)
void Bullet::ProcBomb() void Bullet::ProcBomb()
{ {
self_collider_->rad = gun_meta->i->explosion_range(); self_collider_->rad = GetExplosionRange();
if (IsCurrWeapon()) { if (IsCurrWeapon()) {
self_collider_->rad *= (1 + ability_->GetAttrRate(kHAT_WeaponExplosionRange));
} }
std::set<Entity*> objects; std::set<Entity*> objects;
Car* c4_target = nullptr; Car* c4_target = nullptr;
@ -300,6 +299,15 @@ float Bullet::GetAtk()
return atk * attr_rate; return atk * attr_rate;
} }
float Bullet::GetExplosionRange()
{
float e_range = gun_meta->i->explosion_range();
if (IsCurrWeapon()) {
e_range *= (1 + ability_->GetAttrRate(kHAT_WeaponExplosionRange));
}
return e_range;
}
void Bullet::Check(float distance) void Bullet::Check(float distance)
{ {
std::set<Entity*> objects; std::set<Entity*> objects;
@ -365,6 +373,7 @@ void Bullet::ProcFragBomb(int delay_time)
task->gun_meta = gun_meta; task->gun_meta = gun_meta;
task->meta = meta; task->meta = meta;
task->atk = GetAtk(); task->atk = GetAtk();
task->explosion_range = GetExplosionRange();
room->xtimer.AddDeadLineTimerAndAttach room->xtimer.AddDeadLineTimerAndAttach
(std::max(1, (int)(delay_time / FRAME_RATE_MS)), (std::max(1, (int)(delay_time / FRAME_RATE_MS)),
a8::XParams() a8::XParams()

View File

@ -39,6 +39,7 @@ class Bullet : public MoveableEntity
void RecalcSelfCollider(); void RecalcSelfCollider();
bool IsBomb(); bool IsBomb();
float GetAtk(); float GetAtk();
float GetExplosionRange();
bool IsCurrWeapon(); bool IsCurrWeapon();
protected: protected:

View File

@ -20,7 +20,7 @@ void FragMiTask::Done()
Explosion explosion; Explosion explosion;
explosion.EnemyAndObstacleAttack(sender, explosion.EnemyAndObstacleAttack(sender,
center, center,
meta->i->explosion_range(), explosion_range,
gun_meta->i->explosion_effect(), gun_meta->i->explosion_effect(),
GetAtk()); GetAtk());
} }

View File

@ -19,6 +19,7 @@ class FragMiTask : public MicroTask
CreatureWeakPtr follow_target; CreatureWeakPtr follow_target;
MetaData::Equip* gun_meta = nullptr; MetaData::Equip* gun_meta = nullptr;
MetaData::Equip* meta = nullptr; MetaData::Equip* meta = nullptr;
float explosion_range = 1;
float atk = 0; float atk = 0;
void Done(); void Done();

View File

@ -3548,6 +3548,14 @@ void Human::OnExplosionHit(Explosion* e)
GetAbility()->GetAttrAbs(kHAT_Def); GetAbility()->GetAttrAbs(kHAT_Def);
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K); float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
finaly_dmg = std::max(finaly_dmg, 0.0f); 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 #if 1
DecHP(finaly_dmg, DecHP(finaly_dmg,
1, 1,