爆炸战前无伤害

This commit is contained in:
aozhiwei 2021-08-19 05:35:08 +00:00
parent 0c51f6badb
commit 01803f1290
5 changed files with 39 additions and 0 deletions

View File

@ -24,6 +24,7 @@ void Explosion::IndifferenceAttack(Room* room,
dmg_ = dmg;
center_ = center;
special_damage_type_ = special_damage_type;
create_frameno_ = room_->GetFrameNo();
InternalAttack();
}
@ -45,6 +46,7 @@ void Explosion::EnemyAndObstacleAttack(CreatureWeakPtr& sender,
dmg_ = dmg;
center_ = center;
special_damage_type_ = special_damage_type;
create_frameno_ = room_->GetFrameNo();
InternalAttack();
}
@ -122,3 +124,8 @@ void Explosion::InternalAttack()
target->OnExplosionHit(this);
}
}
bool Explosion::IsPreBattleExplosion()
{
return create_frameno_ <= room_->GetBattleStartFrameNo();
}

View File

@ -12,6 +12,7 @@ class Explosion
CreatureWeakPtr GetSender() { return sender_; };
float GetDmg() { return dmg_; };
long long GetSpecialDamageType() { return special_damage_type_; };
bool IsPreBattleExplosion();
void IndifferenceAttack(Room* room,
const a8::Vec2& center,
@ -37,4 +38,5 @@ class Explosion
float dmg_ = 0;
a8::Vec2 center_;
long long special_damage_type_ = 0;
long long create_frameno_ = 0;
};

View File

@ -86,6 +86,14 @@ void Hero::OnExplosionHit(Explosion* e)
if (dead) {
return;
}
if (e->IsPreBattleExplosion()) {
return;
}
if (HasBuffEffect(kBET_Jump) ||
HasBuffEffect(kBET_Fly)) {
return;
}
RemoveBuffByEffectId(kBET_PeaceMode);
float dmg = e->GetDmg();
float def = GetDef() * (1 + GetAbility()->GetAttrRate(kHAT_Def)) +
@ -118,6 +126,11 @@ void Hero::OnBulletHit(Bullet* bullet)
if (IsInvincible()) {
return;
}
if (HasBuffEffect(kBET_Jump) ||
HasBuffEffect(kBET_Fly)) {
return;
}
RemoveBuffByEffectId(kBET_PeaceMode);
if (!IsDead(room) && (bullet->IsBomb() || bullet->sender.Get()->team_id != team_id)) {
float dmg = bullet->GetAtk();

View File

@ -3602,6 +3602,11 @@ void Human::OnBulletHit(Bullet* bullet)
bullet->sender.Get()->GetRace() == GetRace()) {
return;
}
if (HasBuffEffect(kBET_Jump) ||
HasBuffEffect(kBET_Fly)) {
return;
}
RemoveBuffByEffectId(kBET_PeaceMode);
if (!dead && (bullet->IsBomb() || bullet->sender.Get()->team_id != team_id)) {
float old_hp = GetHP();
@ -3658,6 +3663,14 @@ void Human::OnExplosionHit(Explosion* e)
if (dead) {
return;
}
if (e->IsPreBattleExplosion()) {
return;
}
if (HasBuffEffect(kBET_Jump) ||
HasBuffEffect(kBET_Fly)) {
return;
}
RemoveBuffByEffectId(kBET_PeaceMode);
float dmg = e->GetDmg();
float def = GetDef() * (1 + GetAbility()->GetAttrRate(kHAT_Def)) +

View File

@ -475,6 +475,7 @@ void Obstacle::OnBulletHit(Bullet* bullet)
if (bullet->IsPreBattleBullet()) {
return;
}
if (!IsDead(bullet->room) &&
!IsTerminatorAirDropBox(bullet->room)) {
if (meta->receive_special_damage_type != 0 &&
@ -556,6 +557,9 @@ void Obstacle::OnExplosionHit(Explosion* e)
((e->GetSpecialDamageType() & meta->receive_special_damage_type) == 0)) {
return;
}
if (e->IsPreBattleExplosion()) {
return;
}
float dmg = e->GetDmg();
float def = 0;