8.草无法被子弹命中无法被消除,需要支持被指定子弹或爆炸消灭
This commit is contained in:
parent
75b928cef1
commit
42700cbd63
@ -295,7 +295,14 @@ void Bullet::Check(float distance)
|
||||
std::set<ColliderComponent*> colliders;
|
||||
room->map_service->GetColliders(room, GetX(), GetY(), colliders);
|
||||
for (ColliderComponent* collider : colliders) {
|
||||
if (TestCollision(room, collider) && !a8::HasBitFlag(collider->tag, kHalfWallTag)) {
|
||||
if (TestCollision(room, collider) &&
|
||||
!a8::HasBitFlag(collider->tag, kHalfWallTag)) {
|
||||
if (collider->owner->IsEntityType(ET_Obstacle)) {
|
||||
Obstacle* obstacle = (Obstacle*)collider->owner;
|
||||
if (obstacle->CanThroughable(this)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
objects.insert(collider->owner);
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ void FragMiTask::Done()
|
||||
}
|
||||
Obstacle* obstacle = (Obstacle*)target;
|
||||
if (!obstacle->IsDead(room) &&
|
||||
obstacle->Attackable() &&
|
||||
obstacle->Attackable(sender.Get()) &&
|
||||
!obstacle->IsTerminatorAirDropBox(room)) {
|
||||
float dmg = GetAtk() * (1 + sender.Get()->GetAttrRate(kHAT_Atk)) +
|
||||
sender.Get()->GetAttrAbs(kHAT_Atk);
|
||||
|
@ -165,7 +165,7 @@ bool Hero::IsCollisionInMapService()
|
||||
return true;
|
||||
}
|
||||
if (!obstacle->IsDead(room) &&
|
||||
obstacle->Attackable() &&
|
||||
obstacle->Attackable(this) &&
|
||||
obstacle->meta->i->drop() != 0 &&
|
||||
obstacle->IsTouchInteraction() &&
|
||||
room->GetGasData().gas_mode != GasInactive &&
|
||||
|
@ -525,7 +525,7 @@ bool Human::IsCollisionInMapService()
|
||||
return true;
|
||||
}
|
||||
if (!obstacle->IsDead(room) &&
|
||||
obstacle->Attackable() &&
|
||||
obstacle->Attackable(this) &&
|
||||
obstacle->meta->i->drop() != 0 &&
|
||||
obstacle->IsTouchInteraction() &&
|
||||
room->GetGasData().gas_mode != GasInactive &&
|
||||
|
@ -355,7 +355,7 @@ void Obstacle::Explosion(Bullet* bullet)
|
||||
{
|
||||
Obstacle* obstacle = (Obstacle*)target;
|
||||
if (!obstacle->IsDead(room) &&
|
||||
obstacle->Attackable() &&
|
||||
obstacle->Attackable(this) &&
|
||||
!obstacle->IsTerminatorAirDropBox(room)) {
|
||||
float dmg = meta->i->damage();
|
||||
float def = 0;
|
||||
@ -497,9 +497,30 @@ bool Obstacle::IsPermanent()
|
||||
return is_permanent;
|
||||
}
|
||||
|
||||
bool Obstacle::Attackable()
|
||||
bool Obstacle::Attackable(Entity* sender)
|
||||
{
|
||||
return meta->i->attack_type() == 1;
|
||||
switch (meta->i->attack_type()) {
|
||||
case 1:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
//只有特定子弹
|
||||
if (sender->IsEntityType(ET_Bullet)) {
|
||||
Bullet* bullet = (Bullet*)sender;
|
||||
return ((bullet->gun_meta->special_damage_type & meta->receive_special_damage_type) != 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool Obstacle::Throughable()
|
||||
@ -566,7 +587,7 @@ void Obstacle::SetMasterId(Room* room, int master_id)
|
||||
void Obstacle::OnBulletHit(Bullet* bullet)
|
||||
{
|
||||
if (!IsDead(bullet->room) &&
|
||||
Attackable() &&
|
||||
Attackable(bullet) &&
|
||||
!IsTerminatorAirDropBox(bullet->room)) {
|
||||
if (meta->receive_special_damage_type != 0 &&
|
||||
((bullet->gun_meta->special_damage_type & meta->receive_special_damage_type) == 0)) {
|
||||
@ -627,11 +648,18 @@ void Obstacle::OnBulletHit(Bullet* bullet)
|
||||
|
||||
bool Obstacle::CanThroughable(Creature* c)
|
||||
{
|
||||
if (meta->i->attack_type() == 3) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Obstacle::CanThroughable(Bullet* bullet)
|
||||
{
|
||||
if (meta->i->attack_type() == 3) {
|
||||
return meta->receive_special_damage_type != 0 &&
|
||||
((bullet->gun_meta->special_damage_type & meta->receive_special_damage_type) == 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ class Obstacle : public Entity
|
||||
int GetMasterId(Room* room);
|
||||
void SetMasterId(Room* room, int master_id);
|
||||
bool IsPermanent();
|
||||
bool Attackable();
|
||||
bool Attackable(Entity* sender);
|
||||
bool Throughable();
|
||||
bool IsTouchInteraction();
|
||||
bool IsOpenInteraction();
|
||||
|
@ -241,7 +241,7 @@ void RoomObstacle::Explosion()
|
||||
{
|
||||
Obstacle* obstacle = (Obstacle*)target;
|
||||
if (!obstacle->IsDead(room) &&
|
||||
obstacle->Attackable() &&
|
||||
obstacle->Attackable(this) &&
|
||||
!obstacle->IsTerminatorAirDropBox(room)) {
|
||||
float dmg = meta->i->damage();
|
||||
float def = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user